Skip to main content
POST
Cancel a turn

Authorizations

Authorization
string
header
required

An API token for one organization. You create and revoke tokens in the dashboard. A token scoped to one App can reach only that App, so give that kind of token to an agent. An organization-wide token can create a short-lived one with POST /api/tokens.

Headers

Idempotency-Key
string

A key that identifies this request for retries, up to 200 printable characters. A retry with the same key and input returns the first request's result instead of repeating the work. If you omit the key, the API generates one and returns it in the Idempotency-Key response header.

Required string length: 1 - 200

Path Parameters

id
string
required

A unique ID that starts with app_.

Pattern: ^app_[0-9A-Za-z]{24}$
Example:

"app_Zj7XhMgplmTJcp5Dk4vcYuk0"

session_id
string
required

A unique ID that starts with ses_.

Pattern: ^ses_[0-9A-Za-z]{24}$
Example:

"ses_Zj7XhMgplmTJcp5Dk4vcYuk0"

turn_id
string
required

A unique ID that starts with trn_.

Pattern: ^trn_[0-9A-Za-z]{24}$
Example:

"trn_Zj7XhMgplmTJcp5Dk4vcYuk0"

Response

The canceled turn, or the finished turn unchanged.

id
string
required

The turn's ID, which starts with trn_.

session_id
string
required

The ID of the session that the turn belongs to.

status
enum<string>
required

The turn's state:

  • queued: waiting behind the session's active turn.
  • running: the agent is working.
  • waiting: the agent needs input from a person, which input_request describes.
  • completed, failed, or cancelled: the turn has ended, and its status doesn't change again.
Available options:
queued,
running,
waiting,
completed,
failed,
cancelled
message
string
required

The message that started the turn.

model
string
required

The model that the turn runs on. If requested_model is auto, this is the model that Auto chose.

requested_model
string
required

The model that the turn asked for: auto or a model ID.

effort
enum<string>
required

How much the model thinks on this turn, from low to max. Auto chooses it by how much reasoning the task needs, unless the request set effort; with a chosen model, it is the model's default unless the request set it.

Available options:
low,
medium,
high,
xhigh,
max
input_request
object | null
required

The input that the agent is waiting for, or null if the turn isn't waiting.

base_commit_id
string | null
required

The commit that the turn started from. To undo the turn, pass this ID as commit_id to POST /api/apps/{id}/restore.

error
object | null
required

Why the turn failed, or null if it didn't fail. The code is one of the following:

  • agent_error: the agent stopped unexpectedly.
  • app_deleted: the App was deleted.
  • input_expired: no one answered the input request in time.
  • interrupted: the turn was interrupted repeatedly without progress.
  • turn_budget_exceeded: the turn ran out of time.
  • user_deleted: the user the turn acts for deleted their account.
usage
object
required

The tokens that the turn used.

created_by
string | null
required

The ID of the user the turn acts for, or null if that user deleted their account. The turn has that user's current role.

created_at
string<date-time>
required

When the turn was created.

Example:

"2026-10-03T14:01:30.000Z"

started_at
string<date-time> | null
required

When the turn started running, or null if it hasn't started.

Example:

"2026-10-03T14:01:30.000Z"

ended_at
string<date-time> | null
required

When the turn ended, or null if it hasn't ended.

Example:

"2026-10-03T14:01:30.000Z"