Skip to main content

Webhooks (Management API)

Register webhook subscriptions to receive real-time notifications for events across your organisation. For webhook payload formats and security, see the Webhooks section.

List Webhook Subscriptions

Retrieve all active webhook subscriptions for your organisation.
GET /v1/management/notification-subscriptions

Example Request

curl -X GET "https://api.rxscale.com/v1/management/notification-subscriptions/" \
  -H "X-API-Key: your-api-key-here"

Response

[
  {
    "uid": "ns-abc123",
    "notification_type": "pharmacy_order_created",
    "target": "https://your-system.com/webhooks/rxscale",
    "options": "WEBHOOK",
    "payload_version": "1"
  }
]

Register Webhook Subscription

Create a new webhook subscription for your organisation.
POST /v1/management/notification-subscriptions

Request Body

{
  "notification_type": "pharmacy_order_created",
  "target": "https://your-system.com/webhooks/rxscale",
  "payload_version": "1"
}
FieldTypeRequiredDescription
notification_typestringYesEvent type to subscribe to
targetstringYesWebhook URL to receive notifications (must be HTTPS)
meta_dataobjectNoOptional metadata for the subscription
payload_versionstringNoPayload schema version (default: "1")

Available Event Types

Event TypeDescription
pharmacy_order_createdA new pharmacy order has been created
pharmacy_order_updatedAn existing order’s status has changed
pharmacy_sku_stock_updatedStock level changed for a pharmacy SKU

Example Request

curl -X POST "https://api.rxscale.com/v1/management/notification-subscriptions/" \
  -H "X-API-Key: your-api-key-here" \
  -H "Content-Type: application/json" \
  -d '{
    "notification_type": "pharmacy_order_created",
    "target": "https://your-system.com/webhooks/rxscale"
  }'

Response (201 Created)

{
  "uid": "ns-abc123",
  "notification_type": "pharmacy_order_created",
  "target": "https://your-system.com/webhooks/rxscale",
  "options": "WEBHOOK",
  "payload_version": "1"
}

Remove Webhook Subscription

Delete (deactivate) a webhook subscription by specifying the target URL and notification type.
DELETE /v1/management/notification-subscriptions
target
string
required
The webhook target URL
notification_type
string
required
The notification type to unsubscribe from

Example Request

curl -X DELETE "https://api.rxscale.com/v1/management/notification-subscriptions/?target=https://your-system.com/webhooks/rxscale&notification_type=pharmacy_order_created" \
  -H "X-API-Key: your-api-key-here"
Returns 204 No Content on success.

Test Webhook Delivery

Send a sample webhook payload to a target URL to verify your endpoint is configured correctly. This is useful for verifying your webhook endpoint is working before creating a subscription.
POST /v1/management/notification-subscriptions/test

Request Body

{
  "target_url": "https://your-system.com/webhooks/rxscale",
  "event_type": "pharmacy_order_created",
  "header_key": "X-Custom-Auth",
  "header_value": "my-secret-token"
}
FieldTypeRequiredDescription
target_urlstringYesURL to send the test webhook to (must be HTTPS)
event_typestringNoType of event to simulate (default: pharmacy_order_created)
header_keystringNoCustom header name to include in the test request
header_valuestringNoCustom header value to include in the test request

Example Request

curl -X POST "https://api.rxscale.com/v1/management/notification-subscriptions/test" \
  -H "X-API-Key: your-api-key-here" \
  -H "Content-Type: application/json" \
  -d '{
    "target_url": "https://your-system.com/webhooks/rxscale",
    "event_type": "pharmacy_order_created",
    "header_key": "X-Custom-Auth",
    "header_value": "my-secret-token"
  }'

Response

{
  "success": true,
  "status_code": 200,
  "payload_sent": {
    "event_type": "pharmacy_order_created",
    "timestamp": 1711700000,
    "payload_version": "1",
    "data": { ... }
  }
}
Test webhook payloads include the header X-Webhook-Test: true so your endpoint can distinguish test deliveries from real ones.