Skip to main content

Create one reservation from a canonical slot

POST /reservations/add/

What It Does

Create one reservation from a current slot returned by the availability endpoint.

Authentication

Requires an API token with the write scope. Send it as a bearer token or with the configured API key header.

Parameters

This endpoint does not define query or path parameters.

Request Body

Content type: application/json

Required: Yes

Schema: ReservationCreate

FieldRequiredTypeDescription
serviceIdYesstringTheBooking service identifier.
customerIdYesstringTheBooking customer identifier.
providerIdYesinteger or stringTheBooking provider identifier.
availabilityIdYesstringCanonical slot identifier returned by GET /availability/get/.
startYesinteger (int64)Unix timestamp for the slot start.
endYesinteger (int64)Unix timestamp for the slot end.
dataNoobjectAdditional structured data accepted by the route.

Responses

StatusMeaningDescriptionBody
200SuccessResource createdOkEnvelope + object
400Invalid requestInvalid request or application rule failureErrorEnvelope
401Authentication requiredMissing or invalid API tokenWpRestError
403ForbiddenInvalid, stale, unbookable, or over-capacity slot; or insufficient token scope.ErrorEnvelope or WpRestError
404Not foundResource not foundErrorEnvelope

Booking Rules

  • Use a slot returned by GET /availability/get/. The API validates the slot again when the reservation is created.
  • A previously displayed slot can be rejected if capacity, provider occupancy, lead time, or a connected calendar changed in the meantime.

Request Example

curl -X POST "https://example.com/wp-json/thebooking/v1/API/reservations/add/" \
-H "Authorization: Bearer $TBK_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"serviceId": "service_123",
"customerId": "customer_123",
"providerId": 123,
"availabilityId": "slot_123",
"start": 1779148800,
"end": 1779152400,
"data": {}
}'

JSON Body

{
"serviceId": "service_123",
"customerId": "customer_123",
"providerId": 123,
"availabilityId": "slot_123",
"start": 1779148800,
"end": 1779152400,
"data": {}
}

Success Response Example

{
"status": "OK",
"id": "resource_123"
}