Skip to main content

API Key Authentication

All API requests must include your API key in the X-API-Key header.

Key Types

Never use production keys (pk_live_) for testing. Use sandbox keys (pk_test_) instead.

Getting Your API Key

1

Login to Dashboard

2

Go to API Keys

Navigate to SettingsAPI Keys
3

Generate Key

Click Generate New Key and configure:
  • Name: A descriptive name (e.g., “Production Website”)
  • Countries: Which countries this key can ship to
  • IP Whitelist: Optional IP restrictions
4

Save Securely

The full key is shown only once. Save it immediately.

Key Security Best Practices

Never hardcode API keys in your source code.
In the dashboard, add your server’s IP addresses to the whitelist. Requests from other IPs will be rejected.
Generate new keys periodically and revoke old ones. This limits exposure if a key is compromised.
API keys should only be used server-side. Never include them in:
  • Browser JavaScript
  • Mobile app bundles
  • Public repositories

Country Access Control

Each API key is restricted to specific destination countries. This is configured when generating the key. If you try to create an order to a country not in your key’s whitelist:

Rate Limiting Headers

Every response includes rate limit information:

Error Responses

Invalid API Key

HTTP Status: 401 Unauthorized

Missing API Key

HTTP Status: 401 Unauthorized

Rate Limit Exceeded

HTTP Status: 429 Too Many Requests

Testing Authentication

Use this endpoint to verify your API key is working:
Successful response: