Skip to content

Webhooks

Receive a signed HTTP POST when people sign in, accounts change or an administrator edits a realm, and verify that it came from Authio.

A webhook is a POST that Authio sends to an address of yours when something happens, so your systems can react without polling the API: provision a user in your database when the account is created, open a ticket when a refresh token is reused, mirror every administrative change into a compliance store.

Every delivery carries the same JSON envelope and an HMAC-SHA256 signature made with a secret only you and Authio know. Failed deliveries are retried on a schedule you choose, and every attempt is kept in a delivery history you can read, filter and replay from the console.

Client and realm endpoints

An endpoint is registered in one of two places, and that decides what it can hear:

Registered onWhat it hearsWhere in the console
A clientWhat happens to the people who use that application: sign-ins, accounts, tokens, keys and suspensions, and the client’s own quarantines.The Webhooks section of the client’s page, or Webhooks with the client chosen
A realmEvery change an administrator makes anywhere in the realm (admin_resource_created, admin_resource_updated, admin_resource_deleted), the attacks the platform detects against it (attack_detected, credential_compromised), the quarantines of its clients (client_quarantined, client_quarantine_ended) and the user_* events of every person of the realm, whichever client they belong to.The Administrative trail section of the realm’s page

The user_* events reach both: the endpoints of the client the person belongs to and the endpoints of the realm. A person created in the realm itself, as single sign-on across the realm’s clients has them, belongs to no client, so their events reach only the realm’s endpoints, with client_id set to null. The quarantine events reach both too: the endpoints of the client in quarantine and those of its realm. The rest does not mix: a client endpoint cannot subscribe to the administrative or attack events, and a realm endpoint cannot subscribe to sign-ins, tokens or keys. An endpoint that names an event it would never receive is refused when you register it, rather than staying silent.

