<!-- Generated from the canonical 99 Digital API documentation. Do not edit this file. -->

Canonical page: https://docs.99digital.co.il/partners-api/settings/webhook/set-webhook

# Set Webhook

`POST https://partners.99digital.co.il/api/settings/setWebhook`

Part 1: set the webhook address. Set Webhook allows you to set the partner webhook URL, where you receive notifications and updates about your partner account.

Every event of your partner account (WhatsApp onboarding, builders, Online
accounts and Facebook onboarding) is sent to this URL — see
[Webhook](https://docs.99digital.co.il/partners-api/settings/webhook) for how it works, and the page
of each event for its payload:
[Event: WhatsApp](https://docs.99digital.co.il/partners-api/settings/webhook/whatsapp-event),
[Event: Builder](https://docs.99digital.co.il/partners-api/settings/webhook/builder-event),
[Event: Online](https://docs.99digital.co.il/partners-api/settings/webhook/online-event) and
[Event: Facebook](https://docs.99digital.co.il/partners-api/settings/webhook/facebook-event).
Webhooks arrive from the IP address **34.165.99.212**.

**Settings:**

| Setting | Value |
| --- | --- |
| URL | `https://partners.99digital.co.il/api/settings/setWebhook` |
| Method | JSON via POST |
| Header | `Authorization: Bearer <access_token>` — the access token is received from [Access Token](https://docs.99digital.co.il/partners-api/settings/access-token). |

**Body:**

| Parameter | Description / Example | Maximum length | Remarks |
| --- | --- | --- | --- |
| `url` | The webhook URL. It must start with `https://` or `http://`. | 512 | Full URL here: then a domain name or an IPv4 address, an optional port, and a path without spaces. Domain names whose last part is longer than 6 letters (such as `.digital`) are not accepted. |

**Response:**

```json
{
  "status": "OK",
  "url": "https://your-server.example.com/99digital/partners-webhook",
  "reason": 1
}
```

**Response explained:**

| Parameter | Description |
| --- | --- |
| `status` | OK or FAIL. "OK" means the webhook URL is saved. "FAIL" means error. |
| `url` | The webhook url you provided. |
| `reason` | The status explanation — see below. |

| Reason | Explanation |
| --- | --- |
| 1 | Not FAIL. The status is OK. |
| 2 | Wrong credentials: the `Authorization` header is missing or not `Bearer <token>`, or this endpoint doesn't accept the token's type (account-scoped and onboarding tokens are rejected). |
| 3 | Access token does not exist or expired. Please generate another one with [Access Token](https://docs.99digital.co.il/partners-api/settings/access-token). |
| 4 | Server error, try again. Also returned when the body isn't valid JSON, or isn't sent with `Content-Type: application/json`. |
| 24 | The url is missing or invalid. |

## Remarks

- Your partner account has one webhook URL. Setting a new URL replaces the
  previous one, for every user of your partner account.
- You can't remove the webhook with this endpoint: an empty `url` is
  rejected with reason 24.
- Some events carry API keys, so use an `https://` URL.
- The change is recorded in the **Audit Log** of your partners dashboard.
- Send your partner access token. A token created with an Online account's
  **Account API Credentials** is rejected with reason 2.

## Authentication

`Authorization: Bearer <token>` header — `Bearer ` followed by your access token. Create the token with [Access Token](https://docs.99digital.co.il/partners-api/settings/access-token), from the client id and client secret in your partners dashboard. It is valid for one hour.

## Request body

Content type: `application/json` (required)

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `url` | string | Yes | The webhook URL — a full URL that must start with `https://` or `http://`, then a domain name or an IPv4 address, an optional port, and a path without spaces. Domain names whose last part is longer than 6 letters (such as `.digital`) are not accepted. Example: `https://your-server.example.com/99digital/partners-webhook`. |

### Example (generated from the schema)

```json
{
  "url": "https://your-server.example.com/99digital/partners-webhook"
}
```

## Responses

### 200 — The request was processed. Both a successful and a failed request answer with HTTP 200 — check `status`, and `reason` when it is FAIL.

Content type: `application/json`

| Field | Type | Description |
| --- | --- | --- |
| `status` | string | (one of: OK) OK means the webhook URL is saved. Always `OK`. |
| `url` | string | (one of: OK) The webhook URL you provided. Example: `https://your-server.example.com/99digital/partners-webhook`. |
| `reason` | integer | (one of: OK) 1 — not FAIL, the status is OK. Always `1`. |
| `status` | string | (one of: FAIL) FAIL means error; `reason` says why. Always `FAIL`. |
| `reason` | integer | (one of: FAIL) The status explanation in case of FAIL. One of: `2` — Wrong credentials: the `Authorization` header is missing or not `Bearer <token>`, or this endpoint doesn't accept the token's type (account-scoped and onboarding tokens are rejected); `3` — The access token is wrong or expired. Create a new one with [Access Token](https://docs.99digital.co.il/partners-api/settings/access-token); `4` — Server error, try again. Also returned when the body isn't valid JSON, or isn't sent with `Content-Type: application/json`; `24` — `url` is missing or invalid. |

#### Example: OK

The webhook URL is saved.

```json
{
  "status": "OK",
  "url": "https://your-server.example.com/99digital/partners-webhook",
  "reason": 1
}
```

#### Example: Reason 3

The access token is wrong or expired.

```json
{
  "status": "FAIL",
  "reason": 3
}
```

#### Example: Reason 24

`url` is missing or invalid.

```json
{
  "status": "FAIL",
  "reason": 24
}
```
