> ## Documentation Index
> Fetch the complete documentation index at: https://docs.blnkfinance.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Create, Edit, and Manage Hooks

> Learn how Hooks work in the Blnk Ledger.

<Info>Available in version 0.8.4 and later.</Info>

## Overview

Efficiently manage hooks through our dedicated hook endpoints. These endpoints seamlessly integrate with the hook manager, providing robust validation, comprehensive error handling, and consistent response delivery.

## Register a new hook

```
POST http://YOUR_BLNK_INSTANCE_URL/hooks
```

<CodeGroup>
  ```bash Create pre-transaction hook theme={"system"}
  curl -X POST "http://YOUR_BLNK_INSTANCE_URL/hooks" \
    -H "X-Blnk-Key: YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "name": "Pre-transaction validation",
      "url": "https://api.example.com/webhook",
      "type": "PRE_TRANSACTION",
      "active": true,
      "timeout": 30,
      "retry_count": 3
    }'
  ```

  ```bash Create post-transaction hook theme={"system"}
  curl -X POST "http://YOUR_BLNK_INSTANCE_URL/hooks" \
    -H "X-Blnk-Key: YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "name": "Post-transaction validation",
      "url": "https://api.example.com/webhook",
      "type": "POST_TRANSACTION",
      "active": true,
      "timeout": 30,
      "retry_count": 3
    }'
  ```

  ```json Payload (Pre-transaction) theme={"system"}
  {
    "transaction_id": "txn_e0f5ab98-bb87-4b09-aefe-839ddb11598b",
    "hook_type": "PRE_TRANSACTION",
    "timestamp": "2025-02-23T09:43:49.627239+01:00",
    "data": {
      "precise_amount": 20000,
      "amount": 200,
      "rate": 1,
      "precision": 100,
      "transaction_id": "txn_e0f5ab98-bb87-4b09-aefe-839ddb11598b",
      "parent_transaction": "",
      "source": "bln_7f91a1ae-6073-4b7a-952c-23abf94a6634",
      "destination": "bln_59b83b9c-842c-427f-91eb-43cdeaf5c01a",
      "reference": "4rdddd3dd3rredddddddddde3sddddsdddeddeed",
      "currency": "GBP",
      "description": "Testing inflight/rates issue",
      "status": "QUEUED",
      "hash": "623e05ceb7ca7b02a9318092de7b75d8c668628e2db76c42b621b61055b10b3e",
      "allow_overdraft": true,
      "inflight": false,
      "skip_queue": true,
      "created_at": "2025-02-23T09:43:49.623494+01:00",
      "scheduled_for": "0001-01-01T00:00:00Z",
      "inflight_expiry_date": "0001-01-01T00:00:00Z"
    }
  }
  ```

  ```json Payload (Post-transaction) theme={"system"}
  {
    "transaction_id": "txn_e0f5ab98-bb87-4b09-aefe-839ddb11598b",
    "hook_type": "POST_TRANSACTION",
    "timestamp": "2025-02-23T09:43:49.636219+01:00",
    "data": {
      "precise_amount": 20000,
      "amount": 200,
      "rate": 1,
      "precision": 100,
      "transaction_id": "txn_e0f5ab98-bb87-4b09-aefe-839ddb11598b",
      "parent_transaction": "",
      "source": "bln_7f91a1ae-6073-4b7a-952c-23abf94a6634",
      "destination": "bln_59b83b9c-842c-427f-91eb-43cdeaf5c01a",
      "reference": "4rdddd3dd3rredddddddddde3sddddsdddeddeed",
      "currency": "GBP",
      "description": "Testing inflight/rates issue",
      "status": "APPLIED",
      "hash": "623e05ceb7ca7b02a9318092de7b75d8c668628e2db76c42b621b61055b10b3e",
      "allow_overdraft": true,
      "inflight": false,
      "skip_queue": true,
      "created_at": "2025-02-23T09:43:49.623494+01:00",
      "scheduled_for": "0001-01-01T00:00:00Z",
      "inflight_expiry_date": "0001-01-01T00:00:00Z"
    }
  }
  ```
</CodeGroup>

| **Field**     | **Type** | **Description**                                            |
| :------------ | :------- | :--------------------------------------------------------- |
| `name`        | string   | Name of the hook                                           |
| `url`         | string   | Endpoint URL where the hook will send requests             |
| `type`        | string   | Type of the hook — `PRE_TRANSACTION` or `POST_TRANSACTION` |
| `active`      | boolean  | Indicates whether the hook is enabled or disabled          |
| `timeout`     | number   | Maximum time (in seconds) allowed for the hook to execute  |
| `retry_count` | number   | Maximum number of retry attempts if the hook fails         |

## Update an existing hook

```
PUT http://YOUR_BLNK_INSTANCE_URL/hooks/{hook_id}
```

## Retrieve a specific hook

```
GET http://YOUR_BLNK_INSTANCE_URL/hooks/{hook_id}
```

## List hooks by type

```
GET http://YOUR_BLNK_INSTANCE_URL/hooks?type=PRE_TRANSACTION
```

## Delete a hook

```
DELETE http://YOUR_BLNK_INSTANCE_URL/hooks/{hook_id}
```

## 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](mailto:support@blnkfinance.com) or [join our Discord community](https://discord.gg/7WNv94zPpx).

***

<Tip>
  **Tip:** Connect to Blnk Cloud to see your Core data.

  You can view your transactions, manage identities, create custom reports, invite other team members to collaborate, and perform operations on your Core — all in one dashboard.

  [Check out Blnk Cloud →](https://www.blnkfinance.com/products/cloud)
</Tip>
