# Register a domain

> POST /v1/domains registers the domain for the key's subscription and returns it with the DNS record or file that verifies it: parameters, examples and errors.

Source: https://esigncomply.com/docs/api/account/register-a-domain

Last updated November 26, 2026

In the Esign Comply API, `POST /v1/domains` registers the domain for the key's subscription and returns it with the DNS record or file that verifies it. Call it with a `full_access` key before go-live, since test mode works without a domain and live mode does not.

`POST /v1/domains` · 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](https://esigncomply.com/docs/api.md#authentication).

## Request example

### cURL

```bash
curl https://esigncomply.com/v1/domains \
  -H "Authorization: Bearer $ESIGNCOMPLY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "domain": "app.example.com",
    "region": "us"
  }'
```

### Node SDK

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

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

const { data, error } = await esc.domains.create({ domain: "app.example.com", region: "us" });
```

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

Registers the domain for the key's subscription. One subscription covers one registered domain and every subdomain. You can enter a host or a URL: Esign Comply computes the registrable domain with the Public Suffix List, so `app.example.com` registers `example.com`. A host on a shared platform suffix, such as `myapp.vercel.app`, is registered on its own and verifies by a well-known file because DNS records cannot be added there. Moving later to a custom domain is a domain change.

Test keys work on `localhost`, `127.0.0.1` and listed preview hosts without a domain. You need a verified domain to go live. See the [domains guide](https://esigncomply.com/docs/guides/domains.md).

## Parameters

### Body fields

| Field | Type | Required | Description |
|---|---|---|---|
| `domain` | string | Yes | A host name or URL, for example `app.example.com`. Localhost and IP addresses cannot be registered. |
| `region` | string | No | `us` or `eu`. Sets where evidence is stored and which API host the keys use. Chosen here and fixed afterwards. The Free plan records live in `us` only: live recording in `eu` needs a paid plan. |

Publish the record shown in `verification`, then wait for the automatic check or call the verify endpoint. For a platform host the `verification` object is:

```json
{
  "method": "file",
  "url": "https://myapp.vercel.app/.well-known/esigncomply.txt",
  "content": "<token>"
}
```

Serve `content` as the body of that URL over HTTPS, without a redirect to another host.

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 Domain object.

```json
{
  "object": "domain",
  "id": "dom_4Kx9",
  "domain": "example.com",
  "entered_host": "app.example.com",
  "region": "us",
  "status": "pending",
  "verification": {
    "method": "dns",
    "type": "TXT",
    "name": "_esigncomply.example.com",
    "host": "_esigncomply",
    "value": "esc-verify=Z5vdrGwKYnQRXVjM6wo926aomq0yQQwQ"
  },
  "registered_at": "2026-11-26T00:18:10.927Z",
  "verified_at": null,
  "last_checked_at": null,
  "lapsed_at": null,
  "test_origins": [],
  "conformance_enforcement": "notify",
  "api_url": "https://esigncomply.com/v1",
  "created_at": "2026-11-26T00:15:23.620Z"
}
```

### Response fields

| Field | Type | Description |
|---|---|---|
| `object` | string |  |
| `id` | string |  |
| `domain` | string | The registrable domain. Covers every subdomain. |
| `entered_host` | string |  |
| `region` | string |  |
| `status` | string | not_started, pending, verified, failed or lapsed. |
| `verification` | object | DNS: { method, type, name, host, value }. File: { method, url, content }. |
| `registered_at` | datetime |  |
| `verified_at` | datetime |  |
| `last_checked_at` | datetime |  |
| `lapsed_at` | datetime |  |
| `test_origins` | array of string |  |
| `conformance_enforcement` | string | What a live signature that fails a rule does. notify (the default): it is recorded, and you are told at once which rule failed and what to fix. block: it is refused before it is sealed. |
| `api_url` | string |  |
| `created_at` | datetime |  |

## Errors

| Code | HTTP | When |
|---|---|---|
| [`invalid_request`](https://esigncomply.com/docs/api/errors.md#invalid_request) | 400 | `400`: the value is not a host name, is localhost or an IP address, the region is not available, or the registered domain was already changed within the last 12 months. |
| [`plan_feature_unavailable`](https://esigncomply.com/docs/api/errors.md#plan_feature_unavailable) | 403 | `403`: the region is not on the plan. |
| [`domain_already_registered`](https://esigncomply.com/docs/api/errors.md#domain_already_registered) | 409 | `409`: the domain is attached to another subscription. |

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), [`domain_not_verified`](https://esigncomply.com/docs/api/errors.md#domain_not_verified), [`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/domains

### Which credential does POST /v1/domains 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/domains 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/domains 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/domains 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/domains?

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/domains?

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

## Related

- [Account](https://esigncomply.com/docs/api/account.md): the overview of the resource and all of its operations.
- [List domains](https://esigncomply.com/docs/api/account/list-domains.md): `GET /v1/domains`
- [Retrieve a domain](https://esigncomply.com/docs/api/account/retrieve-a-domain.md): `GET /v1/domains/{id}`
- [Update a domain](https://esigncomply.com/docs/api/account/update-a-domain.md): `PATCH /v1/domains/{id}`
- [Verify a domain](https://esigncomply.com/docs/api/account/verify-a-domain.md): `POST /v1/domains/{id}/verify`
- [Domains](https://esigncomply.com/docs/guides/domains.md)
- [Test mode](https://esigncomply.com/docs/guides/test-mode.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.
