---
title: "Autentificare | Documentație | e-Transport Gateway by R&D Copilot"
description: "Obține datele de acces, cere un token și apelează cu el API-ul e-Transport Gateway."
canonical: "https://etransport.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 e-Transport 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=etransport&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 `etransport.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=etransport.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/etransport/v1/declarations?companyId=9a893b65-2286-477f-8eab-61c12f7d6b3e&limit=20" \
  -H "Authorization: Bearer $RDC_TOKEN"
```

JavaScript

```javascript
const response = await fetch(`${process.env.RDC_BASE_URL}/etransport/v1/declarations?companyId=9a893b65-2286-477f-8eab-61c12f7d6b3e&limit=20`, {
  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"]}/etransport/v1/declarations?companyId=9a893b65-2286-477f-8eab-61c12f7d6b3e&limit=20',
    headers={
        'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
    },
)
result = response.json()
```

PHP

```php
<?php

$curl = curl_init(getenv('RDC_BASE_URL') . '/etransport/v1/declarations?companyId=9a893b65-2286-477f-8eab-61c12f7d6b3e&limit=20');
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")}/etransport/v1/declarations?companyId=9a893b65-2286-477f-8eab-61c12f7d6b3e&limit=20");
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": "b0bc421b-5e82-4bc2-9416-a33bd20bf92e",
      "companyId": "9a893b65-2286-477f-8eab-61c12f7d6b3e",
      "reference": "PO-8862",
      "operationType": "AIC",
      "status": "processing",
      "uit": null,
      "uploadIndex": "1000131",
      "startDate": "2026-11-24",
      "lastValidDay": "2026-12-08",
      "validity": null,
      "partner": {
        "country": "HU",
        "code": "",
        "name": "Tisza Pack Kft."
      },
      "transporter": {
        "country": "RO",
        "code": "62049137",
        "name": "Transbistrița Logistic SRL"
      },
      "vehicle": "ZZ41TBL",
      "trailers": [
        "ZZ42TBL"
      ],
      "from": {
        "kind": "border_crossing",
        "crossing": 2
      },
      "to": {
        "kind": "address",
        "county": 27,
        "locality": "Piatra-Neamț",
        "street": "Str. Depozitelor",
        "number": null,
        "notes": "Rampa 4"
      },
      "goods": [
        {
          "line": 1,
          "code": null,
          "name": "Cutii de carton ondulat, 40 de paleți",
          "tariffCode": "481910",
          "purposeCode": 101,
          "quantity": "40",
          "unit": "XPX",
          "netMass": "1180.00",
          "grossMass": "1240.00",
          "value": "18400.00"
        }
      ],
      "documents": [
        {
          "type": "cmr",
          "number": "CMR-HU-55812",
          "date": "2026-11-23",
          "remarks": null
        },
        {
          "type": "invoice",
          "number": "TP-30918",
          "date": "2026-11-22",
          "remarks": null
        }
      ],
      "totals": {
        "lines": 1,
        "netMass": "1180.00",
        "grossMass": "1240.00",
        "value": "18400.00"
      },
      "departedAt": null,
      "confirmation": null,
      "vehicleChanges": [],
      "correctionOf": null,
      "afterOutage": false,
      "source": "gateway",
      "revision": 6
    },
    {
      "id": "15699075-5c6a-4a8b-a225-166309ad1b48",
      "companyId": "9a893b65-2286-477f-8eab-61c12f7d6b3e",
      "reference": "LIV-2026-01839",
      "operationType": "TTN",
      "status": "accepted",
      "uit": "75LXQY50R5NU4243",
      "uploadIndex": "1000121",
      "startDate": "2026-11-23",
      "lastValidDay": "2026-11-27",
      "validity": "valid",
      "partner": {
        "country": "RO",
        "code": "39172614",
        "name": "Cofetăria Vălul Alb SRL"
      },
      "transporter": {
        "country": "RO",
        "code": "48290619",
        "name": "Brumar Distribuție SRL"
      },
      "vehicle": "ZZ24BRM",
      "trailers": [],
      "from": {
        "kind": "address",
        "county": 27,
        "locality": "Piatra-Neamț",
        "street": "Str. Depozitelor",
        "number": null,
        "notes": "Rampa 4"
      },
      "to": {
        "kind": "address",
        "county": 27,
        "locality": "Roman",
        "street": "Str. Principală",
        "number": null,
        "notes": null
      },
      "goods": [
        {
          "line": 1,
          "code": "ME-0307",
          "name": "Mere Golden, ladă de 12 kg",
          "tariffCode": "080810",
          "purposeCode": 101,
          "quantity": "12",
          "unit": "XCR",
          "netMass": "144.00",
          "grossMass": "154.80",
          "value": "576.00"
        },
        {
          "line": 2,
          "code": "NU-0622",
          "name": "Nuci decojite, sac de 5 kg",
          "tariffCode": "080232",
          "purposeCode": 101,
          "quantity": "6",
          "unit": "XBG",
          "netMass": "30.00",
          "grossMass": "30.60",
          "value": "1800.00"
        },
        {
          "line": 3,
          "code": "AP-0412",
          "name": "Apă minerală plată, 2 l, set de 6",
          "tariffCode": "220110",
          "purposeCode": 101,
          "quantity": "6",
          "unit": "XPK",
          "netMass": "72.00",
          "grossMass": "76.20",
          "value": "90.00"
        }
      ],
      "documents": [
        {
          "type": "delivery_note",
          "number": "AV-1039",
          "date": "2026-11-23",
          "remarks": null
        },
        {
          "type": "invoice",
          "number": "BRD-2026-00415",
          "date": "2026-11-23",
          "remarks": null
        }
      ],
      "totals": {
        "lines": 3,
        "netMass": "246.00",
        "grossMass": "261.60",
        "value": "2466.00"
      },
      "departedAt": "2026-11-23T05:48:00Z",
      "confirmation": null,
      "vehicleChanges": [
        {
          "at": "2026-11-23T06:35:00Z",
          "vehicle": "ZZ24BRM",
          "trailers": [],
          "note": "Pană de cauciuc, vehicul înlocuit"
        }
      ],
      "correctionOf": null,
      "afterOutage": false,
      "source": "gateway",
      "revision": 3
    },
    {
      "id": "4533692d-469c-4b70-acdb-d1a9a4a0f54f",
      "companyId": "9a893b65-2286-477f-8eab-61c12f7d6b3e",
      "reference": "LIV-2026-01842",
      "operationType": "TTN",
      "status": "accepted",
      "uit": "4F7K2Q9M8X1D6383",
      "uploadIndex": "1000128",
      "startDate": "2026-11-23",
      "lastValidDay": "2026-11-27",
      "validity": "valid",
      "partner": {
        "country": "RO",
        "code": "39172541",
        "name": "Hanul Ozana SRL"
      },
      "transporter": {
        "country": "RO",
        "code": "48290619",
        "name": "Brumar Distribuție SRL"
      },
      "vehicle": "ZZ21BRM",
      "trailers": [],
      "from": {
        "kind": "address",
        "county": 27,
        "locality": "Piatra-Neamț",
        "street": "Str. Depozitelor",
        "number": null,
        "notes": "Rampa 4"
      },
      "to": {
        "kind": "address",
        "county": 27,
        "locality": "Târgu Neamț",
        "street": "Str. Principală",
        "number": null,
        "notes": null
      },
      "goods": [
        {
          "line": 1,
          "code": "CA-0010",
          "name": "Cartofi albi, sac de 25 kg",
          "tariffCode": "070190",
          "purposeCode": 101,
          "quantity": "6",
          "unit": "XBG",
          "netMass": "150.00",
          "grossMass": "151.80",
          "value": "330.00"
        },
        {
          "line": 2,
          "code": "CE-0101",
          "name": "Ceapă galbenă, plasă de 10 kg",
          "tariffCode": "070310",
          "purposeCode": 101,
          "quantity": "4",
          "unit": "XBG",
          "netMass": "40.00",
          "grossMass": "40.60",
          "value": "112.00"
        },
        {
          "line": 3,
          "code": "MO-0201",
          "name": "Morcovi, sac de 10 kg",
          "tariffCode": "070610",
          "purposeCode": 101,
          "quantity": "4",
          "unit": "XBG",
          "netMass": "40.00",
          "grossMass": "40.60",
          "value": "128.00"
        },
        {
          "line": 4,
          "code": "ME-0307",
          "name": "Mere Golden, ladă de 12 kg",
          "tariffCode": "080810",
          "purposeCode": 101,
          "quantity": "8",
          "unit": "XCR",
          "netMass": "96.00",
          "grossMass": "103.20",
          "value": "384.00"
        },
        {
          "line": 5,
          "code": "AP-0412",
          "name": "Apă minerală plată, 2 l, set de 6",
          "tariffCode": "220110",
          "purposeCode": 101,
          "quantity": "10",
          "unit": "XPK",
          "netMass": "120.00",
          "grossMass": "127.00",
          "value": "150.00"
        },
        {
          "line": 6,
          "code": "SU-0518",
          "name": "Băutură carbogazoasă îndulcită, 2 l, set de 6",
          "tariffCode": "220210",
          "purposeCode": 101,
          "quantity": "3",
          "unit": "XPK",
          "netMass": "36.00",
          "grossMass": "38.10",
          "value": "72.00"
        }
      ],
      "documents": [
        {
          "type": "delivery_note",
          "number": "AV-1042",
          "date": "2026-11-23",
          "remarks": null
        },
        {
          "type": "invoice",
          "number": "BRD-2026-00418",
          "date": "2026-11-23",
          "remarks": null
        }
      ],
      "totals": {
        "lines": 6,
        "netMass": "482.00",
        "grossMass": "501.30",
        "value": "1176.00"
      },
      "departedAt": null,
      "confirmation": null,
      "vehicleChanges": [],
      "correctionOf": null,
      "afterOutage": false,
      "source": "gateway",
      "revision": 1
    }
  ],
  "nextCursor": null
}
```

## 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 `etransport.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://etransport.rdcopilot.com/ro/docs/get-started/sandbox-and-live/).

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