Receiving webhooks
Beta. Webhooks push project events to your server, so you don't have to poll. The routes and event payloads can still change; breaking changes are announced in the changelog.
Scope
Managing webhooks needs the webhooks:manage scope. Only admin and owner keys can hold it. A key without it gets 403 insufficient_scope. See Authentication & scopes.
Subscribe
curl -s https://api.arbitr.ai/v1/webhooks \
-X POST \
-H "X-API-Key: abr_live_…" \
-H "Content-Type: application/json" \
-d '{"url": "https://example.com/arbitr/webhook", "event_types": ["project.completed", "project.failed"]}'
- The URL must be public
https. Private and local addresses are refused. - The URL can't be changed. To move to a new URL, create a new webhook and disable the old one.
- A live key creates a live webhook; a test key creates a test webhook. See Test mode.
- The response carries
plaintext_secret. It is shown once. Store it now.
Send a signed webhook.test event to check your endpoint with POST /v1/webhooks/{webhook_id}/test.
What we send
Each event is a POST with a JSON body:
{
"id": "0b6f3d1e-5a42-4f0e-9d7c-8a1b2c3d4e5f",
"event_id": "7c9e6679-7425-40de-944b-e07fc1f90ae7",
"event": "project.completed",
"created_at": "2026-10-29T09:14:22+00:00",
"mode": "live",
"data": {
"project_id": "3f2a9c1e-4b7d-4c8a-9f10-2d6e5b7c8a91",
"org_id": "c1d2e3f4-0a1b-4c2d-8e3f-5a6b7c8d9e0f",
"status": "completed",
"requester": null,
"reference": "order-1042"
}
}
| Field | Meaning |
|---|---|
id |
The delivery. The same on every retry and redelivery. |
event_id |
The event. The same for every webhook that receives it. Not sent on webhook.test. |
event |
The event name. |
created_at |
When the event happened. |
mode |
live or test. |
data |
Event details. |
Every project event's data has project_id, org_id, status, requester (an object, or null) and reference (a string, or null). Some events add fields:
| Event | Added to data |
|---|---|
project.awaiting_payment |
required, available, shortfall |
project.hold_ready |
hold: kind, stage, quote_version, expires_at, intelligence_credits, trust_credits, estimated_completion_at, lines, fees. A review hold (kind review, audio and video projects, beta) has only kind, stage and expires_at |
project.confirmed |
hold: kind, quote_version, confirmed_at |
project.hold_expired |
hold as on project.hold_ready, and archived |
project.failed |
reason: null, or kind, extension, file_type, detail when the cause is one the requester can act on |
project.completed |
Can include completed_at, avg_quality_score, name, deliverables_count |
project.review_requested, project.review_awaiting_payment, project.review_completed |
destination, service_plan; project.review_awaiting_payment also adds required, available, shortfall |
hold.lines and hold.fees have the same shape as lines and fees on the quote. project.created, project.cancelled and project.published add nothing. The full schema of every event is in the API reference under Webhooks.
Headers on every delivery:
| Header | Value |
|---|---|
X-Arbitr-Event |
The event name. |
X-Arbitr-Delivery-Id |
Matches id. |
X-Arbitr-Event-Id |
Matches event_id. Not sent on webhook.test. |
X-Arbitr-Subscription-Id |
The webhook the delivery is for. |
X-Arbitr-Timestamp |
Unix time in seconds, when the delivery was signed. |
X-Arbitr-Signature |
sha256= and the hex HMAC-SHA256 of <timestamp>.<body>. |
Verify the signature
Anyone can POST to your URL, so check the signature before you act on a body.
- Read the raw request body bytes. Don't parse and re-serialise the JSON; a different key order or whitespace changes the signature.
- Build
<timestamp>.<body>: theX-Arbitr-Timestampvalue, a dot, then the raw body. - Compute the HMAC-SHA256 of it with your
plaintext_secret, and prefix the hex digest withsha256=. - Compare it with
X-Arbitr-Signaturein constant time. - Reject the delivery if the timestamp is more than 5 minutes from your clock. This stops a captured delivery from being replayed.
import hmac
import time
from hashlib import sha256
def is_valid(secret: str, timestamp: str, body: bytes, signature: str) -> bool:
if abs(time.time() - int(timestamp)) > 300:
return False
expected = "sha256=" + hmac.new(
secret.encode(), f"{timestamp}.".encode() + body, sha256
).hexdigest()
return hmac.compare_digest(expected, signature)
Handle deliveries
- Answer fast with a
2xx. Do the work after you have answered. Any other status, or no answer, counts as a failure. - Dedupe on
id. A delivery can arrive more than once, and a redelivery keeps itsid. Dedupe onevent_idtoo if you subscribe more than one webhook to the same event. - Don't rely on order. Events can arrive out of order.
data.statusnames the event's own state (usually the last part ofevent), not the project's lifecycle status, so don't order by it. Usecreated_atto decide which event is newer, or read the project for its current status. - Expect retries. A failed delivery is retried up to 5 more times, after 1 minute, 5 minutes, 30 minutes, 2 hours and 6 hours. Then it is abandoned.
- Failures disable the webhook. After 5 failed deliveries in a row the webhook is disabled and
disabled_reasonisauto_failures. Fix your endpoint, then setstatustoactivewithPATCH /v1/webhooks/{webhook_id}. We also email your organisation's admins when this happens. Events that happen while it is disabled are held, and when you re-enable it we send the most recent ones (up to 1000) again, along with the deliveries that failed just before it was disabled. Expect a burst, and dedupe.
Check and redeliver
GET /v1/webhooks/{webhook_id}/deliveries lists deliveries, newest first, with their status and the last_response_status your endpoint returned. Filter with status and event.
POST /v1/webhooks/{webhook_id}/deliveries/{delivery_id}/redeliver queues a delivery to be sent again. It answers 409 delivery_in_progress if the delivery is already queued, and 409 subscription_disabled if the webhook isn't active.