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/api

POST /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

HeaderDescription
Content-TyperequiredAlways application/json.
x-api-keyrequiredYour API key. See Authentication.
Klart-Team-IdrequiredYour team ID. See Authentication.

Request body

FieldTypeDescription
mentionrequiredstringIdentifies which of your configured agents should generate the answer.
messagesrequiredarrayThe conversation so far, oldest first. At least one message is required.
messages[].rolerequired"user" | "assistant"Who sent this message.
messages[].contentrequiredstringThe message text. Can be an empty string.

Response body — 200 OK

FieldTypeDescription
responserequiredstringThe agent's answer.
documentsarraySources the answer was grounded in. Omitted or empty when not applicable.
documents[].urlstringLink to the source document or record.
documents[].titlestringDisplay 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.