Webhooks API

Configure webhooks for real-time event notifications

Webhooks

Configure webhooks to receive real-time notifications when events occur in your LEXOH system.

POST /api/v1/webhooks

Create a new webhook endpoint.

Request Example

⎘ Copy
curl -X POST "https://api.lexoh.com/v1/webhooks" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://your-server.com/webhook",
    "events": ["access.granted", "device.connected"],
    "secret": "your_webhook_secret"
  }'

Webhook Payload

When an event occurs, LEXOH will send a POST request to your webhook URL with the following payload:

{
  "id": "evt_12345",
  "type": "access.granted",
  "timestamp": "2024-01-15T10:30:00Z",
  "data": {
    "device_id": "device_456",
    "user_id": "user_123",
    "location": "Main Entrance"
  }
}

Webhook Security

Each webhook payload includes an X-LEXOH-Signature header containing an HMAC SHA-256 signature. Verify this signature to ensure the webhook came from LEXOH.

// Python example
import hmac
import hashlib

def verify_webhook(payload, signature, secret):
    computed = hmac.new(
        secret.encode(),
        payload.encode(),
        hashlib.sha256
    ).hexdigest()
    return hmac.compare_digest(computed, signature)

Available Events

Webhook Event Types:

  • device.connected - Device comes online
  • device.disconnected - Device goes offline
  • access.granted - Access permission granted
  • access.denied - Access permission denied
  • alert.triggered - Security alert triggered
GET /api/v1/webhooks

List all configured webhooks.

DELETE /api/v1/webhooks/{id}

Delete a webhook configuration.

🎉 You've Completed the API Reference!

Start building amazing integrations with the LEXOH platform