Webhooks API
Webhooks allow your application to receive real-time HTTP callbacks when events occur in Auris. When a subscribed event fires (e.g., a user logs in, a role is assigned, an account is locked), Auris sends a POST request to your configured URL with a JSON payload describing the event.
Every webhook delivery is signed with HMAC-SHA256 using a per-webhook signing secret. This allows your server to verify that the payload originated from Auris and was not tampered with in transit.
All webhook management endpoints require the manage:webhooks permission and the x-tenant header.
Webhook CRUD
List Webhooks
/api/webhooksRequires: manage:webhooksList all webhook endpoints configured for the tenant. Returns webhook metadata including the subscribed events, active status, and failure statistics. The signing secret is never returned in list responses.
Query parameters
Success response
{
"ok": true,
"data": {
"data": [
{
"id": "whk_abc123",
"name": "Production Event Handler",
"url": "https://api.yourapp.com/webhooks/auris",
"events": ["user.created", "user.updated", "login.success", "login.failed"],
"isActive": true,
"lastDeliveryAt": "2025-02-18T09:45:00Z",
"failureCount": 0,
"createdAt": "2025-01-15T10:00:00Z"
}
],
"pagination": {
"page": 1,
"limit": 20,
"total": 3,
"totalPages": 1
}
}
}Create Webhook
/api/webhooksRequires: manage:webhooksCreate a new webhook endpoint. A signing secret is automatically generated with a whsec_
prefix. The secret is returned only in the creation response — store it securely, as it cannot
be retrieved later (only rotated).
Request body
{
"name": "Production Event Handler",
"url": "https://api.yourapp.com/webhooks/auris",
"events": ["user.created", "user.updated", "user.deleted", "login.success"]
}Webhook URLs must use HTTPS. HTTP URLs are rejected to prevent secrets and user data from being transmitted in plaintext.
Success response
{
"ok": true,
"data": {
"id": "whk_def456",
"name": "Production Event Handler",
"url": "https://api.yourapp.com/webhooks/auris",
"events": ["user.created", "user.updated", "user.deleted", "login.success"],
"secret": "whsec_7f3a8b2c4d5e6f0a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9b0c1d2e3f",
"isActive": true,
"createdAt": "2025-02-18T10:00:00Z"
}
}The secret field is only returned in the creation response and after secret rotation. Copy and store it immediately in a secure location (e.g., environment variable or secrets manager). It cannot be retrieved again.
Error codes
Get Webhook
/api/webhooks/[id]Requires: manage:webhooksRetrieve a single webhook by ID. Returns full webhook details excluding the signing secret.
Success response
{
"ok": true,
"data": {
"id": "whk_abc123",
"name": "Production Event Handler",
"url": "https://api.yourapp.com/webhooks/auris",
"events": ["user.created", "user.updated", "login.success", "login.failed"],
"isActive": true,
"failureCount": 0,
"lastDeliveryAt": "2025-02-18T09:45:00Z",
"createdAt": "2025-01-15T10:00:00Z",
"updatedAt": "2025-02-10T14:00:00Z"
}
}Update Webhook
/api/webhooks/[id]Requires: manage:webhooksUpdate a webhook’s name, URL, subscribed events, or active status. All fields are optional — only provided fields are updated.
Request body
{
"name": "Production Event Handler v2",
"events": ["user.created", "user.updated", "user.deleted", "login.success", "login.failed", "role.assigned"],
"isActive": true
}Success response
{
"ok": true,
"data": {
"id": "whk_abc123",
"name": "Production Event Handler v2",
"url": "https://api.yourapp.com/webhooks/auris",
"events": ["user.created", "user.updated", "user.deleted", "login.success", "login.failed", "role.assigned"],
"isActive": true,
"updatedAt": "2025-02-18T11:00:00Z"
}
}Delete Webhook
/api/webhooks/[id]Requires: manage:webhooksDelete a webhook endpoint. Pending deliveries for this webhook are cancelled. Delivery history is retained for audit purposes.
Success response
{
"ok": true,
"data": { "deleted": true }
}Secret Rotation
/api/webhooks/[id]/rotate-secretRequires: manage:webhooksGenerate a new signing secret for the webhook. The old secret is immediately invalidated. The new secret is returned in the response. All subsequent deliveries will be signed with the new secret.
Request: No body required.
Success response
{
"ok": true,
"data": {
"secret": "whsec_9a8b7c6d5e4f3a2b1c0d9e8f7a6b5c4d3e2f1a0b9c8d7e6f5a4b3c2d1e0f9a"
}
}After rotating a secret, update your webhook handler to use the new secret immediately. Deliveries in-flight at the moment of rotation may still use the old secret. Best practice: support verifying against both old and new secrets for a short grace period during rotation.
Testing
/api/webhooks/[id]/testRequires: manage:webhooksSend a test delivery to the webhook URL. Auris sends a webhook.test event with a sample
payload. The delivery is recorded in the delivery log. Use this to verify your endpoint is
reachable and correctly verifying signatures.
Request: No body required.
Success response
{
"ok": true,
"data": {
"deliveryId": "del_xyz789",
"statusCode": 200,
"success": true,
"responseTime": 142
}
}Test event payload (what your endpoint receives)
{
"event": "webhook.test",
"timestamp": "2025-02-18T10:30:00Z",
"tenant": "acme-corp",
"data": {
"message": "This is a test delivery from Auris.",
"webhookId": "whk_abc123"
}
}Error codes
Delivery Log
List Deliveries
/api/webhooks/[id]/deliveriesRequires: manage:webhooksList delivery attempts for a webhook, ordered by timestamp descending. Each delivery includes the event type, HTTP status code, response time, and whether the delivery was successful. Retried deliveries are separate entries linked to the same event.
Query parameters
Success response
{
"ok": true,
"data": {
"data": [
{
"id": "del_abc123",
"event": "user.created",
"statusCode": 200,
"success": true,
"responseTime": 89,
"attempts": 1,
"payload": {
"event": "user.created",
"timestamp": "2025-02-18T09:45:00Z",
"tenant": "acme-corp",
"data": {
"userId": "usr_abc123",
"email": "[email protected]"
}
},
"createdAt": "2025-02-18T09:45:00Z",
"completedAt": "2025-02-18T09:45:01Z"
},
{
"id": "del_def456",
"event": "login.failed",
"statusCode": 500,
"success": false,
"responseTime": 2034,
"attempts": 3,
"error": "Server returned 500 Internal Server Error",
"payload": {
"event": "login.failed",
"timestamp": "2025-02-18T09:30:00Z",
"tenant": "acme-corp",
"data": {
"email": "[email protected]",
"reason": "INVALID_CREDENTIALS",
"ipAddress": "203.0.113.50"
}
},
"createdAt": "2025-02-18T09:30:00Z",
"completedAt": "2025-02-18T09:35:12Z"
}
],
"pagination": {
"page": 1,
"limit": 20,
"total": 156,
"totalPages": 8
}
}
}Retry Delivery
/api/webhooks/[id]/deliveries/[deliveryId]/retryRequires: manage:webhooksManually retry a failed delivery. The original payload is re-sent with a new signature. Creates a new delivery entry linked to the same event.
Request: No body required.
Success response
{
"ok": true,
"data": {
"deliveryId": "del_ghi789",
"statusCode": 200,
"success": true,
"responseTime": 95
}
}Error codes
Event Types
Auris emits the following webhook events. Subscribe to the events relevant to your use case.
Authentication Events
User Management Events
Role & Permission Events
Security Events
Organization Events
System Events
Webhook Payload Format
Every webhook delivery sends a POST request with a JSON body:
{
"event": "user.created",
"timestamp": "2025-02-18T10:00:00Z",
"tenant": "acme-corp",
"data": {
"userId": "usr_abc123",
"email": "[email protected]",
"firstName": "Alice",
"lastName": "Smith"
}
}The shape of data varies by event type. User events include user fields, role events include role details, and login events include the email and IP address.
Signature Verification
Every delivery includes two headers for signature verification:
Verification Algorithm
- Read the raw request body as a UTF-8 string (do not parse JSON first).
- Read the
X-Webhook-Timestampheader. - Concatenate:
timestamp + "." + body - Compute HMAC-SHA256 of the concatenated string using your webhook’s signing secret.
- Compare the hex-encoded result with the
X-Webhook-Signatureheader using a timing-safe comparison. - Optionally, reject deliveries where the timestamp is more than 5 minutes old (to prevent replay attacks).
Node.js Verification Example
import crypto from 'crypto';
function verifyWebhookSignature(rawBody, signature, timestamp, secret) {
// 1. Check timestamp freshness (optional but recommended)
const currentTime = Math.floor(Date.now() / 1000);
if (Math.abs(currentTime - parseInt(timestamp)) > 300) {
throw new Error('Webhook timestamp is too old');
}
// 2. Compute expected signature
const signedPayload = `${timestamp}.${rawBody}`;
const expectedSignature = crypto
.createHmac('sha256', secret)
.update(signedPayload)
.digest('hex');
// 3. Timing-safe comparison
const expected = Buffer.from(expectedSignature, 'hex');
const received = Buffer.from(signature, 'hex');
if (expected.length !== received.length) {
return false;
}
return crypto.timingSafeEqual(expected, received);
}
// Express.js handler
app.post('/webhooks/auris', express.raw({ type: 'application/json' }), (req, res) => {
const signature = req.headers['x-webhook-signature'];
const timestamp = req.headers['x-webhook-timestamp'];
const rawBody = req.body.toString('utf-8');
if (!verifyWebhookSignature(rawBody, signature, timestamp, process.env.AURIS_WEBHOOK_SECRET)) {
return res.status(401).json({ error: 'Invalid signature' });
}
const event = JSON.parse(rawBody);
console.log(`Received ${event.event}:`, event.data);
// Process the event...
res.status(200).json({ received: true });
});Python Verification Example
import hmac
import hashlib
import time
def verify_webhook_signature(raw_body: bytes, signature: str, timestamp: str, secret: str) -> bool:
# Check timestamp freshness
current_time = int(time.time())
if abs(current_time - int(timestamp)) > 300:
return False
# Compute expected signature
signed_payload = f"{timestamp}.{raw_body.decode('utf-8')}"
expected = hmac.new(
secret.encode('utf-8'),
signed_payload.encode('utf-8'),
hashlib.sha256
).hexdigest()
# Timing-safe comparison
return hmac.compare_digest(expected, signature)The @auris/js SDK includes a built-in webhook verification utility: import { verifyWebhookSignature } from '@auris/js'. It handles timestamp validation, HMAC computation, and timing-safe comparison. See the SDK documentation for details.
Delivery Behavior
Timeouts
Auris waits up to 30 seconds for a response from your webhook endpoint. If your endpoint does not respond within this window, the delivery is marked as failed.
Retry Policy
Failed deliveries are retried with exponential backoff:
After 3 failed retry attempts, the delivery is marked as permanently failed. It can still be manually retried via the API or Console.
Automatic Disabling
If a webhook accumulates 10 consecutive failures (across any deliveries), it is automatically deactivated (isActive: false). You will need to fix the endpoint and manually re-enable the webhook via PATCH /api/webhooks/[id] with { "isActive": true }.
Idempotency
Your webhook handler should be idempotent. In rare cases (network issues, retries), the same event may be delivered more than once. Use the timestamp and event fields to deduplicate if needed.
Best Practices
- Respond quickly: Return a
2xxstatus code as soon as possible. Process the event asynchronously (e.g., queue it) rather than doing heavy work in the request handler. - Verify signatures: Always verify the HMAC-SHA256 signature before processing the payload. Never trust a webhook payload without verification.
- Use HTTPS: Auris rejects non-HTTPS webhook URLs. Use a valid TLS certificate.
- Handle retries: Design your handler to be idempotent. The same event may be delivered more than once.
- Rotate secrets periodically: Use the rotate-secret endpoint to generate a new signing secret on a regular schedule (e.g., quarterly).
- Monitor deliveries: Check the delivery log in the Console or via the API to ensure your endpoint is healthy.
Related
- Setting Up Webhooks — Step-by-step guide to creating webhook receivers
- Managing Webhooks — Configure webhooks from the Console
- Actions Engine API — Custom logic hooks that complement webhooks
- JavaScript SDK —
verifyWebhookSignature()for signature verification