Thread ID (thr_...). Must be a personal user thread visible to the authenticated user.
Successful response
List artifacts for a thread Returns all artifacts produced during a thread's AI conversation. Artifacts are structured outputs such as code files, documents, or generated assets created by the AI agent in response to messages in the thread. The authenticated user must have access to the specified thread. Results are returned in a single page; there is no cursor-based pagination for this endpoint.
Thread ID (thr_...). Must be accessible to the authenticated user.
Successful response
Delete a thread Permanently deletes a thread and all of its messages and artifacts. This action cannot be undone. The authenticated user must own the thread or be an owner of the team the thread belongs to. Attempting to delete a thread owned by another user or team returns 403.
Thread ID (thr_...). The authenticated user must own this thread.
Empty response on successful deletion.
Retrieve a thread Returns the full thread record for the given thread ID. The authenticated user must own the thread or be a member of the workspace it belongs to. Use this endpoint to fetch the current state of a single thread, including its title, description, and metadata. To list many threads, use the list endpoint with cursor-based pagination.
Thread ID (thr_...). The authenticated user must have access to this thread.
The requested thread object.
Mark a thread as read
Records that a user has read up to a specific message in the thread. Unread
indicators and badge counts are cleared up to the specified message.
You must supply exactly one of last_read_message or use_latest_message.
Omitting both returns 400. If use_latest_message is true and the thread
has no messages, the request succeeds silently with no state change.
For server-to-server (S2S) requests where no user identity is present in the
token, the user param is required to identify whose read state to update.
Thread ID (thr_...). The thread to mark as read.
Request body.
Optionallast_read_message?: stringMessage ID (msg_...) to record as the last read message. Mutually exclusive with use_latest_message.
Optionaluse_latest_message?: booleanWhen true, marks the thread as read up to the latest message. Mutually exclusive with last_read_message.
Optionaluser?: stringUser ID (usr_...) whose read state to update. Required for S2S requests; ignored when an authenticated user is present in the token.
Empty response on success.
List messages in a thread
Returns a cursor-paginated list of messages belonging to the specified thread,
ordered from oldest to newest. Supply before_cursor, after_cursor, or both
to page through or bound the result set; omit both to receive the most recent page.
Supply anchor and direction to fetch a window before, after, or around a
specific message. Use anchor=last_matching&anchor_agent_mode=embedded to
resolve the anchor from the latest embedded-agent message, and add
anchor_agent to scope that resolution to a single sender agent.
Supply metadata as a JSON-encoded structured expression to filter message
metadata before cursor pagination or anchored window limits are applied.
The authenticated user must have access to the thread's owner (workspace or user).
A 403 is returned if the thread exists but is not accessible to the caller; a 404
is returned if the thread does not exist or is not visible to the authenticated user.
Pass include_reply_counts: true to annotate each message with the number of
threaded replies it has received. This adds a small amount of latency and should
be omitted when reply counts are not needed.
Thread ID (thr_...). The authenticated user must have access to this thread.
Optionalparams: {Query parameters.
OptionalafterCursor?: stringOpaque cursor returned in a previous response's after_cursor field. When provided, returns messages immediately after that position. May be combined with before_cursor to bound a range.
OptionalafterLimit?: numberFor direction=around, maximum number of messages newer than the anchor. Defaults to 20; maximum is 100.
Optionalanchor?: stringMessage ID (msg_...) to use as a window anchor, or last_matching to resolve the anchor from the latest message matching the anchor filters. Cannot be combined with before_cursor or after_cursor.
OptionalanchorAgent?: stringWhen anchor=last_matching, scope the anchor resolution to messages sent by this agent (agi_...). Combine with anchor_agent_mode to resolve the latest message from a specific agent in a given mode.
OptionalanchorAgentMode?: "cli" | "embedded"When anchor=last_matching, resolve the anchor from the latest message with this local agent execution mode.
OptionalbeforeCursor?: stringOpaque cursor returned in a previous response's before_cursor field. When provided, returns messages immediately before that position. May be combined with after_cursor to bound a range.
OptionalbeforeLimit?: numberFor direction=around, maximum number of messages older than the anchor. Defaults to 20; maximum is 100.
Optionaldirection?: "before" | "after" | "around"Window direction relative to anchor. before returns older messages, after returns newer messages, and around returns messages on both sides. Defaults to after when anchor is supplied. direction=around cannot be combined with an explicit limit; use before_limit and after_limit.
OptionalincludeAnchor?: booleanWhether to include the anchor message in a window response. Defaults to true for direction=around; ignored for ordinary cursor pagination and one-sided windows.
OptionalincludeReplyCounts?: booleanWhen true, each message in the response is annotated with its threaded reply count. Defaults to false. Adds latency; omit when reply counts are not needed.
Optionallimit?: numberMaximum number of messages to return per page. Defaults to 20; maximum is 100.
Optionalmetadata?: {Structured metadata filter expression. Only messages whose metadata object satisfies the expression are returned. The filter is applied before cursor pagination and anchored window limits.
Successful response
Update a thread's profile picture Uploads a new profile picture for the specified thread and returns the updated thread object. The image must be supplied as a base64-encoded string with its MIME type. The authenticated user must own the thread or be a team owner of the workspace the thread belongs to. Supplying invalid base64 data returns 422.
Thread ID (thr_...). The authenticated user must have permission to update this thread.
Request body.
Profile picture payload. Must include the base64-encoded image data and its MIME type.
The thread object after the profile picture has been updated.
Retrieve a thread's read status
Returns the read status of a thread for the specified user, including the ID
of the last message they have read and the number of unread messages remaining.
For user-authenticated requests, the status is always returned for the
authenticated user and the user parameter is ignored. For server-to-server
(S2S) requests, the user parameter is required and must be a valid user ID.
Returns 404 if the thread does not exist or the caller does not have access
to it.
Thread ID (thr_...). Must be accessible to the authenticated user or, for S2S requests, to the specified user.
Optionalparams: { user?: string }Query parameters.
Optionaluser?: stringUser ID (usr_...) whose read status to retrieve. Required for S2S requests; ignored for user-authenticated requests, which always return the status for the authenticated user.
The read status record for the requested thread and user.
Update a thread
Updates one or more mutable properties of the specified thread and returns
the full thread object with the applied changes. Only the fields you provide
are modified; omitted fields retain their current values.
If profile_picture is supplied, the image is uploaded before the other
fields are saved, after all ordinary thread fields have passed validation.
Supplying invalid base64 picture data returns 422 and no other fields are
updated.
Visibility can only widen: private may become restricted or team, and
restricted may become team. The authenticated viewer must have
permission to modify the thread.
Mirror-thread titles, descriptions, and notification state remain editable
by privileged app viewers. Mirror metadata, visibility, and membership are
provider-managed and cannot be changed through this endpoint.
Thread ID (thr_...). The authenticated user must have permission to update this thread.
Request body.
Optionaldescription?: stringOptional longer text describing the thread's purpose. Replaces the existing description when provided.
Optionalmetadata?: Record<string, unknown>Arbitrary key-value metadata to store on the thread. Merged with or replaces existing metadata.
Optionalmuted?: booleanWhen true, suppresses notifications for new messages in this thread for the authenticated user.
Optionalprofile_picture?: { data?: string; filename?: string; mime_type?: string }New profile picture for the thread. Provide all three inner fields to replace the existing image.
Optionaltitle?: stringHuman-readable display name for the thread. Replaces the existing title when provided.
Optionalvisibility?: "team" | "private" | "restricted"Widen a team-owned thread: private may become restricted or team, and restricted may become team. Visibility cannot be narrowed.
The thread object after the update has been applied.
Search messages in a thread
Searches canonical message content in the specified thread. "text" mode
performs the existing case-insensitive substring search, "embedding" ranks
stored message embeddings by cosine similarity, and "hybrid" combines the
text and embedding rankings with Reciprocal Rank Fusion (RRF). Only messages
visible to the authenticated caller are considered.
Results are intentionally lean: each row contains only a bounded content
snippet, sender identity, and timestamp. Attachments, reactions, ACLs, and
metadata are neither hydrated nor serialized. At most 20 results are
returned. Text results support chronological cursor pagination. Embedding and
hybrid results are relevance-ranked single pages and return null cursors.
Thread ID (thr_...). Must be visible to the authenticated caller.
Optionalparams: {Query parameters.
OptionalafterCursor?: stringText mode only. Opaque cursor returned by a previous page; fetches newer matches.
Optionalapp?: stringApp ID (app_...). Required by the protected developer mount and omitted from the public mount.
OptionalbeforeCursor?: stringText mode only. Opaque cursor returned by a previous page; fetches older matches.
Optionallimit?: numberMaximum number of results. Defaults to 20 and is capped at 20.
Optionalmode?: "text" | "embedding" | "hybrid"Search algorithm: text for substring matching, embedding for cosine similarity, or hybrid for RRF over both rankings.
Optionalq?: stringText or semantic search query. Must contain 3 to 200 characters after trimming.
Successful response
List trajectories for a thread
Returns a cursor-paginated list of thread message trajectories associated with the
specified thread. Each trajectory links a user message and its agent response to the
underlying AI trajectory record that captured the model's reasoning steps.
The authenticated user must own the thread or be a member of the workspace it belongs
to. Results are returned in reverse chronological order by default. Use before_cursor
and after_cursor to navigate pages; provide at most one cursor per request.
Optionally filter results to trajectories produced in response to a specific message
by supplying the message parameter. When no trajectories match the query, data
is an empty array and both cursor fields are null. A cursor that cannot be decoded
returns a 400 invalid_cursor error.
Thread ID (thr_...). The authenticated user must own this thread or belong to its workspace.
Optionalparams: {Query parameters.
OptionalafterCursor?: stringOpaque cursor from a previous response's after_cursor field. Returns the page of results following that cursor position.
OptionalbeforeCursor?: stringOpaque cursor from a previous response's before_cursor field. Returns the page of results preceding that cursor position.
Optionallimit?: numberMaximum number of trajectories to return per page. Defaults to 20; maximum is 100.
Optionalmessage?: stringMessage ID (msg_...). When provided, limits results to trajectories associated with this specific message.
Successful response
List agents in a thread Returns the agents participating in the specified thread. Only personal user threads (threads owned by a single user, not a team) expose agents through this endpoint; requests for team threads return 404. The authenticated user must have visibility into the thread. Each agent entry includes display information such as name and profile picture. Thread-level overrides (e.g. a custom name or profile picture set for this thread) take precedence over the agent's default values. When the caller is the thread owner, each entry also includes an
agent_configobject describing the agent's message policy and context configuration.