Skip to main content

Identity webhooks

Path can notify your customer app backend when a shared Path identity changes. These are App webhook events: they use your existing App webhook endpoint, signing secret, and App token. They are notify-only: your backend cannot veto a Path email change or deletion.

Subscribe an endpoint​

Create or update an endpoint using your App token. Identity events are explicit opt-in; existing endpoints do not receive them until their events list includes the names you need.

POST /api/v1/apps/:appId/webhook-endpoints
Content-Type: application/json
Authorization: Bearer <app-token>

{
"url": "https://api.example.com/path/webhooks",
"events": [
"user.account_deletion_requested",
"user.organization_membership_removed",
"user.account_deletion_restored",
"user.account_deletion_finalized",
"user.email_changed"
]
}

Save the signing secret returned at endpoint creation. It is required to validate deliveries. To change events, URL, or active state without rotating that secret, use:

PATCH /api/v1/apps/:appId/webhook-endpoints/:endpointId

Use these App-token routes for delivery operations:

GET /api/v1/apps/:appId/webhook-deliveries?status=dead&event=user.email_changed
POST /api/v1/apps/:appId/webhook-deliveries/:deliveryId/retry

Only dead deliveries can be manually retried.

Verify and parse deliveries​

Verify the exact raw request bytes before parsing JSON. The signature covers timestamp + "." + rawBody; do not stringify a parsed object before verification.

import {
verifyAndParsePathIdentityWebhook,
} from '@pathsystems/path/webhooks/server'

export async function handlePathWebhook(request: Request) {
const body = new Uint8Array(await request.arrayBuffer())
const event = verifyAndParsePathIdentityWebhook({
body,
secret: process.env.PATH_WEBHOOK_SECRET!,
headers: request.headers,
})

if (!event) return new Response('invalid signature', { status: 401 })

// Store event.id in a durable unique table, then enqueue local work.
// Unknown event types should still return 2xx after that durable record.
return new Response(null, { status: 204 })
}

The helper is server-only. Do not import it into a browser component or expose your endpoint secret to end users.

Event contract​

Every identity event is a signed JSON envelope with schema_version: 1:

{
"id": "stable-logical-event-id",
"type": "user.account_deletion_requested",
"schema_version": 1,
"occurred_at": "2026-07-21T18:42:00Z",
"app": { "id": "recipient-app-id" },
"subject": { "type": "user", "id": "global-path-user-id" },
"source": {
"surface": "customer_app_account_management",
"app_id": "source-app-id"
},
"data": {
"operation_id": "deletion-operation-id",
"requested_at": "2026-07-21T18:42:00Z",
"scheduled_for": "2026-08-20T18:42:00Z"
}
}
TypeDataCustomer-app action
user.account_deletion_requestedoperation_id, requested_at, scheduled_forKeep local work reversible; for example, cancel future renewal.
user.account_deletion_restoredoperation_id, restored_atReverse work associated with that operation.
user.account_deletion_finalizedoperation_id, finalized_atDelete or anonymize local data according to your retention obligations. No email or name is included.
user.email_changedprevious_email, emailUpdate a local email mapping after verification.
user.organization_membership_removedorganization_id, removed_atRemove the user from App-owned organization data after an SDK organization-user deletion.

source.surface is customer_app_account_management when the hosted page started the operation, or platform_account_settings when it began in Path settings.

Leaving an app is not an identity-deletion event​

An end user leaving a single customer App (the hosted account-management page's normal destructive action) still does not emit an identity webhook. The user.organization_membership_removed event is emitted only when an App uses the SDK's users.delete(userId) organization-user operation; it is delivered only to the calling App and reports the affected organization.

The user.account_deletion_* events always mean the shared Path identity's global 30-day deletion lifecycle. The hosted page can still trigger that lifecycle: if leaving an App would leave the user with no other App and no Organization membership, Path runs an explicit cascade that schedules real identity deletion through the same lifecycle. In that case the account_deletion events fire exactly as documented above, with source.surface still customer_app_account_management.

Delivery semantics​

  • Delivery is at least once. Deduplicate by the body id, not X-Path-Delivery-Id.
  • Events can arrive out of order and an ambiguous successful request can be delivered more than once. Model deletion changes as a state machine keyed by operation_id.
  • Path treats any 2xx response as success. Return 2xx quickly after durable enqueue; process slow customer work asynchronously.
  • Identity events attempt delivery immediately and then with increasing delays, up to eight attempts. Failed rows eventually become dead, remain inspectable, and can be manually retried.
  • Delivered payloads are retained for 30 days; dead payloads for 90 days.
  • An unknown subject.id should be a successful no-op (2xx), not a retryable error.

Customer endpoint outages never block Path identity changes. Do not irreversibly delete customer-held data on the requested event; wait for user.account_deletion_finalized.