StreamingLive data
Webhooks
Predictefy can POST a signed event to your HTTPS endpoint when a background job finishes or an execution changes status, so you do not have to poll for either.
Endpoint management is available through the API, the CLI, and the MCP server on deployments where webhooks are enabled. The developer console has no webhook screen yet.
Events
Section titled “Events”| Event | Scope | Fires when |
|---|---|---|
ingest.run.completed | Platform-wide | a catalog refresh finishes |
matcher.run.completed | Platform-wide | a cross-venue matching run finishes |
execution.status.changed | Your account | a submitted execution, cancel, or refresh commits a different status |
conditional.triggered | Your account | an armed take-profit / stop-loss rule was satisfied |
conditional.fired | Your account | a conditional order became a venue submission |
conditional.fire_failed | Your account | a hosted fire ended without a venue submission, or a client reported not_submitted |
conditional.expired | Your account | a conditional order’s expiresAt passed while it was still armed |
The two job events carry that run’s result: job, started_at, finished_at, ok, and a
counts tally. On a failed run ok is false and counts.error holds the message.
execution.status.changed carries lifecycle metadata only:
{ "executionId": "8a4fdf19-49e1-4702-9cb8-31fd9c46f7e1", "venue": "hyperliquid", "status": "filled", "previousStatus": "acked", "occurredAt": "2026-08-01T02:03:04.000Z"}It is tenant-scoped: it reaches only endpoints owned by the execution’s account. Your account id is routing context and is deliberately not in the payload.
The four conditional.* events are tenant-scoped for the same reason. Their payload and the
action field that tells a client-mode customer what to do next are documented in
Conditional orders.
It fires only on a real transition. An unchanged result, a lost concurrent update, or an already-terminal row emits nothing — so a quiet period means nothing changed, not that a delivery was dropped.
Registering an endpoint
Section titled “Registering an endpoint”All routes are API-key authenticated and scoped to your account.
Endpoints must use HTTPS on the default port (443).
curl -s "$PREDICTEFY_API_URL/v1/webhooks" \ -H "Authorization: Bearer pk_live_YOUR_KEY" \ -H "content-type: application/json" \ -d '{"url":"https://example.com/hooks/predictefy","events":["execution.status.changed"]}'The response includes a secret shown exactly once. Store it immediately; it is never returned
again, and listing your endpoints redacts it.
url must be public HTTPS. Localhost, loopback, and private or link-local addresses are
rejected — IPv4, IPv6, and IPv4-mapped-IPv6 literals alike. events must be a non-empty subset of
the table above.
GET /v1/webhooks— your endpoints, secrets redacted.DELETE /v1/webhooks/{id}— delete one, along with its queued deliveries. An id that is not yours returns404.GET /v1/webhooks/{id}/deliveries?after=<cursor>&limit=<n>— delivery rows withid,event,payload,status,createdAt, anddeliveredAt.limitdefaults to 50, capped at 200. Rows are always oldest-to-newest; passnextCursorback asafter. Both SDKs expose this asclient.webhooks.deliveries(id, params).
For local development, predictefy webhooks listen [--endpoint <id>] polls that route every two
seconds. Without an endpoint it creates a temporary non-routable one and deletes it on exit.
--forward http://localhost:PORT/path re-POSTs each payload locally.
Rotating a secret
Section titled “Rotating a secret”Call POST /v1/webhooks/{id}/rotate with your API key to replace an endpoint’s signing
secret immediately. The response’s data.secret is the new raw secret, shown only once;
store it securely and update your receiver. data.rotatedAt records the rotation time.
An endpoint outside your account returns 404.
There is no old-secret grace period. Deliveries claimed after rotation, including queued retries, use the new secret. A delivery already claimed can still arrive signed with the old secret, so account for in-flight requests when switching your receiver.
For zero downtime, use a second endpoint:
- Prepare a second receiver URL that can accept its own signing secret.
- Register a second endpoint with the same event subscriptions, then configure its receiver with the returned secret. Keep the original endpoint and receiver running during setup.
- Verify signed deliveries at the second receiver. Deduplicate events received through both endpoints using the event identities described below.
- Delete the original endpoint once the second receiver is ready. Deletion removes the old endpoint’s queued deliveries; keep handling any already in-flight requests.
New and rotated secrets are stored encrypted at rest and read only when a delivery is signed. This does not change the headers or signature verification contract below.
What a delivery looks like
Section titled “What a delivery looks like”Each delivery is a POST to your URL with these headers:
| Header | Value |
|---|---|
Content-Type | application/json |
X-Predictefy-Event | the event name |
X-Predictefy-Timestamp | Unix seconds when the delivery was signed |
X-Predictefy-Signature | hex HMAC-SHA256 — see below |
Redirects are not followed, and each attempt times out after 10 seconds.
Verifying the signature
Section titled “Verifying the signature”The signature is a hex HMAC-SHA256 over `${timestamp}.${rawBody}` keyed by your endpoint
secret. Recompute it over the exact bytes you received — not a re-serialized object — and compare
in constant time:
import { createHmac, timingSafeEqual } from 'node:crypto';
function verify(rawBody: string, headers: Record<string, string>, secret: string): boolean { const timestamp = headers['x-predictefy-timestamp']; const signature = headers['x-predictefy-signature']; if (!timestamp || !signature) return false; const expected = createHmac('sha256', secret).update(`${timestamp}.${rawBody}`).digest('hex'); const a = Buffer.from(signature, 'hex'); const b = Buffer.from(expected, 'hex'); return a.length === b.length && timingSafeEqual(a, b);}Optionally reject deliveries whose X-Predictefy-Timestamp is far from your clock, to blunt replay
attacks.
Retries
Section titled “Retries”Respond 2xx to acknowledge. Any non-2xx, network error, or timeout is retried with exponential
backoff, then abandoned:
| Attempt | Retry after |
|---|---|
| 1 → 2 | 1 minute |
| 2 → 3 | 5 minutes |
| 3 → 4 | 30 minutes |
| 4 → 5 | 2 hours |
| after 5 failed attempts | marked failed (no further retries) |
Make your handler idempotent. For job events, dedupe on the payload’s job and started_at;
for execution events, on executionId, status, and occurredAt.
Availability
Section titled “Availability”Webhook delivery and endpoint management are available on deployments where webhooks are enabled.
Unavailable calls answer 404 ROUTE_NOT_FOUND and are not charged.