Skip to content

New: deep research, balance and auto-reload tools in the keyless MCP server. Install in one line

Contents

Fetch pages as Markdown, with optional query-aware highlights and a pruned context. Billed per page that loads.

POST/v1/contents

Try it

Credits: 1 per URL that loads (max 10)Also at: /contents

Fetch pages as Markdown, with optional query-aware highlights. Failed URLs come back in statuses and are not billed.

Parameters

NameInTypeRequiredDescription
urls / idsbodystring[]yes1 to 10 URLs in total.
textbodyboolnoReturn the page as Markdown. Default true.
highlightsbodybool | {query, numSentences, highlightsPerUrl}no400 to 700 character Markdown chunks, not sentences: numSentences is accepted and ignored.
pruned_contextbodyboolnoReturn prunedContext for the highlight query.

Example request

curl -s https://api.contextfetch.dev/v1/contents \  -H "Authorization: Bearer YOUR_API_KEY" \  -H "Content-Type: application/json" \  -d '{"urls":["https://docs.python.org/3/library/asyncio-task.html"],"text":true,"highlights":{"query":"task groups"}}'

Example response

{
  "requestId": "a1b2c3d4e5f60718293a4b5c6d7e8f90",
  "results": [
    {
      "id": "c7e1a2b3-4d5e-5f60-8a9b-0c1d2e3f4a5b",
      "url": "https://docs.python.org/3/library/asyncio-task.html",
      "title": "Coroutines and Tasks",
      "text": "# Coroutines and Tasks\n\n...",
      "highlights": ["...the chunk most relevant to task groups..."],
      "highlightScores": [0.95],
      "prunedContext": "## Task Groups\n\n..."
    }
  ],
  "costDollars": {"total": 0.001}
}

Response headers

HeaderMeaning
X-Credits-RemainingOn every billable response: free requests left today for keyless calls, credits left for a paid key.

Errors

StatusBodyWhen
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.
422-Request validation failed, e.g. a query over 2,000 characters or a threshold outside 100 to 100,000.