Configure a provider's ledger counterparty
Sets the ledger account used as counterparty for the postings of one provider, in one ledger, for one asset. A ledger with no configured counterparty uses @external/<asset>.
How it works
- The tenant comes from your credential. Send the organization that owns the ledger in
X-Organization-Id. - Send
ledger_idas a canonical UUID, in any case. The ledger is stored and answered in lower case. - Send
assetCode,accountAlias,reasonand theversionyou read with the get operation (0if never configured). - To go back to the default, write
@external/<asset>. It must name the sameassetCode. - Any other alias must be an account of that ledger in Midaz, of type
externaland of the assetassetCode. - Use an
externalaccount. Midaz applies no balance floor to it, so postings run against the provider’s position. - Each ledger has one counterparty per provider and asset. Each write is recorded in the history with the actor, the time, the old and new account and the reason.
- One counterparty per organization: the external leg of the accounting routes
BOLETO_IN_DEBIT,PAYMENT_OUT_CREDITandDARF_OUT_CREDITbelongs to the organization and names one account for all its ledgers. So all its ledgers and providers must name the same account. A different account is refused with reasonLEDGER_COUNTERPARTY_CONFLICT. - A ledger or provider still on
@external/<asset>never conflicts. Its postings are refused until you write the same account there too. You can write providers and ledgers in any order. - Writing
@external/<asset>is never refused for a conflict. That provider’s postings are then refused until the organization’s accounting routes name the account in effect again. - A posting uses the counterparty of the ledger and of the provider recorded on the operation, not the provider currently on the route.
- The commit or cancel of a reserve follows the original pending transaction, not the new counterparty.
- If the account later stops passing the checks, the posting fails with
PBP-0706. It is never sent to@external/<asset>instead. - While a payment of that provider in that ledger waits for its pending-debit posting, or a settled boleto waits for its settlement-credit posting, the write is refused with reason
POSTINGS_IN_FLIGHT. Resend under the sameIdempotency-Keyonce the posting settles. - Nothing is written on any refusal.
- Send an
Idempotency-Key. A retry under the same key replays the stored200.
Cabeçalhos
Midaz organization that owns the ledger in the path. Required: a request without it, or with a value that is not a canonical UUID, is refused with 400 PBP-0025. Used only to look the account of accountAlias up in that ledger; it does not select the tenant, which comes from the validated identity.
Parâmetros de caminho
Midaz ledger whose counterparty is read or written, the same identifier the boleto and the payment record as their ledger. Each ledger has its own counterparty per provider and asset. Must be a canonical UUID (any case); otherwise 400 PBP-0026.
1 - 100"0199a1b2-c3d4-7e5f-8a9b-0c1d2e3f4a6c"
Corpo
The asset, the account, the reason and the version read.
Alias of the ledger account, with the leading @. @external/ returns to the default and must name the assetCode of the request; any other value is the alias of an account created through the Midaz API, of a-zA-Z0-9@:_- only. Otherwise 400 PBP-0001.
2 - 100^(@external/[A-Z]{3,10}|@[A-Za-z0-9@:_-]{1,99})$"@siloc-a-liquidar"
Resposta
OK. The counterparty was written. A retry under the same Idempotency-Key returns this same answer.

