Hooks
Update Hook
Change some or all fields of an existing hook
PUT
/
lending-external-securities-v2
/
api
/
hooks
/
{marketId}
/
{hookId}
curl -X PUT "https://api.trusset.org/lending-external-securities-v2/api/hooks/{marketId}/{hookId}" \
-H "X-API-Key: trusset_your_key_here" \
-H "Content-Type: application/json" \
-d '{"checkFrequency": "1h"}'
const res = await fetch(
`https://api.trusset.org/lending-external-securities-v2/api/hooks/${marketId}/${hookId}`,
{
method: 'PUT',
headers: {
'X-API-Key': 'trusset_your_key_here',
'Content-Type': 'application/json'
},
body: JSON.stringify({ checkFrequency: '1h' })
}
);
const { data: hook } = await res.json();
{
"success": true,
"data": {
"id": "hook_003",
"marketId": "clx_secmarket_001",
"hookType": "monitorRisk",
"name": "NAV Publication Monitor",
"active": true,
"riskUri": "https://nav.example.com/funds/NYF1",
"riskFields": [{ "path": "ageHours", "operator": "<", "threshold": 36 }],
"riskThreshold": null,
"checkFrequency": "1h",
"parameterChecks": [],
"triggerHookIds": [],
"actionType": null,
"maxBuyPrice": null,
"webhookUrl": null,
"webhookPayload": null,
"signerAddress": "0x1234f9a07c6b53d81e2a4f70c9b385d6014a7e52",
"signerFunded": false,
"lastExecutedAt": "2026-09-25T12:00:00.000Z",
"lastResult": true,
"executionCount": 1,
"createdAt": "2026-09-25T12:00:00.000Z",
"updatedAt": "2026-09-25T12:05:00.000Z",
"signed": true
},
"error": null,
"metadata": {
"timestamp": "2026-09-25T12:05:00.000Z",
"requestId": "550e8400-e29b-41d4-a716-446655440000",
"instanceId": "inst_abc123"
}
}
{
"success": false,
"data": null,
"error": {
"code": "MISSING_WEBHOOK_URL",
"message": "Webhook URL required for inform action"
}
}
Updates a hook in place and returns the full updated record. Every field from Create Hook is accepted,
A changed
hookType included, and all of them are optional. Only the fields sent are changed. Nothing goes on-chain.
Arrays and webhookPayload are replaced whole, not merged. null fails validation for every field, so a URL, checkFrequency, actionType or riskThreshold cannot be unset once stored. Arrays can be emptied with [].
Cross-field validation runs against the merged record, not the request body alone. Switching actionType to inform on a hook that has no webhookUrl is therefore rejected with MISSING_WEBHOOK_URL. So is switching hookType to monitorRisk on a hook without a riskUri, with MISSING_RISK_URI.
Unlike create,
riskFields is not re-required on update. A monitorRisk hook that already has risk fields keeps them when only checkFrequency is sent. Sending riskFields: [] empties them, and the monitor then fails every run with Missing risk config without logging it.checkFrequency takes effect from the scheduler’s next wake-up, not from this call. A changed webhookUrl applies to deliveries already queued too, because each attempt is sent to the URL the hook holds at that moment.
Path Parameters
string
required
string
required
Hook ID.
Body Parameters
Any subset of the Create Hook body, with the same types and ranges.triggerHookIds is checked against this market again whenever it is sent non-empty.
Response Fields
object
The updated hook record, with a new
updatedAt. See List Hooks for each field.curl -X PUT "https://api.trusset.org/lending-external-securities-v2/api/hooks/{marketId}/{hookId}" \
-H "X-API-Key: trusset_your_key_here" \
-H "Content-Type: application/json" \
-d '{"checkFrequency": "1h"}'
const res = await fetch(
`https://api.trusset.org/lending-external-securities-v2/api/hooks/${marketId}/${hookId}`,
{
method: 'PUT',
headers: {
'X-API-Key': 'trusset_your_key_here',
'Content-Type': 'application/json'
},
body: JSON.stringify({ checkFrequency: '1h' })
}
);
const { data: hook } = await res.json();
{
"success": true,
"data": {
"id": "hook_003",
"marketId": "clx_secmarket_001",
"hookType": "monitorRisk",
"name": "NAV Publication Monitor",
"active": true,
"riskUri": "https://nav.example.com/funds/NYF1",
"riskFields": [{ "path": "ageHours", "operator": "<", "threshold": 36 }],
"riskThreshold": null,
"checkFrequency": "1h",
"parameterChecks": [],
"triggerHookIds": [],
"actionType": null,
"maxBuyPrice": null,
"webhookUrl": null,
"webhookPayload": null,
"signerAddress": "0x1234f9a07c6b53d81e2a4f70c9b385d6014a7e52",
"signerFunded": false,
"lastExecutedAt": "2026-09-25T12:00:00.000Z",
"lastResult": true,
"executionCount": 1,
"createdAt": "2026-09-25T12:00:00.000Z",
"updatedAt": "2026-09-25T12:05:00.000Z",
"signed": true
},
"error": null,
"metadata": {
"timestamp": "2026-09-25T12:05:00.000Z",
"requestId": "550e8400-e29b-41d4-a716-446655440000",
"instanceId": "inst_abc123"
}
}
{
"success": false,
"data": null,
"error": {
"code": "MISSING_WEBHOOK_URL",
"message": "Webhook URL required for inform action"
}
}
Error Codes
| Code | HTTP | Cause |
|---|---|---|
VALIDATION_ERROR | 400 | A field fails the schema, including null or a URL on a private or reserved host. error.details lists each { field, message } |
MISSING_RISK_URI | 400 | The merged record is a monitorRisk hook without a riskUri |
MISSING_ACTION_TYPE | 400 | The merged record is an afterLiquidation hook without an actionType |
MISSING_WEBHOOK_URL | 400 | The merged record has actionType inform and no webhookUrl |
INVALID_TRIGGER_HOOKS | 400 | An ID in triggerHookIds is not a hook on this market |
KEY_MATERIAL_REJECTED | 400 | A key in the body, including inside webhookPayload, is named for key material |
MISSING_MARKET_ID | 400 | marketId is longer than 100 characters |
MISSING_HOOK_ID | 400 | hookId is longer than 100 characters |
MARKET_NOT_FOUND | 404 | No market with this ID belongs to your instance |
HOOK_NOT_FOUND | 404 | No hook with this ID exists on this market |
⌘I
curl -X PUT "https://api.trusset.org/lending-external-securities-v2/api/hooks/{marketId}/{hookId}" \
-H "X-API-Key: trusset_your_key_here" \
-H "Content-Type: application/json" \
-d '{"checkFrequency": "1h"}'
const res = await fetch(
`https://api.trusset.org/lending-external-securities-v2/api/hooks/${marketId}/${hookId}`,
{
method: 'PUT',
headers: {
'X-API-Key': 'trusset_your_key_here',
'Content-Type': 'application/json'
},
body: JSON.stringify({ checkFrequency: '1h' })
}
);
const { data: hook } = await res.json();
{
"success": true,
"data": {
"id": "hook_003",
"marketId": "clx_secmarket_001",
"hookType": "monitorRisk",
"name": "NAV Publication Monitor",
"active": true,
"riskUri": "https://nav.example.com/funds/NYF1",
"riskFields": [{ "path": "ageHours", "operator": "<", "threshold": 36 }],
"riskThreshold": null,
"checkFrequency": "1h",
"parameterChecks": [],
"triggerHookIds": [],
"actionType": null,
"maxBuyPrice": null,
"webhookUrl": null,
"webhookPayload": null,
"signerAddress": "0x1234f9a07c6b53d81e2a4f70c9b385d6014a7e52",
"signerFunded": false,
"lastExecutedAt": "2026-09-25T12:00:00.000Z",
"lastResult": true,
"executionCount": 1,
"createdAt": "2026-09-25T12:00:00.000Z",
"updatedAt": "2026-09-25T12:05:00.000Z",
"signed": true
},
"error": null,
"metadata": {
"timestamp": "2026-09-25T12:05:00.000Z",
"requestId": "550e8400-e29b-41d4-a716-446655440000",
"instanceId": "inst_abc123"
}
}
{
"success": false,
"data": null,
"error": {
"code": "MISSING_WEBHOOK_URL",
"message": "Webhook URL required for inform action"
}
}
