Skip to content
Docs
API 1.0.0 · 23 Nov 2026

Search the docs

    Română

    Upload and classify

    Create a draft from one file and a class, read the result and change its properties before it goes to approval.

    On this page

    Send the file in base64 with the class and the properties of the document. The samples read $RDC_BASE_URL and $RDC_TOKEN; the Quickstart shows both.

    curl

    curl -X POST "$RDC_BASE_URL/documents/v1/documents" \
      -H "Authorization: Bearer $RDC_TOKEN" \
      -H "Content-Type: application/json" \
      -d '{
      "operationId": "8d1f4c6b-2a37-4e90-b5d8-71c3e0a9f246",
      "class": "invoice",
      "name": "Invoice MV-2026-03117",
      "counterpartyId": "365fcde1-a8f1-4abc-bff5-001cc36ad963",
      "project": "Purchasing",
      "date": "2026-11-20",
      "amount": "12502.17",
      "owner": "sorin-avram",
      "extract": true,
      "file": {
        "name": "MV-2026-03117.pdf",
        "mediaType": "application/pdf",
        "content": "JVBERi0xLjcKJeLjz9MKJSVFT0YK"
      }
    }'

    JavaScript

    const response = await fetch(`${process.env.RDC_BASE_URL}/documents/v1/documents`, {
      method: 'POST',
      headers: {
        Authorization: `Bearer ${process.env.RDC_TOKEN}`,
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        "operationId": "8d1f4c6b-2a37-4e90-b5d8-71c3e0a9f246",
        "class": "invoice",
        "name": "Invoice MV-2026-03117",
        "counterpartyId": "365fcde1-a8f1-4abc-bff5-001cc36ad963",
        "project": "Purchasing",
        "date": "2026-11-20",
        "amount": "12502.17",
        "owner": "sorin-avram",
        "extract": true,
        "file": {
          "name": "MV-2026-03117.pdf",
          "mediaType": "application/pdf",
          "content": "JVBERi0xLjcKJeLjz9MKJSVFT0YK"
        }
      }),
    });
    const result = await response.json();

    Python

    import os
    import requests
    
    response = requests.request(
        'POST',
        f'{os.environ["RDC_BASE_URL"]}/documents/v1/documents',
        headers={
            'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
        },
        json={
            'operationId': '8d1f4c6b-2a37-4e90-b5d8-71c3e0a9f246',
            'class': 'invoice',
            'name': 'Invoice MV-2026-03117',
            'counterpartyId': '365fcde1-a8f1-4abc-bff5-001cc36ad963',
            'project': 'Purchasing',
            'date': '2026-11-20',
            'amount': '12502.17',
            'owner': 'sorin-avram',
            'extract': True,
            'file': {
                'name': 'MV-2026-03117.pdf',
                'mediaType': 'application/pdf',
                'content': 'JVBERi0xLjcKJeLjz9MKJSVFT0YK',
            },
        },
    )
    result = response.json()

    PHP

    <?php
    
    $body = <<<'JSON'
    {
      "operationId": "8d1f4c6b-2a37-4e90-b5d8-71c3e0a9f246",
      "class": "invoice",
      "name": "Invoice MV-2026-03117",
      "counterpartyId": "365fcde1-a8f1-4abc-bff5-001cc36ad963",
      "project": "Purchasing",
      "date": "2026-11-20",
      "amount": "12502.17",
      "owner": "sorin-avram",
      "extract": true,
      "file": {
        "name": "MV-2026-03117.pdf",
        "mediaType": "application/pdf",
        "content": "JVBERi0xLjcKJeLjz9MKJSVFT0YK"
      }
    }
    JSON;
    
    $curl = curl_init(getenv('RDC_BASE_URL') . '/documents/v1/documents');
    curl_setopt_array($curl, [
        CURLOPT_CUSTOMREQUEST => 'POST',
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_HTTPHEADER => [
            'Authorization: Bearer ' . getenv('RDC_TOKEN'),
            'Content-Type: application/json',
        ],
        CURLOPT_POSTFIELDS => $body,
    ]);
    $result = json_decode(curl_exec($curl), true);
    curl_close($curl);

    C#

    using System.Net.Http.Headers;
    
    var client = new HttpClient();
    var request = new HttpRequestMessage(HttpMethod.Post, $"{Environment.GetEnvironmentVariable("RDC_BASE_URL")}/documents/v1/documents");
    request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
    request.Content = new StringContent("""
    {
      "operationId": "8d1f4c6b-2a37-4e90-b5d8-71c3e0a9f246",
      "class": "invoice",
      "name": "Invoice MV-2026-03117",
      "counterpartyId": "365fcde1-a8f1-4abc-bff5-001cc36ad963",
      "project": "Purchasing",
      "date": "2026-11-20",
      "amount": "12502.17",
      "owner": "sorin-avram",
      "extract": true,
      "file": {
        "name": "MV-2026-03117.pdf",
        "mediaType": "application/pdf",
        "content": "JVBERi0xLjcKJeLjz9MKJSVFT0YK"
      }
    }
    """, System.Text.Encoding.UTF8, "application/json");
    var response = await client.SendAsync(request);
    var result = await response.Content.ReadAsStringAsync();

    Response 202

    {
      "operationId": "8d1f4c6b-2a37-4e90-b5d8-71c3e0a9f246",
      "status": "accepted",
      "aggregateRevision": 1,
      "documentId": "ba4d0edc-7dd5-41e9-82ab-0ed0b4c95fa6",
      "number": "DOC-2026-0403"
    }

    Read the result

    The answer says that the change was accepted. It carries the documentId and the number of the new document, here DOC-2026-0403. Keep both next to the file you sent.

    Look the operation up with the operationId you sent. When status is completed, the document exists.

    curl

    curl "$RDC_BASE_URL/documents/v1/operations/8d1f4c6b-2a37-4e90-b5d8-71c3e0a9f246" \
      -H "Authorization: Bearer $RDC_TOKEN"

    JavaScript

    const response = await fetch(`${process.env.RDC_BASE_URL}/documents/v1/operations/8d1f4c6b-2a37-4e90-b5d8-71c3e0a9f246`, {
      method: 'GET',
      headers: {
        Authorization: `Bearer ${process.env.RDC_TOKEN}`,
      },
    });
    const result = await response.json();

    Python

    import os
    import requests
    
    response = requests.request(
        'GET',
        f'{os.environ["RDC_BASE_URL"]}/documents/v1/operations/8d1f4c6b-2a37-4e90-b5d8-71c3e0a9f246',
        headers={
            'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
        },
    )
    result = response.json()

    PHP

    <?php
    
    $curl = curl_init(getenv('RDC_BASE_URL') . '/documents/v1/operations/8d1f4c6b-2a37-4e90-b5d8-71c3e0a9f246');
    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#

    using System.Net.Http.Headers;
    
    var client = new HttpClient();
    var request = new HttpRequestMessage(HttpMethod.Get, $"{Environment.GetEnvironmentVariable("RDC_BASE_URL")}/documents/v1/operations/8d1f4c6b-2a37-4e90-b5d8-71c3e0a9f246");
    request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
    var response = await client.SendAsync(request);
    var result = await response.Content.ReadAsStringAsync();

    Response 200

    {
      "operationId": "8d1f4c6b-2a37-4e90-b5d8-71c3e0a9f246",
      "status": "completed",
      "aggregateRevision": 1,
      "documentId": "ba4d0edc-7dd5-41e9-82ab-0ed0b4c95fa6"
    }

    Then read the document with getDocument. A new document is a draft with version 1 and revision 1, and its keepUntil is already set: 2036-12-31.

    Get the document

    curl

    curl "$RDC_BASE_URL/documents/v1/documents/ba4d0edc-7dd5-41e9-82ab-0ed0b4c95fa6" \
      -H "Authorization: Bearer $RDC_TOKEN"

    JavaScript

    const response = await fetch(`${process.env.RDC_BASE_URL}/documents/v1/documents/ba4d0edc-7dd5-41e9-82ab-0ed0b4c95fa6`, {
      method: 'GET',
      headers: {
        Authorization: `Bearer ${process.env.RDC_TOKEN}`,
      },
    });
    const result = await response.json();

    Python

    import os
    import requests
    
    response = requests.request(
        'GET',
        f'{os.environ["RDC_BASE_URL"]}/documents/v1/documents/ba4d0edc-7dd5-41e9-82ab-0ed0b4c95fa6',
        headers={
            'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
        },
    )
    result = response.json()

    PHP

    <?php
    
    $curl = curl_init(getenv('RDC_BASE_URL') . '/documents/v1/documents/ba4d0edc-7dd5-41e9-82ab-0ed0b4c95fa6');
    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#

    using System.Net.Http.Headers;
    
    var client = new HttpClient();
    var request = new HttpRequestMessage(HttpMethod.Get, $"{Environment.GetEnvironmentVariable("RDC_BASE_URL")}/documents/v1/documents/ba4d0edc-7dd5-41e9-82ab-0ed0b4c95fa6");
    request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
    var response = await client.SendAsync(request);
    var result = await response.Content.ReadAsStringAsync();

    Response 200

    {
      "id": "ba4d0edc-7dd5-41e9-82ab-0ed0b4c95fa6",
      "number": "DOC-2026-0403",
      "name": "Invoice MV-2026-03117",
      "class": "invoice",
      "counterpartyId": "365fcde1-a8f1-4abc-bff5-001cc36ad963",
      "counterparty": "Moara Vadului SRL",
      "project": "Purchasing",
      "owner": "sorin-avram",
      "date": "2026-11-20",
      "amount": "12502.17",
      "currency": "RON",
      "status": "draft",
      "version": 1,
      "returned": false,
      "keepUntil": "2036-12-31",
      "changedAt": "2026-11-23T07:12:00Z",
      "approval": {
        "route": [],
        "decisions": [],
        "next": null
      },
      "signature": null,
      "readers": {
        "groups": [
          "finance",
          "purchasing"
        ],
        "people": [
          "sorin-avram"
        ]
      },
      "revision": 1
    }

    Choose the class

    The class is one of contract, invoice, offer or report. It decides who approves the document, whether it is signed and how long it is kept. Read the same table from listClasses.

    ClassApprovers, in orderAfter approvalKept
    contractioana-marin up to 100000.00 RON; above it ioana-marin, then ana-rusuSent for signature, then archived10 years from the end of the year of its date
    invoiceioana-marin up to 25000.00 RON; above it ioana-marin, then ana-rusuArchived10 years from the end of the year of its date
    offerioana-marin up to 50000.00 RON; above it ioana-marin, then ana-rusuSent for signature, then archived3 years from the end of the year of its date
    reportana-rusu for every amountArchived5 years from the end of the year of its date

    curl

    curl "$RDC_BASE_URL/documents/v1/classes?limit=20" \
      -H "Authorization: Bearer $RDC_TOKEN"

    JavaScript

    const response = await fetch(`${process.env.RDC_BASE_URL}/documents/v1/classes?limit=20`, {
      method: 'GET',
      headers: {
        Authorization: `Bearer ${process.env.RDC_TOKEN}`,
      },
    });
    const result = await response.json();

    Python

    import os
    import requests
    
    response = requests.request(
        'GET',
        f'{os.environ["RDC_BASE_URL"]}/documents/v1/classes?limit=20',
        headers={
            'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
        },
    )
    result = response.json()

    PHP

    <?php
    
    $curl = curl_init(getenv('RDC_BASE_URL') . '/documents/v1/classes?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#

    using System.Net.Http.Headers;
    
    var client = new HttpClient();
    var request = new HttpRequestMessage(HttpMethod.Get, $"{Environment.GetEnvironmentVariable("RDC_BASE_URL")}/documents/v1/classes?limit=20");
    request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
    var response = await client.SendAsync(request);
    var result = await response.Content.ReadAsStringAsync();

    Response 200

    {
      "items": [
        {
          "id": "contract",
          "signed": true,
          "keepYears": 10,
          "readers": [
            "finance",
            "sales",
            "purchasing"
          ],
          "approval": {
            "limit": "100000.00",
            "approvers": [
              "ioana-marin",
              "ana-rusu"
            ]
          }
        },
        {
          "id": "invoice",
          "signed": false,
          "keepYears": 10,
          "readers": [
            "finance",
            "purchasing"
          ],
          "approval": {
            "limit": "25000.00",
            "approvers": [
              "ioana-marin",
              "ana-rusu"
            ]
          }
        },
        {
          "id": "offer",
          "signed": true,
          "keepYears": 3,
          "readers": [
            "finance",
            "sales"
          ],
          "approval": {
            "limit": "50000.00",
            "approvers": [
              "ioana-marin",
              "ana-rusu"
            ]
          }
        },
        {
          "id": "report",
          "signed": false,
          "keepYears": 5,
          "readers": [
            "finance",
            "warehouse"
          ],
          "approval": {
            "limit": null,
            "approvers": [
              "ana-rusu"
            ]
          }
        }
      ],
      "nextCursor": null
    }

    A document of a class with a limit goes to the first approver when its amount is at most the limit, and to every approver above it. The keep-until date is the end of the year of the date on the document plus the years of its class. Approvals and Retention follow both rules.

    If the class is wrong

    A draft cannot change its class: updateProperties has no class field. Create a new document with the right class and submit that one. The API has no delete, and a draft cannot be archived, so the first draft stays in the list as a draft.

    Change the properties of a draft

    While the document is a draft, updateProperties changes its name, counterparty, project, date and amount. Send only what changes, and the revision you read as expectedRevision.

    curl

    curl -X POST "$RDC_BASE_URL/documents/v1/documents/417fc646-2924-483f-b1d7-b2c07692e924/properties" \
      -H "Authorization: Bearer $RDC_TOKEN" \
      -H "Content-Type: application/json" \
      -d '{
      "operationId": "66a3c447-ac92-4bec-8056-4be113f4de08",
      "expectedRevision": 1,
      "by": "sorin-avram",
      "name": "Transport agreement 2027, Transbistrița Logistic",
      "amount": "64500.00"
    }'

    JavaScript

    const response = await fetch(`${process.env.RDC_BASE_URL}/documents/v1/documents/417fc646-2924-483f-b1d7-b2c07692e924/properties`, {
      method: 'POST',
      headers: {
        Authorization: `Bearer ${process.env.RDC_TOKEN}`,
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        "operationId": "66a3c447-ac92-4bec-8056-4be113f4de08",
        "expectedRevision": 1,
        "by": "sorin-avram",
        "name": "Transport agreement 2027, Transbistrița Logistic",
        "amount": "64500.00"
      }),
    });
    const result = await response.json();

    Python

    import os
    import requests
    
    response = requests.request(
        'POST',
        f'{os.environ["RDC_BASE_URL"]}/documents/v1/documents/417fc646-2924-483f-b1d7-b2c07692e924/properties',
        headers={
            'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
        },
        json={
            'operationId': '66a3c447-ac92-4bec-8056-4be113f4de08',
            'expectedRevision': 1,
            'by': 'sorin-avram',
            'name': 'Transport agreement 2027, Transbistrița Logistic',
            'amount': '64500.00',
        },
    )
    result = response.json()

    PHP

    <?php
    
    $body = <<<'JSON'
    {
      "operationId": "66a3c447-ac92-4bec-8056-4be113f4de08",
      "expectedRevision": 1,
      "by": "sorin-avram",
      "name": "Transport agreement 2027, Transbistrița Logistic",
      "amount": "64500.00"
    }
    JSON;
    
    $curl = curl_init(getenv('RDC_BASE_URL') . '/documents/v1/documents/417fc646-2924-483f-b1d7-b2c07692e924/properties');
    curl_setopt_array($curl, [
        CURLOPT_CUSTOMREQUEST => 'POST',
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_HTTPHEADER => [
            'Authorization: Bearer ' . getenv('RDC_TOKEN'),
            'Content-Type: application/json',
        ],
        CURLOPT_POSTFIELDS => $body,
    ]);
    $result = json_decode(curl_exec($curl), true);
    curl_close($curl);

    C#

    using System.Net.Http.Headers;
    
    var client = new HttpClient();
    var request = new HttpRequestMessage(HttpMethod.Post, $"{Environment.GetEnvironmentVariable("RDC_BASE_URL")}/documents/v1/documents/417fc646-2924-483f-b1d7-b2c07692e924/properties");
    request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
    request.Content = new StringContent("""
    {
      "operationId": "66a3c447-ac92-4bec-8056-4be113f4de08",
      "expectedRevision": 1,
      "by": "sorin-avram",
      "name": "Transport agreement 2027, Transbistrița Logistic",
      "amount": "64500.00"
    }
    """, System.Text.Encoding.UTF8, "application/json");
    var response = await client.SendAsync(request);
    var result = await response.Content.ReadAsStringAsync();

    Response 202

    {
      "operationId": "66a3c447-ac92-4bec-8056-4be113f4de08",
      "status": "accepted",
      "aggregateRevision": 2
    }

    A new file for the draft is a new version: send it with reviseDocument. The owner and the class stay as they were created.

    The file

    FieldRule
    file.contentThe file in base64, up to 10 MiB before it is encoded.
    file.mediaTypeapplication/pdf, image/png, image/jpeg or image/tiff.
    file.name1 to 200 characters.
    nameThe name of the document: 1 to 280 characters.
    dateA real day in the form YYYY-MM-DD.
    amountA decimal string above zero with at most two decimals, in RON.

    Send it again safely

    Create the operationId before the first request and store it with the file. After a timeout, send the same request with the same operationId: the document is created once and the answer is the first one. See Idempotency and concurrency.

    CodeStatusWhat to do
    class_not_valid422Send one of the four classes. Do not send the same body again.
    name_required422Give the document a name within the length above.
    date_not_valid422Send a real day as YYYY-MM-DD.
    amount_not_valid422Send the amount as a decimal string with at most two decimals.
    counterparty_not_found404Use the counterpartyId of a customer, a supplier or a carrier of your account.
    person_not_found404Use the identifier of a person of your account as owner.
    invalid_request400fields names each wrong field, such as file.mediaType or a file over 10 MiB. Correct it and send the request with a new operationId.
    operation_reused409The operationId was used with another body. Send the first body again, or a new operationId for a new document.
    rate_limited429Wait the seconds in Retry-After, then send the same request with the same operationId.
    unavailable503Send the same request again with the same operationId.