Authentication
The ChainPal API uses API keys for authentication. All API requests must include a valid API key in theAuthorization header.
API Key Types
ChainPal provides two types of API keys for different use cases:Public Keys
- Prefix:
cp_pk_test_orcp_pk_live_ - Use Case: Client-side integrations (e.g., initializing payments from your frontend)
- Permissions: Limited to creating payments and getting quotes
- Endpoints:
POST /payments,POST /payments/quote
Secret Keys
- Prefix:
cp_sk_test_orcp_sk_live_ - Use Case: Server-side integrations only
- Permissions: Full API access including payment verification and listing
- Endpoints: All endpoints, including
GET /payments,GET /payments/:paymentId,GET /payments/:paymentId/verify
Key Prefixes
The prefix encodes both the type (public vs secret) and the environment (test vs live):Test and Live keys are independent — use them side-by-side
There is no per-account “active environment” toggle. Each request is routed by the prefix on the key you send:cp_*_test_*→ request is processed in test modecp_*_live_*→ request is processed in live mode
- The
environmentfield on every payment object reflects the env of the key used to create it. A payment created with a test key is and stays a test payment; same for live. - Webhook URLs and callback URLs are configured per environment
(
testWebhookURL+testCallbackURL,liveWebhookURL+liveCallbackURL). The dispatcher picks the right pair based on the payment’s env. - Rate limits are tracked per
(business, environment)bucket — test traffic doesn’t eat into your live budget.
Migrating from the old “switch environment” model? The
POST /users/public-api/toggle-environment endpoint is deprecated and
returns 410 Gone. Just send requests with whichever key matches the
env you want.Authorization Header
Include your API key in theAuthorization header using the Bearer scheme:
Example Requests
Using a Public Key (Initialize Payment)
Using a Secret Key (Verify Payment)
IP Whitelisting
For enhanced security, you can configure IP whitelisting in your dashboard. When enabled:- Only requests from whitelisted IP addresses will be accepted for Secret Key endpoints
- Requests from non-whitelisted IPs will receive a
403 Forbiddenresponse - You can whitelist up to 3 IP addresses
GET /payments/:paymentId/verifyGET /payments/reference/:reference/verifyGET /payments/:paymentIdGET /payments
Rate Limiting
API requests are rate-limited to prevent abuse:
When you exceed the rate limit, you’ll receive a
429 Too Many Requests response.

