Clients API
NewAdd the people who order or sign up on your website to your Calenzy Clients.
/v1/clientsNot counted in your quota1 endpointFrom your server onlySend us each person who orders, books or signs up on your own website. They appear in Clients with everything else you know about them, and you can reach them later with Campaigns.
Send the same person as often as you like: we find them by their email, then by their phone number, and only add someone new when nobody matches. On a match we fill what was empty and never overwrite what is already there.
News and offers
Ask on your form whether the person agrees to receive your news and offers, with a box they tick themselves, and send their answer as marketing_consent. We keep the answer on their timeline.
A new person is subscribed only when they said yes. Someone we already know who now says yes is subscribed again. Someone we already know who says no, or leaves the box empty, stays exactly as they were: an unticked box on an order is not an unsubscribe.
Add a client
Find a person in your Clients, or add them.
| projectRequiredinteger | Your project's ID |
| namestring | The name as the person typed it. Or send first_name and last_name |
| first_name, last_namestring | The name in two parts, when your form asks for both |
| emailstring | Their email address. email or phone is required |
| phonestring | Their phone number, with its country code (+33612345678) or as your customers write it in your country (06 12 34 56 78) |
| languagestring | Their language, such as fr or en. en when absent |
| marketing_consentboolean | Their answer to your news and offers box. See News and offers |
| tagsarray | Tags to add to them, such as ["Online order"]. Up to 10, 40 characters each. Tags they already have stay |
| statusstring | success |
| client.idinteger | Their ID in Clients. Send it as contact_id with an SMS |
| client.createdboolean | true when we added them now, false when they were already in Clients |
| client.subscribedboolean | Whether they receive your campaigns |
{ "name": "Marie Dupont", "phone": "06 12 34 56 78", "email": "marie.dupont@example.com", "language": "fr", "marketing_consent": true, "tags": ["Online order"] }
curl -X POST "https://api.calenzy.app/v1/clients?project=7" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Marie Dupont",
"phone": "06 12 34 56 78",
"email": "marie.dupont@example.com",
"language": "fr",
"marketing_consent": true,
"tags": ["Online order"]
}'{ "status": "success", "client": { "id": 1234, "created": true, "subscribed": true } }
Errors
Besides these, any call can answer one of the common errors.
| Code | HTTP | When |
|---|---|---|
missing_project | 400 | project is missing |
missing_contact | 400 | Neither email nor phone was sent |
invalid_email | 400 | email is not an email address |
invalid_phone | 400 | phone is not a phone number |
project_not_found | 404 | The project does not exist or is not yours |
client_save_failed | 500 | We could not save the person. Retry |