Skip to main content
POST /v1/sessions/{session_id}/threads/{thread_id}/archive Archives a child thread. The archive operation sets the thread status to archived, cancels all pending mailbox messages, and unblocks the coordinator thread (if applicable).
Only threads with role set to child can be archived. Coordinator threads cannot be archived.

Headers

HeaderRequiredDescription
AuthorizationYesBearer <PAT>

Path Parameters

ParameterTypeRequiredDescription
session_idstringYesSession ID (sess_ prefix)
thread_idstringYesThread ID (sthr_ prefix)

Example Request

curl -X POST "https://api.qoder.com/api/v1/cloud/sessions/sess_019f00000000000000000000000000aa/threads/sthr_019f00000000000000000000000002bb/archive" \
  -H "Authorization: Bearer $QODER_PAT"

Example Response

HTTP 200 OK
{
  "id": "sthr_019f00000000000000000000000002bb",
  "type": "session_thread",
  "session_id": "sess_019f00000000000000000000000000aa",
  "parent_thread_id": "sthr_019f00000000000000000000000001aa",
  "agent": {
    "id": "agent_019f000000000000000000000000002b",
    "type": "agent",
    "name": "Research Agent",
    "model": "ultimate",
    "version": 2
  },
  "agent_id": "agent_019f000000000000000000000000002b",
  "agent_version": 2,
  "name": "Research Agent",
  "role": "child",
  "status": "archived",
  "stop_reason": {"type": "archive"},
  "created_by_tool_use_id": "toolu_bdrk_01T42NPLcKrBvLJfWgGt3QMt",
  "archived_at": "2026-06-15T08:10:00.000Z",
  "created_at": "2026-06-15T08:01:00.000Z",
  "updated_at": "2026-06-15T08:10:00.000Z"
}

Response Fields

Returns the archived Session Thread object. The status becomes "archived" and stop_reason is set to {"type": "archive"}.

Archive behavior

The archive operation triggers the following:
  • Thread status is set to archived
  • All pending messages in the thread’s mailbox are cancelled
  • If the coordinator is waiting for this thread’s result via the Agent tool, it receives an "Agent cancelled." tool result and the coordinator resumes execution
  • A session.thread_status_terminated event is emitted with stop_reason set to {"type": "archive"}

Errors

HTTPTypeTrigger
401authentication_errorPAT invalid or expired
404not_found_errorSession or Thread does not exist
409invalid_request_errorAttempted to archive a coordinator thread
409invalid_request_errorThread status is not idle and cannot be archived
See Errors for full error envelope reference.

Managed Agents

Learn the coordinator and child thread collaboration model.

List Session Threads

Inspect all threads in a session and their statuses.

Session Thread object

Full field reference for the Session Thread object.