Create a customer
POST /api/v1/customers
Creates a customer in the organization of the key. The id returned here is the customerId a
booking needs.
Authorization
| Role in the organization | This endpoint |
|---|---|
owner | Allowed |
admin | Allowed |
member | Allowed |
Request body
| Field | Type | Required | Description |
|---|---|---|---|
name | string | yes | The customer name |
email | string | no | Unique inside the organization when present |
phone | string | no | |
notes | string | no | Free text for the team |
Example
bash
curl -X POST -H "x-api-key: $VILLASLOT_API_KEY" -H "content-type: application/json" \
-d '{"name":"Tomas Lindqvist","email":"tomas@example.com"}' \
"https://villaslot.app/api/v1/customers"Response
201 Created— the created customer.
What it refuses
409 Conflict— the plan limit for customers is reached.422 Unprocessable Entity— the name is missing, the email is malformed, or another customer of the organization already carries that email. Search first and reuse the existing id.401 Unauthorized— missing or invalid key, or a key whose bearer left the organization.404 Not Found— unknown id, or an id belonging to another organization. The two are deliberately indistinguishable.429 Too Many Requests— over 120 requests in a minute for this key.