API authentication

The two steps that authenticate a call, the scope of each product, how long to keep a token, and what 401 and 403 mean.

On this page

Code authenticates as a client with OAuth 2.0 client credentials and sends the token it receives as a bearer token.

Step 1: ask for a token

Send the client id and the secret of your integration to the token address that came with your account, and set scope to the scope of the product: <product>.access.

Token request

curl -X POST "$RDC_TOKEN_URL" \
  -d "grant_type=client_credentials" \
  -d "client_id=$RDC_CLIENT_ID" \
  -d "client_secret=$RDC_CLIENT_SECRET" \
  -d "scope=inventory.access"

The answer holds the token and how long it lasts.

Answer 200

{
  "access_token": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.e30.c2lnbmF0dXJl",
  "token_type": "Bearer",
  "expires_in": 300
}

FieldMeaning
access_tokenThe token.
token_typeAlways Bearer.
expires_inSeconds until the token ends. The value of your answer is the one that holds.

Step 2: send the token

Put the token in the header Authorization of every request: Authorization: Bearer $RDC_TOKEN. Each sample in this guide does it.

Scopes

A scope gives access to one product: <product>.access, such as inventory.access. A client asks for the scopes of the products it calls and can use only those.

One client, one company

A client is issued for one legal company, and its token reaches the data of that company only. A second company needs a second client: ask our team through the contact form.

A token ends

Reuse a token until expires_in seconds have passed, then ask for a new one. Do not ask for a token per request: it adds one more request to every call.

StatusCodeCauseWhat to do
401unauthorizedThe token is missing, expired or not ours.Ask for a new token, then send the request again.
403forbiddenThe token does not give access to this company or operation.Do not repeat it. Check the scope and the company of the client.

Keeping the secret

  • Use one client for each integration and for each environment, so one secret can be rotated without touching the others.
  • Keep the secret on a server you control. Never put it in a web page or a mobile app.
  • Rotation goes through our team: write through the contact form.

In the product docs