Skip to main content

Create an appointment service

POST /services/add/

What It Does​

Create a new appointment service with the public fields supported by the API.

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: ServiceCreate

FieldRequiredTypeDescription
nameYesstringDisplay name shown in the administration panel and booking flows.
descriptionNostringOptional text description.
classNoconst appointmentService type. The public contract documents appointment services only.
colorNostring or nullOptional visual color used by the administration UI.

Responses​

StatusMeaningDescriptionBody
200SuccessResource createdOkEnvelope + object
400Invalid requestInvalid request or application rule failureErrorEnvelope
401Authentication requiredMissing or invalid API tokenWpRestError
403ForbiddenToken lacks write scope or the operation is forbiddenWpRestError or ErrorEnvelope

Request Example​

curl -X POST "https://example.com/wp-json/thebooking/v1/API/services/add/" \
-H "Authorization: Bearer $TBK_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "Example name",
"description": "string",
"class": "appointment",
"color": "string"
}'

JSON Body​

{
"name": "Example name",
"description": "string",
"class": "appointment",
"color": "string"
}

Success Response Example​

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