Skip to main content
POST
/
lending-stocks
/
api
/
hooks
/
{marketId}
curl -X POST "https://api.trusset.org/lending-stocks/api/hooks/{marketId}" \
  -H "X-API-Key: trusset_your_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "hookType": "monitorRisk",
    "name": "External Risk Feed",
    "riskUri": "https://risk.example.com/api/score",
    "riskFields": [{"path": "score", "operator": "<", "threshold": 50}],
    "checkFrequency": "5m"
  }'
{
  "success": true,
  "data": {
    "id": "hook_002",
    "marketId": "clx_market_001",
    "hookType": "monitorRisk",
    "name": "External Risk Feed",
    "riskUri": "https://risk.example.com/api/score",
    "riskFields": [{"path": "score", "operator": "<", "threshold": 50}],
    "checkFrequency": "5m",
    "active": true,
    "executionCount": 0
  }
}
Creates a risk monitor, pre-liquidation check, or post-liquidation action hook.

Path Parameters

marketId
string
required
Market ID.

Body Parameters

hookType
string
required
One of monitorRisk, beforeLiquidation, or afterLiquidation.
name
string
Display name (max 128 chars). Defaults to a name based on the hook type.
riskUri
string
URL to poll for risk data. Required for monitorRisk hooks.
riskFields
array
Array of field checks applied to the risk URI response. Each object has path (dot-notation), optional operator (>, >=, <, <=, ==, !=), and optional threshold.
checkFrequency
string
Polling interval for monitorRisk hooks. One of 1m, 5m, 15m, 30m, 1h, 6h, 12h, 24h.
parameterChecks
array
Array of on-chain parameter checks for beforeLiquidation hooks. Each object has parameter (healthFactor, collateralValue, debtValue, collateralRatio, interestAccrued), operator, and threshold.
actionType
string
Required for afterLiquidation hooks. buy (auto-bid on auctions) or inform (send webhook).
maxBuyPrice
string
Maximum price per token for buy action hooks.
webhookUrl
string
Webhook URL for inform action hooks.
webhookPayload
object
Additional fields merged into webhook payloads.
triggerHookIds
array
Array of hook IDs whose failure triggers this hook. Max 10.
curl -X POST "https://api.trusset.org/lending-stocks/api/hooks/{marketId}" \
  -H "X-API-Key: trusset_your_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "hookType": "monitorRisk",
    "name": "External Risk Feed",
    "riskUri": "https://risk.example.com/api/score",
    "riskFields": [{"path": "score", "operator": "<", "threshold": 50}],
    "checkFrequency": "5m"
  }'
{
  "success": true,
  "data": {
    "id": "hook_002",
    "marketId": "clx_market_001",
    "hookType": "monitorRisk",
    "name": "External Risk Feed",
    "riskUri": "https://risk.example.com/api/score",
    "riskFields": [{"path": "score", "operator": "<", "threshold": 50}],
    "checkFrequency": "5m",
    "active": true,
    "executionCount": 0
  }
}