Authentication
All API requests require an Authorization header with your API key:
Authorization: Bearer pk_live_xxxxxxxxxxxx
Get an API key
Visit policynumbers.com/api, enter your email, and click Generate API key. The key is shown once — save it immediately.
warning
Your API key grants access to your verification credits. Never commit it to source control or expose it in client-side code.
Key types
| Prefix | Mode | Credits consumed |
|---|---|---|
pk_live_ | Production | Yes |
pk_test_ | Sandbox | No |
Generate a test key from the same portal page to develop and test without using real credits.
Using your key
- curl
- Python
- Node.js
curl -X POST https://policynumbers.com/api/v1/verify \
-H "Authorization: Bearer pk_live_xxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{"policy_number":"ABC12345","country":"UK","insurance_type":"motor"}'
import requests
resp = requests.post(
"https://policynumbers.com/api/v1/verify",
headers={"Authorization": "Bearer pk_live_xxxxxxxxxxxx"},
json={"policy_number": "ABC12345", "country": "UK", "insurance_type": "motor"},
)
print(resp.json())
const resp = await fetch("https://policynumbers.com/api/v1/verify", {
method: "POST",
headers: {
"Authorization": "Bearer pk_live_xxxxxxxxxxxx",
"Content-Type": "application/json",
},
body: JSON.stringify({ policy_number: "ABC12345", country: "UK", insurance_type: "motor" }),
});
console.log(await resp.json());
Error codes
| Code | Meaning |
|---|---|
401 | Missing or invalid API key |
402 | Insufficient verification credits |
429 | Rate limit exceeded |