Skip to content

Webhooks Rail

Event notification and webhook management endpoints.

The Webhooks rail provides:

  • Webhook endpoint management
  • Event delivery
  • Retry handling
  • Delivery logs
POST /v1/webhooks/endpoints
const endpoint = await iof.webhooks.createEndpoint({
url: "https://yourapp.com/webhooks",
events: ["contract.*", "kyc.verified"],
secret: process.env.WEBHOOK_SECRET, // Optional, auto-generated if not provided
});

Response:

{
"id": "we_abc",
"url": "https://yourapp.com/webhooks",
"events": ["contract.*", "kyc.verified"],
"secret": "WEBHOOK_SECRET_SHOWN_ONCE",
"status": "active",
"createdAt": "2024-01-15T10:30:00Z"
}
GET /v1/webhooks/endpoints/:id
const endpoint = await iof.webhooks.getEndpoint("we_abc");
PATCH /v1/webhooks/endpoints/:id
const endpoint = await iof.webhooks.updateEndpoint("we_abc", {
events: ["contract.*", "kyc.*", "compliance.*"],
});
DELETE /v1/webhooks/endpoints/:id
await iof.webhooks.deleteEndpoint("we_abc");
GET /v1/webhooks/events
const events = await iof.webhooks.listEvents({
endpointId: "we_abc",
status: "failed",
limit: 50,
});
POST /v1/webhooks/events/:id/retry
await iof.webhooks.retryEvent("evt_xyz");
  • contract.created
  • contract.updated
  • contract.activated
  • contract.matured
  • contract.closed
  • kyc.submitted
  • kyc.verified
  • kyc.rejected
  • kyc.expired
  • compliance.check.completed
  • compliance.alert.triggered
  • billing.invoice.created
  • billing.invoice.paid
StatusDescription
pendingAwaiting delivery
deliveredSuccessfully delivered
failedDelivery failed
retryingRetry in progress
AttemptDelay
1Immediate
21 minute
35 minutes
430 minutes
52 hours

See Webhook Security for signature verification.