API: Open Chat Studio v1 Description: Build, deploy and monitor chatbots. TAG: Chat Description: The Chat API is designed to be used for integrating chatbots into external systems. ENDPOINTS: GET /api/chat/{session_id}/{task_id}/poll/ Summary: Poll for task updates Parameters: - session_id (path, string (required)): Session ID - task_id (path, string (required)): Check on the status of a specific task Responses: 200: Content: application/json Schema: ChatTaskPoll 404: Content: application/json Schema: ErrorDetail 500: Content: application/json Schema: ChatTaskPollError Security: cookieAuth embedKeyAuth POST /api/chat/{session_id}/consent/ Summary: Record that the participant accepted the chatbot's consent form Description: Record consent for the form version the participant was shown. A `form_version_id` that is not the session version's current form is refused with `409` and the current block, so the widget re-renders rather than recording consent to text the participant never saw. Parameters: - session_id (path, string (required)): Session ID Request Body: Content: application/json Schema: ChatConsentRequest Responses: 204: No response body 400: Content: application/json Schema: ChatConsentSessionEnded 409: Content: application/json Schema: ChatConsentStale Security: cookieAuth embedKeyAuth GET /api/chat/{session_id}/files/{file_id}/content/ Summary: Download a file attached to a message in a chat session Parameters: - file_id (path, integer (required)): File ID - session_id (path, string (required)): Session ID Responses: 200: Content: application/octet-stream Schema: string Security: cookieAuth embedKeyAuth POST /api/chat/{session_id}/message/ Summary: Send a message to a chat session Parameters: - session_id (path, string (required)): Session ID Request Body: Content: application/json Schema: ChatSendMessageRequestWithAttachments Responses: 202: Content: application/json Schema: ChatSendMessageResponse 403: Content: application/json Schema: ChatSendMessageForbidden Security: cookieAuth embedKeyAuth GET /api/chat/{session_id}/poll/ Summary: Poll for new messages in a chat session. Do not poll more than once every 30 seconds Description: Poll for new messages in a chat session Parameters: - limit (query, integer (optional)): Maximum number of messages to return (default: 50) - session_id (path, string (required)): Session ID - since (query, string (optional)): Only return messages after this timestamp Responses: 200: Content: application/json Schema: ChatPollResponse Security: cookieAuth embedKeyAuth POST /api/chat/{session_id}/token/ Summary: Renew a chat session's token Description: Issue a new session token for an existing session, so the widget can continue the conversation after its current token expires. Called by the widget with a fresh client-credentials token from the host, the same `chat:start` token used for `POST /api/chat/start/`. Admission matches session start: the token must be for the session's chatbot, the Chat API Channel must be in OAuth token mode, and the channel's origin rule applies. Parameters: - session_id (path, string (required)): Session ID Responses: 200: Content: application/json Schema: ChatSessionTokenResponse 401: Content: application/json Schema: ChatAccessDenied Security: chatOAuth2 - Required scopes: chat:start POST /api/chat/{session_id}/upload/ Summary: Upload files for a chat message Parameters: - session_id (path, string (required)): Session ID Request Body: Content: multipart/form-data Schema: ChatUploadFileRequest Responses: 201: Content: application/json Schema: ChatUploadFileResponse 403: Content: application/json Schema: ChatConsentRequired Security: cookieAuth embedKeyAuth POST /api/chat/start/ Summary: Start a new chat session for a widget Description: Start a new chat session - supports both authenticated users and embedded widgets Request Body: Content: application/json Schema: ChatStartSessionRequest Responses: 201: Content: application/json Schema: ChatStartSessionResponse 401: Content: application/json Schema: ChatAccessDenied 403: Content: application/json Schema: ChatStartSessionForbidden 409: Content: application/json Schema: ChatStartSessionRefused Security: chatOAuth2 - Required scopes: chat:start cookieAuth embedKeyAuth SCHEMAS: ChatAccessDenied: - error: string (required) - code: string (required) ChatConsent: - required: boolean (required) - form_version_id: integer (required) - text: string (required) ChatConsentRequest: - form_version_id: integer (required) ChatConsentRequired: - error: string (required) - code: string (required) - consent: ChatConsent (required) ChatConsentSessionEnded: - error: string (required) ChatConsentStale: - error: string (required) - code: string (required) - consent: ChatConsent (required) ChatFile: - name: string (required) - content_type: string - size: integer (required) - content_url: string (required) - download_url: string (required) ChatMessage: - created_at: string (required) - role: MessageRoleEnum (required) - content: string (required) - metadata: Unknown (required) - tags: array of string (required) - attachments: array of ChatFile (required) ChatPollResponse: - messages: array of ChatMessage (required) - has_more: boolean (required) - session_status: Unknown (required) - consent: Unknown (required) ChatSendMessageForbidden: - type: unknown ChatSendMessageRequestWithAttachments: - message: string (required) - context: object - attachment_ids: array of integer - version_number: integer ChatSendMessageResponse: - task_id: string (required) - status: Unknown (required) - error: string ChatSessionTokenResponse: - session_id: string (required) - session_token: string (required) - expires_at: string (required) ChatStartSessionForbidden: - type: unknown ChatStartSessionRefused: - error: string (required) - code: string (required) ChatStartSessionRequest: - chatbot_id: string (required) - version_number: integer - session_data: object - participant_remote_id: string - participant_name: string - timezone: string ChatStartSessionResponse: - session_id: string (required) - session_token: string (required) - expires_at: string (required) - chatbot: Unknown (required) - participant: Unknown (required) - consent: Unknown (required) ChatTaskPoll: - message: ChatMessage - status: ChatTaskPollStatusEnum ChatTaskPollError: - error: string - status: string (required) ChatTaskPollStatusEnum: - enum: [processing, complete] ChatUploadFileRequest: - files: array of string (required) ChatUploadFileResponse: - files: array of UploadedFile (required) ErrorDetail: - detail: string (required) MessageRoleEnum: - enum: [system, user, assistant] UploadedFile: - id: integer (required) - name: string (required) - size: integer (required) - content_type: string (required) SECURITY: - OAuth2 - Authorization Code Flow (authorization url: /o/authorize/, token url: /o/token/) - API Key authentication (header: X-api-key) - chatOAuth2 - Client Credentials Flow (authorization url: , token url: /o/token/) - API Key authentication (cookie: sessionid) - API Key authentication (header: X-Embed-Key) - HTTP bearer authentication