Send a message
POST/api/v2/projects/:slug/chats/
Send a message and receive an answer with source references. Returns 201 for a new conversation and 200 for an existing one.
To continue a conversation, send chat_uuid in the request body and copy the previous response body's restore_token into the X-Chat-Restore-Token header.
To continue an answer that reached its length limit, omit message and send chat_uuid and continue_message_id. The response keeps the same user_message_id and assistant messageId and contains the complete answer, including the new text. Replace the existing answer in your interface.
One message and its completed reply use one interaction. Continuing the same answer does not add an interaction. Follow-up messages count separately. See usage and billing.
Required permission: chats_create (private projects only).
Request
Responses
- 200
- 201
- 400
- 403
- 404
- 409
Message sent
New chat created
Bad request. Invalid or missing data.
Access denied. Check the API key, permissions, project access, and allowed domains.
Resource not found.
This conversation already has a generation in progress. Wait before retrying.