Add an endpoint

  1. Open the client’s webhooks

    In Clients, open the client and go to the Webhooks section of its page, or open Webhooks and choose the client. Registering an endpoint needs the client:write permission.

  2. Describe the endpoint

    Choose Add endpoint and fill in a name (up to 128 characters), the URL (an absolute https:// address with a host, up to 2,048 characters), an optional description and at least one event. Retries and First retry after set how failed deliveries are sent again; the defaults suit most receivers.

  3. Store the signing secret

    Authio generates the endpoint’s signing secret, a value that starts with whsec_. Put it in your receiver’s configuration: for example AUTHIO_WEBHOOK_SECRET for @hyper.authio/server, or Authio:Webhooks:Secret for Authio.AspNetCore.

    The secret is shown once, right after the endpoint is created, and only to people with the secret:read permission. Afterwards the console shows only its last four characters; if you lose it, choose Rotate secret.
  4. Send a test

    Choose Send test. Authio posts a ping event to the endpoint and records the attempt in its history, with the status code and body your receiver answered with.

Event types

EventEndpointSent when
user_createdClient and realmA user is created by any path: sign-up, an administrator, an import, or a first sign-in through an external identity provider.
user_updatedClient and realmA user’s profile or status changes.
user_deletedClient and realmAn administrator deletes a user, or the person deletes their own account in the account portal. data is the account as it stood when it was deleted, and it is the last copy of that data Authio sends: right after, Authio erases it.
login_succeededClientAn authentication succeeds, in any grant.
login_failedClientAn authentication is refused.
user_locked_outClient and realmAn account is locked after repeated failed attempts.
token_revokedClientA token is revoked explicitly.
keys_rotatedClientThe client’s signing and encryption keys rotate, by an administrator or on schedule.
token_reuse_detectedClientA refresh token is presented again after it was already exchanged. The session behind it has been ended.
user_suspendedClient and realmA suspension is written, whether it starts now or later.
user_suspension_endedClient and realmA suspension is lifted or runs out.
user_authenticator_app_enrolledClient and realmA person finishes setting up an authenticator app.
user_authenticator_app_removedClient and realmAn authenticator app is removed, by the person or reset by an administrator.
user_recovery_codes_regeneratedClient and realmA person replaces their recovery codes; the old ones stop working.
user_recovery_code_usedClient and realmSomeone signs in with a recovery code instead of the authenticator app, so without the phone.
admin_resource_createdRealmAn administrator creates a resource: a client, a role, a key, anything.
admin_resource_updatedRealmAn administrator changes a resource.
admin_resource_deletedRealmAn administrator deletes a resource.
attack_detectedRealmThe platform detects an attack against the realm and takes a measure against it. Sent once per incident, when it opens.
credential_compromisedRealmAn account’s correct password arrives from a source attacking the realm. The attempt is refused and the person must choose a new password at the next sign-in.
client_quarantinedClient and realmA client goes into quarantine, put in by hand or by its automatic policy.
client_quarantine_changedClient and realmThe end of a client’s quarantine moves.
client_quarantine_endedClient and realmA client’s quarantine ends, at its time or by hand, or is cancelled before its start.
pingBothYou choose Send test. It cannot be subscribed to.

Only administrative changes that succeeded are announced; refused attempts stay in the audit trail. Token exchanges for connected accounts are recorded in the access trail but do not raise login_succeeded or login_failed, because they are not sign-ins.

Payload

Every event arrives in the same envelope. id identifies the event and stays the same across every retry and replay of it; created_at is in Unix seconds; realm_id and client_id name where it happened (client_id is null for an event of the realm, and for a person who belongs to no client); data depends on the event.

login_succeededJSON
{
  "id": "6c1e0f7a-3b9d-4f2e-9a51-0d8c2b7e4f13",
  "type": "login_succeeded",
  "created_at": 1791360000,
  "realm_id": "acme",
  "client_id": "acme-web",
  "data": {
    "grant_type": "authorization_code",
    "user_id": "0f6b2c4e-8a1d-4c3b-9e7f-5a2d1c8b6e40",
    "username": "ana",
    "email": "ana@acme.com",
    "ip_address": "203.0.113.24",
    "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7)",
    "session_id": "b7d4e2a1-5c3f-4e8b-a6d9-1f0c7e3b2a58",
    "failure_reason": null,
    "resource": null,
    "scopes": ["openid", "profile", "email"],
    "authentication_methods": ["pwd", "otp", "mfa"],
    "acr": "2",
    "identity_provider": null,
    "consumer_id": null,
    "consumer_name": null
  }
}

What each event carries in data

EventsFields in data
user_created, user_updated, user_deletedid, username, email, first_name, last_name, email_confirmed, status, realm_id, client_id
login_succeeded, login_failedgrant_type, user_id, username, email, ip_address, user_agent, session_id, failure_reason, resource, scopes, authentication_methods, acr, identity_provider, consumer_id, consumer_name
user_locked_outuser_id, username, email, lockout_end, access_failed_count
token_revokedtoken_id, subject, session_id, token_type_hint
token_reuse_detectedtoken_id, subject, session_id, ip_address, user_agent
keys_rotatedsigning_key_id, encryption_key_id, plus revoked_keys_count for a rotation by hand or rotation_days and automatic for a scheduled one
user_suspended, user_suspension_endedid, user_id, level, status, starts_at, ends_at, restricted_scopes, revokes_every_role, revoked_role_ids, sessions_terminated_at, lifted_at
user_authenticator_app_enrolled, user_authenticator_app_removed, user_recovery_codes_regenerated, user_recovery_code_useduser_id, username, email, actor (user or administrator), recovery_codes_remaining. Never a code or the secret.
admin_resource_created, admin_resource_updated, admin_resource_deletedaction, resource_type, resource_id, parent_id, realm_id, client_id, actor_type, actor_user_id, actor_username, actor_email, actor_credential_id, actor_credential_name, actor_platform_operator, ip_address, method, path, details
attack_detectedincident_id, kind, severity, measure, ip_address, country, asn, network_operator, user_id, started_at
credential_compromisedincident_id, user_id, username, ip_address, country, asn, network_operator, password_change_required
client_quarantined, client_quarantine_changed, client_quarantine_endedid, client_id, origin, status, access, scheduled, allowed_user_ids, allowed_group_ids, ends_access, requires_password_change, requires_second_factor, starts_at, ends_at, incident_id, lifted_at, end_changed_at, replaced_by_quarantine_id, message_shown_to_users
pingmessage, subscription

In login_succeeded and login_failed, grant_type is the grant as the protocol names it (authorization_code, client_credentials, refresh_token…), scopes and authentication_methods are lists (empty when there are none), and failure_reason is a stable code such as InvalidUserCredentials or AccountLockedOut, or null for a success, so you can match on it without depending on the wording. A request refused before anybody was named arrives with user_id set to null: a client switched off (ClientInactive), a grant it did not register (GrantTypeDisabled), its quarantine (ClientQuarantined) or a subscription that no longer allows sign-in (AccountNotEntitled).

resource tells a sign-in to your application apart from a token issued for a resource server such as an MCP server, and authentication_methods, acr and identity_provider tell how the person signed in. In the administrative events the kind of resource travels in resource_type, so the three event names never change when the API grows.

  • resource_id is what was created, changed or deleted, and parent_id what it belongs to, when the endpoint names it (the person a suspension is of, the identity provider of a role mapping); both are null when there is nothing to name, as for an import that touches many records at once.
  • actor_type says who made the change: User, a person signed in, or Credential, an account credential (an API key, a personal access token or a client secret). For a credential, actor_credential_id and actor_credential_name name it, actor_user_id and actor_username name the person it acts for, and actor_email is null.
  • A rotation of a client’s secret (admin_resource_updated) also carries details: mode — Immediate (the previous secret was refused at once), Overlap (it still works for a while) or Compromise (it was refused and the tokens issued with it revoked) — with previous_value_valid_until and issued_tokens_revoked_before, in UTC, for the modes they belong to. See Rotating secrets.
  • actor_platform_operator is true when the change was made by an Authio operator rather than by one of the account’s own people.
  • A change an agent applied through the Authio MCP server arrives like any other, with method set to POST, path to /mcp#<tool> (/mcp#update_client, for example) and details holding channel (mcp), tool and, when the agent signed in with a console account, agent: the address of the agent’s metadata document, an address on claude.ai or vscode.dev. details is null for a change that declares nothing beyond its kind and resource.
  • Calls that change nothing publish nothing: a test sent to a webhook, a replayed delivery, a token projection or claim-mapper preview, a confirmation e-mail resent, and every rehearsal (dryRun) of an import. A refused change, an impersonation and a change outside a realm publish nothing either.

Headers

HeaderValue
X-Authio-Signaturet={timestamp},v1={signature}: the Unix time the attempt was sent and the lowercase hex HMAC-SHA256 of {timestamp}.{body}. During a secret rotation with an overlap window the header carries more than one v1, t={timestamp},v1={new},v1={previous}, one per secret that signs.
X-Authio-EventThe event name, or ping, so you can route without parsing the body.
X-Authio-Event-IdThe event’s id, the same on every retry and replay.
Content-Typeapplication/json

Verify signatures

Anyone who knows your endpoint’s address can post to it, so check every delivery before acting on it. The Authio libraries do the whole check: createAuthioWebhooks from @hyper.authio/server (or authioWebhooks from @hyper.authio/express, on Express) and AddAuthioWebhooks from Authio.AspNetCore verify the signature over the raw body against every configured secret, refuse a timestamp more than five minutes away, skip an X-Authio-Event-Id they already handled and hand each event to your handlers, with its data typed:

app/api/webhooks/authio/route.tsTypeScript
import { createAuthioWebhooks } from '@hyper.authio/server'

const webhooks = createAuthioWebhooks({ secret: process.env.AUTHIO_WEBHOOK_SECRET })
  .on('user_created', async (event) => provision(event.data.id, event.data.email))
  .on('*', (event) => console.log(`Received ${event.type} (${event.id})`))

export async function POST(request: Request) {
  const outcome = await webhooks.handle({
    body: new Uint8Array(await request.arrayBuffer()), // the raw body, byte for byte
    headers: request.headers,
  })

  return new Response(null, { status: outcome.status })
}

Both answer 200 for a delivery handled, a duplicate or a ping, 401 for a missing, wrong or stale signature, 400 for a body that is no Authio event, 413 for one too large and 500 when a handler throws, which lets Authio deliver again. While you rotate the secret, configure both values: secrets on Node.js, Secrets on .NET. To check one delivery outside a route, verifyWebhookSignature from @hyper.authio/client and AuthioWebhookVerifier.Verify from Authio.Client answer whether it holds and why not. With several instances on .NET, set Deduplication to Distributed and register an IDistributedCache; typed handlers and the rest are in Node.js and .NET.

Verify in another language

Authio has libraries for Node.js and .NET only. In any other language, make the same checks yourself:

  1. Read the raw request body, byte for byte, before any JSON parsing.
  2. Split X-Authio-Signature on commas and take the t value and every v1 value: while a rotated secret is in its overlap window there is one v1 for the new secret and one for the previous.
  3. Compute the HMAC-SHA256 of {t}.{raw body}, keyed with the whole secret including its whsec_ prefix, and encode it as lowercase hex.
  4. Compare it with each v1 in constant time, and accept the delivery when any of them matches.
  5. Reject the delivery if t is more than five minutes away from your clock. The timestamp is set when each attempt is sent, so retries and replays carry a fresh one.
To check your setup without writing code, open Webhooks and choose Verify signature: paste a delivery’s raw body, the secret and the X-Authio-Signature header, and the console recomputes the signature in your browser. Nothing you paste there is sent anywhere.

Rotate the signing secret

Rotate secret replaces the endpoint’s signing secret and shows the new one once. Rotating needs the secret:write permission on top of client:write (realm:update for a realm endpoint), and the new value is returned only to people with secret:read. Choose how long the previous secret keeps signing in Keep the previous value working for:

  • With an overlap window, every delivery until the window ends — retries already queued included — carries two signatures, v1={new},v1={previous}, so a receiver verifying with either secret accepts it. The endpoint answers previousSecretValidUntil, the moment the previous secret stops signing; switch your receiver before then.
  • With no overlap, the previous secret stops signing at once and the next delivery carries only the new signature, so update your receiver right away. Deliveries that fail in between are retried on the endpoint’s policy, signed with the new secret.

Through the Admin API, POST …/webhooks/{webhookId}/rotate-secret takes an optional body with previousValueValidForMinutes, from 0 (no overlap, the same as omitting it) up to the maximum GET /api/v1/admin/secrets/rotation-policy reports. It works the same for client endpoints (/api/v1/admin/realms/{realm}/clients/{client}/webhooks) and realm endpoints (/api/v1/admin/realms/{realm}/webhooks). With @hyper.authio/admin, it is admin.webhook.rotateSecret({ realm, client, webhookId, body: { previousValueValidForMinutes: 60 } }) for a client endpoint and admin.realmWebhook.rotateSecret({ realm, webhookId, body }) for a realm one; IAuthioAdminClient has no method for it, so on .NET send it through the HttpClient of routes without a method.

An endpoint whose signing secret can no longer be read answers hasSecret: false, and the console lists it in a warning. Nothing is posted to it: every attempt is recorded as failed with “Not sent: the endpoint’s signing secret could not be read”. Rotate its secret to give it a new one and resume deliveries.

Retries and delivery history

  • An attempt succeeds when your endpoint answers with any 2xx status within 10 seconds. Any other status, a timeout or a connection error is a failure. Redirects are not followed.
  • A failed event is retried on the endpoint’s policy. With the defaults (5 retries, first one after 60 seconds) the retries come about 1 minute, 5 minutes, 25 minutes, 2 hours and 6 hours after each failure: each waits five times longer than the one before, never more than six hours, moved by up to 20% either way.
  • Retries accepts 0 to 10 (0 turns retries off) and First retry after 30 to 3,600 seconds. Tests and manual resends are never retried.
  • After 10 consecutive failures the endpoint is disabled automatically; for a client endpoint, the account owner also gets a critical notification. A success resets the count, and automatic retries do not add to it. A retry that comes due while the endpoint is paused or disabled is dropped, and the failed attempt is marked as the last (retriesExhausted: true).

An endpoint is Active, Paused or Disabled. To bring a disabled realm endpoint back, fix the receiver and turn Receiving back on in its editor. The console registers, tests, rotates and deletes client endpoints; to change one, or set a disabled one back to Active, update it through the Admin API with PUT /api/v1/admin/realms/{realm}/clients/{client}/webhooks/{webhookId}, which is admin.webhook.update in @hyper.authio/admin.

The history of a client’s endpoints lives on Webhooks, whose page for one client has the sections Overview, Endpoints, Events and Deliveries, and in the Webhooks section of the client’s page. Overview shows attempts, acceptance rate, latency and the most common failure responses; Events lists each occurrence with how far its fan-out got (Pending, Delivered, Partial or Failed); Deliveries lists every attempt with the request body and your response. Each attempt is labelled with its kind:

KindWhat it is
EventThe first delivery of an event.
RetryAn automatic retry of a failed event.
ReplayA delivery someone sent again by hand.
TestA ping sent with Send test.

Replay this delivery sends the stored payload again, unchanged, even if the user or resource it describes has changed since. It only works while the endpoint is active, and it cancels any automatic retries still scheduled for the same event. For realm endpoints the console lists deliveries and sends tests; replay and metrics are available for client endpoints. Delivery history is kept for 30 days; on Dedicated, for the window configured for the environment.

Diagnose with AI, in the peek of a client endpoint that failed or is not active, reads the period’s attempts by status, how long they took and the most frequent failure texts, and says what is wrong and what to do, beside the counts it read. The AI never receives the payload, the secret or the URL (only whether it is https and whether the host is public), and receivers’ texts reach it shortened, with e-mail addresses, IPs and tokens masked. An active endpoint with nothing failed in the period does not call the AI. See what the AI does.

Test your endpoint

  • Send test posts a signed ping to one endpoint. It counts towards the endpoint’s health, because an endpoint that rejects a test has a real problem.
  • Capture endpoint, on Webhooks, opens a temporary address that records every request it receives — method, headers and body — for 24 hours. Use it as an endpoint’s URL to see exactly what Authio sends before your receiver exists. The address is protected only by its random path, so send it test data only.
  • Authio delivers only to public addresses, checked after DNS resolution: localhost and private networks are refused. To receive on your machine, use the capture endpoint or a tunnel that gives you a public HTTPS address.

Best practices

  • Verify before you act. Reject any delivery whose signature does not match or whose timestamp is outside your tolerance.
  • Answer fast, work later. Return a 2xx as soon as the delivery is verified and stored, and do the slow work in a queue. Ten seconds is the hard limit, and a slow endpoint fails deliveries it actually received.
  • Make handlers idempotent. Delivery is at least once: the same event can reach you again through a retry or a replay. Keep the id (also in X-Authio-Event-Id) of what you processed and skip repeats.
  • Do not rely on order. A retry can arrive hours after a newer event. Use created_at, or read the current state from the API, when order matters.
  • Treat `token_reuse_detected` as an incident. It means a refresh token was very likely stolen: someone other than its holder presented it.
  • Plan secret rotations. Verify against every v1 and rotate with an overlap window, then switch your receiver to the new secret before the window ends (see Rotate the signing secret).

Notification webhooks

Separate from event webhooks, your account’s operational notifications — expiring secrets, unusual sign-in failures, a disabled webhook, quotas near their limit — can also be posted to a URL. The account owner sets it in Notifications › Preferences. The body carries id, type, severity, key, arguments, title, description, resource_id, realm_id and created_at. title and description are always in English; key names the notification and arguments holds its values, so your side can word it in any language. These posts are not signed and do not appear in the delivery history, so treat them as alerts, not as a source of truth.

Next steps