Skip to main content
POST
Create or continue a chat

Approval-required responses

If the agent reaches an ask-first action, this endpoint returns 200 OK with status: "approval_required" instead of failing. Use the returned assistant_message_id and approval metadata to resume the chat via POST /chats/{chat_id}/approvals.

Tools, data analysis, and documents

Use tool_mode to set action behavior for one request. ask requires approval for every configured action, act allows configured actions to run without approval, and off disables all actions. Use tool_configs to override individual configured actions in ask or act mode. Use tool_connector_ids to select a subset of the agent’s configured external tools. These settings cannot add tools or change the agent’s saved configuration. Set data_analysis to true to enable Data Analysis when the agent allows it, or false to disable it for this request. Omit the field to use the agent’s configured default. Use document_refs to attach up to 20 exact documents by Realm API data source ID and source document ID. Realm checks that the API token’s user can access each document before creating the chat.

One answer at a time per chat

A chat answers one message at a time. If you send a request for a chat_id that is still generating an answer, Realm responds with 409 Conflict and an error code of generation_in_flight, rather than running both turns and losing one of the answers. The response includes a Retry-After header and a retry_after_seconds field with the number of seconds the in-flight answer may still run. Wait that long and retry, or omit chat_id to start a separate chat. Requests for different chats never conflict with each other.

Authorizations

Authorization
string
header
default:YOUR_API_TOKEN
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json
content
string
required

The content of the user message.

assistant_id
string | null

Deprecated. Use agent_id instead.

agent_id
string | null

The ID of the agent to use for the chat. You can find the ID by clicking on the agent in the Agents page.

chat_id
string

The ID of the chat to continue. If not provided, a new chat will be created.

Example:

"123"

research_mode
boolean

Enable research mode for this chat. Only works if the agent has research mode enabled ('optional' or 'always_on').

data_analysis
boolean

Control Data Analysis for this request. Omit to use the agent's configured default, set true to enable it when allowed, or set false to disable it for this request.

document_refs
object[]

Attach exact documents by Realm API data source ID and source document ID.

Maximum array length: 20
citation_style
enum<string>
default:remove

The style of citations to use. 'remove' will not show any citations, 'link' will format them as URLs.

Available options:
link,
remove
output_format
enum<string>
default:markdown

The format of the content returned. 'markdown' includes formatting, 'text' returns plain text.

Available options:
markdown,
text
prompt_variables
object

Prompt variables as input to the agent.

answer_only
boolean
default:false

When enabled for non-streaming responses, return only the final answer text, excluding intermediate reasoning, thinking steps, and agent narration. Has no effect on streaming responses.

eco_mode
boolean

Experimental. Use cost-efficient models for this request. Omit to inherit the agent and organization defaults. Eco is available only for Auto and Smart agents.

eval_options
object
tool_mode
enum<string>

Set action behavior for this request. Ask requires approval for every available action, act skips approval for available actions, and off disables all actions.

Available options:
ask,
act,
off
tool_connector_ids
string[]

Replace the agent's configured external tools with these connector or action identifiers for this request.

Maximum array length: 100
Minimum string length: 1
tool_configs
object

Override ask, enabled, or disabled status for individual available actions. Overrides take precedence over ask or act mode; off always disables actions.

Response

Success

id
string
required

Unique identifier for the chat

assistant_id
string
required

Deprecated. Use agent_id instead.

agent_id
string
required

The ID of the agent that processed the request

created
number
required

Unix timestamp in milliseconds of when the completion was created

created_date
string
required

ISO 8601 formatted timestamp of when the completion was created

content
string
required

The content of the chat

research_mode
boolean
required

If research mode was used for this chat. The agent configuration can override the user requested value.

output_format
enum<string>
required

The format of the content returned

Available options:
markdown,
text
status
enum<string>
required

Whether the chat completed immediately or was queued

Available options:
completed,
queued
eval_trace
object

Normalized persisted turn trace returned only for authorized eval requests