Skip to main content

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

NameLocationRequiredTypeDescription
createUserqueryNobooleanCreate a linked WordPress user when wpUserId is not supplied.

Request Body

Content type: application/json

Required: Yes

Schema: CustomerCreate

FieldRequiredTypeDescription
nameYesstringDisplay name shown in the administration panel and booking flows.
emailYesstring (email)Customer or provider email address.
phoneNostringCustomer phone number.
wpUserIdNointegerLinked WordPress user ID.
timezoneNostring or nullIANA timezone for customer-facing date and time handling.
languageNostringCustomer language code used for localized communication when available.

Responses

StatusMeaningDescriptionBody
201CreatedResource 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
404Not foundResource not foundErrorEnvelope

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"
}