Does test mode work on preview deployments?
Yes, test mode works on a preview deployment once you add the preview's host to your domain's test origins. Esign Comply accepts test keys on localhost, 127.0.0.1 and your registered domain with no setup. Any other host, a preview URL included, is refused with 403 domain_mismatch until you list it. You can list up to 25 hosts.
How do I add a preview host to my test origins?
List the host under Domains in the dashboard, or send test_origins to PATCH /v1/domains/{id}. The call needs a key with full_access, and it replaces the whole list. GET /v1/domains returns the domain ID for your key.
curl -X PATCH https://esigncomply.com/v1/domains/dom_4Kx9 \
-H "Authorization: Bearer $ESIGNCOMPLY_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "test_origins": ["preview.example.dev", "myapp-git-main.vercel.app"] }'
An entry also covers its subdomains. List the exact host of your project, never a platform's shared suffix such as vercel.app. A host that changes with every deployment has to be listed again each time, so open previews through a stable address, such as a branch URL.
Which hosts does a test key accept?
| Host | Notes |
|---|---|
localhost and *.localhost |
Any port |
127.0.0.1 and [::1] |
Any port |
| Your registered domain and its subdomains | Once you have registered one |
Hosts in test_origins |
Up to 25, each with its subdomains |
Which test-mode calls check the host?
Two checks compare a host with the hosts a test key accepts. context.url on POST /v1/sessions is optional in test mode, and when you send it, its host must be one of them. The Origin header of every browser call made with the session's client token must be one of them too. Both failures return domain_mismatch. On a browser call the message names the origin that was refused. A test request with no Origin header is accepted, so scripts and test runners work.
Which key belongs on a preview deployment?
The test key. A live key accepts only hosts inside your verified registered domain, so a live session on a preview host outside it is refused. Keep the live key in production only, and check livemode when your server confirms a record, so a test record never unlocks production access.
Related
- Where test keys work
- Update a domain: the
test_originsfield. - Vercel quickstart: keys per environment and branch URLs.
- Can I use a live key on localhost?
Last updated · API version 2026-11-21