Reader /r/
Any public URL as Markdown in one GET. Add ?q= to keep only the chunks relevant to a question.
GET/r/{url}
Try itCredits: 1
Any public URL as Markdown (text/markdown). Add ?q= to prune the page to the chunks relevant to a question.
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| url | path | string | yes | Full http(s) URL. GitHub blob URLs are read as raw files, arXiv PDFs as their HTML versions. |
| q | query | string | no | Question or topic to prune to. |
Example request
curl -si "https://api.contextfetch.dev/r/https://docs.python.org/3/library/asyncio-task.html?q=task+groups" \ -H "Authorization: Bearer YOUR_API_KEY"Example response
HTTP/2 200
content-type: text/markdown; charset=utf-8
x-token-savings: 91.0
x-raw-tokens: 18240
x-output-tokens: 1650
## Task Groups
...Response headers
| Header | Meaning |
|---|---|
| X-Token-Savings | Percent saved: Markdown vs raw HTML, or pruned vs full Markdown when q is given. |
| X-Raw-Tokens | Tokens before, ceil(chars / 4). |
| X-Output-Tokens | Tokens returned. |
| X-Credits-Remaining | On every billable response: free requests left today for keyless calls, credits left for a paid key. |
Errors
| Status | Body | When |
|---|---|---|
| 400 | {"error": "url_not_allowed"} | The URL is not public http(s): private, loopback, link-local and similar addresses are rejected, also after redirects. |
| 401 | {"error": "invalid_api_key"} | The key is unknown. |
| 402 | {"error": "insufficient_credits" | "keyless_limit", "message": "...", "checkout_url": "...", "pricing": {...}, "packs": [...], "action": {"type": "payment_link", "url": "https://api.contextfetch.dev/buy/instant", "prompt_to_user": "..."}} | Out of credits, or the keyless allowance is used up. Also sends X-Payment-URL. |
| 502 | {"error": "fetch_failed", "message": "..."} | The target page could not be fetched. |