Skip to main content
POST
/
v1
/
chat
/
completions
curl -X POST https://api.tinytalk.ai/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "api-key: <API_KEY>" \
  -d '{
    "botId": "your-agent-id",
    "stream": false,
    "messages": [
      { "role": "user", "content": "Good morning" }
    ]
  }'
{
  "id": "chatcmpl-DEiS3ZvDkqboJuwJAQxA3BEx283xK",
  "object": "chat.completion",
  "created": 1772399835,
  "model": "gpt-5.2-chat-latest",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "Good morning! How can I assist you today?",
        "refusal": null,
        "annotations": []
      },
      "logprobs": null,
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 441,
    "completion_tokens": 10,
    "total_tokens": 451
  },
  "payload": {
    "citedResources": []
  }
}
Send a message to your agent and receive a response. The API follows a conversational format — pass the full message history to maintain context across turns.

Headers

HeaderRequiredDescription
api-keyFor private agentsYour Tiny Talk API key
Content-TypeYesMust be application/json

Body parameters

botId
string
required
Your agent’s ID. Find it in the dashboard under Settings → General.
messages
array
required
The conversation history. Each message is an object with role and content.
stream
boolean
default:"true"
Whether to stream the response as server-sent events (SSE). Defaults to the agent’s stream setting if not specified.
model
string
Override the agent’s default AI model. Must be a model available on your plan. If omitted, the agent’s configured model is used.

Response

Streaming (default)

The API streams the response as server-sent events (SSE). Each chunk is prefixed with data: and the stream terminates with data: [DONE]. After the stream completes, a message_payload event is sent containing any Knowledge Base sources cited in the response.

Non-streaming

When stream is set to false, the API returns a single JSON response with the complete message, token usage, and cited resources.
payload.citedResources
array
Website URLs from the Knowledge Base that were cited in the response. Only returned when Display Links to References is enabled in the messenger settings. Each object includes id, url, title, and type.
curl -X POST https://api.tinytalk.ai/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "api-key: <API_KEY>" \
  -d '{
    "botId": "your-agent-id",
    "stream": false,
    "messages": [
      { "role": "user", "content": "Good morning" }
    ]
  }'
{
  "id": "chatcmpl-DEiS3ZvDkqboJuwJAQxA3BEx283xK",
  "object": "chat.completion",
  "created": 1772399835,
  "model": "gpt-5.2-chat-latest",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "Good morning! How can I assist you today?",
        "refusal": null,
        "annotations": []
      },
      "logprobs": null,
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 441,
    "completion_tokens": 10,
    "total_tokens": 451
  },
  "payload": {
    "citedResources": []
  }
}

Multi-turn conversations

To maintain context across multiple exchanges, include previous messages in the messages array. The agent uses the full history to generate more relevant responses.
Including conversation history improves response quality significantly. Without it, each request is treated as a standalone question and the agent loses context from earlier messages.