Docs
Scraping workflows

Scrape a page

Choose formats, content filters, browser actions, cache behavior, and proxy policy.

POST /scrape is the general-purpose endpoint for one URL. It renders the page, applies optional actions and filters, and returns the formats requested in the body.

{
  "url": "https://example.com/docs",
  "formats": ["markdown", "links"],
  "onlyMainContent": true,
  "proxy": "auto",
  "maxAge": 3600000
}

On a client-rendered page, Berrycrawl can wait for the selected tab or route to display its content when only navigation or support controls have appeared. This wait uses the request’s existing timeout. For Markdown-only requests, an otherwise empty page can return content from a visible frame that fills most of the viewport. A frame on another origin must load a public page without authentication.

Berrycrawl follows immediate redirects declared through an HTTP Refresh header or an HTML meta refresh tag. The metadata url field reports the final destination.

Failed scrape outcomes

Check the response body's success field on every response. Berrycrawl returns HTTP 200 with success: false for a completed failure such as an unavailable page, a target error, or a scrape timeout. Read code, message, and retryable to choose the next action. For example, use another source for SCRAPE_CONTENT_UNAVAILABLE or retry with backoff for SCRAPE_TIMEOUT. These results use zero credits.

CAPTCHA and anti-bot challenges

A confirmed challenge returns HTTP 200 with a blocked result and zero credits used.

{
  "success": false,
  "code": "SCRAPE_CHALLENGE_DETECTED",
  "message": "A CAPTCHA or anti-bot challenge blocked access to this page. Skip further scrape and browser attempts for this URL and continue with a different source. If none is suitable, tell the user the page was blocked.",
  "retryable": false,
  "metadata": { "statusCode": 403, "blockCategory": "challenge" },
  "credits": { "used": 0 }
}

Check success before reading data. The challenge result has no data field. Use the code to skip this URL and choose another source. See Errors and retries.

Formats

Use plain string formats for standard outputs. Some formats accept an object when they need options.

FormatUse it for
markdownAgent context, retrieval, and summarization
htmlProcessed page markup
rawHtmlUnmodified rendered document markup
linksDiscovered links from the page
imagesImage URLs and metadata
jsonStructured extraction against a supplied JSON schema
summaryA compact AI-written summary

The base operation is 1 credit for a successful uncached scrape. Proxy escalation is included and never changes the customer price. JSON extraction adds 4 credits; summaries add 2. Failed, blocked, and cached ordinary page responses are free. YouTube transcripts use the separate flat price below.

YouTube transcripts

Pass a YouTube video URL to this endpoint to receive its timestamped transcript. Berrycrawl also provides the focused POST /youtube/transcript endpoint for the same pipeline. It recognizes standard watch links, youtu.be links, Shorts, live-video links, and embed URLs. The dedicated YouTube transcript guide covers both request paths, response metadata, pricing, and errors.

{
  "url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
  "formats": ["markdown"]
}

The response uses the normal scrape shape. data.markdown contains the title, creator, and timestamped transcript. Metadata includes the resolved caption language, video ID, duration, creator, and thumbnail when available.

Every successful YouTube transcript scrape costs a flat 5 credits. Missing captions and failed requests are not charged. Browser actions and the dedicated screenshot endpoint load the YouTube page instead of using transcript mode.

Main-content filtering

Set onlyMainContent to remove navigation, cookie banners, footers, and repeated chrome. If a page uses image-only articles for featured cards, the filter can also keep separately marked sections that contain headings and prose. Use includeTags and excludeTags when a page needs more precise selection. If exact DOM fidelity matters, request rawHtml and leave main-content filtering off.

On pages that put an empty skip-to-main anchor directly before the content, main-content filtering can keep the section that follows it. A response containing only navigation placeholders can return SCRAPE_EMPTY_CONTENT without a charge.

When a public HTML page stays blank while waiting on image requests, Berrycrawl can retry a Markdown-only scrape once with lightweight image placeholders within the same request timeout.

The Wayback Machine’s public CDX search endpoint can return plain text or JSON directly in Markdown. The HTTP request uses up to 27 seconds within the requested scrape timeout.

Berrycrawl returns public sitemap XML directly in Markdown. Recognized sitemap URLs use up to 27 seconds within the requested scrape timeout. Sitemap documents can be up to 25 MiB after decompression.

Cache control

maxAge is the maximum acceptable cache age in milliseconds. Set it to 0 to force a refresh. A larger value favors speed and lower infrastructure cost; a smaller value favors freshness.

Proxy policy

  • auto starts direct for standard requests and can escalate when a route fails.
  • none and basic use a direct connection.
  • datacenter, residential, and stealth select the starting proxy tier.

To request a public country edition of an HTML page, set location.country to a two-letter country code such as US. With proxy: "auto", Berrycrawl starts with a proxy targeted to that country when a proxy is configured. Recognized document and feed URLs keep their native download path.

Check metadata.url and metadata.statusCode for the final destination and its HTTP status.

When enabled for a controlled production cohort, Berrycrawl can start one delayed secondary IPRoyal route on the residential rung and accept the first valid response. Browser actions, screenshots, PDFs, and Bright Data never use this hedge.

Browser actions

Actions let a scrape wait, click, type, press keys, scroll, or run supported page interactions before extraction. Keep action sequences short and deterministic. Prefer selectors tied to stable attributes over presentation classes.

Concurrency and queueing

When all active scrape slots are occupied, Berrycrawl places the request in a bounded, distributed FIFO queue. It does not immediately return 429. Queue time counts against the request's timeout, and successful responses include queue admission metadata.

Use GET /account to read the workspace's active count, queued count, active limit, and queue limit. For many unrelated URLs, send bounded parallel scrape calls and persist each response in your application.

Avoid blind retries

Retry timeouts and transient upstream failures. Do not retry a 400 caused by an invalid format, selector, URL, or schema until the request changes.