Skip to content

Webhook Endpoints

Clerk User Sync

POST /api/webhooks/clerk

URL: https://g2-elite-webhook.2pw.workers.dev/api/webhooks/clerk

Receives Clerk webhook events and syncs user data to the D1 core database. Signatures verified using svix.

Events Handled

EventAction
user.createdInsert into platform_users (clerk_id, email, firstName, lastName, phone, avatarUrl)
user.updatedUpdate platform_users fields
user.deletedSoft-delete (set deleted_at)

Required Headers

HeaderDescription
svix-idWebhook event ID
svix-timestampEvent timestamp
svix-signatureHMAC signature for verification

Verification

The webhook secret (CLERK_WEBHOOK_SECRET) is used to verify the svix signature. Requests with missing or invalid signatures return 401.

Internal Documentation — Do Not Share