# Create a session

> Create a session: POST /v1/sessions starts a signing session for one signer over 1 to 10 document versions and returns the client token for the browser.

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

Last updated November 26, 2026

In the Esign Comply API, `POST /v1/sessions` starts a signing session for one signer over 1 to 10 document versions and returns the client token for the browser. Call it from your server when a person is about to sign or accept.

`POST /v1/sessions` · API version `2026-11-21`

## Authentication

Send a secret key in the `Authorization` header: `Bearer $ESIGNCOMPLY_API_KEY`. The key needs `full_access` or `recording_access` permission. Test keys and live keys both work, and each reads and writes the objects of its own environment. Call it from your server: a secret key never goes to a browser. Keys and permissions are described under [Authentication](https://esigncomply.com/docs/api.md#authentication).

## Request example

### cURL

```bash
curl https://esigncomply.com/v1/sessions \
  -H "Authorization: Bearer $ESIGNCOMPLY_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: signup-user_7c1d-tos-2026-11-21" \
  -d '{
    "profile": "prof_signup_4f1a",
    "signer": {
      "external_id": "user_7c1d",
      "email": "dana@example.org",
      "name": "Dana Whitfield",
      "class": "consumer",
      "country": "US",
      "region": "US-CA"
    },
    "documents": [
      {
        "document": "doc_8Hq2",
        "version": "current"
      },
      {
        "document": "doc_Pv71",
        "version": "current"
      }
    ],
    "context": {
      "url": "http://localhost:3000/signup",
      "locale": "en-US",
      "purpose": "account_signup"
    },
    "metadata": {
      "plan": "pro"
    },
    "expires_in": 1800
  }'
```

### Node SDK

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

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

const { data, error } = await esc.sessions.create(
  {
    profile: "prof_signup_4f1a",
    signer: {
      external_id: "user_7c1d",
      email: "dana@example.org",
      name: "Dana Whitfield",
      class: "consumer",
      country: "US",
      region: "US-CA",
    },
    documents: [
      { document: "doc_8Hq2", version: "current" },
      { document: "doc_Pv71", version: "current" },
    ],
    context: { url: "http://localhost:3000/signup", locale: "en-US", purpose: "account_signup" },
    metadata: { plan: "pro" },
    expires_in: 1800,
  },
  { idempotencyKey: "signup-user_7c1d-tos-2026-11-21" },
);
```

The two samples send the same `Idempotency-Key` with bodies that differ in whitespace. Run one of them, or change the key: the same key with different bytes in the body answers `409` [`idempotency_conflict`](https://esigncomply.com/docs/api/errors.md#idempotency_conflict).

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 `...`.

## Parameters

### Body fields

| Field | Type | Required | Description |
|---|---|---|---|
| `profile` | string | Yes | Profile ID, for example `prof_signup_4f1a`. |
| `signer.external_id` | string, 1 to 255 characters | Yes | Your own identifier for the person. Asserted by you. |
| `signer.email` | string | No | Used for the receipt. On an L2 or L3 profile, also the destination for `email_otp` and `email_link` verification. |
| `signer.name` | string | No | Asserted name. |
| `signer.phone` | string | No | Optional. Asserted by you and recorded as given. Esign Comply sends nothing to it and does not verify it. |
| `signer.class` | string | No | `consumer`, `business` or `employee`. Another value is kept with the warning `signer_class_unrecognized:<value>`. When absent, the profile's `signer_class` applies. |
| `signer.country` | string | No | ISO 3166-1 alpha-2, for example `US`. Take it from your form or account data. |
| `signer.region` | string | No | The signer's state as ISO 3166-2 (`US-CA`), or a bare code with `signer.country` (`CA` with `US`). It means where the signer resides or, for employees, primarily works. Never infer it from an IP address. |
| `signer.locality` | string | No | Locality code read by rules with a locality scope, for example `NYC`. |
| `signer.actor_type` | string | No | `human` (default) or `electronic_agent`. |
| `signer.operator`, `signer.authority_reference` | string | No | For `electronic_agent` sessions: who operates the agent and under what authority. |
| `jurisdictions.mode` | `auto`, `strictest`, `explicit` | No | Overrides the profile's mode for this ceremony. |
| `jurisdictions.packs` | array of pack codes | No | Narrows the profile's packs. Required in `explicit` mode. |
| `jurisdictions.governing_law` | string | No | Overrides the profile's governing law. |
| `documents[]` | array, 1 to 10 items | Yes | Each item is `{ "document": "doc_...", "version": "dv_..." }`. Omit `version` or send `"current"` to resolve the version in effect now. |
| `context.url` | string | Live: yes | The page where the ceremony runs. In live mode it must be inside the registered domain. In test mode it must be on `localhost`, `127.0.0.1`, the registered domain or a listed preview host. |
| `context.locale` | string | No | For example `en-US`. Selects document translations when `version` is `current`. |
| `context.purpose` | string | No | `account_signup`, `one_time_purchase`, `free_trial`, `auto_renewal`, `contract_signature`, `nda`, `policy_update`, `other`. Feeds rule scope and the method check. |
| `context.facts` | object | No | Asserted facts that pack rules read, for example `document_category`. Keys are listed per pack in the [catalogue](https://esigncomply.com/docs/api/jurisdictions.md). |
| `context.notes` | string, up to 2,000 characters | No | Free text, sealed in the record as asserted. Not read by any rule. |
| `context.extra` | any JSON, up to 16 KB | No | Arbitrary JSON, sealed in the record as asserted. Not read by any rule. |
| `metadata` | object, up to 50 keys | No | Your own key-value pairs. Returned on the record. |
| `expires_in` | integer, 60 to 86,400 | No | Lifetime in seconds. Default 1,800. |
| `capture_mode` | `direct`, `server_only` | No | `direct` (default): events come from the signer's browser. `server_only`: your server sends the events with the secret key, and every event is tagged asserted. |

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

`201 Created` with a Session object.

```json
{
  "object": "session",
  "id": "ses_5nWq",
  "status": "created",
  "livemode": false,
  "client_token": "esc_ct_...",
  "expires_at": "2026-11-26T00:46:11.521Z",
  "profile": {
    "id": "prof_signup_4f1a",
    "version": 1
  },
  "assurance_level": "L1",
  "signature_method": "checkbox",
  "capture_mode": "direct",
  "minimal_capture": false,
  "required_steps": [
    "client.attached",
    "document.presented:dv_3kT9",
    "document.presented:dv_Lm02",
    "notice.captured",
    "intent.captured",
    "signature.applied"
  ],
  "advised_steps": [],
  "documents": [
    {
      "document_id": "doc_8Hq2",
      "version_id": "dv_3kT9",
      "render_hash": "sha256:56dbea58...",
      "content_hash": "sha256:4e712fcc...",
      "title": "Terms of Service",
      "type": "terms",
      "language": "en",
      "format": "markdown"
    },
    {
      "document_id": "doc_Pv71",
      "version_id": "dv_Lm02",
      "render_hash": "sha256:ab32791f...",
      "content_hash": "sha256:8499061f...",
      "title": "Privacy Notice",
      "type": "privacy_notice",
      "language": "en",
      "format": "text"
    }
  ],
  "applied_jurisdictions": [
    {
      "code": "US-FED",
      "version": "2026-11-22",
      "reason": "base"
    },
    {
      "code": "US-CA",
      "version": "2026-11-21",
      "reason": "signer_region"
    }
  ],
  "jurisdiction_mode": "auto",
  "rule_set_version": "2026.11.22",
  "rules_fired": [
    "US-01",
    "US-02",
    "US-03"
  ],
  "conformance_enforcement": null,
  "required_strings": [],
  "retention_floor": null,
  "guidance_release": "2026.11.2",
  "advisories": [],
  "warnings": [],
  "api_url": "https://esigncomply.com/v1"
}
```

### Response fields

| Field | Description |
|---|---|
| `client_token` | Short-lived token (`esc_ct_...`) scoped to this session. Send only this to the browser. It is returned once, here. |
| `required_steps` | The authoritative list of steps for this session. Read it and satisfy each entry. Do not hard-code steps. |
| `advised_steps` | Live sessions: steps a rule in `advise` would require if it were enforced, for example the consumer consent steps while the domain is set to `notify`. They are not required. Perform them all the same: a live signature without one is recorded with a `block` finding, and you are told. Empty in test mode, where every such step is in `required_steps`. |
| `conformance_enforcement` | What this session does when the signature fails a rule. Live sessions: `notify` (the signature is recorded, and you are told at once which rule failed and what to fix) or `block` (it is refused before it is sealed). It is the domain's setting when the session was created, and the session keeps it. `null` in test mode, where a finding never refuses a signature. See [When a live signature fails a rule](https://esigncomply.com/docs/conformance.md#enforcement). |
| `documents[]` | The exact versions pinned. Save the `version_id` values in server-owned state: you compare them with the record at confirmation. |
| `applied_jurisdictions[]` | Each applied pack with `code`, `version` and `reason` (`base`, `signer_region`, `governing_law`, `organization_region`, `strictest`, `explicit`). |
| `rules_fired[]` | IDs of the pack rules that fired. |
| `required_strings[]` | Wording the applied packs ask the page to carry: `slot`, `block`, `rule`, `kind` (`verbatim` or `elements`), `text`, `translations`, `elements`, `statutory`, `label`, `check`. Render every `verbatim` string as given in the slot named. |
| `retention_floor` | The longest retention floor among applied packs, or null. |
| `minimal_capture` | `true` when optional markup, style, layout, network and device capture is off: the profile uses `eu_minimal`, or an `EU`, `UK` or `CH` pack applied. `notice.captured` is not a required step then. |
| `advisories[]` | Record conditions in the advise state that would add a step: `rule`, `finding`, `notice`. The steps are in `advised_steps`. Never a reason for an error. |
| `warnings[]` | Non-blocking concerns. Open list. |
| `api_url` | The regional API base for this session. Pass it to the browser SDK as `apiUrl` when you serve EU-region domains. |

The same jurisdiction values are sealed in the record.

## Rules

- **Declared URL.** `context.url` must fall within the registered domain in live mode, otherwise `403 domain_mismatch`. Live mode requires it.
- **Pack selection.** `signer.class`, `signer.country`, `signer.region` and the governing law select the packs within the profile. The full rules, including unknown location, are under [Jurisdictions](https://esigncomply.com/docs/api/jurisdictions.md).
- **Client token.** Short-lived, signed, scoped to one session.
- **Exclusion screen.** The union of the exclusion screens of every applied pack runs here, against `context.facts.document_category`. A blocked category returns `422 document_type_excluded` with the reason and the rule ID.
- **Customer-supplied context.** `context.notes`, `context.extra`, `context.facts` and `metadata` are sealed inside the record as asserted material and are printed apart from what Esign Comply observed.
- **Tolerant input.** Unknown top-level or nested fields are ignored and reported as `unknown_field:<path>`. Unknown fact keys are stored with `fact_unrecognized:<key>`. Neither is an error. A wrong type for a known field or a missing required field still returns `400`.
- **Advisories** never change the status code or `required_steps`.
- **When a live signature fails a rule.** The domain's `conformance_enforcement` setting is read here and stays with the session. By default (`notify`) a live signature that fails a rule is recorded, and you are told at once which rule failed and what to fix. With `block` it is refused before it is sealed, and the steps an adopted Block rule adds are in `required_steps`. Changing the setting affects sessions created afterwards.
- **Assurance level.** The session runs at the profile's `assurance_level`. L1 is the default and is on every plan. A profile at L2 or L3 needs the Unlimited or Enterprise plan, in test mode and in live mode: on Free and Starter the session is refused with `403` [`plan_feature_unavailable`](https://esigncomply.com/docs/api/errors.md#plan_feature_unavailable) and `param: "profile"`. Nothing is migrated, so a profile left at L2 or L3 cannot start sessions until you change it to L1 or upgrade. An upgrade takes effect at once.
- **Quota.** The plan's limit is checked here, never at completion. Past the limit, a new live session can be refused with `402` [`quota_exhausted`](https://esigncomply.com/docs/api/errors.md#quota_exhausted). Sessions already created still complete. See [Free plan limits](https://esigncomply.com/docs/guides/test-mode.md#free-plan-limits) and [Starter limits](https://esigncomply.com/docs/guides/test-mode.md#starter-limits).

## Warnings

Common values: `unknown_field:<path>`, `signer_class_unrecognized:<value>`, `signer_country_missing`, `signer_region_missing`, `signer_region_unrecognized`, `state_pack_unavailable:<code>`, `jurisdiction_not_enabled:<code>`, `governing_law_no_pack:<code>`, `fact_missing:<key>`, `fact_unrecognized:<key>`, `document_type_requires_review:<id>`, `record_conditions_pending_adoption`, `pack_version_stale`. Each is explained under [Jurisdictions](https://esigncomply.com/docs/api/jurisdictions.md).

## Errors

| Code | HTTP | When |
|---|---|---|
| [`invalid_request`](https://esigncomply.com/docs/api/errors.md#invalid_request) | 400 | Malformed body, `signer.email` is not an email address, `metadata` has more than 50 keys, `context.extra` is over 16 KB, `context.url` missing in live mode, `explicit` mode without `jurisdictions.packs`, or a [hash-only](https://esigncomply.com/docs/api/documents.md#hash-only-registration) document version pinned for a consumer signer, or for a signer whose class neither the session nor the profile gives (`param: "documents"`). |
| [`jurisdiction_unknown`](https://esigncomply.com/docs/api/errors.md#jurisdiction_unknown) | 400 | Jurisdiction resolution refused the session. |
| [`domain_not_verified`](https://esigncomply.com/docs/api/errors.md#domain_not_verified) | 403 | Live key before domain verification, or verification lapsed more than 14 days ago. |
| [`domain_mismatch`](https://esigncomply.com/docs/api/errors.md#domain_mismatch) | 403 | `context.url` is outside the registered domain (live) or the test allowlist (test). |
| [`plan_feature_unavailable`](https://esigncomply.com/docs/api/errors.md#plan_feature_unavailable) | 403 | Test and live: the profile is at L2 or L3 and the plan is Free or Starter. `param` is `profile` and the message reads `This profile uses assurance_level L2. Signer verification by emailed code is on Unlimited and Enterprise. Change the profile to assurance_level L1, or upgrade.` Live only: the subscription was canceled, or the domain is in a region the plan does not include (the EU region on Free). |
| [`not_found`](https://esigncomply.com/docs/api/errors.md#not_found) | 404 | Unknown profile, document or version in this domain and environment. `param` names the field, for example `documents.0.document`. |
| [`document_type_excluded`](https://esigncomply.com/docs/api/errors.md#document_type_excluded) | 422 | Jurisdiction resolution refused the session. |
| [`version_not_published`](https://esigncomply.com/docs/api/errors.md#version_not_published) | 422 | A document has no published version, or none in effect yet. |
| [`jurisdiction_not_enabled`](https://esigncomply.com/docs/api/errors.md#jurisdiction_not_enabled) | 422 | Jurisdiction resolution refused the session. |
| [`signer_region_required`](https://esigncomply.com/docs/api/errors.md#signer_region_required) | 422 | Jurisdiction resolution refused the session. |
| [`jurisdiction_fact_required`](https://esigncomply.com/docs/api/errors.md#jurisdiction_fact_required) | 422 | Jurisdiction resolution refused the session. |
| [`quota_exhausted`](https://esigncomply.com/docs/api/errors.md#quota_exhausted) | 402 | Live mode, on Free or Starter: the request came past the plan's limit and the new live signature was refused. The error carries `plan`, `limit`, `period`, `locked_since` and `upgrade_url`. Sessions already created still complete. |
| [`test_quota_exceeded`](https://esigncomply.com/docs/api/errors.md#test_quota_exceeded) | 429 | This month's test-mode allowance is used up. |
| [`idempotency_conflict`](https://esigncomply.com/docs/api/errors.md#idempotency_conflict) | 409 | The `Idempotency-Key` was reused with a different body. |

Like every call made with a secret key, it can also return [`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), [`insufficient_permission`](https://esigncomply.com/docs/api/errors.md#insufficient_permission), [`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

### Which credential does POST /v1/sessions need?

A secret key with full_access or recording_access permission. Send it as a Bearer token in the Authorization header, from your server only. A session client token is refused with insufficient_permission.

### Does POST /v1/sessions work with a test key?

Yes. It works with test keys and live keys. A test key reads and writes test objects only, and a live key works once the domain is verified.

### Does POST /v1/sessions count as a signature event?

No. The signature event is counted when the session is completed and the record is written. Creating a live session checks the plan's limit, and past the limit it can be refused with quota_exhausted.

### Is POST /v1/sessions 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?

The limit is counted for each key and depends on the plan: 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?

Yes: esc.sessions.create() 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.
- [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`
- [Start a verification](https://esigncomply.com/docs/api/sessions/start-a-verification.md): `POST /v1/sessions/{id}/verifications`
- [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.
