---
title: "Autentificare | Documentație | REGES Gateway by R&D Copilot"
description: "Obține datele de acces, cere un token și apelează cu el API-ul REGES Gateway."
canonical: "https://reges.rdcopilot.com/ro/docs/get-started/authentication/"
language: ro
updated: 2026-11-22
---

# Autentificare

Obține datele de acces, cere un token și apelează cu el API-ul REGES Gateway.

Datele de acces ale clientului API, adresa de bază și o companie de test se emit odată cu contul. Conturile sunt deschise de echipa noastră: cere unul prin formularul de contact și îl configurăm împreună.

[Cere un cont](https://rdcopilot.com/ro/contact/?product=reges&topic=api-access)

## Cere un token

API-ul folosește OAuth 2.0 cu fluxul client credentials. Clientul tău cere serviciului de autentificare un token pentru scope-ul `reges.access` și îl trimite ca token de tip bearer la fiecare cerere.

Cererea de token

```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=reges.access"
```

Răspunsul conține aceste câmpuri.

| Câmp | Descriere |
| --- | --- |
| `access_token` | Tokenul. Trimite-l ca `Authorization: Bearer $RDC_TOKEN`. |
| `token_type` | Întotdeauna `Bearer`. |
| `expires_in` | Secundele rămase până la expirarea tokenului. Reutilizează tokenul până atunci și cere unul nou înainte să expire. Nu cere un token la fiecare cerere. |

## Apelează API-ul

Fiecare cerere include tokenul. Exemplul listează înregistrări și arată antetul în fiecare limbaj.

curl

```bash
curl "$RDC_BASE_URL/reges/v1/register-operations?employerId=6e2aa977-c041-49c3-8c57-b9f2cd6cf3f0&limit=3" \
  -H "Authorization: Bearer $RDC_TOKEN"
```

JavaScript

```javascript
const response = await fetch(`${process.env.RDC_BASE_URL}/reges/v1/register-operations?employerId=6e2aa977-c041-49c3-8c57-b9f2cd6cf3f0&limit=3`, {
  method: 'GET',
  headers: {
    Authorization: `Bearer ${process.env.RDC_TOKEN}`,
  },
});
const result = await response.json();
```

Python

```python
import os
import requests

response = requests.request(
    'GET',
    f'{os.environ["RDC_BASE_URL"]}/reges/v1/register-operations?employerId=6e2aa977-c041-49c3-8c57-b9f2cd6cf3f0&limit=3',
    headers={
        'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
    },
)
result = response.json()
```

PHP

```php
<?php

$curl = curl_init(getenv('RDC_BASE_URL') . '/reges/v1/register-operations?employerId=6e2aa977-c041-49c3-8c57-b9f2cd6cf3f0&limit=3');
curl_setopt_array($curl, [
    CURLOPT_CUSTOMREQUEST => 'GET',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        'Authorization: Bearer ' . getenv('RDC_TOKEN'),
    ],
]);
$result = json_decode(curl_exec($curl), true);
curl_close($curl);
```

C#

```csharp
using System.Net.Http.Headers;

var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Get, $"{Environment.GetEnvironmentVariable("RDC_BASE_URL")}/reges/v1/register-operations?employerId=6e2aa977-c041-49c3-8c57-b9f2cd6cf3f0&limit=3");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync();
```

Răspuns 200

```json
{
  "items": [
    {
      "id": "27357abf-301f-4956-88af-73c842b85100",
      "number": "RG-2026-001471",
      "employerId": "6e2aa977-c041-49c3-8c57-b9f2cd6cf3f0",
      "contractId": "4fc60d72-3c1e-415c-a931-f0b21bfda436",
      "employee": "Mihai Stan",
      "kind": "change-salary",
      "status": "authorized",
      "date": "2026-10-26",
      "until": null,
      "deadline": {
        "date": "2026-11-20",
        "rule": "salary",
        "from": "2026-10-26",
        "workingDaysLeft": -1
      },
      "late": true,
      "details": {
        "date": "2026-10-26",
        "salary": "5600.00"
      },
      "preparedBy": {
        "id": "f3a70882-0da0-4686-bc0c-f29ce600bb0c",
        "name": "Elena Dumitru"
      },
      "authorizedBy": {
        "id": "c403d6ca-4254-4be4-8781-6be8b95a3de0",
        "name": "Ana Rusu"
      },
      "transmittedBy": null,
      "reference": null,
      "rejection": null,
      "lateReason": null,
      "correctionOf": null,
      "attempts": 0,
      "history": [
        {
          "status": "draft",
          "at": "2026-10-27T10:02:00Z",
          "by": {
            "id": "f3a70882-0da0-4686-bc0c-f29ce600bb0c",
            "name": "Elena Dumitru"
          },
          "reference": null,
          "message": null,
          "reason": null,
          "late": false
        },
        {
          "status": "validated",
          "at": "2026-10-27T10:10:00Z",
          "by": null,
          "reference": null,
          "message": null,
          "reason": null,
          "late": false
        },
        {
          "status": "authorized",
          "at": "2026-10-28T11:30:00Z",
          "by": {
            "id": "c403d6ca-4254-4be4-8781-6be8b95a3de0",
            "name": "Ana Rusu"
          },
          "reference": null,
          "message": null,
          "reason": null,
          "late": false
        }
      ],
      "revision": 3
    },
    {
      "id": "b5f54bb0-fa5e-43d6-b9fc-b5b0afe9d3d7",
      "number": "RG-2026-001481",
      "employerId": "6e2aa977-c041-49c3-8c57-b9f2cd6cf3f0",
      "contractId": "02b6b76c-19a6-4b97-af20-50b265e9d36d",
      "employee": "Radu Ionescu",
      "kind": "suspend",
      "status": "validated",
      "date": "2026-11-18",
      "until": null,
      "deadline": {
        "date": "2026-11-23",
        "rule": "suspension-days",
        "from": "2026-11-19",
        "workingDaysLeft": 0
      },
      "late": false,
      "details": {
        "date": "2026-11-18",
        "reason": "medical-leave",
        "learnedOn": "2026-11-19"
      },
      "preparedBy": {
        "id": "f3a70882-0da0-4686-bc0c-f29ce600bb0c",
        "name": "Elena Dumitru"
      },
      "authorizedBy": null,
      "transmittedBy": null,
      "reference": null,
      "rejection": null,
      "lateReason": null,
      "correctionOf": null,
      "attempts": 0,
      "history": [
        {
          "status": "draft",
          "at": "2026-11-19T15:12:00Z",
          "by": {
            "id": "f3a70882-0da0-4686-bc0c-f29ce600bb0c",
            "name": "Elena Dumitru"
          },
          "reference": null,
          "message": null,
          "reason": null,
          "late": false
        },
        {
          "status": "validated",
          "at": "2026-11-19T15:20:00Z",
          "by": null,
          "reference": null,
          "message": null,
          "reason": null,
          "late": false
        }
      ],
      "revision": 2
    },
    {
      "id": "4bbaadac-0dc6-40b0-9470-f26f8177bd8d",
      "number": "RG-2026-001483",
      "employerId": "6e2aa977-c041-49c3-8c57-b9f2cd6cf3f0",
      "contractId": "13156f30-1274-45d1-af53-672ccb3c7e04",
      "employee": "Dan Ilie",
      "kind": "hire",
      "status": "draft",
      "date": "2026-12-02",
      "until": null,
      "deadline": {
        "date": "2026-12-01",
        "rule": "hire",
        "from": "2026-12-02",
        "workingDaysLeft": 4
      },
      "late": false,
      "details": {
        "date": "2026-12-02"
      },
      "preparedBy": {
        "id": "f3a70882-0da0-4686-bc0c-f29ce600bb0c",
        "name": "Elena Dumitru"
      },
      "authorizedBy": null,
      "transmittedBy": null,
      "reference": null,
      "rejection": null,
      "lateReason": null,
      "correctionOf": null,
      "attempts": 0,
      "history": [
        {
          "status": "draft",
          "at": "2026-11-20T13:41:00Z",
          "by": {
            "id": "f3a70882-0da0-4686-bc0c-f29ce600bb0c",
            "name": "Elena Dumitru"
          },
          "reference": null,
          "message": null,
          "reason": null,
          "late": false
        }
      ],
      "revision": 1
    }
  ],
  "nextCursor": "eyJvZmZzZXQiOjN9"
}
```

## Cereri refuzate

| Cod de stare | Cod | Cauză | Ce faci |
| --- | --- | --- | --- |
| `401` | `unauthorized` | Niciun token sau un token nevalid ori expirat. | Cere un token nou, apoi repetă cererea. |
| `403` | `forbidden` | Un token valid fără scope-ul `reges.access` sau o cerere pentru date din afara contului tău. | Nu o repeta. Verifică scope-ul și societatea. |

Păstrează secretul clientului pe un server pe care îl controlezi. Nu îl pune într-o pagină web sau într-o aplicație mobilă.

Construiește mai întâi pe compania de test. Citește [Test și producție](https://reges.rdcopilot.com/ro/docs/get-started/sandbox-and-live/).

Regula completă: [Ghidul dezvoltatorului](https://rdcopilot.com/ro/docs/authentication/)
