# Can I use a live key on localhost?

> A live key cannot run a signing flow on localhost: live sessions and browser calls must come from your verified registered domain. Use a test key.

Source: https://esigncomply.com/docs/kb/can-i-use-a-live-key-on-localhost

Last updated November 25, 2026

No, a live key cannot run a signing flow on localhost. Esign Comply accepts a live session only when `context.url` is inside your verified registered domain, and live browser calls only from that domain. A session that names `http://localhost` is refused with `403 domain_mismatch`. Use a test key on localhost.

## What does a live key check that a test key does not?

| Check | Live key | Test key |
|---|---|---|
| The domain | Verified. Otherwise `403` [`domain_not_verified`](https://esigncomply.com/docs/api/errors.md#domain_not_verified). | No domain needed |
| `context.url` on `POST /v1/sessions` | Required, and inside the registered domain | Optional. `localhost`, `127.0.0.1`, the registered domain or a listed preview host |
| `Origin` of a browser call | Inside the registered domain. A call with no `Origin` is refused. | The same hosts as `context.url`. A call with no `Origin` is accepted. |

A live request that fails the second or third check returns `403` [`domain_mismatch`](https://esigncomply.com/docs/api/errors.md#domain_mismatch).

## Can a script on my machine call the API with a live key?

Yes. Requests made with a secret key are not checked against a host, so a script on your machine can read live records or call `GET /v1/usage`. The domain rule applies to `context.url` and to the browser calls made with a session's client token. Keep the live key in your production environment, and give a reporting script its own `read_only` key.

## How do I test the whole flow on localhost?

Use a test key. Test keys work on `localhost`, `*.localhost`, `127.0.0.1` and `[::1]`, on any port, before you register a domain. A test record goes through the same sealing steps on a separate test ledger and carries `livemode: false`. Test records are deleted after 30 days.

## Where can I try a live signature before launch?

On your registered domain or any of its subdomains, for example a staging subdomain. Registering `app.example.com` covers `example.com` and every subdomain. A live signature there is a real record and counts as one signature event.

## Related

- [Where test keys work](https://esigncomply.com/docs/guides/test-mode.md#where-test-keys-work)
- [Register a domain](https://esigncomply.com/docs/guides/domains.md)
- [Going live](https://esigncomply.com/docs/guides/test-mode.md#going-live)
- [Does test mode work on preview deployments?](https://esigncomply.com/docs/kb/does-test-mode-work-on-preview-deployments.md)
