Webhooks
A research arm can land after the search's answer went out. A webhook tells you when it does. The trace is the record; the webhook is the nudge.
The hosted service runs no slow-lane arm today, so on api.jevlin.ai nothing lands late and no webhook is sent. It matters on a deployment that runs the research arms; see Search.
Setting it
On the platform, open the project's Limits page (an owner or admin) and set a webhook: an https URL on a public host, and a secret of 16 to 256 bytes. The router then sends one search.slow_lane.landed event per landed arm.
The event
{"event": "search.slow_lane.landed",
"request_id": "…", "tenant_id": "…", "provider": "parallel",
"status": "ok", "cost_micros": 52000, "landed_at": "…"}
It carries no query and no results; read those from the trace, GET /v1/traces/{request_id}. It is sent only after the arm is billed and the trace amended, so that read already shows it. A search answered from the cache calls no arm, so it sends no event. Deliveries come with User-Agent: jevlin-webhook/1.
Verifying it
Each delivery has three headers:
| header | value |
|---|---|
X-Jevlin-Event | search.slow_lane.landed |
X-Jevlin-Timestamp | Unix seconds |
X-Jevlin-Signature | sha256= and the hex HMAC-SHA256 of the timestamp, a ., and the raw body, keyed with your secret |
Before trusting a delivery, compute the HMAC, compare it in constant time, and reject a timestamp more than a few minutes old:
mac = hmac.new(secret, f"{ts}.".encode() + body, hashlib.sha256).hexdigest()
ok = hmac.compare_digest("sha256=" + mac, request.headers["X-Jevlin-Signature"])
Retries
Answer with a 2xx quickly. A delivery is tried up to four times in all (after 1, 2 and 4 seconds, each with a 5-second timeout) on a timeout, a 5xx, a 408 or a 429; any other 4xx ends it. A delivery can arrive more than once, so de-duplicate on request_id and provider.
A client that must not miss a landing reads the trace back.