Skip to main content
Threads

Archive a Session thread

Archive a child thread in a managed-agent Session.

POST /api/v1/cloud/sessions/{session_id}/threads/{thread_id}/archive Archives a child thread in the idle state. The primary thread cannot be archived.

Path parameters

ParameterTypeDescription
session_idstringSession ID with the sess_ prefix
thread_idstringThread ID with the sthr_ prefix

Headers

HeaderRequiredDescription
AuthorizationYesBearer <PAT or SAT>

Example request

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

Example response

HTTP 200 OK Returns the Session Thread object.
{
  "id": "sthr_019ef2a07a06704fb899908c29eed779",
  "type": "session_thread",
  "session_id": "sess_019ef2a07a0670b3b68a84f0f3c5c98e",
  "parent_thread_id": "sthr_019ef2a07a06704fb899908c29eed778",
  "agent": {
    "id": "agent_019e390add9f7bac9b6cc806db46fcbd",
    "type": "agent",
    "version": 2,
    "name": "doc-test-agent",
    "description": "",
    "model": {"id": "ultimate", "effective_context_window": 200000},
    "system": "You are an expert software engineer.",
    "tools": [{"enabled_tools": ["Bash", "Read", "Write", "Edit", "Glob", "Grep"], "type": "agent_toolset_20260401"}],
    "skills": [],
    "mcp_servers": []
  },
  "status": "terminated",
  "stats": null,
  "archived_at": "2026-06-23T06:00:00.000Z",
  "created_at": "2026-06-23T05:53:19.774840Z",
  "updated_at": "2026-06-23T06:00:00.000Z"
}

Errors

HTTPTypeTrigger
401Authentication error; see response format belowAccess token missing, or PAT / SAT invalid or expired
404not_found_errorSession or thread does not exist or is outside the accessible scope
409invalid_request_errorThe thread is primary, or the child thread is not idle (including an already-archived child thread)
HTTP 401 Unauthorized Authentication errors may come directly from the gateway and do not always contain error.type. For example, a missing Authorization header returns:
{
  "code": "TOKEN_INVALID",
  "message": "missing authorization token",
  "timestamp": "1792982170292"
}
HTTP 404 Not Found
{
  "type": "error",
  "request_id": "cb80235f-76a2-4ff3-9e28-5aa2da12dc14",
  "error": {
    "type": "not_found_error",
    "message": "Session thread 'sthr_fakefakefake_xxxxxxxxxxxxxxxx' was not found."
  }
}
HTTP 409 Conflict
{
  "type": "error",
  "request_id": "cb80235f-76a2-4ff3-9e28-5aa2da12dc14",
  "error": {
    "type": "invalid_request_error",
    "message": "Only idle child session threads can be archived."
  }
}
IDs and timestamps in error examples are illustrative. Handle errors using the HTTP status and the returned code or error.type, without relying on fixed message text. If you receive 409, use GET /api/v1/cloud/sessions/{session_id}/threads/{thread_id} to check the thread's current state. See Errors for the full error envelope.