Skip to content

Send a message to the assistant

POST
/api/drafts/{id}/messages
curl --request POST \
--url https://forge.example.com/api/drafts/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/messages \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "text": "example" }'

The answer streams back as text/event-stream. Refusals before the stream starts are problem documents: 403 when the classification is off for AI, 409 when the assistant is not set up or a turn is already running, 429 when the month’s allowance is used up. To stop a turn, close the request.

id
required
string format: uuid
Media typeapplication/json
object
text
required
string

Example generated

{
"text": "example"
}

The assistant’s answer as it is written, as server-sent events: text for its words, activity when it checks or changes the model, draft when the draft changes, tier when the draft moves to the Deep tier, then done; or error when the turn cannot finish, keeping what was written so far.

Media typetext/event-stream
string

A refusal or an error, as a problem document. A model or draft you may not see answers 404, as one that does not exist.

Media typeapplication/problem+json
object
type
string
title
string
status
integer
detail
string
instance
string

Example generated

{
"type": "example",
"title": "example",
"status": 1,
"detail": "example",
"instance": "example"
}