Overview
The Packs API allows you to create bundles that combine multiple products and/or services into a single package with special pricing. Packs are ideal for creating treatment packages, promotional bundles, or comprehensive service offerings.
The Pack Object
Unique identifier for the pack (UUID)
Pack name (max 150 characters)
Detailed pack description
Unique pack code for internal reference (max 50 characters)
Final combined price for the entire pack
Tax rate percentage (default: 21.0)
Pack status: activo or inactivo (default: activo)
URL to pack image (max 255 characters)
Array of product items included in the pack, each with quantity and product details
Array of service items included in the pack, each with quantity and service details
List Packs
curl -X GET "https://api.beils.com/api/catalog/packs" \
-H "Authorization: Bearer YOUR_TOKEN"
Retrieves a list of all packs with their included products and services.
Query Parameters
Search packs by name, description, or code (partial match)
Response
Returns an array of pack objects with populated product and service details, ordered by creation date (newest first).
[
{
"pack_id": "550e8400-e29b-41d4-a716-446655440000",
"name": "Complete Beauty Treatment",
"description": "Full day spa package with facial, massage, and premium products",
"code": "PACK-BEAUTY-001",
"price": 199.99,
"tax_rate": 21.0,
"status": "activo",
"image_url": "https://cdn.beils.com/packs/beauty-treatment.jpg",
"products": [
{
"pack_id": "550e8400-e29b-41d4-a716-446655440000",
"product_id": "660e8400-e29b-41d4-a716-446655440001",
"quantity": 1,
"product": {
"name": "Premium Face Cream 50ml",
"price": 45.00
}
},
{
"pack_id": "550e8400-e29b-41d4-a716-446655440000",
"product_id": "660e8400-e29b-41d4-a716-446655440002",
"quantity": 2,
"product": {
"name": "Relaxing Bath Oil 100ml",
"price": 25.00
}
}
],
"services": [
{
"pack_id": "550e8400-e29b-41d4-a716-446655440000",
"service_id": "770e8400-e29b-41d4-a716-446655440003",
"quantity": 1,
"service": {
"name": "Deep Cleansing Facial",
"price": 65.00
}
},
{
"pack_id": "550e8400-e29b-41d4-a716-446655440000",
"service_id": "770e8400-e29b-41d4-a716-446655440004",
"quantity": 1,
"service": {
"name": "Relaxing Massage 90min",
"price": 80.00
}
}
],
"created_at": "2024-03-15T10:30:00Z",
"updated_at": "2024-03-15T10:30:00Z"
}
]
Create Pack
curl -X POST "https://api.beils.com/api/catalog/packs" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "Complete Beauty Treatment",
"description": "Full day spa package with facial, massage, and premium products",
"code": "PACK-BEAUTY-001",
"price": 199.99,
"tax_rate": 21.0,
"status": "activo",
"image_url": "https://cdn.beils.com/packs/beauty-treatment.jpg",
"products": [
{
"product_id": "660e8400-e29b-41d4-a716-446655440001",
"quantity": 1
},
{
"product_id": "660e8400-e29b-41d4-a716-446655440002",
"quantity": 2
}
],
"services": [
{
"service_id": "770e8400-e29b-41d4-a716-446655440003",
"quantity": 1
},
{
"service_id": "770e8400-e29b-41d4-a716-446655440004",
"quantity": 1
}
]
}'
Creates a new pack with associated products and services. The operation is performed in a transaction to ensure all items are created together.
Body Parameters
Pack name (max 150 characters)
Unique pack code (max 50 characters)
Final pack price (typically discounted from individual item prices)
Tax rate percentage (default: 21.0)
Pack status: activo or inactivo (default: activo)
URL to pack promotional image
Array of product items to include in the pack. Each item must have:
product_id (string): The product UUID
quantity (integer): Quantity of this product in the pack
Array of service items to include in the pack. Each item must have:
service_id (string): The service UUID
quantity (integer): Number of service sessions in the pack
Response
Returns the created pack object with full product and service details.
Get Pack
curl -X GET "https://api.beils.com/api/catalog/packs/{pack_id}" \
-H "Authorization: Bearer YOUR_TOKEN"
Retrieves a specific pack by ID with all included products and services.
Path Parameters
The unique pack identifier
Response
Returns the pack object with complete product and service information.
Error Responses
Update Pack
curl -X PUT "https://api.beils.com/api/catalog/packs/{pack_id}" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "Complete Beauty Treatment - Premium",
"price": 219.99,
"products": [
{
"product_id": "660e8400-e29b-41d4-a716-446655440001",
"quantity": 2
}
],
"services": [
{
"service_id": "770e8400-e29b-41d4-a716-446655440003",
"quantity": 1
},
{
"service_id": "770e8400-e29b-41d4-a716-446655440004",
"quantity": 2
}
]
}'
Updates an existing pack. When updating products or services, all existing items are removed and replaced with the new set provided. This ensures clean and predictable pack composition.
Path Parameters
The unique pack identifier
Body Parameters
All fields are optional. Only include the fields you want to update.
Complete array of products to include in the pack. All existing products will be replaced.
Complete array of services to include in the pack. All existing services will be replaced.
When updating products or services, provide the complete list of items you want in the pack. The system performs a clean replacement:
- Deletes all existing pack items
- Creates new pack items from the provided arrays
To remove all products/services, pass an empty array [].
Response
Returns the updated pack object with populated product and service names.
Delete Pack
curl -X DELETE "https://api.beils.com/api/catalog/packs/{pack_id}" \
-H "Authorization: Bearer YOUR_TOKEN"
Deletes a pack and all its associated product and service items.
Path Parameters
The unique pack identifier
Response
Deleting a pack will remove all product and service associations but will not delete the actual products or services themselves.
Use Cases
Treatment Packages
Create comprehensive treatment packages that combine multiple services:
{
"name": "Bridal Beauty Package",
"description": "Complete bridal preparation with 3 facials, manicure, and pedicure",
"price": 299.99,
"services": [
{ "service_id": "facial_deep_cleansing", "quantity": 3 },
{ "service_id": "manicure_gel", "quantity": 1 },
{ "service_id": "pedicure_spa", "quantity": 1 }
]
}
Product Bundles
Create product bundles with promotional pricing:
{
"name": "Complete Hair Care Kit",
"description": "Everything you need for healthy hair",
"price": 89.99,
"products": [
{ "product_id": "shampoo_professional", "quantity": 1 },
{ "product_id": "conditioner_professional", "quantity": 1 },
{ "product_id": "hair_mask_repair", "quantity": 1 },
{ "product_id": "serum_shine", "quantity": 1 }
]
}
Mixed Packages
Combine products and services for complete experiences:
{
"name": "Home Care + Spa Day",
"description": "Professional spa treatment with take-home products",
"price": 159.99,
"services": [
{ "service_id": "facial_hydration", "quantity": 1 },
{ "service_id": "massage_60min", "quantity": 1 }
],
"products": [
{ "product_id": "face_cream_premium", "quantity": 1 },
{ "product_id": "body_lotion_luxury", "quantity": 1 }
]
}
Pricing Strategy
The price field represents the final pack price, which is typically set lower than the sum of individual item prices to provide value:
// Individual prices
const facial = 65.00;
const massage = 80.00;
const cream = 45.00;
const total = facial + massage + cream; // 190.00
// Pack price (15% discount)
const packPrice = 161.50; // Saves customer 28.50
Transaction Safety
All pack creation and update operations use database transactions to ensure data consistency. If any part of the operation fails (e.g., invalid product_id), the entire operation is rolled back, preventing partial pack creation.