Skip to content
Docs
API 1.0.0 · 22 Nov 2026

Search the docs

    Română

    Corrections

    A correction is a new version that points back to the first. The first version never changes.

    On this page

    A return that the authority answered cannot be edited. To change it, make version 2: correctReturn creates a new draft with supersedes pointing to the first version. You then build, check, sign, approve and file it like any other return.

    When a correction is allowed

    • The return is accepted or rejected. Another status is refused with invalid_status.
    • The ledger of the period has a snapshot newer than the one the return was built from. Otherwise the answer is source_unchanged, because a new version would be the same return again.
    • No correction exists yet. Otherwise the answer is already_corrected and the newer version is the one to read.

    What is kept

    Both versions keep their rows, their evidence, their submissions and their history. The obligation lists both and its currentReturnId is the newest. In the example the rejected return is version 1, and the correction is version 2, a draft.

    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
    }