Webhooks

Clerk Auth Webhook

Handle Clerk user.created events. Creates an enrollment subscription using matching rules or available free plans, and responds with the created subscription info.

POST
/webhooks/clerk

Authorization

bearerAuth
AuthorizationBearer <token>

Use your secret API key as the bearer token

In: header

Request Body

application/json

type*string
Value in"user.created"
data*

Response Body

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://api.getlumen.dev/v1/webhooks/clerk" \  -H "Content-Type: application/json" \  -d '{    "type": "user.created",    "data": {      "id": "user_2a3b4c",      "email_addresses": [        {          "id": "idn_123",          "email_address": "jane@example.com"        }      ],      "first_name": "Jane",      "last_name": "Smith",      "username": "jane.s"    }  }'
{
  "received": true,
  "message": "Enrollment subscription created successfully",
  "subscription": {
    "id": "sub_int_bXpaJQwRq9e17g8c2kFYLr",
    "customerId": "cus_01j23abc456def789ghi0jklm",
    "planId": "plan_int_6FJ7xXk8Qp9zR2tSa1BcDe",
    "status": "active"
  },
  "invoice": null,
  "plan": {
    "id": "plan_int_6FJ7xXk8Qp9zR2tSa1BcDe"
  },
  "credit_grants_created": 0
}
{
  "error": "Clerk webhook processing failed: Invalid input"
}
{
  "error": "No active pricing tables found for this merchant"
}
{
  "error": "Subscription already exists for this customer",
  "subscription": {
    "id": "sub_int_bXpaJQwRq9e17g8c2kFYLr",
    "status": "active"
  }
}
{
  "error": "Failed to create enrollment subscription"
}