Skip to content
Docs
API 1.0.0 · 23 Nov 2026

Search the docs

    Română

    Approvals

    Submit a document to the approvers of its class and amount, approve it in order or return it with a reason, and follow what each step changes.

    On this page

    Submit a draft with submitDocument. The class and the amount of the document decide its route, and the route is fixed at that moment. The example submits the contract DOC-2026-0402.

    curl

    curl -X POST "$RDC_BASE_URL/documents/v1/documents/417fc646-2924-483f-b1d7-b2c07692e924/submit" \
      -H "Authorization: Bearer $RDC_TOKEN" \
      -H "Content-Type: application/json" \
      -d '{
      "operationId": "881bc655-2a08-4758-b283-ceedcfab6e53",
      "expectedRevision": 1,
      "by": "sorin-avram"
    }'

    JavaScript

    const response = await fetch(`${process.env.RDC_BASE_URL}/documents/v1/documents/417fc646-2924-483f-b1d7-b2c07692e924/submit`, {
      method: 'POST',
      headers: {
        Authorization: `Bearer ${process.env.RDC_TOKEN}`,
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        "operationId": "881bc655-2a08-4758-b283-ceedcfab6e53",
        "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/417fc646-2924-483f-b1d7-b2c07692e924/submit',
        headers={
            'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
        },
        json={
            'operationId': '881bc655-2a08-4758-b283-ceedcfab6e53',
            'expectedRevision': 1,
            'by': 'sorin-avram',
        },
    )
    result = response.json()

    PHP

    <?php
    
    $body = <<<'JSON'
    {
      "operationId": "881bc655-2a08-4758-b283-ceedcfab6e53",
      "expectedRevision": 1,
      "by": "sorin-avram"
    }
    JSON;
    
    $curl = curl_init(getenv('RDC_BASE_URL') . '/documents/v1/documents/417fc646-2924-483f-b1d7-b2c07692e924/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/417fc646-2924-483f-b1d7-b2c07692e924/submit");
    request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
    request.Content = new StringContent("""
    {
      "operationId": "881bc655-2a08-4758-b283-ceedcfab6e53",
      "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": "881bc655-2a08-4758-b283-ceedcfab6e53",
      "status": "accepted",
      "aggregateRevision": 2
    }

    The document is in-review. Its approval holds the route, the decisions taken so far and next, the approver whose decision is awaited. For this contract the route is ioana-marin.

    The route

    The first approver of the class decides every document up to the limit of the class, the limit itself included. Above the limit the document goes to every approver of the class, one after the other. A class without a limit, such as report, has the same route at every amount.

    DocumentClassAmount, RONRoute
    DOC-2026-0401invoice18940.50ioana-marin
    DOC-2026-0400invoice34862.00ioana-marin, ana-rusu
    An invoice at the limitinvoice25000.00ioana-marin
    A reportreportanyana-rusu

    A class that is routed by amount needs an amount before the document is submitted. Nobody approves a document they own: if the owner is on the route, the submit is refused with owner_is_approver.

    Approve in order

    The approvers decide in the order of the route, each once. Send the identifier of the next approver as approver. Here ioana-marin is the only approver of the route, so the document is approved after the answer.

    curl

    curl -X POST "$RDC_BASE_URL/documents/v1/documents/af784fd4-dcdb-4ac4-9e0a-3f59571d40c9/approve" \
      -H "Authorization: Bearer $RDC_TOKEN" \
      -H "Content-Type: application/json" \
      -d '{
      "operationId": "4939c1de-58ca-4732-ab10-4df248268504",
      "expectedRevision": 2,
      "approver": "ioana-marin"
    }'

    JavaScript

    const response = await fetch(`${process.env.RDC_BASE_URL}/documents/v1/documents/af784fd4-dcdb-4ac4-9e0a-3f59571d40c9/approve`, {
      method: 'POST',
      headers: {
        Authorization: `Bearer ${process.env.RDC_TOKEN}`,
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        "operationId": "4939c1de-58ca-4732-ab10-4df248268504",
        "expectedRevision": 2,
        "approver": "ioana-marin"
      }),
    });
    const result = await response.json();

    Python

    import os
    import requests
    
    response = requests.request(
        'POST',
        f'{os.environ["RDC_BASE_URL"]}/documents/v1/documents/af784fd4-dcdb-4ac4-9e0a-3f59571d40c9/approve',
        headers={
            'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
        },
        json={
            'operationId': '4939c1de-58ca-4732-ab10-4df248268504',
            'expectedRevision': 2,
            'approver': 'ioana-marin',
        },
    )
    result = response.json()

    PHP

    <?php
    
    $body = <<<'JSON'
    {
      "operationId": "4939c1de-58ca-4732-ab10-4df248268504",
      "expectedRevision": 2,
      "approver": "ioana-marin"
    }
    JSON;
    
    $curl = curl_init(getenv('RDC_BASE_URL') . '/documents/v1/documents/af784fd4-dcdb-4ac4-9e0a-3f59571d40c9/approve');
    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/af784fd4-dcdb-4ac4-9e0a-3f59571d40c9/approve");
    request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
    request.Content = new StringContent("""
    {
      "operationId": "4939c1de-58ca-4732-ab10-4df248268504",
      "expectedRevision": 2,
      "approver": "ioana-marin"
    }
    """, System.Text.Encoding.UTF8, "application/json");
    var response = await client.SendAsync(request);
    var result = await response.Content.ReadAsStringAsync();

    Response 202

    {
      "operationId": "4939c1de-58ca-4732-ab10-4df248268504",
      "status": "accepted",
      "aggregateRevision": 3
    }

    On a longer route the document stays in-review after each approval, and approval.next names the following approver. DOC-2026-0400 has the route ioana-marin, ana-rusu, and the first approver has decided, so it waits for ana-rusu.

    Find the queue of an approver

    List the documents with the awaitingApprover filter to get the documents that wait for one person.

    Documents that wait for an approver

    curl

    curl "$RDC_BASE_URL/documents/v1/documents?awaitingApprover=ana-rusu&limit=20" \
      -H "Authorization: Bearer $RDC_TOKEN"

    JavaScript

    const response = await fetch(`${process.env.RDC_BASE_URL}/documents/v1/documents?awaitingApprover=ana-rusu&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/documents?awaitingApprover=ana-rusu&limit=20',
        headers={
            'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
        },
    )
    result = response.json()

    PHP

    <?php
    
    $curl = curl_init(getenv('RDC_BASE_URL') . '/documents/v1/documents?awaitingApprover=ana-rusu&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/documents?awaitingApprover=ana-rusu&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": "c4619fe2-a7f9-49d9-98f7-46a02d5c39c3",
          "number": "DOC-2026-0400",
          "name": "Invoice AC-2026-0911",
          "class": "invoice",
          "counterpartyId": "a1f13366-0199-4955-9251-6bd2703ce5cf",
          "counterparty": "Ambalaje Carpatin SRL",
          "project": "Purchasing",
          "owner": "sorin-avram",
          "date": "2026-11-18",
          "amount": "34862.00",
          "currency": "RON",
          "status": "in-review",
          "version": 1,
          "returned": false,
          "keepUntil": "2036-12-31",
          "changedAt": "2026-11-20T09:40:00Z",
          "approval": {
            "route": [
              "ioana-marin",
              "ana-rusu"
            ],
            "decisions": [
              {
                "approver": "ioana-marin",
                "decision": "approved",
                "time": "2026-11-20T09:40:00Z"
              }
            ],
            "next": "ana-rusu"
          },
          "signature": null,
          "readers": {
            "groups": [
              "finance",
              "purchasing"
            ],
            "people": [
              "sorin-avram",
              "ioana-marin",
              "ana-rusu"
            ]
          },
          "revision": 3
        }
      ],
      "nextCursor": null
    }

    Return a document

    The next approver can return the document with a reason of 1 to 280 characters. Here ana-rusu returns DOC-2026-0400.

    curl

    curl -X POST "$RDC_BASE_URL/documents/v1/documents/c4619fe2-a7f9-49d9-98f7-46a02d5c39c3/reject" \
      -H "Authorization: Bearer $RDC_TOKEN" \
      -H "Content-Type: application/json" \
      -d '{
      "operationId": "52427312-c140-49a8-b7e4-f856f6bb1017",
      "expectedRevision": 3,
      "approver": "ana-rusu",
      "reason": "The packaging quantities do not match the delivery note."
    }'

    JavaScript

    const response = await fetch(`${process.env.RDC_BASE_URL}/documents/v1/documents/c4619fe2-a7f9-49d9-98f7-46a02d5c39c3/reject`, {
      method: 'POST',
      headers: {
        Authorization: `Bearer ${process.env.RDC_TOKEN}`,
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        "operationId": "52427312-c140-49a8-b7e4-f856f6bb1017",
        "expectedRevision": 3,
        "approver": "ana-rusu",
        "reason": "The packaging quantities do not match the delivery note."
      }),
    });
    const result = await response.json();

    Python

    import os
    import requests
    
    response = requests.request(
        'POST',
        f'{os.environ["RDC_BASE_URL"]}/documents/v1/documents/c4619fe2-a7f9-49d9-98f7-46a02d5c39c3/reject',
        headers={
            'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
        },
        json={
            'operationId': '52427312-c140-49a8-b7e4-f856f6bb1017',
            'expectedRevision': 3,
            'approver': 'ana-rusu',
            'reason': 'The packaging quantities do not match the delivery note.',
        },
    )
    result = response.json()

    PHP

    <?php
    
    $body = <<<'JSON'
    {
      "operationId": "52427312-c140-49a8-b7e4-f856f6bb1017",
      "expectedRevision": 3,
      "approver": "ana-rusu",
      "reason": "The packaging quantities do not match the delivery note."
    }
    JSON;
    
    $curl = curl_init(getenv('RDC_BASE_URL') . '/documents/v1/documents/c4619fe2-a7f9-49d9-98f7-46a02d5c39c3/reject');
    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/c4619fe2-a7f9-49d9-98f7-46a02d5c39c3/reject");
    request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
    request.Content = new StringContent("""
    {
      "operationId": "52427312-c140-49a8-b7e4-f856f6bb1017",
      "expectedRevision": 3,
      "approver": "ana-rusu",
      "reason": "The packaging quantities do not match the delivery note."
    }
    """, System.Text.Encoding.UTF8, "application/json");
    var response = await client.SendAsync(request);
    var result = await response.Content.ReadAsStringAsync();

    Response 202

    {
      "operationId": "52427312-c140-49a8-b7e4-f856f6bb1017",
      "status": "accepted",
      "aggregateRevision": 4
    }

    The document is a draft again with returned set to true. The round is cleared: approval.route is empty and the decisions are gone. The reason stays in the audit trail.

    Revise the returned report DOC-2026-0396

    curl

    curl -X POST "$RDC_BASE_URL/documents/v1/documents/7e9127fe-ec9e-4863-baf0-4ca4177acc75/revise" \
      -H "Authorization: Bearer $RDC_TOKEN" \
      -H "Content-Type: application/json" \
      -d '{
      "operationId": "45e4eb70-7f6e-4690-a7e9-f31d188116a4",
      "expectedRevision": 3,
      "by": "mihai-stan",
      "note": "Differences by aisle added.",
      "file": {
        "name": "stock-count-october-2026-v2.pdf",
        "mediaType": "application/pdf",
        "content": "JVBERi0xLjcKJeLjz9MKJSVFT0YK"
      }
    }'

    JavaScript

    const response = await fetch(`${process.env.RDC_BASE_URL}/documents/v1/documents/7e9127fe-ec9e-4863-baf0-4ca4177acc75/revise`, {
      method: 'POST',
      headers: {
        Authorization: `Bearer ${process.env.RDC_TOKEN}`,
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        "operationId": "45e4eb70-7f6e-4690-a7e9-f31d188116a4",
        "expectedRevision": 3,
        "by": "mihai-stan",
        "note": "Differences by aisle added.",
        "file": {
          "name": "stock-count-october-2026-v2.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/7e9127fe-ec9e-4863-baf0-4ca4177acc75/revise',
        headers={
            'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
        },
        json={
            'operationId': '45e4eb70-7f6e-4690-a7e9-f31d188116a4',
            'expectedRevision': 3,
            'by': 'mihai-stan',
            'note': 'Differences by aisle added.',
            'file': {
                'name': 'stock-count-october-2026-v2.pdf',
                'mediaType': 'application/pdf',
                'content': 'JVBERi0xLjcKJeLjz9MKJSVFT0YK',
            },
        },
    )
    result = response.json()

    PHP

    <?php
    
    $body = <<<'JSON'
    {
      "operationId": "45e4eb70-7f6e-4690-a7e9-f31d188116a4",
      "expectedRevision": 3,
      "by": "mihai-stan",
      "note": "Differences by aisle added.",
      "file": {
        "name": "stock-count-october-2026-v2.pdf",
        "mediaType": "application/pdf",
        "content": "JVBERi0xLjcKJeLjz9MKJSVFT0YK"
      }
    }
    JSON;
    
    $curl = curl_init(getenv('RDC_BASE_URL') . '/documents/v1/documents/7e9127fe-ec9e-4863-baf0-4ca4177acc75/revise');
    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/7e9127fe-ec9e-4863-baf0-4ca4177acc75/revise");
    request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
    request.Content = new StringContent("""
    {
      "operationId": "45e4eb70-7f6e-4690-a7e9-f31d188116a4",
      "expectedRevision": 3,
      "by": "mihai-stan",
      "note": "Differences by aisle added.",
      "file": {
        "name": "stock-count-october-2026-v2.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": "45e4eb70-7f6e-4690-a7e9-f31d188116a4",
      "status": "accepted",
      "aggregateRevision": 4
    }

    What each step changes

    RequestStatus afterEvent
    submitDocumentin-reviewdocument.submitted
    approveDocumentin-review, until the last approverdocument.approved
    approveDocumentapproved, after the last approverdocument.approved
    rejectDocumentdraft, with returned truedocument.rejected
    reviseDocumentdraft, with returned falsedocument.revised

    Each event names the document in data.number. document.approved also carries the approver and the status, which is approved after the last approver. See the Event catalogue.

    Codes and what to do

    CodeStatusCauseWhat to do
    owner_is_approver422The owner of the document is on its route.No retry. The owner does not change: create the document with another owner.
    amount_required422The class is routed by amount and the document has none.Set the amount with updateProperties, then submit with the new revision.
    revision_required409The document was returned and not revised.Send reviseDocument, then submit.
    document_not_draft409Only a draft is submitted.No retry. Read the document again.
    document_not_in_review409Only a document in review is approved or returned.No retry. Read the document again.
    not_an_approver422The person is not on approval.route.No retry. Send the person in approval.next.
    not_your_turn409An earlier approver has not decided.Read the document again, and decide when approval.next is this approver.
    already_decided409The approver approved the document already.No retry. Read the document again.
    reason_required422The reason is empty or longer than 280 characters.Send a reason within the length.
    revision_conflict409The expectedRevision is older than the document.Read the document again and send its revision.
    person_not_found404The by or the approver is not a person of your account.No retry. Use an identifier of your account.
    document_archived409The document is archived.No retry. Nothing changes on an archived document.
    rate_limited429Too many requests.Wait the seconds in Retry-After, then send the same request with the same operationId.