Skip to main content
POST
/
v1
/
chat
/
tasks
/
{task_id}
/
messages
Append Message To Task
curl --request POST \
  --url https://api.example.com/v1/chat/tasks/{task_id}/messages \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "agent_id": 123,
  "message": {
    "content": "<string>",
    "role": "user"
  },
  "metadata": {}
}
'
{
  "task_id": 123,
  "agent_id": 123,
  "status": "<string>",
  "accepted_at": "2023-11-07T05:31:56Z"
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

task_id
integer
required

Body

application/json

Body for POST /v1/chat/tasks/{task_id}/messages.

Same shape as :class:CreateTaskRequest minus the lack of a metadata field by default -- callers append a new user message to an existing task. agent_id is required again (consistent with the SDK contract: every write carries the agent_id explicitly for forward-compat with multi-agent keys).

agent_id
integer
required

Target agent's primary key. Must match the agent the presented API key is bound to and the task's agent_id.

message
MessageBody · object
required

Next user message in the task.

metadata
Metadata · object

Free-form correlation data passed through unchanged.

Response

Successful Response

POST /v1/chat/tasks/{task_id}/messages -> 202 Accepted response.

The new user message has been persisted and the next turn queued for background execution; callers poll the same way they would after the initial POST /v1/chat/tasks.

task_id
integer
required

Existing task primary key.

agent_id
integer
required

Agent the task is bound to.

status
string
required

Initial status of the new turn, 'running' in the 202 response (the atomic claim inside POST commits the status flip before the response is sent).

accepted_at
string<date-time>
required

UTC timestamp when the server accepted the message and scheduled background execution. Not the message's stored created_at (which may differ slightly due to DB clock).