Developers
REST API
Chat with your agent, add knowledge and read conversations and leads from your own code.
Authentication
Create a key under Settings → API keys (it's shown once). Send it with every request:
Authorization: Bearer af_live_xxxxxxxxxxxxxxxxBase URL: https://anytimereply.com/api/v1. Requests and responses are JSON. Errors return {"error": "message"} with a 4xx/5xx status.
Chat with an agent
POST /api/v1/chat
{
"agent_id": "AGENT_ID",
"message": "Do you deliver to Sylhet?",
"user_id": "customer-123",
"name": "Rafi",
"email": "[email protected]",
"stream": false
}user_id(optional) keeps one conversation per person on your side. Or passconversation_idfrom an earlier reply.- Response:
conversation_id,message_id,text,sources,confidence,handoff,waiting_for_human. - With
"stream": truethe answer arrives as Server-Sent Events:meta, thentokenevents ({"type":"token","t":"…"}), thendone.
The API uses the same brain as the chat bubble: knowledge, Q&A, instructions, actions and handoff.
Agents
GET /api/v1/agents — your agents with id, name, public_key, model and number of sources.
Knowledge
GET /api/v1/agents/{id}/sources— list sources and their training status.POST /api/v1/agents/{id}/sources— add a source:
{ "type": "TEXT", "title": "Delivery policy", "content": "We deliver across Bangladesh in 2–4 days…" }{ "type": "CRAWL", "url": "https://example.com" }type is one of TEXT, URL (one page), CRAWL (whole site), SITEMAP or SHOPIFY.
POST /api/v1/agents/{id}/qa— add a Q&A pair:{"question": "...", "answer": "..."}.
Conversations and leads
GET /api/v1/agents/{id}/conversations?page=1&limit=50&channel=WHATSAPP— newest first.GET /api/v1/conversations/{conversation_id}— one conversation with its messages.GET /api/v1/agents/{id}/leads— submitted forms and captured contacts.
Webhooks
Get notified about chats and leads in real time — see Webhooks.