Skip to content
Docs
API 1.0.0 · 22 Nov 2026

Search the docs

    Română

    Validate before approval

    Read the findings, understand the rules, and rebuild the form that is behind until the errors are gone.

    On this page

    The checks look at one return and at the other returns of the same company and period. An error blocks signing, approving and filing. A warning is for you to read and does not block.

    The rules

    RuleSeverityFormsRequires
    X-01errorD300, D394The supplies and acquisitions of D394 must equal the rows of D300, by rate.
    X-02errorD300, D390The acquisitions of D390 must equal the acquisitions from other member states in D300.
    S-01errorD406The total debit of the ledger must equal its total credit.
    P-01errorD394Every partner row must carry a tax code.
    W-01warningD300The return shows VAT to recover.

    The catalogue is also an operation: listRules.

    Read the findings

    The sample is the VAT return of October. It was signed from snapshot 1, when it agreed with the recapitulative statement D390. Then a purchase from another member state was posted late and D390 was rebuilt from snapshot 2; the VAT return was not. The finding names the rule X-02, the row and the two amounts that differ, so canApprove is false.

    curl

    curl "$RDC_BASE_URL/declarations/v1/returns/3b559a77-5de4-4b9a-9e2e-ca6625d123f2/findings" \
      -H "Authorization: Bearer $RDC_TOKEN"

    JavaScript

    const response = await fetch(`${process.env.RDC_BASE_URL}/declarations/v1/returns/3b559a77-5de4-4b9a-9e2e-ca6625d123f2/findings`, {
      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"]}/declarations/v1/returns/3b559a77-5de4-4b9a-9e2e-ca6625d123f2/findings',
        headers={
            'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
        },
    )
    result = response.json()

    PHP

    <?php
    
    $curl = curl_init(getenv('RDC_BASE_URL') . '/declarations/v1/returns/3b559a77-5de4-4b9a-9e2e-ca6625d123f2/findings');
    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")}/declarations/v1/returns/3b559a77-5de4-4b9a-9e2e-ca6625d123f2/findings");
    request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
    var response = await client.SendAsync(request);
    var result = await response.Content.ReadAsStringAsync();

    Response 200

    {
      "returnId": "3b559a77-5de4-4b9a-9e2e-ca6625d123f2",
      "revision": 4,
      "canApprove": false,
      "errors": 1,
      "warnings": 0,
      "findings": [
        {
          "rule": "X-02",
          "severity": "error",
          "row": "ic-acquisitions",
          "message": "The acquisitions of D390 must equal the acquisitions from other member states in D300. This return has 5252.00; D390 has 8534.50."
        }
      ]
    }

    Fix the form that is behind

    1. Find the older build

      Read the snapshot of both returns. The one with the smaller number was built from the older ledger.

    2. Rebuild it

      regenerateReturn builds it from the newest snapshot and puts it back to generated. Its validation and its signature are replaced; the history keeps them.

    3. Validate it

      validateReturn records the validation. When both returns agree, the error is gone from both.

    4. Sign it again

      signReturn records a new signature on the new build.

    5. Read the findings again

      canApprove is true. Now the return can be approved.

    curl

    curl -X POST "$RDC_BASE_URL/declarations/v1/returns/3b559a77-5de4-4b9a-9e2e-ca6625d123f2/validate" \
      -H "Authorization: Bearer $RDC_TOKEN" \
      -H "Content-Type: application/json" \
      -d '{
      "operationId": "87fbb260-7b9b-436b-bfd0-8ee38a87676e",
      "expectedRevision": 5
    }'

    JavaScript

    const response = await fetch(`${process.env.RDC_BASE_URL}/declarations/v1/returns/3b559a77-5de4-4b9a-9e2e-ca6625d123f2/validate`, {
      method: 'POST',
      headers: {
        Authorization: `Bearer ${process.env.RDC_TOKEN}`,
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        "operationId": "87fbb260-7b9b-436b-bfd0-8ee38a87676e",
        "expectedRevision": 5
      }),
    });
    const result = await response.json();

    Python

    import os
    import requests
    
    response = requests.request(
        'POST',
        f'{os.environ["RDC_BASE_URL"]}/declarations/v1/returns/3b559a77-5de4-4b9a-9e2e-ca6625d123f2/validate',
        headers={
            'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
        },
        json={
            'operationId': '87fbb260-7b9b-436b-bfd0-8ee38a87676e',
            'expectedRevision': 5,
        },
    )
    result = response.json()

    PHP

    <?php
    
    $body = <<<'JSON'
    {
      "operationId": "87fbb260-7b9b-436b-bfd0-8ee38a87676e",
      "expectedRevision": 5
    }
    JSON;
    
    $curl = curl_init(getenv('RDC_BASE_URL') . '/declarations/v1/returns/3b559a77-5de4-4b9a-9e2e-ca6625d123f2/validate');
    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")}/declarations/v1/returns/3b559a77-5de4-4b9a-9e2e-ca6625d123f2/validate");
    request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
    request.Content = new StringContent("""
    {
      "operationId": "87fbb260-7b9b-436b-bfd0-8ee38a87676e",
      "expectedRevision": 5
    }
    """, System.Text.Encoding.UTF8, "application/json");
    var response = await client.SendAsync(request);
    var result = await response.Content.ReadAsStringAsync();

    Response 202

    {
      "operationId": "87fbb260-7b9b-436b-bfd0-8ee38a87676e",
      "status": "accepted",
      "aggregateId": "3b559a77-5de4-4b9a-9e2e-ca6625d123f2",
      "aggregateRevision": 6
    }