# Subscribe a webhook

`POST https://hiremav.com/api/v3/webhooks`

Adds a webhook, the same as **Add notification** in the Mav app. Mav posts each matching event to your URL as JSON. Keep the `id` to remove it later.

## Parameters

- `webhook.url` (string, required): Where Mav posts events. It must be an https URL on the public internet.
- `webhook.events` (array of strings): The events to send, by `name` from List events. Leave it out to get every event, including ones Mav adds later.
- `webhook.agent_ids` (array of strings): Send only these agents’ events, by `id` from List agents. Leave it out for every agent, including ones you add later.
- `webhook.bearer_token` (string): A token Mav sends as a bearer token on every delivery. Mav never returns it. Leave it out to send no `Authorization` header.
- `webhook.managed_by` (string): For an app that keeps the webhook in step with its own settings. `zapier` is the only value, and the Mav Zapier app sends it. Mav then shows the webhook under the app’s name and doesn’t offer to edit it. Mav offers to remove it only after Mav turns it off. Leave it out for your own webhooks.

## Request

```sh
curl -X POST https://hiremav.com/api/v3/webhooks \
  -H "Authorization: Bearer $MAV_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "webhook": {
      "url": "https://example.com/mav/events",
      "events": ["qualified", "opted_out"],
      "agent_ids": ["nag_5Jt7mNcX2bRd8Q"],
      "bearer_token": "YOUR_WEBHOOK_TOKEN"
    }
  }'
```

## Response: 201 Created

```json
{
  "webhook": {
    "id": "nin_8Wd4rTy6UzKp1L",
    "url": "https://example.com/mav/events",
    "events": [
      "qualified",
      "opted_out"
    ],
    "agent_ids": [
      "nag_5Jt7mNcX2bRd8Q"
    ],
    "auth": "Bearer",
    "managed_by": null,
    "active": true,
    "created_at": "2026-10-06T16:40:03Z"
  }
}
```

## Response: 422 Unprocessable Content

```json
{
  "errors": [
    "Url must be an https URL"
  ]
}
```

> `auth` is `Bearer` when you sent a token and `None` when you didn’t. `managed_by` is `null` unless an app manages the webhook. Delivery, under Webhooks, covers retries and what turns a webhook off.
