Skip to content

Delete Thread

DELETE/api/threads/{threadId}

Deletes a thread and its full descendant tree (all subthreads), including all associated messages and thread storage.

Before anything is deleted, each of those threads stops accepting work: it refuses new messages with 423, starts no execution, and creates no child thread. An execution in flight is aborted, and state.execution.abortSignal fires in the running tool or hook. Queued messages and scheduled effects are discarded.

Every open stream connection to a deleted thread is closed with WebSocket close code 1000 before the response is returned.

If the deletion fails part-way, the response is 500. The remaining threads stay unavailable to new work. Send the same request again to complete the deletion.

threadIdstringrequired

The unique thread identifier (UUID)

successbooleanrequired

Whether the deletion was successful

threadIdstringrequired

The root thread ID that was requested for deletion

deletedThreadIdsarray[string]required

Thread IDs deleted in child-first order

deletedCountnumberrequired

Total number of deleted threads (root + descendants)