# Cancel a session

> Cancel a session: POST /v1/sessions/{id}/cancel cancels an open signing session, makes no record and returns the session with the status `cancelled`.

Source: https://esigncomply.com/docs/api/sessions/cancel-a-session

Last updated November 26, 2026

In the Esign Comply API, `POST /v1/sessions/{id}/cancel` cancels an open signing session, makes no record and returns the session with the status `cancelled`. The browser SDK calls it for a Decline control, and your server calls it to end a session itself.

`POST /v1/sessions/{id}/cancel` · API version `2026-11-21`

## Authentication

Send the client token of the session (`esc_ct_...`) or a secret key with `full_access` or `recording_access` permission, in the `Authorization` header: `Bearer $CLIENT_TOKEN` or `Bearer $ESIGNCOMPLY_API_KEY`. A client token works for its own session only, from a page inside the registered domain (live) or on the test allowlist (test). A secret key is used from your server only. Test and live credentials both work.

## Request example

### cURL

```bash
curl -X POST https://esigncomply.com/v1/sessions/ses_TX15/cancel \
  -H "Authorization: Bearer $ESIGNCOMPLY_API_KEY"
```

### Node SDK

```ts
import { EsignComply } from "esigncomply";

const esc = new EsignComply(process.env.ESIGNCOMPLY_API_KEY);

const { data, error } = await esc.sessions.cancel("ses_TX15");
```

This request ran against the API on November 26, 2026, and the response below is what came back. IDs are example values, and long values are shortened with `...`.

## What it does

Use it for a "Decline" control (`ceremony.cancel()` in the SDK) or to end a ceremony from your server. No record is made. Cancelling an already cancelled session returns the same response. The `session.cancelled` webhook carries `cancelled_by`: `signer` for a client-token call, `customer` for a secret-key call, `system` for a verification lockout.

## Parameters

| Name | In | Type | Required | Description |
|---|---|---|---|---|
| `id` | path | string | Yes | ID of the session. |

