Skip to content
Docs
API 1.0.0 · 23 Nov 2026

Search the docs

    Română

    Quickstart

    Create an invoice from a file, read its values, settle them and send it to approval with five requests.

    On this page

    You need the client credentials and the base address of your test company. The samples read them from the environment: $RDC_BASE_URL and $RDC_TOKEN. See Authentication for the token.

    Create a document from a file

    Choose a new operationId and send the file with the properties of the invoice. extract asks for the values on the invoice to be read. The answer says that the change was accepted.

    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

    Look the operation up with the operationId you sent. When status is completed, the document exists and its extraction can be read.

    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"
    }

    StatusMeaning
    The request was recorded and is being applied.
    The change was applied.
    The request was refused. Nothing was changed.

    Read the values

    The extraction lists the nine values of the invoice. Each has the confidence of the reading and a state. Three need a person here: the due date was read with doubt, the gross is not the net plus the VAT, and the account is not the one in the record of the supplier.

    curl

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

    JavaScript

    const response = await fetch(`${process.env.RDC_BASE_URL}/documents/v1/documents/ba4d0edc-7dd5-41e9-82ab-0ed0b4c95fa6/extraction`, {
      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/extraction',
        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/extraction');
    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/extraction");
    request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
    var response = await client.SendAsync(request);
    var result = await response.Content.ReadAsStringAsync();

    Response 200

    {
      "documentId": "ba4d0edc-7dd5-41e9-82ab-0ed0b4c95fa6",
      "channel": "email",
      "receivedAt": "2026-11-23T06:58:00Z",
      "pages": 1,
      "fields": [
        {
          "field": "supplier",
          "value": "Moara Vadului SRL",
          "confidence": 99,
          "state": "accepted",
          "partnerValue": null
        },
        {
          "field": "taxCode",
          "value": "RO51603473",
          "confidence": 98,
          "state": "accepted",
          "partnerValue": null
        },
        {
          "field": "invoiceNumber",
          "value": "MV-2026-03117",
          "confidence": 97,
          "state": "accepted",
          "partnerValue": null
        },
        {
          "field": "issueDate",
          "value": "2026-11-20",
          "confidence": 96,
          "state": "accepted",
          "partnerValue": null
        },
        {
          "field": "dueDate",
          "value": "2026-12-20",
          "confidence": 84,
          "state": "to-review",
          "partnerValue": null
        },
        {
          "field": "net",
          "value": "11247.00",
          "confidence": 99,
          "state": "accepted",
          "partnerValue": null
        },
        {
          "field": "vat",
          "value": "1255.17",
          "confidence": 98,
          "state": "accepted",
          "partnerValue": null
        },
        {
          "field": "gross",
          "value": "12302.17",
          "confidence": 61,
          "state": "to-review",
          "partnerValue": null
        },
        {
          "field": "iban",
          "value": "RO65ZZZZ5160347002219999",
          "confidence": 96,
          "state": "differs",
          "partnerValue": "RO87ZZZZ5160347002210000"
        }
      ],
      "revision": 1
    }

    Settle the values

    Correct the gross to the sum of the net and the VAT. Send the revision of the extraction you read as expectedRevision. A value read with doubt that is right is confirmed with acceptExtractionValue; a value that differs from the record of the supplier is corrected to the value of the record. See Extract data.

    curl

    curl -X POST "$RDC_BASE_URL/documents/v1/documents/ba4d0edc-7dd5-41e9-82ab-0ed0b4c95fa6/extraction/gross/correct" \
      -H "Authorization: Bearer $RDC_TOKEN" \
      -H "Content-Type: application/json" \
      -d '{
      "operationId": "0a211494-7f4a-4d1a-938a-1e50e1bd95b8",
      "expectedRevision": 2,
      "value": "12502.17",
      "by": "sorin-avram"
    }'

    JavaScript

    const response = await fetch(`${process.env.RDC_BASE_URL}/documents/v1/documents/ba4d0edc-7dd5-41e9-82ab-0ed0b4c95fa6/extraction/gross/correct`, {
      method: 'POST',
      headers: {
        Authorization: `Bearer ${process.env.RDC_TOKEN}`,
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        "operationId": "0a211494-7f4a-4d1a-938a-1e50e1bd95b8",
        "expectedRevision": 2,
        "value": "12502.17",
        "by": "sorin-avram"
      }),
    });
    const result = await response.json();

    Python

    import os
    import requests
    
    response = requests.request(
        'POST',
        f'{os.environ["RDC_BASE_URL"]}/documents/v1/documents/ba4d0edc-7dd5-41e9-82ab-0ed0b4c95fa6/extraction/gross/correct',
        headers={
            'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
        },
        json={
            'operationId': '0a211494-7f4a-4d1a-938a-1e50e1bd95b8',
            'expectedRevision': 2,
            'value': '12502.17',
            'by': 'sorin-avram',
        },
    )
    result = response.json()

    PHP

    <?php
    
    $body = <<<'JSON'
    {
      "operationId": "0a211494-7f4a-4d1a-938a-1e50e1bd95b8",
      "expectedRevision": 2,
      "value": "12502.17",
      "by": "sorin-avram"
    }
    JSON;
    
    $curl = curl_init(getenv('RDC_BASE_URL') . '/documents/v1/documents/ba4d0edc-7dd5-41e9-82ab-0ed0b4c95fa6/extraction/gross/correct');
    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/ba4d0edc-7dd5-41e9-82ab-0ed0b4c95fa6/extraction/gross/correct");
    request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
    request.Content = new StringContent("""
    {
      "operationId": "0a211494-7f4a-4d1a-938a-1e50e1bd95b8",
      "expectedRevision": 2,
      "value": "12502.17",
      "by": "sorin-avram"
    }
    """, System.Text.Encoding.UTF8, "application/json");
    var response = await client.SendAsync(request);
    var result = await response.Content.ReadAsStringAsync();

    Response 202

    {
      "operationId": "0a211494-7f4a-4d1a-938a-1e50e1bd95b8",
      "status": "accepted",
      "aggregateRevision": 3
    }

    Send the invoice to approval

    When every value is accepted, submit the invoice. Its class and its amount decide who approves it: the first approver up to the limit of the class, every approver above it. The revision of the document counts the lines of its audit trail, so the answer is higher than the 1 you read.

    Submit the invoice

    curl

    curl -X POST "$RDC_BASE_URL/documents/v1/documents/ba4d0edc-7dd5-41e9-82ab-0ed0b4c95fa6/submit" \
      -H "Authorization: Bearer $RDC_TOKEN" \
      -H "Content-Type: application/json" \
      -d '{
      "operationId": "3dcda6fb-bc03-456d-8f1a-c8af85df385c",
      "expectedRevision": 1,
      "by": "sorin-avram"
    }'

    JavaScript

    const response = await fetch(`${process.env.RDC_BASE_URL}/documents/v1/documents/ba4d0edc-7dd5-41e9-82ab-0ed0b4c95fa6/submit`, {
      method: 'POST',
      headers: {
        Authorization: `Bearer ${process.env.RDC_TOKEN}`,
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        "operationId": "3dcda6fb-bc03-456d-8f1a-c8af85df385c",
        "expectedRevision": 1,
        "by": "sorin-avram"
      }),
    });
    const result = await response.json();

    Python

    import os
    import requests
    
    response = requests.request(
        'POST',
        f'{os.environ["RDC_BASE_URL"]}/documents/v1/documents/ba4d0edc-7dd5-41e9-82ab-0ed0b4c95fa6/submit',
        headers={
            'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
        },
        json={
            'operationId': '3dcda6fb-bc03-456d-8f1a-c8af85df385c',
            'expectedRevision': 1,
            'by': 'sorin-avram',
        },
    )
    result = response.json()

    PHP

    <?php
    
    $body = <<<'JSON'
    {
      "operationId": "3dcda6fb-bc03-456d-8f1a-c8af85df385c",
      "expectedRevision": 1,
      "by": "sorin-avram"
    }
    JSON;
    
    $curl = curl_init(getenv('RDC_BASE_URL') . '/documents/v1/documents/ba4d0edc-7dd5-41e9-82ab-0ed0b4c95fa6/submit');
    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/ba4d0edc-7dd5-41e9-82ab-0ed0b4c95fa6/submit");
    request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
    request.Content = new StringContent("""
    {
      "operationId": "3dcda6fb-bc03-456d-8f1a-c8af85df385c",
      "expectedRevision": 1,
      "by": "sorin-avram"
    }
    """, System.Text.Encoding.UTF8, "application/json");
    var response = await client.SendAsync(request);
    var result = await response.Content.ReadAsStringAsync();

    Response 202

    {
      "operationId": "3dcda6fb-bc03-456d-8f1a-c8af85df385c",
      "status": "accepted",
      "aggregateRevision": 3
    }

    If a value is still not accepted, the answer is a 422 with extraction_unresolved, and fields names each one. Nothing is changed.