API: Your first call in two minutes
How to authenticate and get your first request working.
The API has 62 endpoints spread across 13 resources: contacts, conversations, messages, CRM, calendar, inventory, tasks, team, templates, broadcasts, outbound notifications, and the account. You can use them to do practically everything you can do from the screen.
You authenticate with a key you create in the panel. It goes in the X-ACCESS-TOKEN header, or as Bearer in Authorization if your client prefers. Everything is in JSON and everything is under /api/v1.
Each key has its own permissions, so a read-only key cannot write even if it gets leaked.
What you can do
- Create, read, update, and delete contacts, and write their fields and tags.
- Read conversations and messages, and send messages through any connected channel.
- Move opportunities through the funnel and check pipelines.
- Create, move, and cancel calendar appointments, and search for free slots in either the main calendar or a team member's calendar.
- Manage the catalog and move stock.
- Create tasks, check the team, and manage WhatsApp templates.
The first call: who am I
curl https://platform.chatlevel.ai/api/v1/me \
-H "X-ACCESS-TOKEN: tu_clave"
# respuesta
{
"org": { "id": "org_123", "name": "Mi Tienda" },
"scopes": ["contacts:*", "messages:write"]
}Create a contact and send them a message
# 1. crear el contacto
curl -X POST https://platform.chatlevel.ai/api/v1/contacts \
-H "X-ACCESS-TOKEN: tu_clave" \
-H "Content-Type: application/json" \
-d '{ "name": "Ana López", "phone": "+34600111222" }'
# → { "id": "cnt_abc", ... }
# 2. mandarle un mensaje
curl -X POST https://platform.chatlevel.ai/api/v1/messages/send \
-H "X-ACCESS-TOKEN: tu_clave" \
-H "Content-Type: application/json" \
-d '{ "contact_id": "cnt_abc", "text": "Hola Ana, ya tenemos tu pedido" }'An example
A website form that triggers customer care
- Someone fills out the quote form on your website.
- Your server calls POST /contacts with their name and phone number.
- Then it calls POST /contacts/{id}/tags to add the 'quote' tag.
- That tag triggers a flow that messages them on WhatsApp.
- The customer receives a response in less than a minute, without anyone having to check anything.
Recommendations
- Start with GET /me. If that responds, authentication is correct and the rest is just reading the endpoint.
- Create a key for each system you connect, with only the necessary permissions.
- Use your own domain URL: if you are a client of an agency, your API lives on their domain.
Watch out for this
- A key with write permissions can delete data. For anything that only reads, create a read-only key.
- If you get a 403 error and the key is correct, it almost always means it lacks permission for that resource.
- The specification we serve might lag behind the actual code: if an endpoint does not respond, trust the actual response, not the document.
- Creating an event (POST /calendar/events) and searching for free slots (GET /calendar/availability) always require 'calendar': 'general' for the account calendar, or the 'userId' of a team member (provided by GET /team/members) for theirs. Without it, they return 400. For a specific person, the hours come from their Team schedule and calendar, and the event goes to theirs; if they do not have their calendar connected, it returns 409 and does not add it to the general one.
