Base URL
Get started
1
Create an API key
In the dashboard, go to Project settings > API and generate a key. See Authentication.
2
Make your first request
Retrieve the key to check that it works:
3
Build
Browse the endpoints in the reference, and learn how authentication, errors, and pagination work.
Conventions
AI agents and chatbots
Chatling has two kinds of agent: AI agents and flow-builder chatbots.- Most endpoints work with both. Resources that belong to an agent, such as conversations, contacts, knowledge base sources, labels, teams, channels, and analytics, take either kind’s ID as
agent_id. - Only the endpoints that manage the agent itself are separate:
/agentsfor AI agents and/chatbotsfor chatbots. Using one kind’s ID at the other’s path returns 404, with a message pointing to the right path. - Some endpoints, such as WhatsApp templates and variables, are marked Available for AI agents only. They return 409
unsupported_agent_typefor a chatbot. - A chatbot’s flow doesn’t run through the API. When you send a chatbot a user message, it answers from its knowledge base using the AI settings you pass in
ai.
Idempotent requests
The API supports idempotency for safely retryingPOST requests without performing the same operation twice. If a request times out or fails because of a network error, retry it with the same Idempotency-Key header. Use a unique value, such as a V4 UUID:
Idempotent-Replayed: true header. Only successful responses are saved, so you can retry a failed request with the same key.
Use a new key for each new request. Reusing a key for a different request returns 422 idempotency_key_reused.
Request IDs
Each API request has a request ID, returned in theX-Request-Id header and in error responses. Include it when you contact support.
Authentication
API keys, key restrictions, and rate limits.
Errors
The error format and error codes.
Pagination
Paginate through lists with cursors.