Skip to main content
Call this endpoint at the start of every agent task or run. The session JWT you receive scopes all events, traces, and logs produced during that task back to a single identifiable session. Pass the returned token in the X-OTAS-AGENT-SESSION-TOKEN header on every subsequent OTAS call made within that run.
Authentication for this endpoint uses the agent’s API key (X-OTAS-AGENT-KEY), not a user token. The key must be active and unexpired.

Endpoint

POST /api/agent/v1/session/create/
Base URL: http://localhost:8000

Request headers

X-OTAS-AGENT-KEY
string
required
The agent’s API key in the format agent_<prefix>_<secret>. Obtained when creating the agent or rotating its key.

Request body

meta
object
Optional JSON object with task context. Use it to attach structured metadata to the session for filtering and debugging, e.g. { "task": "summarize", "input_length": 512 }. Defaults to {}.

Response

status
number
1 on success.
status_description
string
"agent_session_created" on success.
response
object
Create a new session for every distinct task or process. Never reuse a session JWT across separate, independent runs — doing so conflates their events under a single session, making attribution and debugging unreliable.
Do not share a session JWT between parallel agent instances. Each concurrent run must start its own session so that events are attributed correctly.

Example

cURL
curl --request POST \
  --url http://localhost:8000/api/agent/v1/session/create/ \
  --header "X-OTAS-AGENT-KEY: agent_xYz1Ab2C_s3cr3tT0k3nV4lueG0esH3re..." \
  --header "Content-Type: application/json" \
  --data '{
    "meta": {
      "task": "summarize",
      "input_length": 512
    }
  }'
Response (200)
{
  "status": 1,
  "status_description": "agent_session_created",
  "response": {
    "Header_value": "X-OTAS-AGENT-SESSION-TOKEN",
    "jwt_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
  }
}
After receiving the token, attach it to all subsequent OTAS calls for this run:
Subsequent call example
curl --request POST \
  --url http://localhost:8000/api/some/v1/endpoint/ \
  --header "X-OTAS-AGENT-SESSION-TOKEN: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." \
  --header "Content-Type: application/json" \
  --data '{}'

Build docs developers (and LLMs) love