Docs / Refresh
Refresh
Start a pipeline run (operator).
- Auth
- client bearer + X-Admin-Token
- Cache-Control
no-store- Source of truth
clients/openapi.jsonanddocs/API.md§12
202withCache-Control: no-storeandLocation: /v1/health?run_id=<id>.409 {"detail":"a refresh is already running"}when the scheduler's run lock is held; the guard answers before a worker thread is started.401 invalid admin token;503whenNEWS_ADMIN_TOKENis unset.- This is an operator route. It is documented because it exists and shares the client bearer; do not call it from a renderer or your own cron.
Webhook delivery admin — X-Admin-Token
backend/app/api/webhook_admin.py, mounted by webhook_admin.mount(app) under /v1/admin/webhooks. This is the read-and-replay surface over the signed-delivery outbox (backend/app/webhooks.py) that used to be reachable only over SSH (python -m app.workers.webhook_worker --list-dead / --requeue-dead).
A webhook URL is a credential. Every response carries the endpoint masked: scheme://host[:port]/# plus a 12-hex digest of the path and query. The path and query never appear in a body, in a header or in this application's log lines, and the endpoint filter below accepts only the masked form. The stored last_error text is likewise never emitted: it embeds up to 200 characters of the receiver's own response body.
Auth is the same admin gate as §3.4: 503 when NEWS_ADMIN_TOKEN is unset, 401 when the token is wrong, and neither value is ever echoed. All three routes are no-store.
GET /v1/admin/webhooks/deliveries
Newest first, in the total order (updated_at DESC, id DESC) — the row id breaks every timestamp tie, so two deliveries written in the same second still have one order.
| Parameter | Default | Bounds | ||
|---|---|---|---|---|
status | all | pending \ | delivered \ | dead; anything else 400 |
endpoint | all | the masked form (https://hooks.example.com/#1a2b3c4d5e6f); a raw URL is 400 | ||
limit | 50 | 1..200; out of range is 400 | ||
cursor | — | next_cursor from the previous page; any other value is 400 |
delivery_idiswebhooks.delivery_id(item_id, endpoint, event)— the samewhk_<32 hex>handle the receiver dedupes on, so a customer can line up this listing with what their own endpoint logged.last_error_classis one oftimeout,tls,transport,endpoint_refused,payload_invalid,http_429,http_5xx,http_4xx,http_other,other, ornullwhen the row has never failed.last_http_statusis the answer's status code when the failure was an HTTP answer, elsenull. The raw text is not a field.last_attempt_atis the row'supdated_at(its last state change). The one exception is a row replayed but not yet attempted again: a replay stamps it without a send.- An empty outbox is an empty page with
count: 0andnext_cursor: null, never an error. If the outbox table does not exist yet,limitationssays so in one line. scannedis how many rows this request read to fill the page (anendpointfilter is matched in Python against the digest);next_cursoris opaque and must be passed back unchanged. Rows inserted mid-walk with a newerupdated_atsort ahead of the cursor and do not disturb the remaining pages.
POST /v1/admin/webhooks/deliveries/{delivery_id}/replay
Requeues exactly one dead delivery: status -> pending, attempts -> 0, last_error -> "", next_attempt_at -> now, delivered_at -> null. No row is inserted and no attempt is counted, so replaying is not a delivery: the dispatcher makes the next attempt on its next pass.
- Idempotent in the safe direction. A second replay of the same id finds the row no longer
deadand answers409, so a retried request can never create a second attempt or a duplicate delivery. 409 {"detail": {"error": "not_replayable", "delivery_id": "...", "status": "pending", "message": "only a dead delivery can be replayed; nothing was changed"}}for any row that ispendingordelivered.404for an id with no row;400for a value that is not awhk_<32 hex>id.- The requeue is one conditional
UPDATE ... WHERE status = 'dead'(webhooks.requeue_dead), so two concurrent replays cannot both succeed.
GET /v1/admin/webhooks/summary
oldest_dead_letterisnullwhen nothing is dead.worker.stateis evidence only, and saysunknownrather than guessing:disabled—NEWS_WEBHOOK_ENDPOINTSis empty, so push delivery is off;unknown— there is nothing to observe (no pending rows, or no outbox table yet);stalledisnull, notfalse, so "not observed" cannot read as "healthy";draining— pending rows exist and none is more than the grace window past due;stalled— at least one pending row is more thangrace_secondspast due. A stopped dispatcher and one merely far behind on a slow endpoint leave identical evidence, which is whatreasonsays instead of claiming which one it is.- The staleness question is asked of the rows, not of a pid: a worker that is running but cannot deliver still shows overdue rows.
Description: docs/API.md §12
Parameters
| Name | In | Required | Type | Example | Notes |
|---|---|---|---|---|---|
X-Admin-Token | header | no | string | Operator token (NEWS_ADMIN_TOKEN). A client bearer is refused here. |
Example request
curl -sS -X POST \
'https://vg.tempproject.online/v1/refresh' \
-H "Authorization: Bearer $NEWS_KEY" \
-H "X-Admin-Token: $NEWS_ADMIN_TOKEN"import json
import os
import urllib.request
URL = "https://vg.tempproject.online/v1/refresh"
KEY = os.environ["NEWS_KEY"]
def call() -> dict:
req = urllib.request.Request(URL, method="POST", headers={
"Authorization": f"Bearer {KEY}",
"X-Admin-Token": os.environ["NEWS_ADMIN_TOKEN"],
})
with urllib.request.urlopen(req, timeout=15) as res:
print(res.status, res.headers.get("Location"))
text = res.read().decode("utf-8")
return json.loads(text) if text else {}
if __name__ == "__main__":
print(call())const res = await fetch(
"https://vg.tempproject.online/v1/refresh",
{
method: "POST",
headers: {
authorization: `Bearer ${process.env.NEWS_KEY}`,
"x-admin-token": process.env.NEWS_ADMIN_TOKEN!,
},
},
);
if (!res.ok) throw new Error(`${res.status} ${await res.text()}`);
console.log(res.headers.get("etag"), await res.json());The requests are generated from the path template and the parameters in clients/openapi.json, so a new parameter appears here without an edit to this site.
Example response
{"run_id": "b3cd20b4cce24570858a3c5fd83a6a71", "status": "started"}Response example in docs/API.md §12 (POST /v1/refresh)
Failures
This operation can answer 202, 400, 401, 404, 409, 422, 429, 503. The full envelope for each status, with its body, is on Errors.