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.The input to your agent. Required unless the request carries a
resume. A request with neither is refused with 400 before your agent is called: Request must include a 'prompt' field, or a 'resume' to answer a paused run.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.
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.The conversation as you hold it, for an agent that reads history. Each item is
{ "role": "...", "content": "..." }.The answer to a run that paused with an
interrupt, sent with the same sessionId. One item per interrupt, and it must answer every one: { "interruptId": "...", "status": "resolved", "payload": ... }, or "status": "cancelled" with no payload. See Human in the loop.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.
The tool calls, tool results and steps, in order, as events. Text deltas are left out, because
result holds them whole.Present only when
status is interrupted: what your agent paused to ask, one object per question, with id, and reason, message, responseSchema and expiresAt when your agent set them. Answer with resume on the same session. The response is 200.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:
done,interruptorerror. Nothing follows it. donecarries the whole reply inresult, plussessionId,versionNumberanddurationMs.interruptmeans your agent paused to ask something. It carriesinterrupts, plussessionId,versionNumberanddurationMs. Answer with aresumeon the same session: Human in the loop.- 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. The threeresume refusals below come from your agent’s container once the run has started, so a streamed call receives them as event: error instead, with the same code and message.
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.