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
} | Field | Meaning |
|---|---|
access_token | The token. |
token_type | Always Bearer. |
expires_in | Seconds 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.
| Status | Code | Cause | What to do |
|---|---|---|---|
401 | unauthorized | The token is missing, expired or not ours. | Ask for a new token, then send the request again. |
403 | forbidden | The 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
- ERP: Scope of the product
- Inventory: Scope of the product
- WMS: Scope of the product
- POS: Scope of the product
- Self-Checkout: Scope of the product
- Accounting: Scope of the product
- Treasury: Scope of the product
- HR: Scope of the product
- Payroll: Scope of the product
- eLearning: Scope of the product
- CRM: Scope of the product
- AI Assistant: Scope of the product
- Private AI Workspace: Scope of the product
- DMS: Scope of the product
- BI: Scope of the product
- IoT: Scope of the product
- e-Factura Gateway: Scope of the product
- e-TVA Check: Scope of the product
- e-Transport Gateway: Scope of the product
- Tax Filing: Scope of the product
- REGES Gateway: Scope of the product
- Integrations: Scope of the product
Related pages
- Your first request: the token in use.
- Sign-in with R&D Copilot: how people open the applications.