Skip to content
Docs
API 1.0.0 · 22 Nov 2026

Search the docs

    Română

    Prepare the explanation file

    Read the explanations of a period, have a second person approve the file, withdraw the approval if something changes, mark the file as filed and export it.

    On this page

    Every period has one explanation file. It holds the explanation of each difference: the reason, the note, who gave it and when. The file goes through three states: draft, approved and filed. The person who prepared it cannot approve it, and it cannot be approved while a row is to_review.

    1. Read the explanations

      listExplanations returns what has been explained so far.

    2. Check the file

      getExplanationFile shows toReview and canApprove. Continue when toReview is 0.

    3. Approve

      A second person sends approveFile. The file becomes approved.

    4. Mark it filed

      markFiled records that the approved file is filed. This state is final.

    5. Or withdraw

      withdrawApproval returns the approved file to draft, so the period takes changes again.

    6. Export it

      getExport with the kind explanation-file returns the file as CSV.

    Read the explanations

    Each entry names the difference (differenceId, kind, rowIds, vat), the reason, the note, explainedBy and explainedAt, and the document or the posting it concerns. A difference with no explanation does not appear here; find it with listDifferences and state=open.

    curl

    curl "$RDC_BASE_URL/etva/v1/periods/79509f60-565a-40eb-a4c3-709e5d49e517/explanations?limit=20" \
      -H "Authorization: Bearer $RDC_TOKEN"

    JavaScript

    const response = await fetch(`${process.env.RDC_BASE_URL}/etva/v1/periods/79509f60-565a-40eb-a4c3-709e5d49e517/explanations?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"]}/etva/v1/periods/79509f60-565a-40eb-a4c3-709e5d49e517/explanations?limit=20',
        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/explanations?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")}/etva/v1/periods/79509f60-565a-40eb-a4c3-709e5d49e517/explanations?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": [
        {
          "differenceId": "e59c4466-b33f-4875-9be1-0fdd35eb90f1",
          "periodId": "79509f60-565a-40eb-a4c3-709e5d49e517",
          "kind": "missing-at-authority",
          "rowIds": [
            "sales-standard"
          ],
          "vat": "417.04",
          "reason": "missing_in_efactura",
          "note": "The upload was answered nok. The corrected invoice BRD-2026-00402 went out on 3 October and belongs to the October return.",
          "explainedBy": "ioana-marin",
          "explainedAt": "2026-11-20T09:05:00Z",
          "documentId": null,
          "postingId": "6861594d-27de-4565-a1fe-72c97fa04d2d"
        },
        {
          "differenceId": "50ad54ee-d206-4a82-a336-193ccffdc407",
          "periodId": "79509f60-565a-40eb-a4c3-709e5d49e517",
          "kind": "rate",
          "rowIds": [
            "purchases-standard",
            "purchases-reduced"
          ],
          "vat": "3198.40",
          "reason": "different_rate",
          "note": "The supplier invoiced the reduced rate. The posting used the standard rate and was corrected on 5 October.",
          "explainedBy": "ioana-marin",
          "explainedAt": "2026-11-20T09:18:00Z",
          "documentId": "85cc4550-2ac5-4c3b-9bd4-ba2d9a49615b",
          "postingId": "6ff78d02-0631-4bec-9aba-31bfda7f8707"
        },
        {
          "differenceId": "766d779d-1961-487c-bed6-c5b78c5012df",
          "periodId": "79509f60-565a-40eb-a4c3-709e5d49e517",
          "kind": "other-period",
          "rowIds": [
            "purchases-reduced"
          ],
          "vat": "-1164.61",
          "reason": "different_period",
          "note": "Dated 30 September, received on 2 October and posted in October. It is claimed in the October return.",
          "explainedBy": "ioana-marin",
          "explainedAt": "2026-11-20T09:31:00Z",
          "documentId": "b2655523-f9ca-43d4-86de-0de02dbafab3",
          "postingId": "9de91d7a-54a0-488b-b74f-6dc378caa04c"
        }
      ],
      "nextCursor": null
    }

    Read the state of the file

    curl

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

    JavaScript

    const response = await fetch(`${process.env.RDC_BASE_URL}/etva/v1/periods/79509f60-565a-40eb-a4c3-709e5d49e517/explanation-file`, {
      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/explanation-file',
        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/explanation-file');
    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/explanation-file");
    request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
    var response = await client.SendAsync(request);
    var result = await response.Content.ReadAsStringAsync();

    Response 200

    {
      "periodId": "79509f60-565a-40eb-a4c3-709e5d49e517",
      "state": "draft",
      "preparedBy": "ioana-marin",
      "approvedBy": null,
      "approvedAt": null,
      "filedAt": null,
      "explained": 3,
      "toReview": 2,
      "canApprove": false,
      "revision": 1
    }

    explained counts the differences with an explanation and toReview the rows still to be reviewed. canApprove is true only when the file is a draft and toReview is 0. Here toReview is 2: sales-standard and purchases-standard wait for the explanation of the duplicate BRD-2026-00372 and the missing invoice AC-004563. Once both are explained, the file reads explained 5, toReview 0 and canApprove true.

    Approve with a second person

    The file of the September period is at revision 1 and two rows are to_review. Approval is refused until the two open differences are explained. Sent now, with expectedRevision 1, the answer is 409 rows_to_review:

    Approval at revision 1

    curl

    curl -X POST "$RDC_BASE_URL/etva/v1/periods/79509f60-565a-40eb-a4c3-709e5d49e517/explanation-file/approve" \
      -H "Authorization: Bearer $RDC_TOKEN" \
      -H "Content-Type: application/json" \
      -d '{
      "operationId": "eb5bab15-e4a9-42bc-a0f0-96ac94f47333",
      "expectedRevision": 1,
      "approvedBy": "ana-rusu"
    }'

    JavaScript

    const response = await fetch(`${process.env.RDC_BASE_URL}/etva/v1/periods/79509f60-565a-40eb-a4c3-709e5d49e517/explanation-file/approve`, {
      method: 'POST',
      headers: {
        Authorization: `Bearer ${process.env.RDC_TOKEN}`,
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        "operationId": "eb5bab15-e4a9-42bc-a0f0-96ac94f47333",
        "expectedRevision": 1,
        "approvedBy": "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/explanation-file/approve',
        headers={
            'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
        },
        json={
            'operationId': 'eb5bab15-e4a9-42bc-a0f0-96ac94f47333',
            'expectedRevision': 1,
            'approvedBy': 'ana-rusu',
        },
    )
    result = response.json()

    PHP

    <?php
    
    $body = <<<'JSON'
    {
      "operationId": "eb5bab15-e4a9-42bc-a0f0-96ac94f47333",
      "expectedRevision": 1,
      "approvedBy": "ana-rusu"
    }
    JSON;
    
    $curl = curl_init(getenv('RDC_BASE_URL') . '/etva/v1/periods/79509f60-565a-40eb-a4c3-709e5d49e517/explanation-file/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")}/etva/v1/periods/79509f60-565a-40eb-a4c3-709e5d49e517/explanation-file/approve");
    request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
    request.Content = new StringContent("""
    {
      "operationId": "eb5bab15-e4a9-42bc-a0f0-96ac94f47333",
      "expectedRevision": 1,
      "approvedBy": "ana-rusu"
    }
    """, System.Text.Encoding.UTF8, "application/json");
    var response = await client.SendAsync(request);
    var result = await response.Content.ReadAsStringAsync();

    Response 409

    {
      "code": "rows_to_review",
      "message": "A row is still `to_review`. The file cannot be approved while a row has a difference nobody explained."
    }

    Nothing was applied, so the revision is still 1. Explain the missing invoice AC-004563 (revision 1 to 2, see Resolve a missing invoice) and the duplicate BRD-2026-00372 (revision 2 to 3, see Resolve a duplicate). The period is then at revision 3 and toReview is 0.

    approvedBy must be a person other than preparedBy. The file was prepared by ioana-marin. When she approves it at revision 3, the answer is 409 same_person:

    Approval by the preparer at revision 3

    curl

    curl -X POST "$RDC_BASE_URL/etva/v1/periods/79509f60-565a-40eb-a4c3-709e5d49e517/explanation-file/approve" \
      -H "Authorization: Bearer $RDC_TOKEN" \
      -H "Content-Type: application/json" \
      -d '{
      "operationId": "51860553-0805-406c-bdd5-129bfa51a338",
      "expectedRevision": 3,
      "approvedBy": "ioana-marin"
    }'

    JavaScript

    const response = await fetch(`${process.env.RDC_BASE_URL}/etva/v1/periods/79509f60-565a-40eb-a4c3-709e5d49e517/explanation-file/approve`, {
      method: 'POST',
      headers: {
        Authorization: `Bearer ${process.env.RDC_TOKEN}`,
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        "operationId": "51860553-0805-406c-bdd5-129bfa51a338",
        "expectedRevision": 3,
        "approvedBy": "ioana-marin"
      }),
    });
    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/explanation-file/approve',
        headers={
            'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
        },
        json={
            'operationId': '51860553-0805-406c-bdd5-129bfa51a338',
            'expectedRevision': 3,
            'approvedBy': 'ioana-marin',
        },
    )
    result = response.json()

    PHP

    <?php
    
    $body = <<<'JSON'
    {
      "operationId": "51860553-0805-406c-bdd5-129bfa51a338",
      "expectedRevision": 3,
      "approvedBy": "ioana-marin"
    }
    JSON;
    
    $curl = curl_init(getenv('RDC_BASE_URL') . '/etva/v1/periods/79509f60-565a-40eb-a4c3-709e5d49e517/explanation-file/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")}/etva/v1/periods/79509f60-565a-40eb-a4c3-709e5d49e517/explanation-file/approve");
    request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
    request.Content = new StringContent("""
    {
      "operationId": "51860553-0805-406c-bdd5-129bfa51a338",
      "expectedRevision": 3,
      "approvedBy": "ioana-marin"
    }
    """, System.Text.Encoding.UTF8, "application/json");
    var response = await client.SendAsync(request);
    var result = await response.Content.ReadAsStringAsync();

    Response 409

    {
      "code": "same_person",
      "message": "The file was prepared by the person who is approving it."
    }

    Then ana-rusu approves it, again at revision 3. The period moves to revision 4.

    curl

    curl -X POST "$RDC_BASE_URL/etva/v1/periods/79509f60-565a-40eb-a4c3-709e5d49e517/explanation-file/approve" \
      -H "Authorization: Bearer $RDC_TOKEN" \
      -H "Content-Type: application/json" \
      -d '{
      "operationId": "384bfa16-2916-43da-a678-c6dcb3d17365",
      "expectedRevision": 3,
      "approvedBy": "ana-rusu"
    }'

    JavaScript

    const response = await fetch(`${process.env.RDC_BASE_URL}/etva/v1/periods/79509f60-565a-40eb-a4c3-709e5d49e517/explanation-file/approve`, {
      method: 'POST',
      headers: {
        Authorization: `Bearer ${process.env.RDC_TOKEN}`,
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        "operationId": "384bfa16-2916-43da-a678-c6dcb3d17365",
        "expectedRevision": 3,
        "approvedBy": "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/explanation-file/approve',
        headers={
            'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
        },
        json={
            'operationId': '384bfa16-2916-43da-a678-c6dcb3d17365',
            'expectedRevision': 3,
            'approvedBy': 'ana-rusu',
        },
    )
    result = response.json()

    PHP

    <?php
    
    $body = <<<'JSON'
    {
      "operationId": "384bfa16-2916-43da-a678-c6dcb3d17365",
      "expectedRevision": 3,
      "approvedBy": "ana-rusu"
    }
    JSON;
    
    $curl = curl_init(getenv('RDC_BASE_URL') . '/etva/v1/periods/79509f60-565a-40eb-a4c3-709e5d49e517/explanation-file/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")}/etva/v1/periods/79509f60-565a-40eb-a4c3-709e5d49e517/explanation-file/approve");
    request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
    request.Content = new StringContent("""
    {
      "operationId": "384bfa16-2916-43da-a678-c6dcb3d17365",
      "expectedRevision": 3,
      "approvedBy": "ana-rusu"
    }
    """, System.Text.Encoding.UTF8, "application/json");
    var response = await client.SendAsync(request);
    var result = await response.Content.ReadAsStringAsync();

    Response 202

    {
      "operationId": "384bfa16-2916-43da-a678-c6dcb3d17365",
      "status": "accepted",
      "aggregateId": "79509f60-565a-40eb-a4c3-709e5d49e517",
      "aggregateRevision": 4
    }

    The file is now approved, with approvedBy and approvedAt, and the event file.approved is sent. An approval is refused in four cases:

    Refused withCodeWhy
    409rows_to_reviewA row is to_review. Explain its open differences first.
    409same_personapprovedBy is the person who prepared the file.
    409wrong_file_stateThe file is not a draft.
    409revision_conflictThe period changed after you read it.

    While the file is not a draft

    An approved or filed file locks the period. Every change under it is refused with 409 file_locked: explaining, reopening, linking, unlinking, setting limits and both kinds of import. Reading is not affected. Withdraw the approval to change the period.

    Mark the file as filed

    When the approved file is filed in your records, record it, at revision 4. filed is final: nothing in the period changes afterwards and the approval cannot be withdrawn. The period moves to revision 5 and the event file.filed is sent.

    curl

    curl -X POST "$RDC_BASE_URL/etva/v1/periods/79509f60-565a-40eb-a4c3-709e5d49e517/explanation-file/file" \
      -H "Authorization: Bearer $RDC_TOKEN" \
      -H "Content-Type: application/json" \
      -d '{
      "operationId": "04f88665-ccc8-4585-8692-f17d17aecc5a",
      "expectedRevision": 4
    }'

    JavaScript

    const response = await fetch(`${process.env.RDC_BASE_URL}/etva/v1/periods/79509f60-565a-40eb-a4c3-709e5d49e517/explanation-file/file`, {
      method: 'POST',
      headers: {
        Authorization: `Bearer ${process.env.RDC_TOKEN}`,
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        "operationId": "04f88665-ccc8-4585-8692-f17d17aecc5a",
        "expectedRevision": 4
      }),
    });
    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/explanation-file/file',
        headers={
            'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
        },
        json={
            'operationId': '04f88665-ccc8-4585-8692-f17d17aecc5a',
            'expectedRevision': 4,
        },
    )
    result = response.json()

    PHP

    <?php
    
    $body = <<<'JSON'
    {
      "operationId": "04f88665-ccc8-4585-8692-f17d17aecc5a",
      "expectedRevision": 4
    }
    JSON;
    
    $curl = curl_init(getenv('RDC_BASE_URL') . '/etva/v1/periods/79509f60-565a-40eb-a4c3-709e5d49e517/explanation-file/file');
    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/explanation-file/file");
    request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
    request.Content = new StringContent("""
    {
      "operationId": "04f88665-ccc8-4585-8692-f17d17aecc5a",
      "expectedRevision": 4
    }
    """, System.Text.Encoding.UTF8, "application/json");
    var response = await client.SendAsync(request);
    var result = await response.Content.ReadAsStringAsync();

    Response 202

    {
      "operationId": "04f88665-ccc8-4585-8692-f17d17aecc5a",
      "status": "accepted",
      "aggregateId": "79509f60-565a-40eb-a4c3-709e5d49e517",
      "aggregateRevision": 5
    }

    Withdraw the approval instead

    From the approved file, at revision 4, there is a second way: withdraw the approval instead of filing. The period moves to revision 5 as well, and a new approval then reads revision 5.

    curl

    curl -X POST "$RDC_BASE_URL/etva/v1/periods/79509f60-565a-40eb-a4c3-709e5d49e517/explanation-file/withdraw" \
      -H "Authorization: Bearer $RDC_TOKEN" \
      -H "Content-Type: application/json" \
      -d '{
      "operationId": "e3c563ae-a533-4679-930f-f456d01e8362",
      "expectedRevision": 4
    }'

    JavaScript

    const response = await fetch(`${process.env.RDC_BASE_URL}/etva/v1/periods/79509f60-565a-40eb-a4c3-709e5d49e517/explanation-file/withdraw`, {
      method: 'POST',
      headers: {
        Authorization: `Bearer ${process.env.RDC_TOKEN}`,
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        "operationId": "e3c563ae-a533-4679-930f-f456d01e8362",
        "expectedRevision": 4
      }),
    });
    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/explanation-file/withdraw',
        headers={
            'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
        },
        json={
            'operationId': 'e3c563ae-a533-4679-930f-f456d01e8362',
            'expectedRevision': 4,
        },
    )
    result = response.json()

    PHP

    <?php
    
    $body = <<<'JSON'
    {
      "operationId": "e3c563ae-a533-4679-930f-f456d01e8362",
      "expectedRevision": 4
    }
    JSON;
    
    $curl = curl_init(getenv('RDC_BASE_URL') . '/etva/v1/periods/79509f60-565a-40eb-a4c3-709e5d49e517/explanation-file/withdraw');
    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/explanation-file/withdraw");
    request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
    request.Content = new StringContent("""
    {
      "operationId": "e3c563ae-a533-4679-930f-f456d01e8362",
      "expectedRevision": 4
    }
    """, System.Text.Encoding.UTF8, "application/json");
    var response = await client.SendAsync(request);
    var result = await response.Content.ReadAsStringAsync();

    Response 202

    {
      "operationId": "e3c563ae-a533-4679-930f-f456d01e8362",
      "status": "accepted",
      "aggregateId": "79509f60-565a-40eb-a4c3-709e5d49e517",
      "aggregateRevision": 5
    }

    The file returns to draft and approvedBy is cleared. Withdrawal works only on an approved file; on a draft or a filed one the answer is 409 wrong_file_state. After a change, the file needs a new approval.

    Export the file

    The export is a CSV file, one line per explained difference: kind, rows, vat, reason, note, explained_by and explained_at. It is made from the period as it is now, in any state of the file.

    Export of the explanation file

    curl

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

    JavaScript

    const response = await fetch(`${process.env.RDC_BASE_URL}/etva/v1/periods/79509f60-565a-40eb-a4c3-709e5d49e517/exports/explanation-file`, {
      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/exports/explanation-file',
        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/exports/explanation-file');
    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/exports/explanation-file");
    request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
    var response = await client.SendAsync(request);
    var result = await response.Content.ReadAsStringAsync();

    Response 200

    {
      "kind": "explanation-file",
      "name": "brumar-2026-09-explanation-file.csv",
      "contentType": "text/csv",
      "content": "kind,rows,vat,reason,note,explained_by,explained_at\nmissing-at-authority,sales-standard,417.04,missing_in_efactura,The upload was answered nok. The corrected invoice BRD-2026-00402 went out on 3 October and belongs to the October return.,ioana-marin,2026-11-20T09:05:00Z\nrate,purchases-standard purchases-reduced,3198.40,different_rate,The supplier invoiced the reduced rate. The posting used the standard rate and was corrected on 5 October.,ioana-marin,2026-11-20T09:18:00Z\nother-period,purchases-reduced,-1164.61,different_period,\"Dated 30 September, received on 2 October and posted in October. It is claimed in the October return.\",ioana-marin,2026-11-20T09:31:00Z\n"
    }

    The events are in the event catalogue. The fields of the explanation operations are in the explanations reference.