Skip to main content
Authentication: This endpoint accepts either key type:
  • Agent API key (ak_*) — scoped to a single agent. Recommended for embedded widgets and other client-side use where a leaked key should not expose your full account. Generate from the agent’s settings.
  • Platform API key (thns_sk_*) — full account access. Use from trusted server-side code. Generate from Dashboard → Settings → API Keys.
In both cases, pass the key as a Bearer token: Authorization: Bearer <key>.
For external integrations, use the V1 agent chat endpoint with either an Agent API Key or a Platform API Key. Create keys from the dashboard.

Path Parameters

agent_id
string
required
Target agent’s public ID (ag_*)

Request Body

message
string
required
User message text
session_id
string
Session ID for conversation memory. Reuse the same ID to continue a conversation

Session Behavior

  • With session_id: The agent remembers previous messages in this session. Use for multi-turn conversations.
  • Without session_id: A new session is created automatically. Each request is treated as independent.

Response 200

Response Fields

response
string
Agent’s text response
session_id
string
Session ID (reuse for follow-up messages)
usage.input_tokens
integer
Tokens in the prompt
usage.output_tokens
integer
Tokens in the response
usage.total_tokens
integer
Total tokens consumed

Example — Multi-Turn Conversation

Turn 1:
Turn 2:

Errors