Zum Hauptinhalt springen

Diese Seite ist nur auf Englisch verfügbar.Auf Englisch öffnen

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.

How to use, in the API page: the address, the header, an example and the routes.

Who can use the API​

EnvironmentWho
ProductionCompanies on an active paid plan, also while a payment is late
SandboxCompanies 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.

The API page without a paid plan.

Create a key​

Only the owner of the company manages keys. Each action asks for the code from your authenticator app.

The API page in the sandbox panel: two keys, one read only and one with allowed IP addresses.
  1. Business panel → API → Create API key.
  2. Name: only your team sees it, up to 40 characters.
  3. Read only, if the key only reads. It cannot be changed later.
  4. Allowed IP addresses, if you want to limit where the key works.
  5. 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.

Create API key: the name, Read only and the allowed IP addresses.
Your new API key: the secret, shown once. The secret in this image is an example.

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.

API keys: a read-only key and a suspended key, with Reactivate.

Errors of the key​

HTTPerrormessage
401unauthorizedMissing API key.
401unauthorizedInvalid API key.
401unauthorizedThis API key belongs to the other environment.
403forbiddenA request from a browser, or from an IP that is not allowed
403not_allowedReason plan_not_active, company_verification_required, company_suspended, api_key_read_only or api_key_suspended