Webhooks
Pi pushesjob.completed and job.failed events to your registered HTTPS endpoints when async jobs reach a terminal state. This lets automation platforms (n8n, agent runners, internal pipelines) react immediately without polling.
Pi signs every delivery with an HMAC-SHA256 signature in the
X-Pi-Signature header. Verify the signature on your server before processing any payload. Make your webhook handler idempotent using the evt_pi_* event ID to deduplicate retries.List webhooks
GET /api/v1/webhooks
Returns all webhooks registered for the authenticated organization.
Request
Response fields
Always
"list".Array of webhook objects. Each item includes:
Register a webhook
POST /api/v1/webhooks
Registers a new webhook endpoint for the authenticated organization.
Request
Body parameters
The HTTPS URL where Pi should deliver events. Must be a valid URL using the
https:// scheme.Shared secret used to sign delivery payloads with HMAC-SHA256. Minimum 8 characters, maximum 500 characters.
Response fields
Always
"webhook".UUID of the newly registered webhook.
The registered URL.
true for newly registered webhooks.ISO 8601 creation timestamp.
ISO 8601 last-updated timestamp.
Enable or disable a webhook
PATCH /api/v1/webhooks/:id
Toggle a webhook on or off without deleting the registration.
Path parameters
UUID of the webhook to update.
Request
Body parameters
Set to
false to disable or true to re-enable the webhook.Delivery
Event types
Pi delivers these event types to registered webhooks:| Event | Trigger |
|---|---|
job.completed | An async job reached the completed terminal state |
job.failed | An async job reached the failed terminal state |
Delivery headers
| Header | Value |
|---|---|
X-Pi-Event | Event type: job.completed or job.failed |
X-Pi-Signature | sha256=<hex> — HMAC-SHA256 signature of the raw JSON body using your webhook secret |
Payload shape
Signature verification (TypeScript / Node.js)
Verify theX-Pi-Signature header before processing any payload:
rawBody — the unparsed request body string — not a re-serialized JSON object. Parsing and re-serializing can change whitespace or key order and invalidate the signature.
Retry behavior
Pi retries delivery on non-2xx responses. Respond with2xx as quickly as possible (before any slow processing) and handle the event asynchronously. Use the evt_pi_* event id to deduplicate retries in your handler.