Quickstart

From zero to rendered, geotargeted pages and async jobs in five minutes.

Embed
Preview of the card
<a href="https://scrapely.15.204.158.166.sslip.io/docs/quickstart"><img src="https://scrapely.15.204.158.166.sslip.io/docs/_api/public/orgs/affc5b0f-d3c2-423a-8143-9d10db5736ae/spaces/981e6275-da3f-446c-82de-889f59c83b6f/pages/001f09f1-8a88-40f1-a156-a29efbb9325c/social-card.svg?v=3e7ae33eec8b" alt="Quickstart" width="600" height="315"></a>

From zero to rendered, geotargeted pages and async jobs in five minutes.

1. Scrape a page

The response is a JSON envelope with the page in content, plus what it cost. Add raw=true to get the page body directly instead, exactly as ScraperAPI returns it.

cURL

curl "https://api.scrapely.dev/v1/scrape" -G \
  -H "Authorization: Bearer YOUR_API_KEY" \
  --data-urlencode "url=https://example.com/products/42"

Response

{
  "url": "https://example.com/products/42",
  "final_url": "https://example.com/products/42",
  "status_code": 200,
  "credits": 1,
  "duration_ms": 812,
  "content_type": "text/html; charset=utf-8",
  "content": "<!doctype html>…"
}

2. Render JavaScript and geotarget

Single-page apps need a browser: render=true (10 credits). country_code routes through that country. Ask for Markdown to feed an LLM without the markup.

cURL

curl "https://api.scrapely.dev/v1/scrape" -G \
  -H "Authorization: Bearer YOUR_API_KEY" \
  --data-urlencode "url=https://example.com/app" \
  -d render=true -d country_code=de -d output_format=markdown

Python

import requests

r = requests.get(
    "https://api.scrapely.dev/v1/scrape",
    headers={"Authorization": "Bearer YOUR_API_KEY"},
    params={
        "url": "https://example.com/app",
        "render": "true",
        "country_code": "de",
        "output_format": "markdown",
    },
    timeout=70,
)
print(r.json()["content"])

Node.js

const params = new URLSearchParams({
  url: 'https://example.com/app',
  render: 'true',
  country_code: 'de',
  output_format: 'markdown',
});
const res = await fetch(`https://api.scrapely.dev/v1/scrape?${params}`, {
  headers: { Authorization: 'Bearer YOUR_API_KEY' },
  signal: AbortSignal.timeout(70_000),
});
console.log((await res.json()).content);

Set a 70-second timeout: We retry hard targets for up to 70 seconds before giving up. A shorter client timeout abandons requests that would have succeeded.

3. Go async for volume

For more than a handful of URLs, create jobs. They queue for a free concurrency slot instead of failing, and POST the result to your webhook when done. See Async jobs and Batches.

cURL

curl -X POST "https://api.scrapely.dev/v1/jobs" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{"url": "https://example.com/products/42", "callback_url": "https://your.app/hooks/scrapely"}'

Response

{
  "id": "job_5f0c8a1b2d3e4f56",
  "object": "job",
  "status": "queued",
  "url": "https://example.com/products/42",
  "credits": 1,
  "status_url": "https://api.scrapely.dev/v1/jobs/job_5f0c8a1b2d3e4f56"
}
Updated