Skip to content
Docs
API 1.0.0 · 22 Nov 2026

Search the docs

    Română

    Handle a rejection

    Read the message of the authority, fix the ledger, and file a corrected version 2.

    A rejected return is final, and it keeps the message of the authority exactly as it came. In the example the authority could not find the tax code of a supplier: “Codul de identificare fiscală al partenerului nu a fost găsit în registrul contribuabililor.”

    1. Read the answer

      getSubmission returns status: rejected and the message. The event com.rdcopilot.declarations.return.rejected.v1 carries the same message.

    2. Find the row

      Read the rows of the return with listRows. The partner code is on the row of D394, as the ledger held it.

    3. Fix the ledger

      Correct the code in your accounting. The ledger gets a newer snapshot.

    4. Correct the return

      correctReturn makes version 2, a draft that points back to the first. Before the ledger changed, it is refused with source_unchanged.

    5. Build and file version 2

      Build, validate, sign, approve and file it as in Approve and file.

    Read the rejected submission

    curl

    curl "$RDC_BASE_URL/declarations/v1/submissions/030db800-1510-4750-b33c-f574a878c0c8" \
      -H "Authorization: Bearer $RDC_TOKEN"

    JavaScript

    const response = await fetch(`${process.env.RDC_BASE_URL}/declarations/v1/submissions/030db800-1510-4750-b33c-f574a878c0c8`, {
      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/submissions/030db800-1510-4750-b33c-f574a878c0c8',
        headers={
            'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
        },
    )
    result = response.json()

    PHP

    <?php
    
    $curl = curl_init(getenv('RDC_BASE_URL') . '/declarations/v1/submissions/030db800-1510-4750-b33c-f574a878c0c8');
    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/submissions/030db800-1510-4750-b33c-f574a878c0c8");
    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": "030db800-1510-4750-b33c-f574a878c0c8",
      "returnId": "6e95eb18-450e-4cca-8671-f3edaaa04d8d",
      "companyId": "a79a302d-e7f0-4fde-9086-48c003b9709a",
      "form": "D394",
      "period": "2026-10",
      "version": 1,
      "uploadIndex": "5013480209",
      "submittedAt": "2026-11-20T09:01:00Z",
      "status": "rejected",
      "answeredAt": "2026-11-20T09:07:40Z",
      "message": "Codul de identificare fiscală al partenerului nu a fost găsit în registrul contribuabililor.",
      "receiptId": null
    }

    Create the corrected version

    curl

    curl -X POST "$RDC_BASE_URL/declarations/v1/returns/6e95eb18-450e-4cca-8671-f3edaaa04d8d/correct" \
      -H "Authorization: Bearer $RDC_TOKEN" \
      -H "Content-Type: application/json" \
      -d '{
      "operationId": "589f4cca-7f8a-4f18-a98b-89fd11ce69cf",
      "expectedRevision": 9
    }'

    JavaScript

    const response = await fetch(`${process.env.RDC_BASE_URL}/declarations/v1/returns/6e95eb18-450e-4cca-8671-f3edaaa04d8d/correct`, {
      method: 'POST',
      headers: {
        Authorization: `Bearer ${process.env.RDC_TOKEN}`,
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        "operationId": "589f4cca-7f8a-4f18-a98b-89fd11ce69cf",
        "expectedRevision": 9
      }),
    });
    const result = await response.json();

    Python

    import os
    import requests
    
    response = requests.request(
        'POST',
        f'{os.environ["RDC_BASE_URL"]}/declarations/v1/returns/6e95eb18-450e-4cca-8671-f3edaaa04d8d/correct',
        headers={
            'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
        },
        json={
            'operationId': '589f4cca-7f8a-4f18-a98b-89fd11ce69cf',
            'expectedRevision': 9,
        },
    )
    result = response.json()

    PHP

    <?php
    
    $body = <<<'JSON'
    {
      "operationId": "589f4cca-7f8a-4f18-a98b-89fd11ce69cf",
      "expectedRevision": 9
    }
    JSON;
    
    $curl = curl_init(getenv('RDC_BASE_URL') . '/declarations/v1/returns/6e95eb18-450e-4cca-8671-f3edaaa04d8d/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")}/declarations/v1/returns/6e95eb18-450e-4cca-8671-f3edaaa04d8d/correct");
    request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
    request.Content = new StringContent("""
    {
      "operationId": "589f4cca-7f8a-4f18-a98b-89fd11ce69cf",
      "expectedRevision": 9
    }
    """, System.Text.Encoding.UTF8, "application/json");
    var response = await client.SendAsync(request);
    var result = await response.Content.ReadAsStringAsync();

    Response 202

    {
      "operationId": "589f4cca-7f8a-4f18-a98b-89fd11ce69cf",
      "status": "accepted",
      "aggregateId": "dff3b09f-8bbd-488b-8b7d-f71eb11ef3af",
      "aggregateRevision": 1
    }