Skip to main content

threads

Creates, updates, deletes, gets or lists a threads resource.

Overview​

Namethreads
TypeResource
Idanthropic.sessions.threads

Fields​

The following fields are returned by SELECT queries:

Successful response (OK)

NameDatatypeDescription
idstringUnique identifier for this thread.
parent_thread_idstringParent thread that spawned this thread. Null for the primary thread.
session_idstringThe session this thread belongs to.
▶agentobjectResolved agent definition for this thread. Snapshot of the agent at thread creation time.
archived_atstring (date-time)When the thread was archived. Null if not archived.
created_atstring (date-time)When the thread was created.
▶statsobjectTiming statistics for this thread. Null until the thread's first status transition.
statusstringCurrent execution status of the thread. (running, idle, rescheduling, terminated)
typestring (session_thread)
updated_atstring (date-time)When the thread was last updated.
▶usageobjectCumulative token usage for this thread. Null until the thread's first idle transition.

Methods​

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectsession_id, thread_idanthropic-workspace-id
listselectsession_idanthropic-workspace-id
archiveexecsession_id, thread_idanthropic-workspace-id

Parameters​

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
session_idstringPath parameter session_id (example: sesn_011CZkZAtmR3yMPDzynEDxu7)
thread_idstringPath parameter thread_id (example: sthr_011CZkZVWa6oIjw0rgXZpnBt)
anthropic-workspace-idstringOptional header to select the Workspace for this request. The value is a Workspace ID (for example, wrkspc_011CZkZaBF1tNoB5wlCeusgy). Only needed for credentials that can act on more than one Workspace. A credential that belongs to a specific Workspace may omit it; if sent, it must match that Workspace. (example: wrkspc_011CZkZaBF1tNoB5wlCeusgy)

SELECT examples​

Successful response (OK)

SELECT
id,
parent_thread_id,
session_id,
agent,
archived_at,
created_at,
stats,
status,
type,
updated_at,
usage
FROM anthropic.sessions.threads
WHERE session_id = '{{ session_id }}' -- required
AND thread_id = '{{ thread_id }}' -- required
AND "anthropic-workspace-id" = '{{ anthropic-workspace-id }}'
;

Lifecycle Methods​

Successful response (OK)

EXEC anthropic.sessions.threads.archive
@session_id='{{ session_id }}' --required,
@thread_id='{{ thread_id }}' --required,
@anthropic-workspace-id='{{ anthropic-workspace-id }}'
;