Create a webhook

Register an endpoint for the organization's events.

POST /organizations/{org}/webhooks

Registers an endpoint. LoginWith generates its signing secret and returns it once, in this response.

Authorization

Org owner. Anyone else gets 403 forbidden.

Path parameters

NameTypeDescription
orgstringThe organization: its id (org_…) or its slug. It has to be an org your token can manage (see Who can call it)

Body

FieldTypeRequiredDescription
urlstringyesAn https URL
eventsstring[]yes1–50 routing-key patterns, such as tenant.*, *.deleted, or # for every event

No other field is accepted.

Response

201 Created with the endpoint and its secret.

{
  "id": "whk_65f1c2a9e4b0d3f7a1c8e90d",
  "url": "https://hooks.acme.com/loginwith",
  "events": ["tenant.*", "*.deleted"],
  "active": true,
  "created_at": "2026-10-18T09:12:00.000Z",
  "secret": "…"
}
FieldTypeDescription
idstringwhk_…
urlURL
eventsstring[]Routing-key patterns
activeboolean
created_atISO date
secretstringThis response only

Errors

StatuserrorWhen
400invalid_requestAn unknown field, or a value that fails validation. The detail names it
403forbiddenYou are not an owner of the org
404not_foundThe org does not exist, or your token cannot manage it

Example

curl -X POST https://loginwith.loginwith.dev/organizations/acme/webhooks \
  -H "Authorization: Bearer $TOKEN" -H "content-type: application/json" \
  -d '{"url": "https://hooks.acme.com/loginwith", "events": ["tenant.*", "*.deleted"]}'