Repository navigation
Let agents start and poll scans over HTTP - #68
Conversation
POST /api/scans with an API key starts a scan, or returns the running or recent one, by the same rules as the website: 202 while it runs, 200 when finished, with a poll URL. New scans spend the key's 10 a day; every request is logged against the key. GET /api/scans/:id returns the status and, once finished, the report; reading needs no key. Bodies are the same shape as /s/<domain>.json. Clear JSON errors: 400, 401, 404, 429 with Retry-After. CORS allowed, preflight answered. The README documents it, until the agents page (#39) exists. Closes #37 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Drippa Sign-Off: HTTP API for agents to start and poll scans✅ Delivers ticket #37 — 5 of 5 outcomes What was promised
Not in this change: The agents page, its Markdown version, the llms.txt file and the new header, footer and home page links from #39. Proof Steps based on ticket #37, the pull request description and the code change. Test it yourself (3 steps)Behaviour change with no page to click.
DetailsAgents and scripts can now start a scan with a self-serve key, or get back the running or recent scan for that domain, and then poll for the result without a key. Errors come back as plain JSON: bad domain or body, missing or invalid key, unknown scan, and hitting the daily limit. The website's scan form now starts scans through the same shared step as the API, and the README gains an HTTP API section. Test coverage: ✅ Well covered — Tests cover starting, reusing a fresh scan, forcing a new one, usage logging, the daily limit, every error case and polling until done. 🔍 Checked:
Updated by Drippa • 2026-10-12 19:34 UTC Comment |
Closes #37
Covers both "Done when" lines of #37 (updated: documented in the README until the agents page, #39, exists): start, reuse of a fresh scan, poll until done and each error case are tested.
What changes
POST /api/scanswithAuthorization: Bearer <key>and{ "domain": "…", "force"?: true }:requestScanrules as the website: one running scan per domain, finished scans under 24 h are reused unlessforce.Retry-After: 3), 200 when finished. The body is the/s/<domain>.jsonshape plusreusedandpoll.GET /api/scans/:id: status, and the report once finished. No key needed, since reading is free like the report pages. Cached like the JSON twin (2 s while running).{ error, message }:400forinvalid_jsonorinvalid_domain.401forinvalid_key, withWWW-Authenticate.404fornot_found.429forrate_limited, withresetAtandRetry-After.Access-Control-Allow-Origin: *and anOPTIONSpreflight that allowsAuthorization, so browser-based agents can call it.lib/start-workflow.ts: the website's scan form and the API now start scans through the same helper.Checked
poll,Retry-After, one new-scan spend).reused: true, nothing spent);forcestarts a new one and spends.example.invalid(202,Retry-After), poll (202), the 400/401/404 cases, and theOPTIONSpreflight. A scan running to completion wasn't checked locally, because the background run can't share the single-connection test database. The unit tests cover polling through to "done".pnpm lint,pnpm typecheck,pnpm testpass.Note
The README uses
https://stackprobe.tech, which is team-only until we open it. It describes how the API will work once public.🤖 Generated with Claude Code