Chat jobs
| Method | Path | Description |
|---|---|---|
| POST | /api/projects/{id}/chat-sessions/{sessionId}/jobs/chat | Send a message. |
| GET | /api/projects/{id}/chat-sessions/{sessionId}/jobs/chat/{chatJobId} | Poll a job. |
| POST | /api/projects/{id}/chat-sessions/{sessionId}/jobs/chat/{chatJobId}/cancel | Stop a running turn. |
Send body:
| Field | Type | Notes |
|---|---|---|
content | string | The message. Required unless diffCommentsContext is present. |
model | string | Optional override for this turn. |
previewContext | object | { frontendName, path }, pinning the message to a page in the preview. |
diffCommentsContext | array | Up to 50 diff comments to hand the agent as review feedback. |
retryFailedJobId | uuid | Retry a failed job. |
steerTargetJobId | uuid | The run you meant to steer, so a stop that lands in the same window can be told apart from a turn that simply ended. |
The response says how the message was delivered:
json
{ "data": { "delivery": "job", "chatJobId": "…", "jobNumber": 3 } }
{ "data": { "delivery": "steer", "steerId": "…" } }
Polling returns:
json
{
"data": {
"job": {
"id": "…",
"status": "running",
"jobNumber": 3,
"buildCompleted": false,
"error": null,
"errorCode": null,
"createdAt": "…",
"startedAt": "…",
"completedAt": null
}
}
}
Statuses are pending, running, awaiting_response, completed, failed,
cancelled. awaiting_response means the agent asked a question and is waiting: send
the answer as an ordinary message.
This endpoint needs the session's sandbox to exist, and returns 404 if it does not. A session created with a first message already has one. For any other session, ask for its preview first, which starts it.