# Set Hook Parameters

**Endpoint**

`POST/v2/hook/set`

**Link**

{% embed url="<https://stagep.tst-apidmndelss.com/openapi/v2.html#/operations/Hook_SetParameters>" %}

Configures webhook settings for receiving real-time notifications about system events. This endpoint allows you to enable/disable webhooks, set the receiving URL, and specify which event types to subscribe to.

***

### **Request**

#### **Headers**

| Key            | Value              | Required |
| -------------- | ------------------ | -------- |
| `Content-Type` | `application/json` | Yes      |
| `Accept`       | `application/json` | Yes      |

#### **Request Body (JSON)**

| Field                  | Type      | Description                                                     | Required | Example                                 |
| ---------------------- | --------- | --------------------------------------------------------------- | -------- | --------------------------------------- |
| **`parameters`**       | `object`  | Webhook configuration object.                                   | Yes      | -                                       |
| → `enabled`            | `boolean` | **Enable webhook feature**.                                     | Yes      | `true`                                  |
| → `hookUrl`            | `string`  | **URL for webhook notifications**. Must be HTTPS in production. | Yes      | `"https://api.yourdomain.com/webhooks"` |
| → `jwtSecret`          | `string`  | **Secret for JWT verification** of webhook requests.            | Yes      | `"your-secret-key-123"`                 |
| → `hookCustomer`       | `boolean` | **Subscribe to customer events**.                               | Yes      | `true`                                  |
| → `hookOperation`      | `boolean` | **Subscribe to operation events**.                              | Yes      | `true`                                  |
| → `hookDepositAccount` | `boolean` | **Subscribe to deposit account events**.                        | Yes      | `false`                                 |
| → `hookCounterparty`   | `boolean` | **Subscribe to counterparty events**.                           | Yes      | `true`                                  |

**Example Request Body:**

json

```
{
  "parameters": {
    "enabled": true,
    "hookUrl": "https://api.yourcompany.com/webhooks/payments",
    "jwtSecret": "sec_5f3d8e2a789bcd1234567890",
    "hookCustomer": true,
    "hookOperation": true,
    "hookDepositAccount": false,
    "hookCounterparty": true
  }
}
```

***

### **Response (200 OK)**

Returns the updated webhook configuration confirming the changes.

#### **Response Fields**

| Field                    | Type      | Description                          | Example                                           |
| ------------------------ | --------- | ------------------------------------ | ------------------------------------------------- |
| **`enabled`**            | `boolean` | Webhook feature status.              | `true`                                            |
| **`hookUrl`**            | `string`  | Webhook notification URL.            | `"https://api.yourcompany.com/webhooks/payments"` |
| **`jwtSecret`**          | `string`  | JWT verification secret.             | `"sec_5f3d8e2a789bcd1234567890"`                  |
| **`hookCustomer`**       | `boolean` | Customer events subscription.        | `true`                                            |
| **`hookOperation`**      | `boolean` | Operation events subscription.       | `true`                                            |
| **`hookDepositAccount`** | `boolean` | Deposit account events subscription. | `false`                                           |
| **`hookCounterparty`**   | `boolean` | Counterparty events subscription.    | `true`                                            |

**Example Response:**

json

```
{
  "enabled": true,
  "hookUrl": "https://api.yourcompany.com/webhooks/payments",
  "jwtSecret": "sec_5f3d8e2a789bcd1234567890",
  "hookCustomer": true,
  "hookOperation": true,
  "hookDepositAccount": false,
  "hookCounterparty": true
}
```

***

### **Examples**

#### **Request**

bash

```
curl -X POST 'https://stagep.tst-apidmndelss.com/v2/hook/set' \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -d '{
    "parameters": {
      "enabled": true,
      "hookUrl": "https://api.example.com/webhooks",
      "jwtSecret": "my-secure-jwt-token-123",
      "hookCustomer": true,
      "hookOperation": true,
      "hookDepositAccount": false,
      "hookCounterparty": true
    }
  }'
```

#### **Disable Webhooks**

bash

```
curl -X POST 'https://stagep.tst-apidmndelss.com/v2/hook/set' \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -d '{
    "parameters": {
      "enabled": false,
      "hookUrl": "",
      "jwtSecret": "",
      "hookCustomer": false,
      "hookOperation": false,
      "hookDepositAccount": false,
      "hookCounterparty": false
    }
  }'
```

***

### **Error Responses**

1. **Invalid URL**:

   json

   ```
   { "error": "hookUrl must be a valid HTTPS URL" }
   ```
2. **Missing Required Field**:

   json

   ```
   { "error": "jwtSecret is required when enabled is true" }
   ```
3. **URL Not Reachable**:

   json

   ```
   { "error": "Webhook URL is not reachable" }
   ```

***

### **Notes**

* **Security**: Use HTTPS for `hookUrl` in production environments.
* **JWT Verification**: Incoming webhooks will include a JWT token in the `Authorization` header that should be verified using your `jwtSecret`.
* **Event Types**:
  * **Customer**: Creation, updates, status changes
  * **Operation**: Payments, transfers, transactions
  * **Deposit Account**: Balance changes, account updates
  * **Counterparty**: Bank details changes
* **Testing**: After configuration, test webhooks using the test endpoint (if available).


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.delos.financial/hooks/set-hook-parameters.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
