Skip to main content
POST
/
hooks
Register new hooks
curl --request POST \
  --url http://localhost:5001/hooks \
  --header 'X-blnk-key: <api-key>'
Use blnk.Hooks.create to register a webhook that Blnk calls before or after a transaction.
blnk.Hooks.create
const response = await blnk.Hooks.create({
  name: 'Pre-transaction validation',
  url: 'https://api.example.com/validate',
  type: 'PRE_TRANSACTION',
  active: true,
  timeout: 30,
  retry_count: 3,
});
FieldDescription
nameDescriptive name for the hook.
urlEndpoint URL Blnk calls when the hook runs.
typePRE_TRANSACTION or POST_TRANSACTION.
activeWhether the hook is enabled.
timeoutMaximum time in seconds allowed for the hook to execute.
retry_countMaximum number of retry attempts if the hook fails.

Response shape

201 Created
{
  "id": "hk_test_123",
  "name": "Pre-transaction validation",
  "url": "https://api.example.com/validate",
  "type": "PRE_TRANSACTION",
  "active": true,
  "timeout": 30,
  "retry_count": 3,
  "created_at": "2024-11-26T08:36:36.238244338Z",
  "last_run": "0001-01-01T00:00:00Z",
  "last_success": false
}
FieldDescription
idUnique ID for the hook. Use it to view, update, or delete the hook.
created_atDate and time the hook was created.
last_runDate and time the hook last executed.
last_successWhether the most recent execution succeeded.

How webhooks work

Hook types, payloads, and execution.

Register new hooks

HTTP request and response schema.

Need help?

We are very happy to help you make the most of Blnk, regardless of whether it is your first time or you are switching from another tool. To ask questions or discuss issues, please contact us or join our Discord community.