Agent

Archive Thread

Archive an execution thread; archived ones receive no new events.

Call Create session first and replace the example session ID with its returned ID.

POST /agent/v1/sessions/{session_id}/threads/{thread_id}/archive◐ Partial

Official Claude documentation ↗

Request parameters

  • session_idstring必填

    path: Session id (sesn_...), as returned by sessions.create or sessions.list. The same id is also accepted as the session_id query parameter on resource and thread calls, where it must equal the path value.

  • thread_idstring必填

    path: Execution thread id (sthr_...), as listed by sessions.threads.list; the primary thread id equals the session's own thread. Unknown or foreign ids return 404.

  • session_idstring必填

    query: Session id (sesn_...), as returned by sessions.create or sessions.list. The same id is also accepted as the session_id query parameter on resource and thread calls, where it must equal the path value.

Returns

200

Archiving the primary thread uses session archival. Archiving a child archives only that child session, leaving the parent and siblings intact. Archived children have status terminated and archived_at; their history remains readable.

Errors follow the Anthropic error format (type / message / request_id) — see error codes

Response

HTTP 200

Successful response

application/json

NameTypeDescription
idstringUnique identifier for this thread.
agentobjectThe resolved agent a `session_thread` runs.
agent.modelstring | objectThe advisor model id. / Model identifier and configuration.
agent.typestringAlways `advisor`. An advisor whose model is consulted for advice in a separate thread (at most one per coordinator). / Always `agent`. A roster member that refers to an agent by id and pinned version.
agent.idstringAgent id (agent_...). Pass it as agent when creating a session and as agent_id in agent calls.
agent.descriptionnull | stringFree-text description of what the agent is for; null when none was set.
agent.mcp_serversarray<object>URL MCP servers the agent can call, paired one-to-one with mcp_toolset entries in tools and saved with the agent version. No credentials are stored here.
agent.namestringDisplay name of the agent, as set on create or update. It is a label, not a unique key.
agent.skillsarray<object>Skill attachments are not supported: a nonempty skills array returns 400. Omit this field or send an empty array. The native Skill tool loads available runtime skills independently of this field.
agent.systemnull | stringSystem prompt given to the model at the start of every session of this agent; null when none was set.
agent.toolsarray<object>Tools of the agent: one agent_toolset_20260401 entry for the native tools (all resolved settings are returned, ready to send back on update), plus mcp_toolset entries; custom tool definitions are rejected with 400. Keep bash enabled to use codemode, Skill and subagents.
agent.versionnumberThe agent's current version. Starts at 1 and increments each time the agent is modified.
archived_atnull | stringA timestamp in RFC 3339 format
created_atstringA timestamp in RFC 3339 format
parent_thread_idnull | stringParent thread that spawned this thread. Null for the primary thread.
session_idstringThe session this thread belongs to.
statsnull | objectTiming statistics for a session thread.
stats.active_secondsnumberCumulative time in seconds the thread spent actively running. Excludes idle time.
stats.duration_secondsnumberElapsed time since thread creation in seconds. For archived threads, frozen at the final update.
stats.startup_secondsnumberTime in seconds for the thread to begin running. Zero for child threads, which start immediately.
statusstringSessionThreadStatus enum
typestringAlways `session_thread`. An execution thread of a session.
updated_atstringA timestamp in RFC 3339 format
usagenull | objectCumulative token usage for a session thread across all turns.
usage.active_secondsnumberCumulative time in seconds this thread spent in running status. Equal to `stats.active_seconds`; surfaced here so a thread's usage carries every quantity its cost is priced on.
usage.cache_creationobjectPrompt-cache creation token usage broken down by cache lifetime.
usage.cache_read_input_tokensnumberTotal tokens read from prompt cache.
usage.input_tokensnumberTotal input tokens consumed across all turns.
usage.list_costnull | objectA monetary amount in a specific currency.
usage.output_tokensnumberTotal output tokens generated across all turns.
usage.server_tool_usenull | objectCumulative count of server-executed tool invocations, broken down by tool.