DSN API keys: test, production, revocation
- Criterion
- Prefix
- Test key
- dsn_test_
- Production key
- dsn_live_
- Criterion
- Accepted files
- Test key
- The published sample files, byte for byte, and the ready-made requests of the sample catalogue on the API page.
- Production key
- Your DSN files and their attachments.
- Criterion
- Counted and billed
- Test key
- No.
- Production key
- Yes, by declared individual.
- Criterion
- Typical refusal
- Test key
- 403, code
exemple_requis, for any other file. - Production key
- 429 (
quota_depasseor sature) beyond the workspace’s call limits: see Errors and limits.
Create a key
- Open Developers › API keys — In the application, on the workspace concerned. Creating and revoking a key is reserved for the workspace’s developers, administrators and owners.
- Choose the mode — Test or production. You then recognise the key by its identifier, in the list and in the action log.
- Copy the secret straight away — It is the prefix followed by 64 hexadecimal characters. It is shown at this moment only: the service cannot show it a second time.
Where to find your API keys, how to create one for test or production, and why its secret is shown only once.
API keys are managed under Developers. The API keys tab lists the workspace keys, test or production, and never shows their secret. The create button opens a window: you choose the environment, test or production. The secret of a key is shown only once, when it is created. This video creates none: Cancel closes the window.
Use a key
The key goes in the Authorization header, with the Bearer scheme. A refused or inactive key receives 401 with the code authentification, with no detail about the cause. A request without an Authorization header also receives 401, with WWW-Authenticate: Bearer. A repeated header receives 400, unless a short token is involved: the refusal is then 401 with the code authentification.
- Keep the key in your tool’s environment or in your secrets vault, never in code or in a command argument.
- A key never goes into a browser. The application calls the API with a short token, valid for five minutes, without exposing your key.
- One key per piece of software and per environment: revoking one does not stop the others.
- Use the key created for the API you are calling: the Cloud’s, or your DSNLint Dedicated instance’s.
Replace or revoke a key
To replace a key without interruption, create the new one, deploy it, check one call, then revoke the old one. If a secret is lost or exposed, revoke the key at once and create another. Revocation propagates within five minutes at most; the key then receives 401.