Cancel a session
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
curl -X POST https://esigncomply.com/v1/sessions/ses_TX15/cancel \
-H "Authorization: Bearer $ESIGNCOMPLY_API_KEY"
Node SDK
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.
Response
200 OK with a Session object.
{
"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 |
404 | No object with that ID exists in this domain and environment. |
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, missing_api_key, invalid_api_key, client_token_expired, domain_not_verified, domain_mismatch, insufficient_permission, idempotency_conflict, region_mismatch, rate_limit_exceeded and internal_error.
Every error has the same body: error.type, error.code, error.message, error.doc_url and error.request_id. See Errors.
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: the overview of the resource and all of its operations.
- Create a session:
POST /v1/sessions - Retrieve a session:
GET /v1/sessions/{id} - Append a ceremony event:
POST /v1/sessions/{id}/events - Get the access sample:
GET /v1/sessions/{id}/access-sample - Quickstart
- Browser SDK
- Errors: every error code, with what to do.
- API conventions: authentication, idempotency, rate limits and versioning.
Last updated · API version 2026-11-21