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

# Overview

> Receive real-time notifications via webhooks

# Webhooks

Webhooks let you receive real-time HTTP notifications when events happen in RxScale. Instead of polling for changes, register a webhook URL and RxScale will send you a POST request whenever an event occurs.

## How Webhooks Work

1. **Register** a webhook subscription with your target URL and desired event type.
2. **Receive** POST requests to your URL when events occur.
3. **Verify** the webhook signature to ensure the request is authentic.
4. **Respond** with a `2xx` status code to acknowledge receipt.

## Webhook Payload Format

All webhook payloads follow the same envelope structure:

```json theme={null}
{
  "event_type": "pharmacy_order_created",
  "timestamp": 1711700000,
  "payload_version": "1",
  "data": {
    // Event-specific data
  }
}
```

| Field             | Type    | Description                                                      |
| ----------------- | ------- | ---------------------------------------------------------------- |
| `event_type`      | string  | The type of event that occurred                                  |
| `timestamp`       | integer | Unix timestamp of when the event was generated                   |
| `payload_version` | string  | Schema version of the payload (currently `"1"`)                  |
| `data`            | object  | Event-specific data — see [Events](/webhooks/events) for details |

## Registering Webhooks

You can register webhooks through:

* **Pharmacy Portal** — Navigate to API Access in the sidebar. If you manage multiple pharmacy groups, select the group from the dropdown at the top of the page.
* **External Pharmacy API** — `POST /v1/external_pharmacy_api/webhooks/`
* **Management API** — `POST /v1/management/notification-subscriptions/`

Each registration returns a `signing_secret` that you must store securely for payload verification.

## Retry Policy

If your endpoint does not respond with a `2xx` status code, RxScale will retry the delivery with exponential backoff.
