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

# Webhook

<Note>
  The v1 API and v2 API share the same secret and webhook URL, both configured on the [dashboard](https://campflare.com/platform).
</Note>

Campflare delivers notifications to your webhook endpoint instantly, which can be configured via the [dashboard](https://campflare.com/platform). You can also override the webhook URL on a per-alert basis by passing `webhook_override_url` when [creating an alert](/api-reference/alerts/create).

## Securing

Webhooks are secured via a JWT Token (using `HS256`), sent from the server, that can be validated by the client. There are client libraries for JWTs in almost every language, with great documentation.

The payload of the JWT will include 2 keys. `iat` is the time that the token was issued as a unix timestamp. And `notification_id`, the id of the notification being sent in the webhook.

The token will be sent in the `authorization` header.

The shared secret to validate each token can be created on the account page on the [dashboard](https://campflare.com/platform).

## Payload

The body of the webhook specifies the event, in this case `v2_availability_alert_notification` and the data associated with the alert notification.
All the fields below are required with the exception of `alert_metadata`.

```json theme={null}
{
  "event": "v2_availability_alert_notification",
  "data": {
    "alert_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
    "notification_id": "1c90c3cc-0d44-4b50-8888-8dd25736011b",
    "sent_at": "2023-11-07T05:31:56Z",
    "campground_id": "<string>",
    "campsite_id": "<string>",
    "campsite_name": "<string>",
    "campground_name": "<string>",
    "reservation_url": "<string>",
    "date_range": {
      "starting_date": "2023-12-25",
      "nights": 123
    },
    "metadata": {
      "anything": 123,
      "you": "put",
      "here": []
    }
  }
}
```
