Overview
The synchronous chat endpoint sends a message to the AI assistant and waits for a complete response. Use this endpoint when your integration needs an immediate answer and can tolerate request latency up to 60 seconds.When to use sync chat
- The caller (application or user) is waiting for the answer
- Request volume is moderate (M2M endpoints are rate limited to 5 req/sec per client IP)
- Your integration can handle response latency of 5-60 seconds
- You want the simplest integration pattern
Authentication
This endpoint requires an API key in theX-API-Key header:
401 or 403.
Request body
string
required
The user’s question or statement. Required.
string
A stable identifier for the conversation. If omitted, a new session is created. For follow-up questions, include the same
session_id to maintain context.Format: typically a UUID or stable string unique to the user/channel.Example: user-123-web, conversation-abc-def, or a UUID.string
The user’s email address. Required when creating a new session (no
session_id provided). Optional for follow-up messages in an existing session.The email is used to associate chat history with a user account.string
The AI model to use for this request. If omitted, defaults to the site’s configured default model or
gpt-4o-mini.Common values: gpt-4o-mini, gpt-4-turbo, claude-3-5-sonnet-20241022.Check available models for your tenant.string
Language for the assistant’s response. If omitted, the assistant chooses based on the input message.Example values:
en, tr, es, fr, de.string
Locale code for the UI context (used for formatting, not response language).Example:
en-US, tr-TR.Request example
Response schema
string
The session identifier for this conversation. Use this in follow-up requests to maintain context.
string
A unique identifier for this chat request. Use it to reference this specific Q&A pair when submitting feedback or checking logs.
string
The assistant’s response to the user’s message.
integer
A score from 0-100 indicating confidence in the answer (higher is more confident). Omitted if not available.
string
Enum:
low, medium, high. Summarizes the confidence score. Omitted if not available.string
Human-readable explanation of the confidence level (e.g., “Based on multiple supporting documents”). Omitted if not available.
Response example
Error responses
400 Bad Request
Missing or invalid fields in the request body.- Missing
messagefield - Invalid JSON structure
- Missing
emailfor a new session (nosession_idprovided)
401 Unauthorized
API key is missing, invalid, expired, or revoked.- Malformed or missing
X-API-Keyheader - Key has been revoked
- Key has expired
- Key belongs to a different tenant
403 Forbidden
The API key’s plan does not include M2M API access.404 Not Found
The site does not exist or does not belong to the authenticated tenant.- Wrong site ID in the path
- Site has been deleted
- Site belongs to a different tenant
429 Too Many Requests
Rate limit exceeded. M2M endpoints allow up to 5 requests per second (rate limiting is applied per client IP and request path). When this limit is exceeded, requests are rejected until the window resets — wait at least one second before retrying.500 Internal Server Error
An unexpected error occurred on the Uppzy side.- The RAG service is temporarily unavailable
- The LLM provider is unreachable
- An internal service dependency failed
Implementation tips
Session strategy
Choose a stablesession_id that groups related messages:
- Per user:
user-123keeps all conversations for that user together - Per channel:
slack-channel-abcfor messaging integrations - Per thread:
support-ticket-456for support systems
Handling confidence
Checkconfidence_level or confidence_score to decide whether to:
- Show the answer directly to users
- Flag low-confidence answers with “This answer may be incomplete”
- Route high-uncertainty cases to a human agent
Timeout handling
The endpoint has a 60-second ceiling. In practice:- Simple answers return in 1-5 seconds
- Complex queries or cold LLM starts may take 10-30 seconds
- Embeddings generation or very large RAG sets can exceed 30 seconds
request_id to poll the async status endpoint if needed.
Retry strategy
Implement exponential backoff for transient failures:Related endpoints
- M2M Chat (Async) — Non-blocking alternative
- M2M Chat Status — Check async request status
- M2M Chat Feedback — Submit quality feedback
- M2M Sessions — List user conversations