APG PayAPG Paydocs

Ledgers and journals

Update ledgers

PATCH/ledgers

Clear the ledgers of a set of merchants or loans. Answers with what was cleared, an empty list clears every owner of that kind.

2 actionsSldgCollectionUpdateAdjustLoanBalanceSldgCollectionUpdateClear

Permissions

Required permission
systemLedgerEntries:create

Requires the `create` action on `systemLedgerEntries` for the supplied runtime context

Request body

This body is a typed union. Pick a variant to see its fields and a matching example.

Discriminated by type
type = "SldgCollectionUpdateAdjustLoanBalance"
loanIdLoanIdrequired

Identifier of a loan.

Example loan_9f2Kd8QpLzXw

Positive increases what the customer owes, negative decreases it. Zero is refused, and the currency must be the loan's.

reasonstringrequired

Why. This lands on the ledger entry and is the only record of the reason.

Example Requested by the customer.

curl -X PATCH https://api.tst.au.apgpay.dev/ledgers \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "type": "SldgCollectionUpdateAdjustLoanBalance",
  "loanId": "loan_9f2Kd8QpLzXw",
  "adjustment": {
    "type": "IsoCurrencyAmount",
    "minorCurrencyUnits": 1250,
    "currency": "AUD"
  },
  "reason": "Requested by the customer."
}'

Responses

The response is a typed union.

Discriminated by type
type = "SldgClearanceAdjusted"

A ledger, where a journal's cleared entries land.

balanceMinorUnits

The balance after the adjustment. Absent where the ledger has no entries, which an adjustment should have just fixed.

Example 1250

Example
{
  "type": "SldgClearanceAdjusted",
  "ledger": {
    "type": "SldgViewAttributes",
    "ledgerId": "sldg_9f2Kd8QpLzXw",
    "businessKey": {
      "type": "SjnlBusinessKeyAttributes",
      "ownerType": "Merchant",
      "ownerIdentifier": "string",
      "category": "General",
      "clearanceSystem": "string",
      "currency": "AUD"
    },
    "ledgerName": "Ada Lovelace",
    "lastClearanceDate": "2026-08-19",
    "lastLedgerSequence": 1250,
    "lastClearanceAutomated": true,
    "latestEntry": {
      "type": "SldgEntryAttributes",
      "sequence": 1250,
      "currency": "AUD",
      "balance": 1250,
      "createdAt": "2026-08-19T04:21:07Z"
    },
    "createdAt": "2026-08-19T04:21:07Z",
    "updatedAt": "2026-08-19T04:21:07Z"
  },
  "balance": 1250
}

Error responses