Skip to main content

Webhooks

Subscribe to outbound events and receive HTTP POST notifications when shifts are filled, credentials expire, payroll runs are submitted, and more.

Event Types

Create a Subscription

Internal operators with cross-org access should also pass orgUnitId as a query parameter or JSON field targeting the customer org unit (team). The response includes a signingSecret (shown once):

Payload Format

Wire JSON body (also stored on delivery rows):
data fields vary by event (for example payroll_completed includes payrollRunId, externalPayrollId, and status).

Signature Verification

Every webhook includes an X-NexSpace-Signature header for verification:
The event name is repeated in X-NexSpace-Event. Verify the body with HMAC-SHA256:

Retry Policy

A delivery is considered successful when your endpoint responds with a 2xx status. Any other status (or a connection error/timeout) schedules a retry on a fixed exponential backoff — the initial send plus up to 5 retries (6 attempts total): Retries are processed by a background job that ticks about once a minute, so nextRetryAt on a delivery row is the earliest a re-attempt will fire, not an exact time. Each attempt is recorded on the delivery (status code, response body, error) and visible via Delivery Inspection. Every retry request also carries an X-NexSpace-Retry header with the attempt number.

Auto-disable (dead-letter)

If the final (6th) attempt still fails, the subscription is automatically disabled (isActive: false) so a broken endpoint stops consuming retries. When this happens NexSpace:
  • stamps the reason and last error on the subscription’s metadata (disabledReason: "max_retries_exceeded", disabledAt, lastError),
  • writes an audit-log entry (WEBHOOK_SUBSCRIPTION_DISABLED), and
  • notifies the subscription’s creator in-app so a human can act.
Once your endpoint is healthy again, re-enable the subscription via PATCH /api/webhooks/{id} with { "isActive": true } (or from Settings → Platform webhooks). New events resume delivery immediately; NexSpace does not replay events that occurred while the subscription was disabled.

Delivery Inspection

View recent delivery attempts for a subscription:
Returns the subscription detail plus the last 25 delivery attempts with status codes, response bodies, and error messages. The Settings UI exposes the same data under Platform webhooks → Deliveries.

Test Events

POST /api/webhooks/{id}/test sends a type: test signed POST to that subscription’s URL only, even if the subscription does not list test or * — use this to verify connectivity.
Or via CLI:

Local debugging with the CLI

nexspace events listen starts a local HTTP receiver, creates a temporary subscription, verifies X-NexSpace-Signature when signingSecret is returned, and prints deliveries as JSONL. Cloud API hosts cannot reach 127.0.0.1 — tunnel first:
Point NEXSPACE_BASE_URL at a local API if you do not need a tunnel. See CLI Commands → Webhooks & events.