Skip to content
العربية

Bookings

Bookings made through the API follow the owner portal’s rules: the same checks for working hours, team leave and clashes, no online-only offers and no deposit. Each one records the app that made it in app_id. Home services can’t be booked or moved through the API in v1.

GET /bookings lists one customer’s bookings with customer, as in GET /bookings?customer=123.

Every service has a pricing_type:

  • fixed: the service’s price is what it costs.
  • variable: it’s sold in tiers, such as hair length, listed in the service’s tiers. Send the one the customer wants as tier_id on the line, or the booking is refused with BOOKING_PRICING_OPTION_REQUIRED. A tier sets the line’s price and length.
  • starting_from: price is where it starts. The line is booked at that price with price_is_from true, and the business confirms the final price later.

A tier_id on a service that isn’t sold in tiers is refused with BOOKING_INVALID_PRICING_OPTION.

Send an Idempotency-Key header on POST /bookings. A retry with the same key and body returns the first booking with 200. The same key with a different body answers 422 idempotency_key_reused.

PATCH /bookings/{booking_id} takes only what changes: date, items, notes or special_requests. items is the booking’s whole list of services after the edit:

  • Send a line with its id to keep it. It keeps its price, tier, add-ons, length and session pack, even when you move its time or team member.
  • Give a kept line another service_id and it is priced from today’s menu, and its add-ons are dropped. Send a tier_id to change a kept line’s tier.
  • A change that would bring the booking below what the customer has paid is refused with BOOKING_SERVICE_CHANGE_BELOW_PAID, or BOOKING_SERVICE_REMOVE_BELOW_PAID when a line is left out.
  • A line without an id is new and is priced from today’s menu.
  • A stored line you leave out is removed.
  • Every edit that sends items gives the lines new ids, so read them from the answer.

Every booking carries a version, also sent as the ETag header. Send it as If-Match and the edit is refused with 412 booking_changed when someone changed the booking after you read it, so you never overwrite a change you haven’t seen. If-Match also takes a list of versions, and * for any.

Notes change in any state, as the business’s own note does. Everything else changes only while the booking is booked and not yet checked out. A cancelled, completed or no-show booking refuses it with BOOKING_NOT_EDITABLE, and a checked-out one with BOOKING_ALREADY_CHECKED_OUT.

Terminal window
curl -s -X PATCH https://api.razza.sa/v1/bookings/BK-000123 \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-H 'If-Match: "3f1c9b0e2d7a4c58a1e6f0b9d2c4e7a1"' \
-H "Content-Type: application/json" \
-d '{"items": [{"id": "981", "service_id": "52", "team_member_id": "7", "start_time": "15:30"}]}'

POST /bookings/{booking_id}/cancel cancels under the business’s cancellation policy. Send "cancelled_by": "business" when the business cancels, so the customer is refunded as the policy says for that case. Money razza can’t return by itself, such as cash, comes back in hand_backs for the business to return.