Chat
Operations tagged Chat in the public API.
/v1/chat
Send a chat turn
Runs one billed chat turn against a chatbot. Requires chat:send. Send Idempotency-Key so a client retry does not double-charge. Returns the assistant message and conversation identifiers.
Required scopechat:send
curl -X POST https://api.agentency.com/v1/chat \
-H "Authorization: Bearer <YOUR_KEY>" \
-H "Content-Type: application/json"
-d '{
"chatbot_id": 1,
"message": "message",
"session_id": 1,
"conversation_history": []
}'/v1/chat/stream
Stream a chat turn
Same as `POST /v1/chat` but streams tokens as `text/event-stream`. The turn is billed, so send an `Idempotency-Key`: a retry with the same key does NOT run a second turn or debit a second credit. Because an SSE body cannot be replayed frame by frame, the retry answers with a JSON summary of the original turn and `Idempotency-Replayed: true`, so you can still recover `query_id` and `session_id` after a dropped connection. Honour `Retry-After` on 429.
Required scopechat:send
curl -X POST https://api.agentency.com/v1/chat/stream \
-H "Authorization: Bearer <YOUR_KEY>" \
-H "Content-Type: application/json"
-d '{
"chatbot_id": 1,
"message": "message",
"session_id": 1,
"conversation_history": []
}'