# Your first request (/getting-started/first-request)

| Step | HTTP | Expected response | What to do |
| --- | --- | --- | --- |
| Submit | `POST /api/v1/data/requests` | `202` with an `id`; a cache hit may already be `completed` | Save `id` and the idempotency key. |
| Poll | `GET /api/v1/data/requests/{id}` | `200` with `pending`, `running`, or `solving_captcha` while active | Use exponential backoff with jitter and an overall deadline. |
| Complete | same poll endpoint | `200`, `completed` | Only now request the result. |
| Retrieve | `GET /api/v1/data/requests/{id}/result[?format=...]` | `200` | Omit `format` for HTML plus extraction data when available, or choose `html`, `text`, `markdown`, or `data` explicitly. |
| Terminal failure | same poll endpoint | `failed` or `cancelled` | Inspect the public error fields; resubmit only when appropriate. |

The `format` query parameter is optional. When omitted, the response uses `format: "html"` and returns the stored page in `html` (or `null` when unavailable); when an extraction exists, it also includes top-level `data` and metadata-only `extraction`. Set `format` explicitly to return only that content field. Explicit `format=data` requires an extraction recipe and otherwise returns `409 RESULT_FORMAT_UNAVAILABLE`.

To request Markdown, use `/result?format=markdown`. It is deterministically converted from stored HTML without an LLM. Conversion selects a non-empty `<main>` or `[role="main"]`, otherwise a single `<article>`, and falls back to `<body>` when neither is available; common navigation and hidden elements are removed. The returned Markdown is capped at 2 MiB of UTF-8. `result_meta.markdown.source_truncated` is `true` or `false` only when stored metadata explicitly records the source HTML truncation state; `null` means that state is unknown. `original_bytes`, `returned_bytes`, and `truncated` describe the converted Markdown before and after the response cap.

The request states are `pending`, `running`, `solving_captcha`, `completed`, `failed`, and `cancelled`. Polling can skip intermediate states; CAPTCHA handling is not a required stage. A result request before completion returns `409 RESULT_NOT_READY`; explicitly requesting unavailable `data` (without an extraction recipe) returns `409 RESULT_FORMAT_UNAVAILABLE`; an expired retained result returns `410 RESULT_EXPIRED`.

Use `Idempotency-Key` on submission so a network retry does not accidentally create duplicate work. Generate it before the first POST, keep it with the exact body for retries, and use a new key for a new logical request. Do not assume that a submitted request is complete, and do not treat a non-2xx response as a result payload.