Threads API
Send a message
Send another message to a thread's current execution.
/api/v1/tasks/{taskId}/commandsDelivers a message to the thread, waking its workspace if it is asleep. Personal tokens may only send messages; other thread commands answer 403.
Every send names the execution it is for in the X-Statefold-Execution header. Read the current execution.id from Get a thread first: a fork or a harness switch changes it, and a send for an earlier execution answers 409 instead of reaching the wrong conversation.
Requires a personal API token with the tasks:send scope, sent as Authorization: Bearer over HTTPS.
Path parameters
taskIdstring (UUID)requiredThe thread. A thread that is not yours answers 404, never 403.
Headers
X-Statefold-ExecutionstringrequiredThe thread's current
execution.id.
Body
type"send"requiredThe only command a personal token may send.
idstring, 1–200 charactersrequiredA fresh identifier for this message, such as a UUID.
textstring, 1–200,000 charactersrequiredThe message.
inputMode"queue" | "steer"optionalWhile the agent is working:
queuewaits for the current turn to finish,steerdelivers into it.skillIdsstring (UUID)[], up to 20optionalSkills from your library to use for this message.
skill"setup-repo"optionalRun the built-in repository setup skill with this message.
attachmentsobject[]optionalInline attachments, as the browser composer sends them. Most scripts leave this out.
Returns
200 OK with a JSON array of the transcript updates produced when the message was admitted. It is not the agent's reply: poll Get a thread for statusSummary.
Errors
Errors are JSON: { "version": 1, "error": { "code", "message" } }. See Errors for retry advice.
- 400
invalid_request The body is not a valid command, the execution header is missing or malformed, or the thread rejected the message as invalid.
- 401
unauthorized The bearer token is missing, invalid or revoked.
- 403
forbidden The token does not have the
tasks:sendscope, or the account is suspended.- 403
forbidden The command is not
send, or the request came from a browser origin Statefold does not trust.- 404
not_found The thread is not yours.
- 409
conflict The execution is not the thread's current one, or the thread cannot take the message in its current state. Read the thread again before retrying.
- 502
unavailable The thread answered with something Statefold could not read. Retry.