---
title: "Cancel a session"
method: POST
path: "/api/sessions/{sessionId}/cancel"
tags: ["Sessions"]
---

# Cancel a session

`POST /api/sessions/{sessionId}/cancel`

## Request

- Base URL: `https://aximo.autify.com`
- URL: `https://aximo.autify.com/api/sessions/{sessionId}/cancel`
- Auth: API key in header `x-api-key`
- TypeScript: <https://skmtc.dev/autify/apis/aximo-api/docs/api/sessions/:sessionId/cancel/post.ts> (a function with typed inputs; its response is checked against the schema)

Stops a queued or running session, the same as the web UI's terminate action.
The session moves to `terminated` and the run stops on its device at the next
step. A BYOD session waiting for an offline device is stopped too, so it does
not resume when the device reconnects.

## Path parameters

- `sessionId` string, uuid, required

## Response `200`

Session cancelled.

- object
  - `success` boolean, required
  - `sessionId` string, uuid, required
  - `status` 'terminated', required

## Other responses

- `400`: sessionId is not a UUID.
- `401`: Missing or invalid API key.
- `404`: Session not found in this organization.
- `409`: Session has already finished (`succeeded`, `failed`, `terminated`, `error` or `archived`) and was left unchanged.
- `429`: Rate limit exceeded — e.g. the daily session limit was reached for the organization, or too many API requests were sent in a short window (retry after the number of seconds in the `Retry-After` header).
- `500`: Unexpected server error.

---

[API](https://skmtc.dev/autify/apis/aximo-api.md) - [All operations](https://skmtc.dev/autify/apis/aximo-api/llms.txt) - [OpenAPI document](https://skmtc.dev/autify/apis/aximo-api/revisions/590722011284?raw)
