Skip to content
Docs
API 1.0.0 · 22 Nov 2026

Search the docs

    Română

    Reverse an entry

    Correct a posted entry with a linked reversal, and read both entries afterwards.

    An entry was posted for the wrong supplier. You do not edit it: you reverse it. Send the id of the entry in the path, a reversalDate and a reason. Here the reversal is dated 2026-11-23, in an open month, and the entry it reverses is dated 2026-10-16. See Reversals, never edits for what a reversal is.

    1. Find the entry

      Read it from the journalEntryId of the posting request, or list the entries of the month. Check that reversedBy is null.

    2. Choose the date

      Not before the entry, and in a month that is not locked. For a correction of a locked month, take a date in the first open month.

    3. Send the reversal

      A new operationId and a reason that a person can read in the audit trail.

    curl

    curl -X POST "$RDC_BASE_URL/accounting/v1/journal-entries/c5a671de-e7b0-42b8-825d-d15c0612ff58/reversals" \
      -H "Authorization: Bearer $RDC_TOKEN" \
      -H "Content-Type: application/json" \
      -d '{
      "operationId": "7676e313-9d1f-42d0-a540-49efc794dfba",
      "reversalDate": "2026-11-23",
      "reason": "Posted for the wrong supplier"
    }'

    JavaScript

    const response = await fetch(`${process.env.RDC_BASE_URL}/accounting/v1/journal-entries/c5a671de-e7b0-42b8-825d-d15c0612ff58/reversals`, {
      method: 'POST',
      headers: {
        Authorization: `Bearer ${process.env.RDC_TOKEN}`,
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        "operationId": "7676e313-9d1f-42d0-a540-49efc794dfba",
        "reversalDate": "2026-11-23",
        "reason": "Posted for the wrong supplier"
      }),
    });
    const result = await response.json();

    Python

    import os
    import requests
    
    response = requests.request(
        'POST',
        f'{os.environ["RDC_BASE_URL"]}/accounting/v1/journal-entries/c5a671de-e7b0-42b8-825d-d15c0612ff58/reversals',
        headers={
            'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
        },
        json={
            'operationId': '7676e313-9d1f-42d0-a540-49efc794dfba',
            'reversalDate': '2026-11-23',
            'reason': 'Posted for the wrong supplier',
        },
    )
    result = response.json()

    PHP

    <?php
    
    $body = <<<'JSON'
    {
      "operationId": "7676e313-9d1f-42d0-a540-49efc794dfba",
      "reversalDate": "2026-11-23",
      "reason": "Posted for the wrong supplier"
    }
    JSON;
    
    $curl = curl_init(getenv('RDC_BASE_URL') . '/accounting/v1/journal-entries/c5a671de-e7b0-42b8-825d-d15c0612ff58/reversals');
    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")}/accounting/v1/journal-entries/c5a671de-e7b0-42b8-825d-d15c0612ff58/reversals");
    request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
    request.Content = new StringContent("""
    {
      "operationId": "7676e313-9d1f-42d0-a540-49efc794dfba",
      "reversalDate": "2026-11-23",
      "reason": "Posted for the wrong supplier"
    }
    """, System.Text.Encoding.UTF8, "application/json");
    var response = await client.SendAsync(request);
    var result = await response.Content.ReadAsStringAsync();

    Response 202

    {
      "operationId": "7676e313-9d1f-42d0-a540-49efc794dfba",
      "status": "accepted",
      "aggregateId": "c5a671de-e7b0-42b8-825d-d15c0612ff58",
      "aggregateRevision": 2
    }

    Afterwards

    The reversed entry is the same as before, with reversedBy set and aggregateRevision 2. The reversal has the lines swapped and reversalOf set. You receive an entry.reversed event.

    The reversed entry

    {
      "id": "c5a671de-e7b0-42b8-825d-d15c0612ff58",
      "number": "JE-2026-10-0002",
      "entryDate": "2026-10-16",
      "period": "2026-10",
      "sourceDocumentId": "a279bde3-abba-4d30-bac5-76d27e3023e8",
      "lines": [
        {
          "account": "371",
          "accountName": "Goods for resale",
          "debit": "9645.00",
          "credit": "0.00"
        },
        {
          "account": "4426",
          "accountName": "Deductible VAT",
          "debit": "1060.95",
          "credit": "0.00"
        },
        {
          "account": "401",
          "accountName": "Suppliers",
          "debit": "0.00",
          "credit": "10705.95"
        }
      ],
      "reversalOf": null,
      "reversedBy": "d6d9657f-3d24-49f8-8912-1c004cba4101",
      "reason": null,
      "postedAt": "2026-10-16T10:08:00Z",
      "aggregateRevision": 2
    }

    The reversal

    {
      "id": "d6d9657f-3d24-49f8-8912-1c004cba4101",
      "number": "JE-2026-11-0001",
      "entryDate": "2026-11-23",
      "period": "2026-11",
      "sourceDocumentId": "a279bde3-abba-4d30-bac5-76d27e3023e8",
      "lines": [
        {
          "account": "371",
          "accountName": "Goods for resale",
          "debit": "0.00",
          "credit": "9645.00"
        },
        {
          "account": "4426",
          "accountName": "Deductible VAT",
          "debit": "0.00",
          "credit": "1060.95"
        },
        {
          "account": "401",
          "accountName": "Suppliers",
          "debit": "10705.95",
          "credit": "0.00"
        }
      ],
      "reversalOf": "c5a671de-e7b0-42b8-825d-d15c0612ff58",
      "reversedBy": null,
      "reason": "Posted for the wrong supplier",
      "postedAt": "2026-11-23T07:12:00Z",
      "aggregateRevision": 1
    }

    The source document goes back to review in Accounting. If the document was right and only its posting was wrong, a person codes it again and posts it, which is a new request with a new postingRequestId. If the document was wrong, correct it at its source and submit its new revision.

    • reversal_conflict (409): the entry already has a reversal or is itself one.
    • period_closed (409): the date is in a locked month.
    • invalid_reversal_date (422): the date is before the entry.