API Documentation — witty-404
witty-404 is an open-source, zero-dependency HTTP error engine hosted globally on Cloudflare Workers edge nodes. It delivers standalone error pages with pure CSS animated diagnostics, formatted JSON payloads, ASCII terminal logs, and dynamic social cards in sub-5ms latency.
Access-Control-Allow-Origin: *. Dynamic responses include strict anti-caching headers (Cache-Control: no-store) so every request delivers fresh comedic relief.
60-Second Terminal Quickstart
Live API Tester Console
Test any witty-404 endpoint directly in your browser without leaving the documentation.
// Click "Send ⚡" to inspect live response
GET /html — Standalone Error Scene
Renders a complete, full-bleed standalone HTML 404 page featuring the diagnostic terminal, animated streaming logs, synchronized airplane flight crash sequence, and action buttons.
Query Parameters
| PARAM | TYPE | DEFAULT | DESCRIPTION |
|---|---|---|---|
| id | string | random | Specific joke ID (e.g. plane-crash, daves-laptop, friday-deploy). |
| theme | string | dark |
Color theme: dark, light, matrix, glitch, or system. |
| tag | string | all | Filter random selection by topic: deploy, infra, legacy, frontend. |
GET /json (or GET /) — Random Joke Payload
Returns the complete structured JSON payload for a disaster joke, including title, subtitle, diagnostic logs array, footnote, and metadata tags.
GET /roast — Dynamic Broken Path Roaster
Substitutes the client's requested URL path into the joke's headline with strict XSS sanitization.
| PARAM | TYPE | REQUIRED | DESCRIPTION |
|---|---|---|---|
| path | string | Yes | The missing URL path (e.g. /api/v2/user/delete). |
| format | string | No | Set to html to receive a standalone rendered page, or omit for JSON. |
GET /terminal — Diagnostic Log Array
Returns an array of strings representing terminal diagnostic steps for direct insertion into custom CLI scripts, CI runners, or custom terminals.
GET /svg — Dynamic 1200x630 Social Card
Generates a crisp 1200x630 vector SVG image with syntax highlights for use in OpenGraph previews, Discord cards, and GitHub README embeds.
GET /text — Plaintext Terminal Banner
Returns a formatted plain text block ready to pipe into terminal scripts, webhooks, or serverless logs without JSON parsing.
Metadata & Utilities: /all, /stats, /count
Explore the disaster catalog, inspect global hit analytics, and query current database metrics.
| ENDPOINT | RESPONSE | DESCRIPTION |
|---|---|---|
GET /all |
JSON Array | Returns all 25+ disaster joke objects. |
GET /stats |
JSON | Returns the global joke impression leaderboard. |
GET /count |
JSON | Returns total active disaster scenarios count. |