# Create a webhook

> POST /webhooks

Source: https://mockflow.com/developers/reference/webhooks/create-webhook

**POST** `https://api.mockflow.com/v1/webhooks`  
Scopes: `boards:read`

**curl**

```bash
curl https://api.mockflow.com/v1/webhooks \
  -X POST \
  -H "Authorization: Bearer $MOCKFLOW_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "url": "https://hooks.example.com/mockflow",
  "events": [
    "board.created",
    "board.deleted"
  ]
}'
```

**JavaScript**

```javascript
const response = await fetch("https://api.mockflow.com/v1/webhooks", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.MOCKFLOW_API_KEY}`,
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
  "url": "https://hooks.example.com/mockflow",
  "events": [
    "board.created",
    "board.deleted"
  ]
})
});

const data = await response.json();
```

**Python**

```python
import os, requests

response = requests.post(
    "https://api.mockflow.com/v1/webhooks",
    headers={"Authorization": f"Bearer {os.environ['MOCKFLOW_API_KEY']}"},
    json={
  "url": "https://hooks.example.com/mockflow",
  "events": [
    "board.created",
    "board.deleted"
  ]
},
)

response.raise_for_status()
data = response.json()
```

**201**

```json
{
  "id": "whk_9fa2",
  "url": "https://app.mockflow.com/board/brd_3f9e2a",
  "events": [
    "board.created",
    "member.*"
  ],
  "boardId": "brd_3f9e2a",
  "description": "string",
  "active": false
}
```

**429**

```json
{
  "error": {
    "code": "rate_limited",
    "message": "Too many requests.",
    "docsUrl": "https://mockflow.com/developers/concepts/errors#rate_limited"
  },
  "requestId": "req_45d49816999bac40"
}
```

Subscribe an https endpoint to events, for one board or every board in the workspace. The answer carries the signing secret, once. Events are sent only about boards the webhook's creator can open. Use this from an integration that subscribes on behalf of its user, such as a Zapier trigger, and delete the webhook when the user turns the trigger off.

### Authorization

- `Authorization` (string, required): `Bearer <key>`. The key needs `boards:read` scope. Create and manage keys in the [developer console](/developers/console/), or use an [OAuth app](/developers/concepts/oauth-apps) to act for other people; what each scope unlocks is on the [scopes page](/developers/concepts/scopes).

### Body

- `url` (string, required): Where to send events. https, to a public host.
- `events` (string[], required): Event types from GET /webhooks/events, a family such as "item.*", or "*" for all.
- `boardId` (string | null): One board only. Leave out for every board in the workspace.
- `description` (string)

### Response

- `id` (string)
- `url` (string)
- `events` (string[])
- `boardId` (string | null): Null for every board in the workspace.
- `description` (string)
- `active` (boolean)
- `pausedReason` (string | null): Why MockFlow paused it
- `createdBy` (string | null): Events are sent only about boards this person can open.
- `createdAt` (string)
- `updatedAt` (string | null)
- `secret` (string)

### Errors

- 429 `rate_limited`: Too many requests.
