DOESCAP DOCS
MODULE 3 / 6 • REST ENDPOINTS

REST ENDPOINTS

All HTTP routes served by ReusableThreadingServer. CORS headers (Access-Control-Allow-Origin: *) and OPTIONS preflight are enabled across every route.

GET /

Serve Relay Frontend

Serves either the built-in responsive dark/light solver UI or your custom HTML template (custom_html / custom_html_path).

EXAMPLE
curl "http://127.0.0.1:8787/"
RESPONSE

Returns 200 OK with text/html; charset=utf-8.

GET /status

Get solver state & parameters

Polled by frontend JavaScript (every 300ms in the default UI) to fetch the active mode, sitekey, rqdata, task name, promo code, and completion flags.

EXAMPLE
curl "http://127.0.0.1:8787/status"
RESPONSE
{
  "mode": "direct",
  "sitekey": "4c672d35-0701-42b2-88c3-78380b0db560",
  "rqdata": "ey...",
  "captcha_host": "discord.com",
  "task_name": "hCaptcha Verification",
  "promo_code": "",
  "solved": false,
  "claimed": false,
  "success_message": "",
  "error": "",
  "rect": null
}
POST /solve

Submit solved captcha token

Dispatched by browser JavaScript when hCaptcha's verification callback fires. Stores the trimmed token and marks the challenge solved.

BODY
token string required
Verified h-captcha-response token string. Missing token returns 400.
{
  "token": "P1_eyJhbGciOi..."
}
EXAMPLE
curl -X POST "http://127.0.0.1:8787/solve" \
  -H "Content-Type: application/json" \
  -d '{"token":"P1_eyJhbGciOi..."}'
RESPONSE
{"ok":true}
GET /frame.jpg

Stream screencast mirror frame

Used in CDP Screencast mode to stream real-time JPEG captures of the puzzle widget. Returns 200 OK (image/jpeg) when a frame is ready, or 204 No Content if no frame has been captured yet.

POST /input

Forward mouse/touch coordinates

Forwards tap and mouse interactions into the headless browser session via CDP, offset by the puzzle iframe's bounding box (rect.x + x, rect.y + y).

PARAMETERS
t string optional (default: "move") — "press" | "move" | "release"
x number optional (default: 0) — Relative horizontal X coordinate
y number optional (default: 0) — Relative vertical Y coordinate
GET /assets/<path>

Serve custom static assets

Active when custom_assets_dir is set. Resolves paths safely with os.path.commonpath containment (blocking directory traversal) and serves files with MIME detection (.html, .css, .js, .json, .png, .jpg, .svg, .ico, .ttf, .woff, .woff2, .otf). Returns 404 Asset Not Found when missing or disabled.