Browse all guides
Get started Getting started
Developers Chat API

Chat API

Send a message and get an answer from your own code.

Every plan For developers

The Chat API sends a message to your agent and returns its answer, using the same knowledge and rules as your widget. Use it to add answers to your own app, help centre or internal tools.

Authentication

Use your key from API Key, sent as a header:

X-Tenant-Api-Key: your-api-key

You can also pass it as a query parameter, ?api-key=your-api-key. This is the same key your website widget uses, so treat it as public and regenerate it if it's misused.

Send a message

curl -X POST https://aidevelopia.com/api/chat \
  -H "X-Tenant-Api-Key: your-api-key" \
  -H "Content-Type: application/json" \
  -d '{"message": "What are your opening hours?", "session_id": "user-123"}'
FieldTypeNotes
messagestring, requiredThe question. Up to 2,000 characters.
session_idstring, optionalSend the same value on follow-ups to keep the conversation. Up to 255 characters. If you leave it out, one is created and returned.
page_urlstring, optionalThe page the user is on, if it helps the answer.

The response

{
  "response": "We're open Monday to Friday, 9am to 6pm.",
  "session_id": "user-123",
  "rating_token": "…",
  "escalation_offer": false,
  "escalation_offer_reason": null,
  "sources": [],
  "branding": { "primary_color": "#0a0a0a", "avatar_url": null, "chatbot_name": "My Bot", "welcome_message": "Hello!" },
  "usage": { "chat_limit": 500, "current_chats": 42 }
}
  • sources lists where the answer came from.
  • escalation_offer is true when the agent suggests handing over to a person.
  • If a person on your team has taken over the conversation, you get {"response": null, "human_mode": true, "session_id": "…"}.
  • chat_limit of -1 means unlimited.

Limits and errors

StatusWhen
401The key is missing, wrong or was deleted.
422The request is invalid, for example message is missing or longer than 2,000 characters. The errors field says which field and why.
403The workspace has been turned off.
429More than 10 messages a minute in one session, or 30 a minute from one IP address. Also returned when you've used your monthly chats.

Every answer through the API counts as a chat, the same as on your website.

Still stuck? Send us a message or email support@aidevelopia.com.