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
| Header | Required | Description |
|---|---|---|
Authorization | Yes | Bearer <PAT> |
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
session_id | string | Yes | Session ID (sess_ prefix) |
thread_id | string | Yes | Thread ID (sthr_ prefix) |
Example Request
Example Response
HTTP 200 OKResponse Fields
Returns the archived Session Thread object. Thestatus 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
Agenttool, it receives an"Agent cancelled."tool result and the coordinator resumes execution - A
session.thread_status_terminatedevent is emitted withstop_reasonset to{"type": "archive"}
Errors
| HTTP | Type | Trigger |
|---|---|---|
| 401 | authentication_error | PAT invalid or expired |
| 404 | not_found_error | Session or Thread does not exist |
| 409 | invalid_request_error | Attempted to archive a coordinator thread |
| 409 | invalid_request_error | Thread status is not idle and cannot be archived |
Related
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.