Headers: `Idempotency-Key` (optional, up to 255 characters) and `Esign-Comply-Version` (optional, a dated API version). See [API conventions](https://esigncomply.com/docs/api.md).

## Response

`200 OK` with a Session object.

```json
{
  "object": "session",
  "id": "ses_TX15",
  "status": "cancelled",
  "livemode": false
}
```

### Response fields

| Field | Type | Description |
|---|---|---|
| `object` | string |  |
| `id` | string |  |
| `status` | string | created, in_progress, awaiting_verification, ready, completed, expired or cancelled. |
| `livemode` | boolean |  |
| `client_token` | string | esc_ct_... Returned at creation only. The one credential that may reach the browser. |
| `expires_at` | datetime |  |
| `profile` | object |  |
| `assurance_level` | string |  |
| `signature_method` | string |  |
| `capture_mode` | string |  |
| `minimal_capture` | boolean |  |
| `required_steps` | array of string | The authoritative list for this session. |
| `advised_steps` | array of string | Live sessions: steps a rule in advise would require if it were enforced. Not required: a signature without one is recorded with a block finding and reported. |
| `completed_steps` | array of string |  |
| `remaining_steps` | array of string |  |
| `documents` | array |  |
| `applied_jurisdictions` | array |  |
| `jurisdiction_mode` | string |  |
| `rule_set_version` | string |  |
| `rules_fired` | array of string |  |
| `conformance_enforcement` | string | What this session does when the signature fails a rule: notify or block for a live session (the domain's setting when the session was created), null in test mode. |
| `required_strings` | array |  |
| `retention_floor` | object |  |
| `guidance_release` | string |  |
| `advisories` | array |  |
| `warnings` | array of string |  |
| `record_id` | string |  |
| `api_url` | string |  |

## Errors

| Code | HTTP | When |
|---|---|---|
| [`not_found`](https://esigncomply.com/docs/api/errors.md#not_found) | 404 | No object with that ID exists in this domain and environment. |
| [`session_not_active`](https://esigncomply.com/docs/api/errors.md#session_not_active) | 409 | When the session is already completed or expired. |

Like every call made with a client token or a secret key, it can also return [`invalid_request`](https://esigncomply.com/docs/api/errors.md#invalid_request), [`missing_api_key`](https://esigncomply.com/docs/api/errors.md#missing_api_key), [`invalid_api_key`](https://esigncomply.com/docs/api/errors.md#invalid_api_key), [`client_token_expired`](https://esigncomply.com/docs/api/errors.md#client_token_expired), [`domain_not_verified`](https://esigncomply.com/docs/api/errors.md#domain_not_verified), [`domain_mismatch`](https://esigncomply.com/docs/api/errors.md#domain_mismatch), [`insufficient_permission`](https://esigncomply.com/docs/api/errors.md#insufficient_permission), [`idempotency_conflict`](https://esigncomply.com/docs/api/errors.md#idempotency_conflict), [`region_mismatch`](https://esigncomply.com/docs/api/errors.md#region_mismatch), [`rate_limit_exceeded`](https://esigncomply.com/docs/api/errors.md#rate_limit_exceeded) and [`internal_error`](https://esigncomply.com/docs/api/errors.md#internal_error).

Every error has the same body: `error.type`, `error.code`, `error.message`, `error.doc_url` and `error.request_id`. See [Errors](https://esigncomply.com/docs/api/errors.md).

## Questions about POST /v1/sessions/{id}/cancel

### Which credential does POST /v1/sessions/{id}/cancel need?

The client token of the session, or a secret key with full_access or recording_access permission. Send either one as a Bearer token in the Authorization header. A client token works for its own session only.

### Does POST /v1/sessions/{id}/cancel work with a test key?

Yes. It works in test mode and in live mode. A client token carries the mode of the key that created its session.

### Does POST /v1/sessions/{id}/cancel count as a signature event?

No. A signature event is counted when a live record is written, by completing a session or by submitting a deferred acceptance. This call writes no record.

### Is POST /v1/sessions/{id}/cancel idempotent?

Yes, with an Idempotency-Key header of up to 255 characters. A repeat with the same key and the same bytes in the body returns the original response, with the header Idempotent-Replayed: true. The same key with a different body answers 409 idempotency_conflict.

### What is the rate limit for POST /v1/sessions/{id}/cancel?

With a client token, 240 calls per minute for each session. With a secret key, the plan's limit for each key: 2 requests per second on Free, 10 on Starter, 50 on Unlimited and 100 on Enterprise. Past the limit the API answers 429 rate_limit_exceeded with a Retry-After header.

### Does the Node SDK have a method for POST /v1/sessions/{id}/cancel?

Yes: esc.sessions.cancel() in the esigncomply package. It resolves to { data, error } and does not throw.

## Related

- [Sessions](https://esigncomply.com/docs/api/sessions.md): the overview of the resource and all of its operations.
- [Create a session](https://esigncomply.com/docs/api/sessions/create-a-session.md): `POST /v1/sessions`
- [Retrieve a session](https://esigncomply.com/docs/api/sessions/retrieve-a-session.md): `GET /v1/sessions/{id}`
- [Append a ceremony event](https://esigncomply.com/docs/api/sessions/append-a-ceremony-event.md): `POST /v1/sessions/{id}/events`
- [Get the access sample](https://esigncomply.com/docs/api/sessions/get-the-access-sample.md): `GET /v1/sessions/{id}/access-sample`
- [Quickstart](https://esigncomply.com/docs/quickstart.md)
- [Browser SDK](https://esigncomply.com/docs/sdk/browser.md)
- [Errors](https://esigncomply.com/docs/api/errors.md): every error code, with what to do.
- [API conventions](https://esigncomply.com/docs/api.md): authentication, idempotency, rate limits and versioning.
