Skip to main content
Every deployed agent answers one HTTPS endpoint. You send a prompt, and you get back either one JSON body or a stream of server sent events carrying the agent’s text, tool calls, tool results and steps as they happen.

The endpoint

Every agent has one endpoint:
The agent’s page in the dashboard shows the full URL and the agent’s ID, which starts with agt_, each with a copy button.

Authentication

Every call carries an API key as a bearer token:
Create a key under API keys in the dashboard. It is shown once, when you create it. See API keys. A key that is missing, unknown, revoked, expired, or scoped to a different agent is refused with 401 and the same message, A valid Onecortex API key is required., except the last case, which answers 404 so the key never learns that the other agent exists.

The request

A JSON body, at most 1 MB.
string
required
The input to your agent. A request without it is refused with 400 before your agent is called: Request must include a 'prompt' field.
string
Your own key for a conversation, 1 to 256 characters. Send the same value again to reach the same running instance of your agent. Leave it out and Onecortex generates one and returns it. See Sessions.
boolean
true for server sent events, false for one JSON body. Left out, the Accept header decides: text/event-stream streams, anything else (including */*) returns JSON.
array
The conversation as you hold it, for an agent that reads history. Each item is { "role": "...", "content": "..." }.
object
Anything you want your agent to see, at most 4 KB as JSON. Larger is refused with 400: The 'metadata' field can be at most 4 KB.
Every other field you send reaches your agent unchanged, as params, with metadata among them. Onecortex does not decide which of your fields mean something. Each framework page says where params arrive in your code.
Request body
Here, your agent receives params of {"model": "gpt-5", "metadata": {"tenant": "acme"}}.

The JSON response

With stream false, the response is one body once the run is over.
string
completed or failed.
string
The whole reply. On a failed run, whatever text arrived before it failed.
array
The tool calls, tool results and steps, in order, as events. Text deltas are left out, because result holds them whole.
object
Present only when status is failed: { "code": "...", "message": "..." }.
string
Your sessionId, echoed unchanged, or the one generated for you.
string
The agent that answered.
number
The version that answered, as shown on the agent’s Versions tab.
string
This request’s ID, starting req_. Quote it to support.
number
How long your agent took, in milliseconds.
For the echo agent from the quickstart:
Terminal
Response

When your agent raises

If your agent’s own code raises, the run fails, and the response is 502 with the same body: status is failed, result holds any text sent before the failure, and error names the exception. Your traceback is not in the response. It is in your agent’s logs.
Response (502)

The event stream

With stream true, the response is text/event-stream. Each event is one frame: an event: line naming its type, a data: line holding the event as JSON on a single line, and a blank line.
Stream
  • Exactly one terminal event ends every stream: done or error. Nothing follows it.
  • done carries the whole reply in result, plus sessionId, versionNumber and durationMs.
  • While your agent is working and has nothing to send, Onecortex writes a comment line, : ping, every 15 seconds, so no proxy closes an idle connection. Server sent event clients ignore comments.
Every event type and its fields are on Streaming and events.
A stream that has started has already sent 200 OK, and cannot change it. If the run fails after that, the failure arrives in the stream as event: error. Handle it: a client that reads only text and done shows a failed run as an empty success.
Stream that fails

Response headers

Errors

An error before the run starts is an HTTP status with this body:
An agent still serves while a new version builds, and while a new version’s build has failed: a deploy never takes a working agent offline. Every error, with its cause and fix, is on Errors.

Limits

60 requests a minute per organization with a burst of 20, 30 a minute per agent, and 10 streams open at once per organization. A request body is at most 1 MB and metadata at most 4 KB. All limits are on Limits.

Examples in your language

Python

httpx, streamed.

TypeScript

fetch, with the stream reader.

curl

curl -N, from a terminal.
Last modified on September 28, 2026