Skip to content
Docs
API 1.0.0 · 22 Nov 2026

Search the docs

    Română

    Resolve a missing invoice

    Find the invoice the ledger lacks and explain why it is not posted, or link it when the ledger holds it under another number.

    On this page

    A not-posted difference flags a document on the pre-filled return with no matching posting in the period. In the September period of Brumar Distribuție SRL it is the invoice AC-004563 from Ambalaje Carpatin SRL, dated 23 September 2026, base 9184.50 and VAT 1928.75 at 21%. It lowers your side of purchases-standard by that VAT, so the row is to_review.

    1. Read the difference

      getDifference gives the kind, the effect on the row and the reasons that fit.

    2. Look in the ledger

      List the postings that no document matches, with listDocuments and side=ledger, match=unmatched.

    3. Link or explain

      If the ledger holds nothing for the invoice, explain the difference. If it holds the invoice under another number, link it.

    4. Read the row again

      getRow or listRows shows the new status.

    Read the difference

    curl

    curl "$RDC_BASE_URL/etva/v1/periods/79509f60-565a-40eb-a4c3-709e5d49e517/differences/46735209-a528-4647-ba66-da4a8e7373ee" \
      -H "Authorization: Bearer $RDC_TOKEN"

    JavaScript

    const response = await fetch(`${process.env.RDC_BASE_URL}/etva/v1/periods/79509f60-565a-40eb-a4c3-709e5d49e517/differences/46735209-a528-4647-ba66-da4a8e7373ee`, {
      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"]}/etva/v1/periods/79509f60-565a-40eb-a4c3-709e5d49e517/differences/46735209-a528-4647-ba66-da4a8e7373ee',
        headers={
            'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
        },
    )
    result = response.json()

    PHP

    <?php
    
    $curl = curl_init(getenv('RDC_BASE_URL') . '/etva/v1/periods/79509f60-565a-40eb-a4c3-709e5d49e517/differences/46735209-a528-4647-ba66-da4a8e7373ee');
    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")}/etva/v1/periods/79509f60-565a-40eb-a4c3-709e5d49e517/differences/46735209-a528-4647-ba66-da4a8e7373ee");
    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": "46735209-a528-4647-ba66-da4a8e7373ee",
      "periodId": "79509f60-565a-40eb-a4c3-709e5d49e517",
      "kind": "not-posted",
      "rowIds": [
        "purchases-standard"
      ],
      "effects": [
        {
          "rowId": "purchases-standard",
          "base": "-9184.50",
          "vat": "-1928.75"
        }
      ],
      "vat": "-1928.75",
      "documentId": "bb9c565d-6248-4964-8f91-c7dbf7838777",
      "postingId": null,
      "state": "open",
      "reasons": [
        "not_yet_posted",
        "different_period"
      ],
      "reason": null,
      "note": null,
      "explainedBy": null,
      "explainedAt": null
    }

    documentId points to the invoice of the pre-filled return and postingId is null: nothing in the ledger matches it by side, number and partner tax id. The reasons that fit are not_yet_posted and different_period.

    Look in the ledger

    The key of a match is the number, so a typing slip in the ledger leaves both sides unmatched. List the postings of your ledger that no document matches.

    Unmatched postings of the ledger

    curl

    curl "$RDC_BASE_URL/etva/v1/periods/79509f60-565a-40eb-a4c3-709e5d49e517/documents?side=ledger&match=unmatched" \
      -H "Authorization: Bearer $RDC_TOKEN"

    JavaScript

    const response = await fetch(`${process.env.RDC_BASE_URL}/etva/v1/periods/79509f60-565a-40eb-a4c3-709e5d49e517/documents?side=ledger&match=unmatched`, {
      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"]}/etva/v1/periods/79509f60-565a-40eb-a4c3-709e5d49e517/documents?side=ledger&match=unmatched',
        headers={
            'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
        },
    )
    result = response.json()

    PHP

    <?php
    
    $curl = curl_init(getenv('RDC_BASE_URL') . '/etva/v1/periods/79509f60-565a-40eb-a4c3-709e5d49e517/documents?side=ledger&match=unmatched');
    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")}/etva/v1/periods/79509f60-565a-40eb-a4c3-709e5d49e517/documents?side=ledger&match=unmatched");
    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": "6861594d-27de-4565-a1fe-72c97fa04d2d",
          "periodId": "79509f60-565a-40eb-a4c3-709e5d49e517",
          "side": "ledger",
          "source": "ledger",
          "direction": "sales",
          "number": "BRD-2026-00391",
          "partnerCif": "RO39172851",
          "partnerName": "Market Trei Brazi SRL",
          "date": "2026-09-27",
          "authorityId": null,
          "parts": [
            {
              "rate": "21",
              "base": "1985.92",
              "vat": "417.04"
            }
          ],
          "base": "1985.92",
          "vat": "417.04",
          "currency": "RON",
          "rowIds": [
            "sales-standard"
          ],
          "match": {
            "state": "unmatched",
            "differenceId": "e59c4466-b33f-4875-9be1-0fdd35eb90f1",
            "counterpartId": null
          }
        }
      ],
      "nextCursor": null
    }

    One posting is left, BRD-2026-00391. It is a sale, already explained as missing-at-authority, and cannot stand for a purchase. The September journal holds no purchase posting for AC-004563, under this number or under another. The comparison marks the invoice as not posted.

    Explain it

    If you choose to explain the difference without linking the October posting, give the reason. Here the invoice reached accounting on 2 October and is posted with the October journal: the reason is not_yet_posted. Send it with the revision you read, 1, together with a note of 8 to 500 characters and the name of the person who explains. The period moves to revision 2.

    curl

    curl -X POST "$RDC_BASE_URL/etva/v1/periods/79509f60-565a-40eb-a4c3-709e5d49e517/differences/46735209-a528-4647-ba66-da4a8e7373ee/explain" \
      -H "Authorization: Bearer $RDC_TOKEN" \
      -H "Content-Type: application/json" \
      -d '{
      "operationId": "3b01ddcf-38da-4d6e-93cd-ccabd05f8018",
      "expectedRevision": 1,
      "reason": "not_yet_posted",
      "note": "The invoice reached accounting on 2 October. It is posted with the October journal.",
      "explainedBy": "ana-rusu"
    }'

    JavaScript

    const response = await fetch(`${process.env.RDC_BASE_URL}/etva/v1/periods/79509f60-565a-40eb-a4c3-709e5d49e517/differences/46735209-a528-4647-ba66-da4a8e7373ee/explain`, {
      method: 'POST',
      headers: {
        Authorization: `Bearer ${process.env.RDC_TOKEN}`,
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        "operationId": "3b01ddcf-38da-4d6e-93cd-ccabd05f8018",
        "expectedRevision": 1,
        "reason": "not_yet_posted",
        "note": "The invoice reached accounting on 2 October. It is posted with the October journal.",
        "explainedBy": "ana-rusu"
      }),
    });
    const result = await response.json();

    Python

    import os
    import requests
    
    response = requests.request(
        'POST',
        f'{os.environ["RDC_BASE_URL"]}/etva/v1/periods/79509f60-565a-40eb-a4c3-709e5d49e517/differences/46735209-a528-4647-ba66-da4a8e7373ee/explain',
        headers={
            'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
        },
        json={
            'operationId': '3b01ddcf-38da-4d6e-93cd-ccabd05f8018',
            'expectedRevision': 1,
            'reason': 'not_yet_posted',
            'note': 'The invoice reached accounting on 2 October. It is posted with the October journal.',
            'explainedBy': 'ana-rusu',
        },
    )
    result = response.json()

    PHP

    <?php
    
    $body = <<<'JSON'
    {
      "operationId": "3b01ddcf-38da-4d6e-93cd-ccabd05f8018",
      "expectedRevision": 1,
      "reason": "not_yet_posted",
      "note": "The invoice reached accounting on 2 October. It is posted with the October journal.",
      "explainedBy": "ana-rusu"
    }
    JSON;
    
    $curl = curl_init(getenv('RDC_BASE_URL') . '/etva/v1/periods/79509f60-565a-40eb-a4c3-709e5d49e517/differences/46735209-a528-4647-ba66-da4a8e7373ee/explain');
    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")}/etva/v1/periods/79509f60-565a-40eb-a4c3-709e5d49e517/differences/46735209-a528-4647-ba66-da4a8e7373ee/explain");
    request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
    request.Content = new StringContent("""
    {
      "operationId": "3b01ddcf-38da-4d6e-93cd-ccabd05f8018",
      "expectedRevision": 1,
      "reason": "not_yet_posted",
      "note": "The invoice reached accounting on 2 October. It is posted with the October journal.",
      "explainedBy": "ana-rusu"
    }
    """, System.Text.Encoding.UTF8, "application/json");
    var response = await client.SendAsync(request);
    var result = await response.Content.ReadAsStringAsync();

    Response 202

    {
      "operationId": "3b01ddcf-38da-4d6e-93cd-ccabd05f8018",
      "status": "accepted",
      "aggregateId": "79509f60-565a-40eb-a4c3-709e5d49e517",
      "aggregateRevision": 2
    }

    The difference becomes explained. Read the row to see the effect.

    The row purchases-standard

    curl

    curl "$RDC_BASE_URL/etva/v1/periods/79509f60-565a-40eb-a4c3-709e5d49e517/rows/purchases-standard" \
      -H "Authorization: Bearer $RDC_TOKEN"

    JavaScript

    const response = await fetch(`${process.env.RDC_BASE_URL}/etva/v1/periods/79509f60-565a-40eb-a4c3-709e5d49e517/rows/purchases-standard`, {
      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"]}/etva/v1/periods/79509f60-565a-40eb-a4c3-709e5d49e517/rows/purchases-standard',
        headers={
            'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
        },
    )
    result = response.json()

    PHP

    <?php
    
    $curl = curl_init(getenv('RDC_BASE_URL') . '/etva/v1/periods/79509f60-565a-40eb-a4c3-709e5d49e517/rows/purchases-standard');
    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")}/etva/v1/periods/79509f60-565a-40eb-a4c3-709e5d49e517/rows/purchases-standard");
    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": "purchases-standard",
      "periodId": "79509f60-565a-40eb-a4c3-709e5d49e517",
      "side": "purchases",
      "rate": "21",
      "title": "Purchases at 21%",
      "yours": {
        "base": "63551.20",
        "vat": "13345.75"
      },
      "prefilled": {
        "base": "40751.70",
        "vat": "8557.86"
      },
      "difference": {
        "base": "22799.50",
        "vat": "4787.89",
        "percent": "55.95"
      },
      "marked": true,
      "status": "explained",
      "differenceIds": [
        "50ad54ee-d206-4a82-a336-193ccffdc407",
        "46735209-a528-4647-ba66-da4a8e7373ee"
      ]
    }

    The figures of the row do not change: purchases-standard keeps its VAT difference of 4787.89 and its status goes from to_review to explained, because no other difference of that row is open. reopenDifference withdraws the explanation and the row returns to to_review. The reason different_period fits too, when the ledger posted the invoice in another month.

    Refused withCodeWhy
    422reason_not_allowedThe reason does not fit the kind of the difference.
    422note_requiredThe note has fewer than 8 characters.
    422note_too_longThe note has more than 500 characters.
    409already_explainedThe difference has an explanation. Reopen it first.
    409file_lockedThe explanation file is approved or filed.

    The October journal holds this September invoice as AC-4563. The partner, invoice date, base and VAT agree with AC-004563. In the comparison window, Link offers AC-4563 with its posting month, October 2026.

    After opening the October period and importing its journal, find that period with listPeriods, then list its unmatched ledger postings. The response includes AC-4563; use its id as the postingId when linking the September document.

    Find the October period

    curl

    curl "$RDC_BASE_URL/etva/v1/periods?companyId=b61159f8-9c0b-4cdb-ac61-afb49517aae6&month=2026-10" \
      -H "Authorization: Bearer $RDC_TOKEN"

    JavaScript

    const response = await fetch(`${process.env.RDC_BASE_URL}/etva/v1/periods?companyId=b61159f8-9c0b-4cdb-ac61-afb49517aae6&month=2026-10`, {
      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"]}/etva/v1/periods?companyId=b61159f8-9c0b-4cdb-ac61-afb49517aae6&month=2026-10',
        headers={
            'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
        },
    )
    result = response.json()

    PHP

    <?php
    
    $curl = curl_init(getenv('RDC_BASE_URL') . '/etva/v1/periods?companyId=b61159f8-9c0b-4cdb-ac61-afb49517aae6&month=2026-10');
    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")}/etva/v1/periods?companyId=b61159f8-9c0b-4cdb-ac61-afb49517aae6&month=2026-10");
    request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
    var response = await client.SendAsync(request);
    var result = await response.Content.ReadAsStringAsync();

    Unmatched October postings

    curl

    curl "$RDC_BASE_URL/etva/v1/periods/74859c26-2e95-422e-bfbd-fe95f1d0851d/documents?side=ledger&match=unmatched" \
      -H "Authorization: Bearer $RDC_TOKEN"

    JavaScript

    const response = await fetch(`${process.env.RDC_BASE_URL}/etva/v1/periods/74859c26-2e95-422e-bfbd-fe95f1d0851d/documents?side=ledger&match=unmatched`, {
      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"]}/etva/v1/periods/74859c26-2e95-422e-bfbd-fe95f1d0851d/documents?side=ledger&match=unmatched',
        headers={
            'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
        },
    )
    result = response.json()

    PHP

    <?php
    
    $curl = curl_init(getenv('RDC_BASE_URL') . '/etva/v1/periods/74859c26-2e95-422e-bfbd-fe95f1d0851d/documents?side=ledger&match=unmatched');
    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")}/etva/v1/periods/74859c26-2e95-422e-bfbd-fe95f1d0851d/documents?side=ledger&match=unmatched");
    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": "9de91d7a-54a0-488b-b74f-6dc378caa04c",
          "periodId": "74859c26-2e95-422e-bfbd-fe95f1d0851d",
          "side": "ledger",
          "source": "ledger",
          "direction": "purchases",
          "number": "BO-2026-0802",
          "partnerCif": "RO51603546",
          "partnerName": "Brânzeturi Obcina SRL",
          "date": "2026-09-30",
          "authorityId": null,
          "parts": [
            {
              "rate": "11",
              "base": "10587.40",
              "vat": "1164.61"
            }
          ],
          "base": "10587.40",
          "vat": "1164.61",
          "currency": "RON",
          "rowIds": [
            "purchases-reduced"
          ],
          "match": {
            "state": "unmatched",
            "differenceId": "7e420973-3ff1-4bec-97fd-2964238aaa03",
            "counterpartId": null
          }
        },
        {
          "id": "8b1597b2-635e-42d1-aef6-0b8654d64720",
          "periodId": "74859c26-2e95-422e-bfbd-fe95f1d0851d",
          "side": "ledger",
          "source": "ledger",
          "direction": "purchases",
          "number": "AC-4563",
          "partnerCif": "RO51603619",
          "partnerName": "Ambalaje Carpatin SRL",
          "date": "2026-09-23",
          "authorityId": null,
          "parts": [
            {
              "rate": "21",
              "base": "9184.50",
              "vat": "1928.75"
            }
          ],
          "base": "9184.50",
          "vat": "1928.75",
          "currency": "RON",
          "rowIds": [
            "purchases-standard"
          ],
          "match": {
            "state": "unmatched",
            "differenceId": "c9aed1d0-5406-42d7-8254-d7729945e39f",
            "counterpartId": null
          }
        }
      ],
      "nextCursor": null
    }

    Link the document AC-004563 to the posting AC-4563, at revision 1. The document must be unmatched, the posting must be free, and both must have the same direction and the same partner. The differences are found again and the period moves to revision 2.

    curl

    curl -X POST "$RDC_BASE_URL/etva/v1/periods/79509f60-565a-40eb-a4c3-709e5d49e517/documents/bb9c565d-6248-4964-8f91-c7dbf7838777/link" \
      -H "Authorization: Bearer $RDC_TOKEN" \
      -H "Content-Type: application/json" \
      -d '{
      "operationId": "338bc15e-e5de-43ad-b6d1-eea5ad72c57b",
      "expectedRevision": 1,
      "postingId": "8b1597b2-635e-42d1-aef6-0b8654d64720"
    }'

    JavaScript

    const response = await fetch(`${process.env.RDC_BASE_URL}/etva/v1/periods/79509f60-565a-40eb-a4c3-709e5d49e517/documents/bb9c565d-6248-4964-8f91-c7dbf7838777/link`, {
      method: 'POST',
      headers: {
        Authorization: `Bearer ${process.env.RDC_TOKEN}`,
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        "operationId": "338bc15e-e5de-43ad-b6d1-eea5ad72c57b",
        "expectedRevision": 1,
        "postingId": "8b1597b2-635e-42d1-aef6-0b8654d64720"
      }),
    });
    const result = await response.json();

    Python

    import os
    import requests
    
    response = requests.request(
        'POST',
        f'{os.environ["RDC_BASE_URL"]}/etva/v1/periods/79509f60-565a-40eb-a4c3-709e5d49e517/documents/bb9c565d-6248-4964-8f91-c7dbf7838777/link',
        headers={
            'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
        },
        json={
            'operationId': '338bc15e-e5de-43ad-b6d1-eea5ad72c57b',
            'expectedRevision': 1,
            'postingId': '8b1597b2-635e-42d1-aef6-0b8654d64720',
        },
    )
    result = response.json()

    PHP

    <?php
    
    $body = <<<'JSON'
    {
      "operationId": "338bc15e-e5de-43ad-b6d1-eea5ad72c57b",
      "expectedRevision": 1,
      "postingId": "8b1597b2-635e-42d1-aef6-0b8654d64720"
    }
    JSON;
    
    $curl = curl_init(getenv('RDC_BASE_URL') . '/etva/v1/periods/79509f60-565a-40eb-a4c3-709e5d49e517/documents/bb9c565d-6248-4964-8f91-c7dbf7838777/link');
    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")}/etva/v1/periods/79509f60-565a-40eb-a4c3-709e5d49e517/documents/bb9c565d-6248-4964-8f91-c7dbf7838777/link");
    request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
    request.Content = new StringContent("""
    {
      "operationId": "338bc15e-e5de-43ad-b6d1-eea5ad72c57b",
      "expectedRevision": 1,
      "postingId": "8b1597b2-635e-42d1-aef6-0b8654d64720"
    }
    """, System.Text.Encoding.UTF8, "application/json");
    var response = await client.SendAsync(request);
    var result = await response.Content.ReadAsStringAsync();

    Response 202

    {
      "operationId": "338bc15e-e5de-43ad-b6d1-eea5ad72c57b",
      "status": "accepted",
      "aggregateId": "79509f60-565a-40eb-a4c3-709e5d49e517",
      "aggregateRevision": 2
    }

    The link replaces the open not-posted difference with an open other-period difference. The document returns other_period and the linked posting ID. September still excludes the October posting, so the VAT difference on purchases-standard remains 4787.89 and the row stays to_review.

    The document after the link

    curl

    curl "$RDC_BASE_URL/etva/v1/periods/79509f60-565a-40eb-a4c3-709e5d49e517/documents/bb9c565d-6248-4964-8f91-c7dbf7838777" \
      -H "Authorization: Bearer $RDC_TOKEN"

    JavaScript

    const response = await fetch(`${process.env.RDC_BASE_URL}/etva/v1/periods/79509f60-565a-40eb-a4c3-709e5d49e517/documents/bb9c565d-6248-4964-8f91-c7dbf7838777`, {
      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"]}/etva/v1/periods/79509f60-565a-40eb-a4c3-709e5d49e517/documents/bb9c565d-6248-4964-8f91-c7dbf7838777',
        headers={
            'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
        },
    )
    result = response.json()

    PHP

    <?php
    
    $curl = curl_init(getenv('RDC_BASE_URL') . '/etva/v1/periods/79509f60-565a-40eb-a4c3-709e5d49e517/documents/bb9c565d-6248-4964-8f91-c7dbf7838777');
    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")}/etva/v1/periods/79509f60-565a-40eb-a4c3-709e5d49e517/documents/bb9c565d-6248-4964-8f91-c7dbf7838777");
    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": "bb9c565d-6248-4964-8f91-c7dbf7838777",
      "periodId": "79509f60-565a-40eb-a4c3-709e5d49e517",
      "side": "prefilled",
      "source": "e-factura",
      "direction": "purchases",
      "number": "AC-004563",
      "partnerCif": "RO51603619",
      "partnerName": "Ambalaje Carpatin SRL",
      "date": "2026-09-23",
      "authorityId": "5012300123",
      "parts": [
        {
          "rate": "21",
          "base": "9184.50",
          "vat": "1928.75"
        }
      ],
      "base": "9184.50",
      "vat": "1928.75",
      "currency": "RON",
      "rowIds": [
        "purchases-standard"
      ],
      "match": {
        "state": "other_period",
        "differenceId": "4e285c39-5697-4a59-bc23-7709186098b2",
        "counterpartId": "8b1597b2-635e-42d1-aef6-0b8654d64720"
      }
    }

    If you linked the wrong posting, undo it at revision 2 with unlinkDocument. The period moves to revision 3 and the original not-posted difference returns with the same ID.

    curl

    curl -X POST "$RDC_BASE_URL/etva/v1/periods/79509f60-565a-40eb-a4c3-709e5d49e517/documents/bb9c565d-6248-4964-8f91-c7dbf7838777/unlink" \
      -H "Authorization: Bearer $RDC_TOKEN" \
      -H "Content-Type: application/json" \
      -d '{
      "operationId": "bbad5549-8855-4ed1-b009-ef0d384b6295",
      "expectedRevision": 2
    }'

    JavaScript

    const response = await fetch(`${process.env.RDC_BASE_URL}/etva/v1/periods/79509f60-565a-40eb-a4c3-709e5d49e517/documents/bb9c565d-6248-4964-8f91-c7dbf7838777/unlink`, {
      method: 'POST',
      headers: {
        Authorization: `Bearer ${process.env.RDC_TOKEN}`,
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        "operationId": "bbad5549-8855-4ed1-b009-ef0d384b6295",
        "expectedRevision": 2
      }),
    });
    const result = await response.json();

    Python

    import os
    import requests
    
    response = requests.request(
        'POST',
        f'{os.environ["RDC_BASE_URL"]}/etva/v1/periods/79509f60-565a-40eb-a4c3-709e5d49e517/documents/bb9c565d-6248-4964-8f91-c7dbf7838777/unlink',
        headers={
            'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
        },
        json={
            'operationId': 'bbad5549-8855-4ed1-b009-ef0d384b6295',
            'expectedRevision': 2,
        },
    )
    result = response.json()

    PHP

    <?php
    
    $body = <<<'JSON'
    {
      "operationId": "bbad5549-8855-4ed1-b009-ef0d384b6295",
      "expectedRevision": 2
    }
    JSON;
    
    $curl = curl_init(getenv('RDC_BASE_URL') . '/etva/v1/periods/79509f60-565a-40eb-a4c3-709e5d49e517/documents/bb9c565d-6248-4964-8f91-c7dbf7838777/unlink');
    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")}/etva/v1/periods/79509f60-565a-40eb-a4c3-709e5d49e517/documents/bb9c565d-6248-4964-8f91-c7dbf7838777/unlink");
    request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
    request.Content = new StringContent("""
    {
      "operationId": "bbad5549-8855-4ed1-b009-ef0d384b6295",
      "expectedRevision": 2
    }
    """, System.Text.Encoding.UTF8, "application/json");
    var response = await client.SendAsync(request);
    var result = await response.Content.ReadAsStringAsync();

    Response 202

    {
      "operationId": "bbad5549-8855-4ed1-b009-ef0d384b6295",
      "status": "accepted",
      "aggregateId": "79509f60-565a-40eb-a4c3-709e5d49e517",
      "aggregateRevision": 3
    }

    Refused withCodeWhy
    409already_matchedThe document is not unmatched.
    409posting_takenAnother document already uses the posting.
    422direction_mismatchA sale and a purchase.
    422partner_mismatchThe partners differ.
    409not_linkedunlinkDocument on a document with no link.

    Every change is sent with the expectedRevision you read; a stale one is refused with revision_conflict. The next step is Prepare the explanation file.