Create a customer
POST /customers/add/
What It Does
Create a customer profile that can later be attached to reservations.
Authentication
Requires an API token with the write scope. Send it as a bearer token or with the configured API key header.
Parameters
| Name | Location | Required | Type | Description |
|---|---|---|---|---|
createUser | query | No | boolean | Create a linked WordPress user when wpUserId is not supplied. |
Request Body
Content type: application/json
Required: Yes
Schema: CustomerCreate
| Field | Required | Type | Description |
|---|---|---|---|
name | Yes | string | Display name shown in the administration panel and booking flows. |
email | Yes | string (email) | Customer or provider email address. |
phone | No | string | Customer phone number. |
wpUserId | No | integer | Linked WordPress user ID. |
timezone | No | string or null | IANA timezone for customer-facing date and time handling. |
language | No | string | Customer language code used for localized communication when available. |
Responses
| Status | Meaning | Description | Body |
|---|---|---|---|
201 | Created | 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 |
404 | Not found | Resource not found | ErrorEnvelope |
Request Example
curl -X POST "https://example.com/wp-json/thebooking/v1/API/customers/add/" \
-H "Authorization: Bearer $TBK_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "Example name",
"email": "customer@example.com",
"phone": "+1 555 0100",
"wpUserId": 123,
"timezone": "Europe/Rome",
"language": "en"
}'
JSON Body
{
"name": "Example name",
"email": "customer@example.com",
"phone": "+1 555 0100",
"wpUserId": 123,
"timezone": "Europe/Rome",
"language": "en"
}
Success Response Example
{
"status": "OK",
"id": "resource_123"
}