Create an API key
In the Esign Comply API, POST /v1/api-keys creates an API key for the same domain and returns its secret once, in this response only. Use it to create the recording_access key your application runs with, or a new key when you rotate.
POST /v1/api-keys · API version 2026-11-21
Authentication
Send a secret key in the Authorization header: Bearer $ESIGNCOMPLY_API_KEY. The key needs full_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.
Request example
cURL
curl https://esigncomply.com/v1/api-keys \
-H "Authorization: Bearer $ESIGNCOMPLY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Preview deployments",
"permission": "recording_access"
}'
Node SDK
import { EsignComply } from "esigncomply";
const esc = new EsignComply(process.env.ESIGNCOMPLY_API_KEY);
const { data, error } = await esc.apiKeys.create({ name: "Preview deployments", permission: "recording_access" });
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
Creates a key for the same domain. The secret is in the response once. Only a prefix and a SHA-256 hash are stored, so it cannot be shown again. This response is never kept for idempotent replay.
Key format: esc_<test|live>_<us|eu>_<random>. The mode and region are part of the key, so SDKs can choose the host. A key works only against the region of its domain: the other region returns region_mismatch with the correct host. Each key is pinned to the API version that was current when it was created.
Parameters
Body fields
| Field | Type | Required | Description |
|---|---|---|---|
name |
string | Yes | A label, up to 80 characters. |
permission |
string | No | full_access, recording_access (default) or read_only. |
mode |
string | No | test or live. Defaults to the mode of the calling key. A test key cannot create a live key. |
| Permission | What the key can do |
|---|---|
full_access |
Every endpoint. |
recording_access |
Create and read sessions; read record status, metadata and the receipt for server-side confirmation; register and read documents; read profiles; create supplements and files; read signer status; read guidance and usage; run conformance checks. No evidence report, evidence package, certificate or export access. |
read_only |
Read documents, profiles, sessions, full records, evidence reports and packages, certificates, supplements, signer status, guidance, usage and conformance runs. No writes. |
Use recording_access for the key your application runs with. A leaked application key then cannot export stored evidence or create a charge.
Store key as a server environment variable (ESIGNCOMPLY_API_KEY). Never print it, commit it or send it to a browser. See the credential rules.
Headers: Idempotency-Key (optional, up to 255 characters) and Esign-Comply-Version (optional, a dated API version). See API conventions.
Response
201 Created with an ApiKey object.
{
"object": "api_key",
"id": "key_2bQ1",
"name": "Preview deployments",
"livemode": false,
"permission": "recording_access",
"prefix": "esc_test_us_...",
"api_version": "2026-11-21",
"last_used_at": null,
"revoked_at": null,
"created_at": "2026-11-26T00:18:00.296Z",
"key": "esc_test_us_...",
"note": "This key is shown once. Only a prefix and a SHA-256 hash are stored."
}
Response fields
| Field | Type | Description |
|---|---|---|
object |
string | |
id |
string | |
name |
string | |
livemode |
boolean | |
permission |
string | |
prefix |
string | |
api_version |
string | |
created_at |
datetime | |
last_used_at |
datetime | |
revoked_at |
datetime | |
key |
string | The secret key. Present only in the creation response. |
revoked |
boolean |
Errors
| Code | HTTP | When |
|---|---|---|
invalid_request |
400 | The request is malformed: the body is not valid JSON, a known field has the wrong type, a required field is missing, a value is out of range, or a limit was passed (for example metadata over 50 keys, context.extra over 16 KB, event data over 256 KB, an Idempotency-Key over 255 characters, an unknown Esign-Comply-Version). |
domain_not_verified |
403 | 403: a live key was requested before the domain is verified. |
insufficient_permission |
403 | 403: a test key asked for a live key, or the calling key is not full_access. |
Like every call made with a secret key, it can also return missing_api_key, invalid_api_key, 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/api-keys
Which credential does POST /v1/api-keys need?
A secret key with full_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/api-keys 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/api-keys 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/api-keys idempotent?
No. The response shows a secret once, so it is not kept for a replay. A repeat with the same Idempotency-Key runs again and creates another object.
What is the rate limit for POST /v1/api-keys?
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/api-keys?
Yes: esc.apiKeys.create() in the esigncomply package. It resolves to { data, error } and does not throw.
Related
- Account: the overview of the resource and all of its operations.
- List API keys:
GET /v1/api-keys - Revoke an API key:
DELETE /v1/api-keys/{id} - Create a webhook endpoint:
POST /v1/webhooks - List webhook endpoints:
GET /v1/webhooks - Domains
- Test mode
- Errors: every error code, with what to do.
- API conventions: authentication, idempotency, rate limits and versioning.
Last updated · API version 2026-11-21