REST API reference
Call the control plane started by dataagent serve. The default base URL is http://127.0.0.1:8790, configured by server.host and server.port in the selected YAML. REST has no built-in access-token check. See the security notes before exposing the control plane beyond loopback.
This reference covers the routes, requests, responses, and events used by integrations. See the HTTP integration guide to run your first conversation.
Response structure
JSON success responses and handled HTTP errors use the following structures:
{"success": true, "data": {}}{"success": false, "error": {"code": "RESOURCE_NOT_FOUND", "message": "Route not found."}}A successful POST /api/v1/runs returns an SSE stream with HTTP 200. A successful cancel request returns HTTP 204 with an empty body. HEAD on the health endpoints returns only the status and headers. Examples marked as full responses include the wrapper. Other JSON examples show the contents of data.
After starting the control plane, run curl -i http://127.0.0.1:8790/ready. A ready service returns HTTP 200 with success: true and data.status: "ready". Use curl -I if you only need the status and headers.
Health checks
| Method | Path | Response |
|---|---|---|
| GET, HEAD | /healthz |
HTTP 200 indicates that the process is reachable. |
| GET, HEAD | /ready |
HTTP 200 indicates readiness. Returns 503 when the engine is unavailable. |
A ready GET /ready response contains success: true, data.status: "ready", and data.conversation.ready: true.
Sessions and runs
List sessions
GET /api/v1/sessions?limit=50 returns sessions for the current server user in descending order by updatedAt, then threadId. limit is an integer from 1 through 100 and defaults to 50.
{
"sessions": [
{
"threadId": "thread-1",
"title": "Summarize the latest report",
"createdAt": "2026-10-15T00:00:00+00:00",
"updatedAt": "2026-10-15T00:00:00+00:00",
"status": "completed",
"hasCheckpoint": true
}
]
}Statuses are running, waiting_for_input, completed, error, and interrupted. A session waiting for an A2A answer is shown as interrupted by REST. On startup, sessions still recorded as running become interrupted.
Read a session
GET /api/v1/sessions/{threadId} adds messages, pendingInteractions, and notice to the list item fields. The messages come from the saved checkpoint or, if absent, the latest graph state on that thread. The route remains available while a run is active. pendingInteractions contains prompts that can be answered over REST. See human feedback for their shape and how to answer. notice is text or null. On an error or interruption, it indicates whether a checkpoint was restored.
An unknown session or a session belonging to another user returns 404. If the current user's session binding cannot be opened, the route returns 409.
Cancel a run
Send POST /api/v1/runs/{runId}/cancel with the active REST run's runId. No request body is needed. Success returns an empty 204. An unknown or finished run returns 404. Once cancellation takes effect, the connected stream ends with RUN_ERROR and code: "CANCELLED". The session is marked interrupted. The client can continue on the same threadId. Use the A2A API to cancel an A2A task.
Conversation and AG-UI events
Send POST /api/v1/runs to start a turn. Before the stream opens, validation failures return 422 and conflicts with an active run or run ID return 409. See the HTTP integration guide for the runnable sequence.
Request fields
Send JSON. A normal turn contains one new message. The server loads history for threadId.
| Field | Constraint |
|---|---|
threadId, runId |
1–128 characters, starting with an ASCII letter or digit. Later characters may include _ and - |
messages |
Exactly one message with id, role: "user", and nonblank text content for a normal turn. Use [] when answering a human feedback prompt |
state |
Omit or send null or {} |
tools, context, forwardedProps |
Required. Send [], [], and {}, respectively |
answers |
A nonempty map from interruptId to answer text when resuming human feedback |
resume, parentRunId |
Omit. Use the same thread to continue or answers to resume an interrupt |
Unknown top-level fields and client-supplied state, tools, or context are rejected. Subagent messages cannot be submitted as user messages. The Server selects the model, plugins, and workspaces.
Only one turn may be active per session. Active run IDs are process-wide, including across threads. The last run ID on a session and message IDs from loaded history cannot be reused to edit or replay. Use new run and message IDs.
Read SSE events
An accepted run returns HTTP 200 and text/event-stream with Cache-Control: no-cache and X-Accel-Buffering: no. Read JSON from SSE data: frames.
RUN_STARTED identifies the turn. Use text and tool events to show progress. A successful run sends the CUSTOM event that clears pending prompts, the final MESSAGES_SNAPSHOT, and RUN_FINISHED in that order. The terminal event can include metadata.durationMs.
| Event or outcome | Client action |
|---|---|
RUN_FINISHED with metadata.status="completed" |
Update the conversation with the final MESSAGES_SNAPSHOT. |
RUN_FINISHED with metadata.status="waiting_for_input" |
Show pending prompts and submit the answer on the same session. |
RUN_ERROR with code="CANCELLED" |
Show the run as stopped. The next turn can reuse the same threadId. |
Other RUN_ERROR |
Keep visible partial output and handle the code. Use a new runId for the next turn. |
| The stream closes without a terminal event | Reload session details before deciding whether to submit another turn. |
Wait for human feedback
A pause ends the stream with RUN_FINISHED and metadata.status="waiting_for_input". A CUSTOM name="human_feedback" event before the final snapshot carries the complete list of pending interactions:
{"type":"CUSTOM","name":"human_feedback","value":[
{"type":"human_feedback","interruptId":"<id>","message":"Choose an identity field.","options":["user_id","device_id"]}
]}options are suggestions. Users can also type an answer. Invalid answers may carry validationError. Replace the client list with each event's array. Submit a nonempty answers map to the same endpoint with the same thread, a fresh run ID, and empty messages.
{
"threadId": "thread-001",
"runId": "run-002",
"messages": [],
"answers": {"<id>": "user_id"},
"tools": [],
"context": [],
"forwardedProps": {}
}Replace <id> with the received interruptId. Parallel interactions can be answered in batches. Sending a new user message while waiting or using an unknown or resolved ID returns 409. Blank answers pause again with validationError.
Reload pending items from GET /api/v1/sessions/{threadId} and its pendingInteractions after refresh or restart. No HTTP stream runs while the user decides, so this wait does not count against turn timeout. Interactions started by A2A must resume via A2A.
SSE error codes
RUN_ERROR.code uses these values. The human-readable message is redacted and limited to 1,500 characters. Integrations should branch on the code. Server logs also include the exception class as error=.
| Code | Meaning |
|---|---|
TIMEOUT |
Turn limit server.run_timeout_seconds or model request timeout |
CANCELLED |
Explicit POST /api/v1/runs/{runId}/cancel |
LOOP_DETECTED |
Loop detection stopped the turn |
LIMIT_EXCEEDED |
model_calls_per_agent or tool_calls_per_agent exceeded |
INCOMPLETE_STREAM |
Missing or duplicate terminal event, or output after termination |
CONFIG_ERROR |
Invalid configuration |
MODEL_ERROR |
Error from the model service |
TOOL_ERROR |
Tool or remote agent failed |
INTERNAL_ERROR |
Other failure |
Outputs
List files
GET /api/v1/sessions/{threadId}/outputs returns regular files sorted by descending modifiedAt, then descending path. Paths are relative to the session's output directory, and sizes are in bytes.
Full response example
{
"success": true,
"data": {"files": [{"path": "notes.txt", "size": 12, "modifiedAt": "2026-10-15T00:00:00+00:00"}]}
}The list excludes symbolic links and the internal paths artifacts/conversation_history and artifacts/large_tool_results. An existing session with no output directory returns an empty list. An output directory that is a symbolic link or a path that is not a directory returns 409. A session that does not exist or belongs to another user returns 404.
Preview UTF-8 text
GET /api/v1/sessions/{threadId}/outputs/preview?path=notes.txt takes a non-empty, URL-encoded relative path.
Full response example
{
"success": true,
"data": {"type": "file", "path": "notes.txt", "content": "Sample notes", "truncated": false}
}The read limit is 64 KiB. A longer file has truncated: true and the returned content ends on a complete UTF-8 character. An absolute path, a .. component, or a NUL character returns 400. Missing, linked, excluded, or non-regular files return 404. Binary or invalid UTF-8 content in the preview returns 415.
HTTP errors
| HTTP status | Code | Typical cause |
|---|---|---|
| 400 | BAD_REQUEST |
Invalid session ID when accessing outputs, or an invalid preview path |
| 404 | RESOURCE_NOT_FOUND |
Unknown route, session, file, or inactive run |
| 405 | METHOD_NOT_ALLOWED |
Unsupported method for the route |
| 409 | CONFLICT |
Active run, replay, unresolved feedback, invalid session binding, or invalid outputs directory |
| 415 | UNSUPPORTED_FILE_TYPE |
Preview only supports UTF-8 text |
| 422 | BAD_REQUEST |
Invalid request body or query parameter. message describes the first validation error. |
| 500 | INTERNAL_ERROR |
Handled server error, such as failure to reload extensions or read outputs |
| 503 | CONVERSATION_UNAVAILABLE |
Engine unavailable for /ready, session routes, or run routes |
A2A
The same server exposes GET /.well-known/agent-card.json and POST /a2a/jsonrpc for A2A. See the A2A reference for discovery, JSON-RPC requests, authorization, and task handling.