Sandbox Testing
PolicyNumbers provides a full sandbox environment via test-mode API keys (pk_test_). All verification calls made with a test key return deterministic mock responses and charge zero credits.
Get a test key
Go to policynumbers.com/api, select Test key (pk_test_) from the dropdown, and click Generate API key.
How sandbox responses work
The response is determined by the policy number prefix:
| Policy number prefix | Result | Confidence |
|---|---|---|
| Anything (default) | verified | 0.95 |
FAIL_ | unverified | 0.10 |
INCONCLUSIVE_ | inconclusive | 0.50 |
All sandbox responses include "sandbox": true and "credits_charged": 0.
Example
curl -X POST https://policynumbers.com/api/v1/verify \
-H "Authorization: Bearer pk_test_xxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{"policy_number":"FAIL_ABC123","country":"UK","insurance_type":"motor"}'
{
"status": "unverified",
"confidence_score": 0.10,
"verification_sources": ["format"],
"flags": ["sandbox_forced_fail"],
"credits_charged": 0,
"sandbox": true,
"processed_in_ms": 1
}
What sandbox does not simulate
- Real credit deduction
- Actual registry lookups (FCA, UKMID, etc.)
- Webhook delivery for async jobs
Use a live key in a staging environment with a small credit balance to test the full end-to-end flow before going to production.