Webhooks
The Webhooks API is the registration surface for outbound event callbacks. A subscription is a (url, events) pair: when one of the listed event types fires for the calling tenant (subscription.created, payment.succeeded, invoice.paid, …), the platform's webhook router POSTs the event payload to url with an HMAC signature derived from the subscription's secret.
Use this for replication into a data warehouse, for triggering downstream automations (Zapier, n8n, in-house workers), or for keeping a customer-facing app in sync without polling. Signed delivery, automatic retry with exponential back-off, and per-subscription delivery logs are all handled by the router.
Writes (POST / PATCH / DELETE) require the commerce scope; reads require read. Disabled subscriptions (isActive=false) stay in the registry but receive no deliveries.
Endpoints
GET /api/v1/outbound-events
Events PeakCommerce has recorded to announce, newest first. An event is written in the same transaction as the change it announces, then fanned out to your webhook subscriptions. failed means it could not be fanned out after 12 attempts; it is also recorded in API Call Stats (integration outbox) and raised as a critical alert, and can be replayed. id is the event id every delivery carries (body id, X-Webhook-Id).
Scoped secret API key — send an sk_live_… value (keys issued before the typed format carry a bare pk_<hex> prefix and are also secret; they still work). A publishable pk_live_…/pk_test_… key is browser-safe, carries no scopes, and is refused by every endpoint in this spec with publishable_key_not_allowed. Coarse scopes: read, commerce, admin (admin covers everything below). Narrow per-resource scopes: journeys|pages :read|write|publish|delete, productsets :read|write|publish|delete, components|rules :read|write|delete, context :read (read-only context tier), catalog :read|write-native. publish is never implied by write.
50Only events created before this time (ISO 8601), for paging
data is a list of { id, eventType, resourceType, resourceId, status, attempts, nextAttemptAt, lastError, occurredAt, dispatchedAt, createdAt }
No content
Validation failed
Insufficient scope (admin required)
GET /api/v1/outbound-events HTTP/1.1
Host: api.peakcommerce.app
X-API-Key: YOUR_API_KEY
Accept: */*
No content
Notes, examples, or caveats for GET /outbound-events go here.
POST /api/v1/outbound-events/{id}/replay
Re-queues a failed event for dispatch, with the same id. Subscriptions that already received it are not sent it again. Audited.
Scoped secret API key — send an sk_live_… value (keys issued before the typed format carry a bare pk_<hex> prefix and are also secret; they still work). A publishable pk_live_…/pk_test_… key is browser-safe, carries no scopes, and is refused by every endpoint in this spec with publishable_key_not_allowed. Coarse scopes: read, commerce, admin (admin covers everything below). Narrow per-resource scopes: journeys|pages :read|write|publish|delete, productsets :read|write|publish|delete, components|rules :read|write|delete, context :read (read-only context tier), catalog :read|write-native. publish is never implied by write.
Re-queued; data is the event
No content
Validation failed
Insufficient scope (admin required)
No such event for this tenant
The event is not failed (not_replayable)
POST /api/v1/outbound-events/{id}/replay HTTP/1.1
Host: api.peakcommerce.app
X-API-Key: YOUR_API_KEY
Accept: */*
No content
Notes, examples, or caveats for POST /outbound-events/{id}/replay go here.
GET /api/v1/outbound-events/health
This tenant's outbound events by status, the age of its oldest undispatched event, and the answering instance's dispatcher sweep stats (last sweep time, duration, outcome counts, last retention prune). Dispatched events are pruned after 30 days; failed ones are kept until replayed.
Scoped secret API key — send an sk_live_… value (keys issued before the typed format carry a bare pk_<hex> prefix and are also secret; they still work). A publishable pk_live_…/pk_test_… key is browser-safe, carries no scopes, and is refused by every endpoint in this spec with publishable_key_not_allowed. Coarse scopes: read, commerce, admin (admin covers everything below). Narrow per-resource scopes: journeys|pages :read|write|publish|delete, productsets :read|write|publish|delete, components|rules :read|write|delete, context :read (read-only context tier), catalog :read|write-native. publish is never implied by write.
data is { counts: { pending, dispatching, dispatched, failed }, oldestUndispatchedAgeSeconds, dispatcher }
No content
Insufficient scope (admin required)
GET /api/v1/outbound-events/health HTTP/1.1
Host: api.peakcommerce.app
X-API-Key: YOUR_API_KEY
Accept: */*
No content
Notes, examples, or caveats for GET /outbound-events/health go here.
GET /api/v1/webhooks
Scoped secret API key — send an sk_live_… value (keys issued before the typed format carry a bare pk_<hex> prefix and are also secret; they still work). A publishable pk_live_…/pk_test_… key is browser-safe, carries no scopes, and is refused by every endpoint in this spec with publishable_key_not_allowed. Coarse scopes: read, commerce, admin (admin covers everything below). Narrow per-resource scopes: journeys|pages :read|write|publish|delete, productsets :read|write|publish|delete, components|rules :read|write|delete, context :read (read-only context tier), catalog :read|write-native. publish is never implied by write.
Max items to return (1–100, default 20)
20Number of items to skip (default 0)
0Filter by active status
Paginated list of webhook subscriptions
API key missing or invalid
GET /api/v1/webhooks HTTP/1.1
Host: api.peakcommerce.app
X-API-Key: YOUR_API_KEY
Accept: */*
No content
Returns every webhook subscription for the calling tenant (active and disabled). The response includes each subscription's url, subscribed events, isActive, last-delivery timestamp, and recent failure count for quick triage.
Requires the read scope.
POST /api/v1/webhooks
Register a webhook subscription for event callbacks. Use `GET /webhooks/event-types` to discover available event type names. Subscribing to `*` receives all events.
Scoped secret API key — send an sk_live_… value (keys issued before the typed format carry a bare pk_<hex> prefix and are also secret; they still work). A publishable pk_live_…/pk_test_… key is browser-safe, carries no scopes, and is refused by every endpoint in this spec with publishable_key_not_allowed. Coarse scopes: read, commerce, admin (admin covers everything below). Narrow per-resource scopes: journeys|pages :read|write|publish|delete, productsets :read|write|publish|delete, components|rules :read|write|delete, context :read (read-only context tier), catalog :read|write-native. publish is never implied by write.
Idempotency key to safely retry without creating duplicates
Public HTTPS endpoint that will receive POST requests. Must use https:// and must not point at a loopback, private-network (10/8, 172.16/12, 192.168/16) or link-local (169.254/16, including cloud metadata) address; otherwise the request is rejected with 400 validation_failed and the reason in details[].message.
Event type names to subscribe to. Use * for all events.
Webhook subscription created. The response includes the secret (shown once) used to verify payloads — see signature scheme in the description.
No content
Validation error — including a url that is not a public https:// endpoint (see url).
POST /api/v1/webhooks HTTP/1.1
Host: api.peakcommerce.app
X-API-Key: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 47
{
"url": "https://example.com",
"events": [
"text"
]
}No content
Registers a new webhook subscription. url must be HTTPS in production. events is the array of event types to subscribe to — use ["*"] to receive everything, or list specific types from the registry exposed by GET /capabilities / event-types listing.
The response 201 carries the new subscription plus the per-subscription signing secret (only ever returned at create time — store it). Use it to verify the X-Signature header on incoming deliveries.
Requires the commerce scope.
DELETE /api/v1/webhooks/{id}
Scoped secret API key — send an sk_live_… value (keys issued before the typed format carry a bare pk_<hex> prefix and are also secret; they still work). A publishable pk_live_…/pk_test_… key is browser-safe, carries no scopes, and is refused by every endpoint in this spec with publishable_key_not_allowed. Coarse scopes: read, commerce, admin (admin covers everything below). Narrow per-resource scopes: journeys|pages :read|write|publish|delete, productsets :read|write|publish|delete, components|rules :read|write|delete, context :read (read-only context tier), catalog :read|write-native. publish is never implied by write.
Webhook deleted
No content
DELETE /api/v1/webhooks/{id} HTTP/1.1
Host: api.peakcommerce.app
X-API-Key: YOUR_API_KEY
Accept: */*
Webhook deleted
No content
Permanently removes the subscription and its delivery history. To stop deliveries without losing history, prefer PATCH with isActive: false.
Requires the commerce scope. Returns 204 on success.
GET /api/v1/webhooks/{id}
Scoped secret API key — send an sk_live_… value (keys issued before the typed format carry a bare pk_<hex> prefix and are also secret; they still work). A publishable pk_live_…/pk_test_… key is browser-safe, carries no scopes, and is refused by every endpoint in this spec with publishable_key_not_allowed. Coarse scopes: read, commerce, admin (admin covers everything below). Narrow per-resource scopes: journeys|pages :read|write|publish|delete, productsets :read|write|publish|delete, components|rules :read|write|delete, context :read (read-only context tier), catalog :read|write-native. publish is never implied by write.
Webhook subscription details
No content
GET /api/v1/webhooks/{id} HTTP/1.1
Host: api.peakcommerce.app
X-API-Key: YOUR_API_KEY
Accept: */*
Webhook subscription details
No content
Returns the full subscription including delivery stats. The signing secret is not returned here — it is only emitted at create time. If you've lost the secret, delete the subscription and create a new one.
Requires the read scope.
PATCH /api/v1/webhooks/{id}
Scoped secret API key — send an sk_live_… value (keys issued before the typed format carry a bare pk_<hex> prefix and are also secret; they still work). A publishable pk_live_…/pk_test_… key is browser-safe, carries no scopes, and is refused by every endpoint in this spec with publishable_key_not_allowed. Coarse scopes: read, commerce, admin (admin covers everything below). Narrow per-resource scopes: journeys|pages :read|write|publish|delete, productsets :read|write|publish|delete, components|rules :read|write|delete, context :read (read-only context tier), catalog :read|write-native. publish is never implied by write.
Same rule as on create: Must use https:// and must not point at a loopback, private-network (10/8, 172.16/12, 192.168/16) or link-local (169.254/16, including cloud metadata) address; otherwise the request is rejected with 400 validation_failed and the reason in details[].message.
Webhook updated
No content
Validation error — including a url that is not a public https:// endpoint.
PATCH /api/v1/webhooks/{id} HTTP/1.1
Host: api.peakcommerce.app
X-API-Key: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 63
{
"url": "https://example.com",
"events": [
"text"
],
"isActive": true
}No content
Partial-update; supply only the fields you want to change. Common patterns: rotate url after a infrastructure migration, narrow events once a downstream consumer is ready for fewer event types, or flip isActive: false to pause deliveries while keeping the subscription for later.
Changing events does not retroactively redeliver missed events. Requires the commerce scope.
GET /api/v1/webhooks/{id}/deliveries
List delivery history for a webhook subscription with optional status and time-range filtering
Scoped secret API key — send an sk_live_… value (keys issued before the typed format carry a bare pk_<hex> prefix and are also secret; they still work). A publishable pk_live_…/pk_test_… key is browser-safe, carries no scopes, and is refused by every endpoint in this spec with publishable_key_not_allowed. Coarse scopes: read, commerce, admin (admin covers everything below). Narrow per-resource scopes: journeys|pages :read|write|publish|delete, productsets :read|write|publish|delete, components|rules :read|write|delete, context :read (read-only context tier), catalog :read|write-native. publish is never implied by write.
Webhook subscription ID
Max items to return (1–100, default 20)
20Number of items to skip (default 0)
0Filter by delivery status (pending | retrying | delivered | dead_letter)
Return deliveries created at or after this ISO 8601 timestamp
Return deliveries created at or before this ISO 8601 timestamp
Paginated delivery history
Webhook subscription not found
GET /api/v1/webhooks/{id}/deliveries HTTP/1.1
Host: api.peakcommerce.app
X-API-Key: YOUR_API_KEY
Accept: */*
{
"data": [
{
"id": "123e4567-e89b-12d3-a456-426614174000",
"webhookSubscriptionId": "123e4567-e89b-12d3-a456-426614174000",
"eventType": "text",
"status": "pending",
"statusCode": 1,
"responseBody": "text",
"attempts": 1,
"maxAttempts": 1,
"lastAttemptAt": "2026-01-01T00:00:00.000Z",
"nextRetryAt": "2026-01-01T00:00:00.000Z",
"createdAt": "2026-01-01T00:00:00.000Z"
}
],
"pagination": {
"total": 1,
"limit": 1,
"offset": 1,
"hasMore": true
}
}Notes, examples, or caveats for GET /webhooks/{id}/deliveries go here.
GET /api/v1/webhooks/{id}/deliveries/{deliveryId}
Get a single delivery record including request payload, response body, and attempt history
Scoped secret API key — send an sk_live_… value (keys issued before the typed format carry a bare pk_<hex> prefix and are also secret; they still work). A publishable pk_live_…/pk_test_… key is browser-safe, carries no scopes, and is refused by every endpoint in this spec with publishable_key_not_allowed. Coarse scopes: read, commerce, admin (admin covers everything below). Narrow per-resource scopes: journeys|pages :read|write|publish|delete, productsets :read|write|publish|delete, components|rules :read|write|delete, context :read (read-only context tier), catalog :read|write-native. publish is never implied by write.
Webhook subscription ID
Delivery ID
Delivery record
A single webhook delivery attempt record.
The event type that triggered this delivery.
Current delivery status. dead_letter means max retry attempts were exhausted.
HTTP status code returned by the consumer endpoint.
First 1000 chars of the consumer response body.
Number of delivery attempts made so far.
Maximum number of attempts before dead-lettering.
When the next retry is scheduled (null if delivered or dead-lettered).
Not found
GET /api/v1/webhooks/{id}/deliveries/{deliveryId} HTTP/1.1
Host: api.peakcommerce.app
X-API-Key: YOUR_API_KEY
Accept: */*
{
"id": "123e4567-e89b-12d3-a456-426614174000",
"webhookSubscriptionId": "123e4567-e89b-12d3-a456-426614174000",
"eventType": "text",
"status": "pending",
"statusCode": 1,
"responseBody": "text",
"attempts": 1,
"maxAttempts": 1,
"lastAttemptAt": "2026-01-01T00:00:00.000Z",
"nextRetryAt": "2026-01-01T00:00:00.000Z",
"createdAt": "2026-01-01T00:00:00.000Z"
}Notes, examples, or caveats for GET /webhooks/{id}/deliveries/{deliveryId} go here.
POST /api/v1/webhooks/{id}/deliveries/{deliveryId}/replay
Replay a delivery — re-enqueues the original payload for re-delivery. Works for any status including dead_letter.
Scoped secret API key — send an sk_live_… value (keys issued before the typed format carry a bare pk_<hex> prefix and are also secret; they still work). A publishable pk_live_…/pk_test_… key is browser-safe, carries no scopes, and is refused by every endpoint in this spec with publishable_key_not_allowed. Coarse scopes: read, commerce, admin (admin covers everything below). Narrow per-resource scopes: journeys|pages :read|write|publish|delete, productsets :read|write|publish|delete, components|rules :read|write|delete, context :read (read-only context tier), catalog :read|write-native. publish is never implied by write.
Webhook subscription ID
Delivery ID
Replay enqueued. The delivery will be re-attempted asynchronously and its status updated.
No content
Not found
POST /api/v1/webhooks/{id}/deliveries/{deliveryId}/replay HTTP/1.1
Host: api.peakcommerce.app
X-API-Key: YOUR_API_KEY
Accept: */*
No content
A replay starts a fresh series of up to 5 attempts, with the same backoff as an original delivery. While a replay is attempting, the automatic retry schedule leaves that delivery alone, so a replay and an automatic retry never fire together. A replay is a new delivery of the same payload, so your endpoint may see the event again; process it idempotently.
Deliveries that were dead-lettered because they stayed undelivered for 24 hours, or because the subscription was inactive, are replayable here once the endpoint is healthy again.
POST /api/v1/webhooks/{id}/rotate-secret
Rotate the signing secret. The new secret signs deliveries immediately; the previous one keeps verifying for 24 hours so the endpoint can be redeployed without dropping events.
Scoped secret API key — send an sk_live_… value (keys issued before the typed format carry a bare pk_<hex> prefix and are also secret; they still work). A publishable pk_live_…/pk_test_… key is browser-safe, carries no scopes, and is refused by every endpoint in this spec with publishable_key_not_allowed. Coarse scopes: read, commerce, admin (admin covers everything below). Narrow per-resource scopes: journeys|pages :read|write|publish|delete, productsets :read|write|publish|delete, components|rules :read|write|delete, context :read (read-only context tier), catalog :read|write-native. publish is never implied by write.
Secret rotated. The response carries the new secret (shown once), previousSecretExpiresAt, and overlapHours.
Webhook subscription not found
POST /api/v1/webhooks/{id}/rotate-secret HTTP/1.1
Host: api.peakcommerce.app
X-API-Key: YOUR_API_KEY
Accept: */*
No content
The new secret is returned once, in this response — there is no way to fetch it again afterwards.
Rotation is designed so you never have to coordinate a simultaneous cutover:
Call this endpoint and store the returned
secret.Deploy it to your endpoint any time within
overlapHours(24). Deliveries in this window carry a signature under both the new and the previous secret, so an endpoint still holding the old one keeps verifying normally.After
previousSecretExpiresAtpasses, only the new secret signs deliveries.
Because the header can carry more than one signature, your verifier must split X-Webhook-Signature on commas and accept the delivery if any entry matches — see the signature scheme. A verifier that compares the whole header against a single digest works fine until the first rotation, then rejects every delivery for 24 hours.
GET /api/v1/webhooks/event-types
List all supported webhook event types that can be used in subscription `events` arrays
Scoped secret API key — send an sk_live_… value (keys issued before the typed format carry a bare pk_<hex> prefix and are also secret; they still work). A publishable pk_live_…/pk_test_… key is browser-safe, carries no scopes, and is refused by every endpoint in this spec with publishable_key_not_allowed. Coarse scopes: read, commerce, admin (admin covers everything below). Narrow per-resource scopes: journeys|pages :read|write|publish|delete, productsets :read|write|publish|delete, components|rules :read|write|delete, context :read (read-only context tier), catalog :read|write-native. publish is never implied by write.
List of platform-supported event types
GET /api/v1/webhooks/event-types HTTP/1.1
Host: api.peakcommerce.app
X-API-Key: YOUR_API_KEY
Accept: */*
List of platform-supported event types
{
"data": [
{
"name": "text",
"category": "text",
"description": "text"
}
],
"total": 1
}Notes, examples, or caveats for GET /webhooks/event-types go here.
Last updated
Was this helpful?
