- Turn a webpage into clean markdown/HTML
- Crawl an entire website and save every page as markdown
- Get all webpages under a domain
- Extract every image on a webpage
Integrate Context.dev's scraping endpoints in your app
Prerequisites
-
A Context.dev API key. Sign up at context.dev/signup, copy the key from the dashboard (prefix
ctxt_secret_), and export it: -
An SDK (optional). Install for your language, or skip the install and call directly with
curl:
Scrape a single page to Markdown
GET /web/scrape/markdown scrapes any URL into LLM-ready GitHub Flavored Markdown. Bot protection and geo-blocks are handled by automatic proxy escalation; pass useMainContentOnly: true to drop nav, footer, sidebars, and other chrome.
The endpoint transparently handles HTML, XML, JSON, text, Markdown, SVG, PDF, DOCX, DOC, XLSX, XLS, PPTX, PPT, and CSV. Excel workbooks come back as one GFM table per sheet (with each sheet name as an ## heading); PowerPoint decks come back as slide-structured markdown (one ## Slide N: Title per slide, followed by body text, tables, and speaker notes); CSV files come back as a single GFM table, with any comma-less leading line surfaced as text above it. Unsupported formats (images, media, archives) return a 415.
maxAgeMs return the cached scrape.
Request Parameters
Response
Get raw HTML instead
Get raw HTML instead
To get the page as raw HTML:1 credit per callRequest Parameters
Response
Crawl a whole site
POST /web/crawl takes a seed URL and returns an array of scraped pages in one call. That’s exactly the shape you want for seeding a RAG index or building a knowledge base.
Request Parameters
Response
Get all URLs of a domain
GET /web/scrape/sitemap reads sitemap.xml from a domain root, follows any nested sitemap indexes, and returns a de-duplicated URL list without rendering any of the pages. Use it for cheap coverage of large sites or to feed a downstream scraper with a curated list.
Request Parameters
Response
Extract every image on a page
GET /web/scrape/images takes a URL and returns a manifest of every image referenced on the page: <img> tags, inline <svg>, CSS background images, <picture> sources, OpenGraph and Twitter card images, favicons.
Opt into enrichment to also get measured dimensions, a CDN-hosted copy, and a visual-type classification per image.
Request Parameters
Response
The base manifest is 1 credit. Setting any
enrichment flag (resolution, hostedUrl, or classification) bumps the entire call to 5 credits, even if only one image qualifies for enrichment.
Run browser actions before scraping
Some pages only reveal their real content after a user interacts — dismissing a cookie banner, clicking “Load more”, switching a tab, or waiting for an animation. Pass anactions array to /web/scrape/markdown, /web/scrape/html, or /web/scrape/images to run up to 5 ordered browser actions after the page loads and before content is captured.
Actions require a paid plan. Free-tier keys receive a
403 PAID_PLAN_REQUIRED. When any action is provided, the request costs 2 credits (5 for enriched images) and both the scrape cache and any HTTP/PDF fast paths are bypassed.do:
perform to trigger the interaction followed by a short wait so the DOM can settle before capture.
Use cases
- Build a RAG pipeline from a docs site by crawling and chunking the returned Markdown.
- Cut LLM token bills by feeding clean Markdown instead of raw HTML.
- Seed a vector index without managing scrapers or proxy infrastructure.
- Monitor competitors’ marketing pages by scraping them on a schedule.
Next steps
Prefetch for Faster Response
Hide cold-hit latency from your users.
Handle Rate Limits
Backoff strategies, client cache, and prefetch fallbacks.
Best Practices
Caching, error handling, and key hygiene.
Troubleshooting
Status codes, retry patterns, and common errors.