The endpoint
Every agent has one endpoint:agt_, each with a copy button.
Authentication
Every call carries an API key as a bearer token: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.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
params of {"model": "gpt-5", "metadata": {"tenant": "acme"}}.
The JSON response
Withstream 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.
echo agent from the quickstart:
Terminal
Response
When your agent raises
If your agent’s own code raises, the run fails, and the response is502 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
Withstream 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:
doneorerror. Nothing follows it. donecarries the whole reply inresult, plussessionId,versionNumberanddurationMs.- 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.
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 andmetadata 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.