Skip to main content
POST
/
api
/
ledger
/
v2
/
{ledger}
/
transactions
/
{id}
/
revert
Revert a ledger transaction by its ID
curl --request POST \
  --url http://localhost/api/ledger/v2/{ledger}/transactions/{id}/revert \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "metadata": {}
}'
{
  "data": {
    "timestamp": "2023-11-07T05:31:56Z",
    "postings": [
      {
        "amount": 100,
        "asset": "COIN",
        "destination": "users:002",
        "source": "users:001"
      }
    ],
    "metadata": {
      "admin": "true"
    },
    "id": 1,
    "reverted": true,
    "insertedAt": "2023-11-07T05:31:56Z",
    "updatedAt": "2023-11-07T05:31:56Z",
    "reference": "ref:001",
    "revertedAt": "2023-11-07T05:31:56Z",
    "preCommitVolumes": {
      "orders:1": {
        "USD": {
          "input": 100,
          "output": 10,
          "balance": 90
        }
      },
      "orders:2": {
        "USD": {
          "input": 100,
          "output": 10,
          "balance": 90
        }
      }
    },
    "postCommitVolumes": {
      "orders:1": {
        "USD": {
          "input": 100,
          "output": 10,
          "balance": 90
        }
      },
      "orders:2": {
        "USD": {
          "input": 100,
          "output": 10,
          "balance": 90
        }
      }
    },
    "preCommitEffectiveVolumes": {
      "orders:1": {
        "USD": {
          "input": 100,
          "output": 10,
          "balance": 90
        }
      },
      "orders:2": {
        "USD": {
          "input": 100,
          "output": 10,
          "balance": 90
        }
      }
    },
    "postCommitEffectiveVolumes": {
      "orders:1": {
        "USD": {
          "input": 100,
          "output": 10,
          "balance": 90
        }
      },
      "orders:2": {
        "USD": {
          "input": 100,
          "output": 10,
          "balance": 90
        }
      }
    }
  }
}
Create a new transaction that reverses the effects of a previous transaction. The original transaction is not deleted—a compensating transaction is created instead.

Parameters

ledger: The name of the ledger containing the transaction. (e.g., ledger001) id: The ID of the transaction to revert. (e.g., 1234) force: When true, allows the revert even if it would cause accounts to go negative. atEffectiveDate: When true, the revert transaction uses the same effective date as the original. Useful for maintaining accurate historical records. dryRun: When true, validates the revert without creating the compensating transaction.

Authorizations

Authorization
string
header
required

The access token received from the authorization server in the OAuth 2.0 flow.

Path Parameters

ledger
string
required

Name of the ledger.

Example:

"ledger001"

id
integer<bigint>
required

Transaction ID.

Required range: x >= 0
Example:

1234

Query Parameters

force
boolean

Force revert

atEffectiveDate
boolean

Revert transaction at effective date of the original tx

dryRun
boolean

Set the dryRun mode. dry run mode doesn't add the logs to the database or publish a message to the message broker.

Example:

true

Body

application/json
metadata
object

Response

OK

data
object
required