Overview
Calculates the total price for one or more service configurations. Use this endpoint to display accurate pricing to your customers before they confirm a booking.
You can optionally include coupon IDs or codes to preview the discounted price.
Endpoint
POST /partners/pricing/calculate-price
Authentication
Requires a valid API Key with the partner_pricing_read permission.
Request Body
{
"items": [
{
"hours": 3,
"serviceId": "dddddddd-0000-0000-0000-000000000004"
}
],
"couponIds": [],
"codes": [],
"userId": null,
"phone": null
}
| Field | Type | Required | Description |
|---|
items | array | Yes | Array of price calculation items. Min 1 item, max 10 items. |
items[].hours | number | Yes | Service duration in hours. Must be between 1 and 24. |
items[].serviceId | UUID | Conditional | Service ID. Required if packageId is not provided. |
items[].packageId | UUID | Conditional | Package ID. Required if serviceId is not provided. |
items[].subServiceId | UUID | No | Sub-service ID for add-ons. |
couponIds | UUID[] | No | Up to 2 coupon IDs to preview discounts for. |
codes | string[] | No | Up to 2 coupon/promo codes to preview discounts for. |
userId | UUID | No | CleanLife user ID for coupon validation (required for COMPENSATION coupons). |
phone | string | No | Customer phone number for coupon validation (MARKETING coupons). |
Example Requests
Single service, no discounts
curl -X POST "https://apiv3.thecleanlife.dev/v1/partners/pricing/calculate-price" \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"items": [
{
"hours": 3,
"serviceId": "dddddddd-0000-0000-0000-000000000004"
}
]
}'
With coupon code preview
curl -X POST "https://apiv3.thecleanlife.dev/v1/partners/pricing/calculate-price" \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"items": [
{
"hours": 3,
"serviceId": "dddddddd-0000-0000-0000-000000000004"
}
],
"codes": ["SUMMER10"]
}'
Success Response
HTTP Status: 200 OK
{
"success": true,
"data": {
"items": [
{
"serviceId": "dddddddd-0000-0000-0000-000000000004",
"hours": 3,
"price": 150.00,
"amount": 135.00,
"amountPayable": 135.00,
"currency": "SAR",
"couponPreview": {
"applied": true,
"discount": 15.00
}
}
],
"total": 135.00,
"currency": "SAR"
}
}
The exact response fields may vary. Fields like couponPreview may be omitted if no coupons are provided or if they apply at the booking invoice level.
Error Responses
| HTTP Status | Code | Description |
|---|
400 | VALIDATION_ERROR | Invalid request body (missing required fields, out-of-range hours, etc.) |
401 | UNAUTHORIZED | Missing or invalid API key |
403 | FORBIDDEN | Missing partner_pricing_read permission |
Notes
serviceId and packageId are mutually exclusive within each item — provide exactly one.
- This endpoint is a preview only — it does not create any record or affect any booking.
- Coupon applicability at booking time may differ from the preview. Coupons are subject to availability, usage limits, and customer eligibility.
- For services billed at the invoice level (not at booking), the
couponPreview may indicate that the coupon is not applied at booking time.
GET /partners/pricing/tiers — Get pricing tiers
POST /partners/bookings — Create the actual booking using these pricing parameters