# Update a domain

> Update a domain: PATCH /v1/domains/{id} sets the monthly certificate spend limit or the test origins of the key's own domain and returns the domain.

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

Last updated November 26, 2026

In the Esign Comply API, `PATCH /v1/domains/{id}` sets the monthly certificate spend limit or the test origins of the key's own domain and returns the domain. Use it to list the preview hosts where test keys work, or to cap what certificates can cost each month.

`PATCH /v1/domains/{id}` · 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 -X PATCH https://esigncomply.com/v1/domains/dom_4Kx9 \
  -H "Authorization: Bearer $ESIGNCOMPLY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "certificate_spend_limit": 50000
  }'
```

### Node SDK

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

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

const { data, error } = await esc.domains.update("dom_4Kx9", { certificate_spend_limit: 50000 });
```

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

`{id}` must be the key's own domain. Send at least one field.

## Parameters

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

### Body fields

| Field | Type | Required | Description |
|---|---|---|---|
| `certificate_spend_limit` | integer | No | Monthly limit for certificate charges, in cents, from `0` to `500000`. The default is `20000` ($200). `0` switches paid certificates off. Higher limits are set on request. |
| `test_origins` | string[] | No | Up to 25 preview hosts on which test keys also work, for example `myapp-git-main.vercel.app`. A listed host also covers its subdomains. Replaces the list. |

A certificate request that would pass the limit returns [`certificate_spend_limit_reached`](https://esigncomply.com/docs/api/errors.md#certificate_spend_limit_reached). See [certificates](https://esigncomply.com/docs/api/certificates.md).

Headers: `Esign-Comply-Version` (optional, a dated API version). See [API conventions](https://esigncomply.com/docs/api.md).

## Response

`200 OK` 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": "2026-11-26T00:18:15.462Z",
  "lapsed_at": null,
  "test_origins": [],
  "conformance_enforcement": "notify",
  "api_url": "https://esigncomply.com/v1",
  "created_at": "2026-11-26T00:15:23.620Z",
  "certificate_spend_limit": 50000
}
```

### 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 | Neither field was sent, the limit is out of range, or a test origin is not a host name. |
| [`not_found`](https://esigncomply.com/docs/api/errors.md#not_found) | 404 | No object with that ID exists in this domain and environment. |

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), [`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 PATCH /v1/domains/{id}

### Which credential does PATCH /v1/domains/{id} 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 PATCH /v1/domains/{id} 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 PATCH /v1/domains/{id} 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 PATCH /v1/domains/{id} idempotent?

It takes no Idempotency-Key header. The API acts on that header for POST calls only, and this is a PATCH.

### What is the rate limit for PATCH /v1/domains/{id}?

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 PATCH /v1/domains/{id}?

Yes: esc.domains.update() 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.
- [Verify a domain](https://esigncomply.com/docs/api/account/verify-a-domain.md): `POST /v1/domains/{id}/verify`
- [Create an API key](https://esigncomply.com/docs/api/account/create-an-api-key.md): `POST /v1/api-keys`
- [List API keys](https://esigncomply.com/docs/api/account/list-api-keys.md): `GET /v1/api-keys`
- [Revoke an API key](https://esigncomply.com/docs/api/account/revoke-an-api-key.md): `DELETE /v1/api-keys/{id}`
- [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.
