Webhooks

Get told when something happens in a creator's account.

Embed
Preview of the card
<a href="https://linkyhub.net/docs/webhooks"><img src="https://linkyhub.net/docs/_api/public/orgs/2fd2a4b7-b627-4925-af1e-1c51bf890403/spaces/c4b920fb-a433-40b5-b354-ff84bf0c3eb1/pages/be268347-175a-4478-a135-1b422fd2c812/social-card.svg?v=3e7ae33eec8b" alt="Webhooks" width="600" height="315"></a>

Each app has one webhook URL. Set it on the app's page in the developer portal, or through the API with a personal API key (below). It must be https on a public host. The signing secret is shown once.

Your endpoint receives an event only for creators who connected your app and granted the scope the event needs:

Event

Needs

order.paid

orders:read

order.refunded

orders:read

order.fulfilled

orders:read

product.updated

products:read

inventory.low

products:read

subscriber.created

audience:read

event.registration

events:read

grant.revoked

none: the creator disconnected your app

user.updated, user.deleted

none: the creator's sign-in account changed or was deleted

Managing the webhook through the API

These operations need a personal API key (Dashboard → Developers → API keys) with apps:write, or apps:read for GET. OAuth access tokens cannot call them. {appId} is an app you registered; any other id answers 404.

Call

Does

PUT /api/v3/apps/{appId}/webhook

Body { "url", "events": [...] }. Creates or replaces the webhook. Answers { url, events, secret, createdAt }. secret (whsec_…) is set only when the webhook is first created and is null after that. Use rotate-secret to get a new one.

GET /api/v3/apps/{appId}/webhook

{ url, events, createdAt, lastDeliveryAt }, never the secret. 404 when none is set.

DELETE /api/v3/apps/{appId}/webhook

Removes it. Deliveries stop.

POST /api/v3/apps/{appId}/webhook/rotate-secret

{ secret, previousSecretExpiresAt }. The new secret is shown once. For 24 hours each delivery is signed with both secrets, the new one first, so the old one keeps verifying while you redeploy.

POST /api/v3/apps/{appId}/webhook/test

Sends one signed webhook.test event to your URL, in the same envelope as a real event, with creator: null. Answers { attempt }, the delivery attempt's result.

url follows the same rule as the dashboard: https, no user name or password, and no localhost, private or link-local address. An unknown event name is refused with 400. Answers 501 not_implemented if the signing service does not offer rotation or test sends yet. Try again later.

curl -X PUT "$LINKHUB_URL/api/v3/apps/$APP_ID/webhook" \
  -H "Authorization: Bearer $LINKHUB_API_KEY" -H "content-type: application/json" \
  -d '{"url":"https://example.com/api/webhooks/linkyhub","events":["order.paid","product.updated","grant.revoked"]}'

The envelope

Every delivery is one JSON object:

{
  "id": "evt_…",
  "type": "order.paid",
  "timestamp": 1764115200000,
  "creator": { "id": "user_…" },
  "data": { "orderId": "…", "amountCents": 2500, "currency": "usd", "creator": { "id": "user_…" } }
}
  • id is the same on every retry, and it is also the webhook-id header.

  • type is the event.

  • creator.id names the creator the event is about. It equals the sub claim of the access token your app holds for that creator, so you can match the delivery to a stored connection without another call. It is on every event type, including grant.revoked and user.*, and is null only when no creator is involved, as on webhook.test.

  • data is the event's payload. For Linky Hub's own events (order.*, product.updated, inventory.low, subscriber.created, event.registration) it carries ids rather than full records, and also data.creator with the same id. grant.revoked and user.* carry data.user_id.

Read creator.id. If a delivery has no top-level creator, fall back to data.creator.id, or data.user_id for grant.revoked and user.*. All three hold the same value.

Verifying

Deliveries are signed with the Standard Webhooks headers webhook-id, webhook-timestamp and webhook-signature. Verify the signature with your signing secret before trusting the body, and reject a timestamp more than five minutes old. Any Standard Webhooks library does both. During a secret rotation webhook-signature carries two v1, entries, and a library accepts either one.

Delivery

Answer with a 2xx within a few seconds and do the work afterwards. A failed delivery is retried with backoff. Deliveries can arrive more than once and out of order: use webhook-id to skip duplicates, and fetch the current state from the API when order matters.

Updated