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
| Field | Required | Type | Description |
|---|---|---|---|
name | Yes | string | Display name shown in the administration panel and booking flows. |
description | No | string | Optional text description. |
class | No | const appointment | Service type. The public contract documents appointment services only. |
color | No | string or null | Optional visual color used by the administration UI. |
Responses
| Status | Meaning | Description | Body |
|---|---|---|---|
200 | Success | Resource created | OkEnvelope + object |
400 | Invalid request | Invalid request or application rule failure | ErrorEnvelope |
401 | Authentication required | Missing or invalid API token | WpRestError |
403 | Forbidden | Token lacks write scope or the operation is forbidden | WpRestError 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"
}