Skip to main content
Sessions

Archive a Session Thread

Archive an idle child Thread in a Forward Session.

POST /api/v1/forward/sessions/{session_id}/threads/{thread_id}/archive Only a Thread with role=child and status=idle can be archived. The coordinator Thread cannot be archived.

Request headers

HeaderRequiredDescription
AuthorizationYesBearer <PAT or SAT>
Idempotency-KeyNoIdentifies one logical archive attempt. Use a unique value for each new logical attempt.

Path parameters

ParameterTypeRequiredDescription
session_idstringYesSession ID with the sess_ prefix.
thread_idstringYesThread ID with the sthr_ prefix.
The request body is empty.

Example request

curl -s -X POST 'https://api.qoder.com/api/v1/forward/sessions/sess_xxx/threads/sthr_child_xxx/archive' \
  -H "Authorization: Bearer $QODER_ACCESS_TOKEN" \
  -H "Idempotency-Key: archive-thread-20260622-001"

Example response

HTTP 200 OK
{
  "id": "sthr_child_xxx",
  "type": "session_thread",
  "session_id": "sess_xxx",
  "parent_thread_id": "sthr_coordinator_xxx",
  "template_id": "tmpl_worker",
  "name": "research",
  "role": "child",
  "status": "archived",
  "stop_reason": { "type": "archive" },
  "created_by_tool_use_id": "toolu_xxx",
  "archived_at": "2026-06-22T12:00:00Z",
  "created_at": "2026-06-22T11:00:00Z",
  "updated_at": "2026-06-22T12:00:00Z"
}
Archiving an already archived child Thread also returns its current object and HTTP 200 OK. The response is a Thread object.

Errors

HTTPTypeCodeCondition
401authentication_errorauthentication_requiredThe PAT or SAT is invalid or expired.
404not_foundsession_not_foundThe Session does not exist or is not visible to the caller.
404not_found_errorthread_not_foundThe Thread does not exist or does not belong to the Session.
409conflict_errorcoordinator_thread_not_archivableThe request tried to archive the coordinator Thread.
409conflict_errorthread_not_idleThe child Thread is not currently idle.
502api_errorruntime_unavailableThe runtime service is unavailable or state reconciliation failed after an archive conflict.

Notes

  • The same Idempotency-Key replays a cached non-5xx response. After a cached 409 thread_not_idle, use a new key if the Thread state has changed and you want to retry.
  • Retry an ambiguous 502 runtime_unavailable with the same key.
  • Confirm the final state with the get Thread endpoint. Do not rely only on a session.thread_status_terminated Event.