RelayaRelayaDocs
Dashboard

Webhooks

Receive real-time notifications when events occur in your Relaya workspace. Register a URL and subscribe to specific event types.

Available Events

EventDescription
appointment.createdA new appointment was booked
appointment.updatedAn appointment was rescheduled or modified
appointment.cancelledAn appointment was cancelled
patient.createdA new patient was registered
voice.call.completedA voice call ended
voice.call.transferredA call was transferred to staff
scribe.note.readyA clinical note finished processing
scribe.note.approvedA clinical note was approved
POST/v1/webhooks

Register a new webhook endpoint. Relaya will send POST requests to your URL when subscribed events occur.

Request Body

ParameterTypeRequiredDescription
urlstringRequiredHTTPS endpoint URL to receive events
eventsstring[]RequiredArray of event types to subscribe to
secretstringOptionalSigning secret for payload verification (auto-generated if omitted)
descriptionstringOptionalOptional description for this webhook

Example Request

curl -X POST "https://api.relaya.one/v1/webhooks" \
  -H "Authorization: Bearer rlya_live_abc123" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://your-app.com/webhooks/relaya",
    "events": ["appointment.created", "appointment.cancelled", "voice.call.completed"],
    "description": "Main production webhook"
  }'

Example Response

{
  "data": {
    "id": "wh_5kn3m8",
    "url": "https://your-app.com/webhooks/relaya",
    "events": ["appointment.created", "appointment.cancelled", "voice.call.completed"],
    "secret": "whsec_a1b2c3d4e5f6g7h8i9j0",
    "description": "Main production webhook",
    "active": true,
    "created_at": "2026-07-25T10:00:00Z"
  }
}
GET/v1/webhooks

List all registered webhooks for your workspace.

DELETE/v1/webhooks/:id

Remove a webhook subscription. Events will no longer be delivered to this endpoint.

Payload Format

Webhook payloads are sent as POST requests with a JSON body:

{
  "id": "evt_9vm3k2",
  "type": "appointment.created",
  "created_at": "2026-07-25T10:00:00Z",
  "data": {
    "id": "apt_n3k8m2v1",
    "patient_id": "pat_4jn7h2",
    "doctor_id": "doc_9km3p1",
    "datetime": "2026-07-28T14:00:00Z",
    "status": "scheduled"
  }
}

Signature Verification

Each webhook includes a X-Relaya-Signature header containing an HMAC-SHA256 signature of the payload body using your webhook secret:

import hmac
import hashlib

def verify_webhook(payload_body, signature, secret):
    expected = hmac.new(
        secret.encode(),
        payload_body,
        hashlib.sha256
    ).hexdigest()
    return hmac.compare_digest(f"sha256={expected}", signature)

Error Codes

CodeStatusDescription
400bad_requestInvalid URL or unsupported event type
401unauthorizedInvalid or missing API key
404not_foundWebhook not found
409conflictURL already registered
429rate_limitedToo many requests