A balance adjustment changes the balance by an amount. It never sets the
balance to a value, so it cannot overwrite profit or loss the trader makes at
the same moment. Use it instead of setting
currentBalance with
PATCH /organization/trading-accounts/{accountId} whenever the account may be
trading.Credit or debit an account
A new adjustment returns
201 Created:
balanceBefore and balanceAfter are the live balance just before and just
after the change. To debit, send a negative amount, for example
"amount": -250.
Retry safely with your reference
Yourreference is the idempotency key, and it never expires.
- Same reference, same request: you get the original adjustment back with
200and"replayed": true. Nothing changes. - Same reference, different request (another account, amount, reason,
metadata or option): refused with
409 REFERENCE_CONFLICT. Use a new reference for a new adjustment.
Idempotency-Key header is accepted too, as on every
write, but you do not need it here.
Which accounts can be adjusted
Debits and the account’s rules
- A debit that would take the balance below zero is refused with
422 INSUFFICIENT_BALANCE. Nothing is recorded, so you can reuse the reference. - A debit is not checked against the account’s loss limits. The account’s
rules apply to the new balance as after any balance change, so a debit that
reaches the maximum loss or drawdown limit fails the account and you receive
account.failed. Check the account withGET /organization/trading-accounts/{accountId}first when that matters.
Errors
The two
503 answers include the adjustment in an adjustment field. Sending
the same request again settles it; it is never applied twice.
Reconcile
List an account’s adjustments, newest first (filter bystatus, paginate with
limit and offset):
Webhooks
Subscribe an endpoint toaccount.balance_adjusted to receive one event per
adjustment (never for a replay):
account.updated (with trigger
balance_adjustment) and, for its subscribers, account.balance_changed with
reason adjustment.