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.
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.
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.
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.
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. Supplying invalid base64 picture data returns 422 and no
other fields are updated.
The authenticated user must own the thread or be a team owner of the workspace
the thread belongs to.
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.
The thread object after the update has been applied.
Search context items within a thread
Performs a full-text search over context items (messages, files, and other
indexed sources) attached to the specified thread. Returns tagged objects
whose content matches the query string.
Use the type param to restrict results to a particular context source. All
accessible context source types are searched when type is omitted. The
authenticated user must have access to the thread.
Thread ID (thr_...). Must be accessible to the authenticated user.
Optionalparams: { q?: string; type?: string }Query parameters.
Optionalq?: stringFull-text search query. Results are ranked by relevance to this string.
Optionaltype?: stringContext source type to restrict the search to, e.g. "thread/messages". Omit to search across all context sources for the thread.
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.