Esta página solo está disponible en inglés.Abrir en inglés
Authentication
Every request carries a secret key of your company in the Authorization header:
curl https://api.sandbox.creditcard/v2/users \
-H "Authorization: Bearer w3c_test_YOUR_SECRET"
The key is only for the server of your company. A request coming from a browser is refused with 403 forbidden: any request that carries the Origin header counts as one. Keep the secret out of web pages and apps.
Who can use the API
| Environment | Who |
|---|---|
| Production | Companies on an active paid plan, also while a payment is late |
| Sandbox | Companies that paid the signup and passed the company verification |
When the API is not open for your company, the API page of the panel says why: The API is part of the paid plans, Verify your company first or Your company is suspended.
Create a key
Only the owner of the company manages keys. Each action asks for the code from your authenticator app.
- Business panel → API → Create API key.
- Name: only your team sees it, up to 40 characters.
- Read only, if the key only reads. It cannot be changed later.
- Allowed IP addresses, if you want to limit where the key works.
- Code from your authenticator app → Create key.
The window Your new API key shows the secret once: "Copy the secret now. It is shown only this once and cannot be seen again." Copy secret → I have copied it. The owner of the company gets a security email about the new key.
Each company has up to 5 keys. Active and suspended keys count; revoked keys do not. The environment of each key shows as Sandbox or Live.
Read-only keys
A key created with Read only can only read. Every write is refused with 403 not_allowed, reason api_key_read_only: This API key is read only. Good for reports and dashboards.
In GET /v2/events, a read-only key receives card.otp without code and url.
Allowed IP addresses
Up to 10 addresses, separated by commas or spaces, with no ranges. Empty means any address, for hosting without a fixed IP. Edit IPs changes the list later.
The address checked is the public IP your request leaves from. The API answers over IPv4. A request from another address is refused with 403 forbidden: This IP address (x) is not allowed for this API key.
The list works like the one of Stripe: optional, and empty for whoever has no fixed IP.
Revoke and reactivate
- Revoke: the key stops working right away and cannot be turned back on.
- Suspended: the automatic stop turned the key off after too many requests for records that do not exist (see Limits). The owner gets an email. Reactivate turns it back on. Before that, check that your system only asks for ids the API returned.
- If the person who created a key stops being the owner of the company, the key stops working.
The column Last used can take up to an hour to update.
Errors of the key
| HTTP | error | message |
|---|---|---|
| 401 | unauthorized | Missing API key. |
| 401 | unauthorized | Invalid API key. |
| 401 | unauthorized | This API key belongs to the other environment. |
| 403 | forbidden | A request from a browser, or from an IP that is not allowed |
| 403 | not_allowed | Reason plan_not_active, company_verification_required, company_suspended, api_key_read_only or api_key_suspended |