Skip to main content
GET /v1/sessions/{session_id}/events Retrieves the events in a session in chronological order (oldest first). Supports cursor-based pagination.

Path parameters

ParameterTypeDescription
session_idstringSession ID with the sess_ prefix

Headers

HeaderRequiredDescription
AuthorizationYesBearer $QODER_PAT

Query parameters

ParameterTypeRequiredDescription
limitintegerNoMaximum number of records to return. Default 20
after_idstringNoCursor pagination: return records after this event ID
before_idstringNoCursor pagination: return records before this event ID
orderstringNoSort direction: asc (default, chronological) or desc (reverse chronological)
typestringNoFilter by event type. Values match the type field on returned events (e.g. user.message, agent.message, agent.artifact_delivered). Supports comma-separated values for multi-type filtering (e.g. type=user.message,agent.message). Repeating the key also works (e.g. type=a&type=b). Omit to return all event types
types[]stringNoArray-style alternative to type. Pass multiple types[]=… parameters to filter by several event types (e.g. types[]=user.message&types[]=agent.message)
created_at[gte]stringNoReturn events created at or after this time (inclusive). RFC 3339 format
created_at[lte]stringNoReturn events created at or before this time (inclusive). RFC 3339 format

Example request

curl -X GET "https://api.qoder.com/api/v1/cloud/sessions/sess_019e392c0d1e74e095d21ea4c6b41def/events?limit=5" \
  -H "Authorization: Bearer $QODER_PAT"

Filtering by event type

# Single type — only agent artifact delivery events
curl -X GET "https://api.qoder.com/api/v1/cloud/sessions/sess_019e392c0d1e74e095d21ea4c6b41def/events?type=agent.artifact_delivered&limit=100" \
  -H "Authorization: Bearer $QODER_PAT"

# Multiple types (comma-separated)
curl -X GET "https://api.qoder.com/api/v1/cloud/sessions/sess_019e392c0d1e74e095d21ea4c6b41def/events?type=user.message,agent.message&limit=100" \
  -H "Authorization: Bearer $QODER_PAT"

# Multiple types (array syntax)
curl -X GET "https://api.qoder.com/api/v1/cloud/sessions/sess_019e392c0d1e74e095d21ea4c6b41def/events?types[]=user.message&types[]=agent.message&limit=100" \
  -H "Authorization: Bearer $QODER_PAT"

Example response

HTTP 200 OK
{
  "data": [
    {
      "id": "evt_019e392c0d787cfaa21bda98e06cd913",
      "type": "user.message",
      "content": "Hello, this is a test message.",
      "session_id": "sess_019e392c0d1e74e095d21ea4c6b41def",
      "turn_id": "turn_019e392c0d787ceea6bb62943f9ac3ec",
      "schema_version": "1.0",
      "created_at": "2026-05-18T03:40:48.888851795Z",
      "processed_at": "2026-05-18T03:40:48.888851795Z"
    },
    {
      "id": "evt_771c1195bcbd4a07834d4ed4dd6450ca",
      "type": "session.status_running",
      "session_id": "sess_019e392c0d1e74e095d21ea4c6b41def",
      "turn_id": "turn_019e392c0d787ceea6bb62943f9ac3ec",
      "schema_version": "1.0",
      "created_at": "2026-05-18T03:40:50.321Z",
      "processed_at": "2026-05-18T03:40:50.321Z"
    }
  ],
  "first_id": "evt_019e392c0d787cfaa21bda98e06cd913",
  "last_id": "evt_771c1195bcbd4a07834d4ed4dd6450ca",
  "has_more": true
}

Event type reference

TypeDescriptionSpecific fields
user.messageUser messagecontent (string)
agent.tool_useAgent tool invocationtool_name, name, tool_input, tool_use_id, requires_confirmation
agent.tool_resultTool execution resulttool_use_id, content (ContentBlock[]), is_error
agent.messageAgent replycontent (ContentBlock[])
agent.thinkingAgent thinking
session.status_runningSession started running
session.status_idleSession returned to idleusage, status, stop_reason
session.errorExecution errorerror, details, retry_status
span.model_request_startModel request started
span.model_request_endModel request ended
agent.artifact_deliveredAgent delivered a file via the DeliverArtifacts toolfile_id, original_filename, size, content_type
terminatedExecution terminated

agent.message content format

{
  "content": [
    {
      "type": "text",
      "text": "The agent's reply text."
    }
  ]
}

session.status_idle extra fields

{
  "type": "session.status_idle",
  "status": "idle",
  "usage": {
    "input_tokens": 150,
    "output_tokens": 42,
    "cache_read_input_tokens": 0,
    "cache_creation_input_tokens": 0
  },
  "stop_reason": {
    "type": "end_turn"
  }
}

session.error format

{
  "type": "session.error",
  "error": {
    "message": "The operation was aborted due to timeout",
    "type": "unknown_error"
  },
  "details": {
    "message": "The operation was aborted due to timeout",
    "name": "TimeoutError"
  },
  "retry_status": {
    "type": "exhausted"
  }
}

Pagination fields

FieldTypeDescription
dataarrayList of event objects
first_idstringID of the first record on the current page
last_idstringID of the last record on the current page
has_morebooleanWhether more records are available

Errors

HTTPTypeTrigger
401authentication_errorPAT invalid or expired
404not_found_errorSession does not exist
See Errors for the full error envelope.

Retrieving agent output files

When an Agent calls the DeliverArtifacts tool, the platform uploads each delivered file to durable storage and emits an agent.artifact_delivered event. Use the type filter to retrieve only these events, then download each file via the Files API.

agent.artifact_delivered event format

{
  "id": "evt_019eab58a1b27c3f9012d4e5f6a7b8c9",
  "type": "agent.artifact_delivered",
  "file_id": "file_019eab58a1b27c3f9012d4e5f6a7b8c9",
  "original_filename": "hello.txt",
  "size": 28,
  "content_type": "text/plain",
  "session_id": "sess_019e392c0d1e74e095d21ea4c6b41def",
  "turn_id": "turn_019eab56b4d77163bd7da587c553548c",
  "schema_version": "1.0",
  "created_at": "2026-06-09T07:44:26.987Z"
}

End-to-end download example

SESSION_ID=sess_abc123

# 1. List only artifact delivery events
curl -s "https://api.qoder.com/api/v1/cloud/sessions/$SESSION_ID/events?type=agent.artifact_delivered&limit=100" \
  -H "Authorization: Bearer $QODER_PAT" | jq '.data[] | {file_id, original_filename, size}'

# 2. Get a presigned download URL (requires Authorization)
URL=$(curl -s "https://api.qoder.com/api/v1/cloud/files/$FILE_ID/content" \
  -H "Authorization: Bearer $QODER_PAT" | jq -r '.url')

# 3. Download (do NOT pass Authorization — the URL is pre-signed)
curl -sL -o "$FILENAME" "$URL"