Skip to main content
POST
Runs one hook immediately and returns the outcome synchronously, except that an inform action returns the delivery it queued. It runs whether or not the hook is active, which makes it the way to test a new hook. The response is HTTP 200 whenever the hook ran, including when the hook itself failed: read the outcome from data.success and data.result.
A buy hook never bids. It returns an approval and a bidOnAuction step for a wallet to sign, priced when they were built. The auction module charges its price at the moment the bid lands. It reverts if the auction has ended, the market is paused, the price is stale, or the signer is the loan’s borrower. Delivery is a compliance-gated token transfer, so a wallet the collateral token does not admit reverts too. The balance check before the steps reads only the instance’s registered wallet, whichever wallet signs.
What the body must carry depends on the hook type:

Path Parameters

string
required
The market’s record ID, as id on List Markets, not its contract address. See Market IDs.
string
required
Hook ID.

Body Parameters

object
Required for beforeLiquidation hooks. Carries the values the hook’s parameterChecks name, such as healthFactor, collateralValue, debtValue, collateralRatio or interestAccrued, as numbers or decimal strings. An optional loanId is written to the execution log. Nothing is read from chain.
object
Required for afterLiquidation hooks. An inform body carries the fields a liquidation’s delivery carries, listed under Signed deliveries, and a field left out reads null. marketLiquidationId, txHash and marketAddress are forwarded as sent, like the fields below. realization, buyer, proceeds, surplus, reserve and payee are forwarded only when valid: ATOMIC, ROUTER or VENUE, a non-zero address, or a non-negative decimal amount. Anything else reads null.

What each type does

monitorRisk sends a GET to riskUri with Accept: application/json, a 10-second timeout and a 5 MB cap on the body. A non-2xx status, a body that is not JSON, a refused host or a timeout returns success: false with the reason in error, and sets the hook’s lastResult to null. A completed evaluation lists each field in fields, up to the first that fails. When it evaluates to false, every active afterLiquidation hook that lists this monitor in triggerHookIds acts on the breach. Their outcomes go to their own logs, not into this response. beforeLiquidation evaluates every check, and result is true only when all pass. checkResults lists { parameter, value, pass } per check, with value as sent. A hook with no parameterChecks returns result: true without logging a run. afterLiquidation first checks triggerHookIds. If it lists any, it acts only when every listed hook is active and its last counted run returned false. Otherwise it returns result: false with reason: "Trigger condition not met". An inform action queues a signed delivery to webhookUrl and returns at once, before anything is sent: result: null, queued: true, the deliveryId and status: "PENDING". A worker sends and retries it as Signed deliveries describes, and List Hook Deliveries shows how it went. A repeated eventKey returns queued: false and duplicate: true instead. The delivery is signed like any other but reports liquidationData as sent, so a receiver checks a reported liquidation against the chain before acting on it. A buy action reads liquidationData.auctionId on the market’s auction module. Without an auctionId it returns result: false with reason: "This liquidation opened no auction, so there is nothing to buy". It returns success: false when the market has no auction module wired or the auction is not active. Above maxBuyPrice it returns result: false with reason: "Price exceeds max buy price". When the registered wallet holds less of the borrow asset than the bid needs, it returns success: false and an error naming the asset. Otherwise it returns two steps. The first approves the auction module to pull the borrow asset for the remaining collateral at the current price. The second is bidOnAuction for all remaining collateral. The run records result: false with reason: "requires_wallet_signature", because nothing has been bought. The hook does not record the bid; confirm the mined bid with Bid on Auction. A monitor’s breach takes neither path above and skips the trigger check. An inform hook queues a riskBreach delivery that carries the monitor and its failing fields instead of loan data. A buy hook only logs that a breach carries no auction to act on. Counted runs, unmet triggers, skipped bids, a buy run without an auction, a short wallet balance and runs that raised an error are written to Get Hook Executions. An inform run is logged when its delivery is delivered or fails for good, not when it is queued. A refusal before anything is evaluated is returned but not logged. That covers a missing risk config, no parameter checks, no webhook URL, no auction module and an inactive auction.

Response Fields

object

Error Codes

These refuse the call before the hook runs. A hook that runs and fails answers 200 with data.success: false.