API Reference
Chat Endpoint
The complete request and response shape for talking to a Klart AI agent over HTTP.
Base URL
Base URL
https://prod.klartprompts.com/apiPOST /chat
Sends a conversation to an agent and returns its answer. Every call is synchronous — there is no streaming response, and no separate polling step.
Headers
| Header | Description |
|---|---|
Content-Typerequired | Always application/json. |
x-api-keyrequired | Your API key. See Authentication. |
Klart-Team-Idrequired | Your team ID. See Authentication. |
Request body
| Field | Type | Description |
|---|---|---|
mentionrequired | string | Identifies which of your configured agents should generate the answer. |
messagesrequired | array | The conversation so far, oldest first. At least one message is required. |
messages[].rolerequired | "user" | "assistant" | Who sent this message. |
messages[].contentrequired | string | The message text. Can be an empty string. |
Response body — 200 OK
| Field | Type | Description |
|---|---|---|
responserequired | string | The agent's answer. |
documents | array | Sources the answer was grounded in. Omitted or empty when not applicable. |
documents[].url | string | Link to the source document or record. |
documents[].title | string | Display title for the source. |
Example
Request
POST /chat
POST /chat HTTP/1.1
Host: prod.klartprompts.com
Content-Type: application/json
x-api-key: YOUR_API_KEY
Klart-Team-Id: YOUR_TEAM_ID
{
"mention": "sales-assistant",
"messages": [
{ "role": "user", "content": "How can I take some days off?" }
]
}Response
200 OK
{
"response": "You can request time off from the Time Off tab in the HR portal. Your manager will need to approve it before it's confirmed.",
"documents": [
{ "url": "https://your-company.example/hr/time-off-policy", "title": "Time Off Policy" }
]
}Build a request
Fill in your own values to generate a working code sample in cURL, JavaScript, or Python.
Fill in the fields below to generate a ready-to-run request. Everything here stays in your browser — nothing is sent anywhere from this page, including your API key.
cURL · POST /chat
curl -X POST "https://prod.klartprompts.com/api/chat" \
-H "Content-Type: application/json" \
-H "x-api-key: YOUR_API_KEY" \
-H "Klart-Team-Id: YOUR_TEAM_ID" \
-d '{
"mention": "sales-assistant",
"messages": [
{
"role": "user",
"content": "How can I take some days off?"
}
]
}'Good to know
- Responses are synchronous JSON only — there is currently no streaming mode.
- Requests are expected to resolve within roughly a minute; design client-side timeouts accordingly.
- Rate limits aren’t currently published. If you’re planning for high volume, contact us so we can help you plan capacity.
Non-2xx responses
A request that fails validation, authentication, or hits an unexpected server error returns a 4xx or 5xx status with a JSON error body — see Errors for the full reference.