AI Chatbot Engine · Docs

Developer API

Ask your assistants questions from your own app or backend, keep their knowledge up to date, and read conversations and leads. To put the chat on a website, use the embed instead.

Start in two minutes

  1. In the dashboard, open Settings → API keys and create a key with the Chat permission. Copy it: it’s shown once.
  2. List your assistants to find an id, then ask one a question:
curl https://aichatbotengine.com/v1/agents \
  -H "Authorization: Bearer sk_live_YOUR_KEY"

curl https://aichatbotengine.com/v1/agents/AGENT_ID/chat \
  -H "Authorization: Bearer sk_live_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"message": "Do you open on Sundays?", "external_user_id": "user-42"}'

From JavaScript on your server:

const res = await fetch(`https://aichatbotengine.com/v1/agents/${agentId}/chat`, {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.CHATBOT_API_KEY}`,   // keep keys on your server
    'Content-Type': 'application/json',
    'Idempotency-Key': crypto.randomUUID(),                      // safe to retry
  },
  body: JSON.stringify({ message: 'Do you open on Sundays?', external_user_id: user.id }),
});
const { answer, citations, conversation_id } = await res.json();
// Send conversation_id with the next message from the same user to continue.

Answers come from the assistant’s published version and count as visitor messages on your plan. Add "stream": true to receive the answer as Server-Sent Events.

Keep knowledge up to date

Push text, Markdown or Q&A from your own systems (needs Change knowledge):

curl https://aichatbotengine.com/v1/sources/SOURCE_ID/documents \
  -H "Authorization: Bearer sk_live_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"question": "Do you ship abroad?", "answer": "Yes, to the EU and the UK."}'

Conventions

  • Keys belong to one organization and carry permissions: chat, knowledge:read, knowledge:write, conversations:read, leads:read. Keep them on your server.
  • Lists are newest first: ?limit= (up to 100) and ?after= the last id you got; responses have data, has_more and next_cursor.
  • Retries: send an Idempotency-Key header on POSTs; the first response is replayed for 24 hours.
  • Limits: 60 requests a minute per key; see the X-RateLimit-* headers. Over it you get 429 with Retry-After.
  • Errors always look like this:
{
  "error": {
    "type": "permission_error",
    "code": "missing_scope",
    "message": "This key doesn’t have the knowledge:write scope.",
    "request_id": "3f9c1c2a8d7e4b61"
  }
}

The API is versioned in the path; changes that could break your code only ever arrive under a new version.

Reference

Generated from the API itself (OpenAPI document).