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

# Webhooks

> Subscribe to real-time notifications

# Webhooks

Webhooks allow you to receive real-time HTTP notifications when events occur in ZenFlow.

<Card title="Webhooks Guide" icon="book" href="/en/guides/webhooks">
  Check the complete guide to see all available events, sample payloads, and how to verify signatures.
</Card>

## Endpoints

| Method | Endpoint    | Description               |
| ------ | ----------- | ------------------------- |
| POST   | `/webhooks` | Subscribe to events       |
| GET    | `/webhooks` | List active subscriptions |

## Subscribe to Events

To receive notifications, create a webhook specifying your URL and the events you're interested in:

```bash theme={null}
POST /api/v1/webhooks
```

```json theme={null}
{
  "name": "My notifications",
  "url": "https://your-server.com/webhooks/zenflow",
  "events": ["order/created", "order/completed", "stock/updated"]
}
```

### Available Events

| Category | Events                                                                 |
| -------- | ---------------------------------------------------------------------- |
| Orders   | `order/created`, `order/updated`, `order/cancelled`, `order/completed` |
| Products | `product/created`, `product/updated`, `product/deleted`                |
| Stock    | `stock/updated`, `stock/low_alert`, `stock/movement_created`           |
| Flows    | `flow/started`, `flow/completed`, `flow/cancelled`                     |

<Warning>
  Save the `secret` returned in the response. You'll need it to verify signatures. It won't be shown again.
</Warning>

## Response

```json theme={null}
{
  "success": true,
  "data": {
    "id": "wh_abc123",
    "name": "My notifications",
    "url": "https://your-server.com/webhooks/zenflow",
    "events": ["order/created", "order/completed", "stock/updated"],
    "secret": "whsec_xxxxxxxxxxxxxxxx",
    "active": true,
    "created_at": "2024-01-15T10:30:00Z"
  }
}
```
