POST /api/v1/forward/sessions/{session_id}/cancel
Requests cancellation of the current turn. If no turn is running, the endpoint returns success without starting a cancellation.
Headers
| Header | Required | Description |
|---|---|---|
Authorization | Yes | Bearer <PAT> |
Idempotency-Key | No | Optional idempotency key for unsafe requests. |
Path parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
session_id | string | Yes | Session ID. |
Example request
Example response
HTTP 202 AcceptedResponse fields
| Field | Type | Description |
|---|---|---|
id | string | Session ID. |
type | string | Always session. |
status | string | canceling when cancellation is accepted. |
Errors
| HTTP | Type | Code | Trigger |
|---|---|---|---|
| 401 | authentication_error | authentication_required | PAT invalid or expired. |
| 404 | not_found_error | session_not_found | Session does not exist. |
| 409 | conflict_error | session_archived | Session is archived. |
| 502 | api_error | runtime_unavailable | Runtime session service is unavailable. |
Notes
202 Acceptedmeans a cancellation was requested.200 OKmeans there was no currently running turn to cancel.- Confirm completion through Event Stream or by polling Session status.