Skip to content

DSN API keys: test, production, revocation

A key identifies your software to the API. It belongs to a workspace and comes in two modes: test, to try things out with nothing counted, and production, to check your DSN files. Its secret is shown only once, when it is created.
  • 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_depasse or sature) beyond the workspace’s call limits: see Errors and limits.

Create a key

  1. 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.
  2. Choose the mode — Test or production. You then recognise the key by its identifier, in the list and in the action log.
  3. 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.
Managing your API keys

Where to find your API keys, how to create one for test or production, and why its secret is shown only once.

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.

Objects are kept separate between test and production: a test key cannot retrieve a real report, and another workspace never sees your batches.

Try it with a test key

DSN glossary: BAN, CRM and payroll
Previous section
DSN API: resend without a second check
Next section