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

# Create a webhook

> Let's try creating a webhook. For this, you can choose to use either the webhook event type's name or its ID.

# Step 3: create a webhook

Let's try creating a webhook. For this, you can choose to use either the webhook event type's name or its ID.

Below are two examples showing how webhook scope works depending on whether you include `accountId`.

### Example A: Global webhook (no `accountId`)

A **global** webhook fires across all accounts in your multi-account configuration. This is required for onboarding event types such as `AccountActivated`, `IdentityVerificationRequest`, `KycInformationRequested`, `KybInformationRequested`, `ApplicationStatusUpdated`, and `AccountStatusUpdated`.

<Warning>
  Do not include `accountId` when subscribing to onboarding event types. Onboarding webhooks are platform-level events that fire before an account exists, so scoping them to an account means you will never receive them.
</Warning>

<CodeGroup>
  ```bash Sandbox theme={null}
  curl -i -X POST \
    https://api-sandbox.equalsmoney.com/v2/webhooks \
    -H 'Authorization: ApiKey {apiKey}' \
    -H 'Content-Type: application/json' \
    -d '{
      "enabled": true,
      "webhookEventTypeName": "AccountActivated",
      "url": "{webhookUrl}"
    }'
  ```

  ```bash Production theme={null}
  curl -i -X POST \
    https://api.equalsmoney.com/v2/webhooks \
    -H 'Authorization: ApiKey {apiKey}' \
    -H 'Content-Type: application/json' \
    -d '{
      "enabled": true,
      "webhookEventTypeName": "AccountActivated",
      "url": "{webhookUrl}"
    }'
  ```
</CodeGroup>

If your request is successful, you'll receive a `201` response.

```json theme={null}
{
  "id": "542609c1-8bf9-46b1-830f-4b87d09d3cf1",
  "enabled": true,
  "accountId": null,
  "url": "https://webhook.site/07a975c2-3f9d-4952-8ea5-98dc688cab7c",
  "productId": "d926625b-5e11-4ec1-b4cd-0af2a8021efc",
  "webhookEventTypeId": "a4dcc403-41aa-4f2e-acf6-32dbaec78e72",
  "updatedAt": "2024-01-09T10:33:33.095Z",
  "createdAt": "2024-01-09T10:33:33.095Z",
  "webhookEventTypeName": "AccountActivated"
}
```

### Example B: Account-specific webhook (with `accountId`)

Include `accountId` to create a webhook scoped to a **specific account**. This is suitable for non-onboarding event types such as `BoxDebited`, `BoxCredited`, `CardTransaction`, and others where the account already exists.

<CodeGroup>
  ```bash Sandbox theme={null}
  curl -i -X POST \
    https://api-sandbox.equalsmoney.com/v2/webhooks \
    -H 'Authorization: ApiKey {apiKey}' \
    -H 'Content-Type: application/json' \
    -d '{
      "enabled": true,
      "accountId": "{accountId}",
      "webhookEventTypeName": "BoxDebited",
      "url": "{webhookUrl}"
    }'
  ```

  ```bash Production theme={null}
  curl -i -X POST \
    https://api.equalsmoney.com/v2/webhooks \
    -H 'Authorization: ApiKey {apiKey}' \
    -H 'Content-Type: application/json' \
    -d '{
      "enabled": true,
      "accountId": "{accountId}",
      "webhookEventTypeName": "BoxDebited",
      "url": "{webhookUrl}"
    }'
  ```
</CodeGroup>

If your request is successful, you'll receive a `201` response.

```json theme={null}
{
  "id": "7b3e91d2-4a5f-48c1-9e2d-6f8a0b1c3d5e",
  "enabled": true,
  "accountId": "F12345",
  "url": "https://webhook.site/07a975c2-3f9d-4952-8ea5-98dc688cab7c",
  "productId": "d926625b-5e11-4ec1-b4cd-0af2a8021efc",
  "webhookEventTypeId": "b5ecc514-52bb-5f3f-bdf7-43ebfd389f83",
  "updatedAt": "2024-01-09T10:35:12.042Z",
  "createdAt": "2024-01-09T10:35:12.042Z",
  "webhookEventTypeName": "BoxDebited"
}
```
