---
title: "API authentication | Developer guide | R&D Copilot"
lang: en
canonical: https://rdcopilot.com/docs/authentication/
content_version: de82a34574db89235b4e64b16743f3fbfe37dfebfd1f997152659688ebb81878
contact: https://rdcopilot.com/contact/
---

# 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.

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

```bash
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

```json
{
  "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](https://rdcopilot.com/contact/?topic=api-access).

## 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](https://rdcopilot.com/contact/?topic=api-access).

A person's password is never an API credential. People sign in to applications; code authenticates as a client.

## In the product docs

-   [ERP: Scope of the product](https://erp.rdcopilot.com/docs/get-started/authentication/#request-a-token)
-   [Inventory: Scope of the product](https://inventory.rdcopilot.com/docs/get-started/authentication/#request-a-token)
-   [WMS: Scope of the product](https://warehouse.rdcopilot.com/docs/get-started/authentication/#request-a-token)
-   [POS: Scope of the product](https://pos.rdcopilot.com/docs/get-started/authentication/#request-a-token)
-   [Self-Checkout: Scope of the product](https://checkout.rdcopilot.com/docs/get-started/authentication/#request-a-token)
-   [Accounting: Scope of the product](https://accounting.rdcopilot.com/docs/get-started/authentication/#request-a-token)
-   [Treasury: Scope of the product](https://banking.rdcopilot.com/docs/get-started/authentication/#request-a-token)
-   [HR: Scope of the product](https://hr.rdcopilot.com/docs/get-started/authentication/#request-a-token)
-   [Payroll: Scope of the product](https://payroll.rdcopilot.com/docs/get-started/authentication/#request-a-token)
-   [eLearning: Scope of the product](https://elearning.rdcopilot.com/docs/get-started/authentication/#request-a-token)
-   [CRM: Scope of the product](https://crm.rdcopilot.com/docs/get-started/authentication/#request-a-token)
-   [AI Assistant: Scope of the product](https://ai.rdcopilot.com/docs/get-started/authentication/#request-a-token)
-   [Private AI Workspace: Scope of the product](https://private-ai.rdcopilot.com/docs/get-started/authentication/#request-a-token)
-   [DMS: Scope of the product](https://documents.rdcopilot.com/docs/get-started/authentication/#request-a-token)
-   [BI: Scope of the product](https://reports.rdcopilot.com/docs/get-started/authentication/#request-a-token)
-   [IoT: Scope of the product](https://iot.rdcopilot.com/docs/get-started/authentication/#request-a-token)
-   [e-Factura Gateway: Scope of the product](https://efactura.rdcopilot.com/docs/get-started/authentication/#request-a-token)
-   [e-TVA Check: Scope of the product](https://etva.rdcopilot.com/docs/get-started/authentication/#request-a-token)
-   [e-Transport Gateway: Scope of the product](https://etransport.rdcopilot.com/docs/get-started/authentication/#request-a-token)
-   [Tax Filing: Scope of the product](https://declarations.rdcopilot.com/docs/get-started/authentication/#request-a-token)
-   [REGES Gateway: Scope of the product](https://reges.rdcopilot.com/docs/get-started/authentication/#request-a-token)
-   [Integrations: Scope of the product](https://integrations.rdcopilot.com/docs/get-started/authentication/#request-a-token)

## Related pages

-   [Your first request](https://rdcopilot.com/docs/first-request/): the token in use.
-   [Sign-in with R&D Copilot](https://rdcopilot.com/docs/sign-in/): how people open the applications.

[Previous · **Sign-in with R&D Copilot**](https://rdcopilot.com/docs/sign-in/) [Next · **Your first request**](https://rdcopilot.com/docs/first-request/)

---

R&D Copilot · Made in EU · Contact: https://rdcopilot.com/contact/
