> ## Documentation Index
> Fetch the complete documentation index at: /llms.txt
> Use this file to discover all available pages before exploring further.

# Crawl

> Crawl a website and get content from every page

Crawl reads a website page by page: it starts at a URL, follows the links it finds, and returns every page it reads in the formats you ask for, Markdown by default.

For details, see the [Crawl Endpoint API Reference](/api-reference/endpoint/crawl-post.md).

## Installation

```bash Python
pip install screenshotrender
```

```bash Node
npm install screenshotrender
```

## Basic usage

The SDKs' `crawl()` starts the crawl, waits for it to finish and returns every page.

```python Python
from screenshotrender import ScreenshotRender

screenshotrender = ScreenshotRender(api_key="sr-YOUR-API-KEY")

crawl = screenshotrender.crawl(
    "https://docs.python.org/3/tutorial/",
    limit=3,
    on_progress=lambda job: print(f"{job.completed} of {job.total} pages"),
)

print(crawl.status, crawl.credits_used, "credits")
for page in crawl.data:
    print(page.metadata.source_url)
```

```js Node
import ScreenshotRender from "screenshotrender";

const screenshotrender = new ScreenshotRender({ apiKey: "sr-YOUR-API-KEY" });

const crawl = await screenshotrender.crawl("https://docs.python.org/3/tutorial/", {
  limit: 3,
  onProgress: (job) => console.log(`${job.completed} of ${job.total} pages`),
});

console.log(crawl.status, crawl.creditsUsed, "credits");
for (const page of crawl.data) {
  console.log(page.metadata?.sourceURL);
}
```

Output:

```text Output (Python)
3 of 3 pages
3 of 3 pages
3 of 3 pages
completed 3 credits
https://docs.python.org/3/tutorial/
https://docs.python.org/3/tutorial/modules.html
https://docs.python.org/3/tutorial/stdlib2.html
```

### Scrape options

`scrapeOptions` sets the formats and page options for every page, like in [Scrape](/features/scrape.md). Without it, every page comes back as Markdown.

## Start a crawl and check later

A crawl runs in the background. Start it, keep its `id`, and check on it when you want.

```python Python
from screenshotrender import ScreenshotRender

screenshotrender = ScreenshotRender(api_key="sr-YOUR-API-KEY")

job = screenshotrender.start_crawl("https://docs.python.org/3/tutorial/", limit=3)
print(job.id)
```

```js Node
import ScreenshotRender from "screenshotrender";

const screenshotrender = new ScreenshotRender({ apiKey: "sr-YOUR-API-KEY" });

const job = await screenshotrender.startCrawl("https://docs.python.org/3/tutorial/", { limit: 3 });
console.log(job.id);
```

```bash cURL
curl -s -X POST "https://www.screenshotrender.com/api/v1/crawl" \
  -H "Authorization: Bearer $SCREENSHOTRENDER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://docs.python.org/3/tutorial/",
    "limit": 3,
    "scrapeOptions": { "formats": ["markdown"] }
  }'
```

```json Response
{
  "success": true,
  "id": "01a23bd3-b4d2-74ba-97bd-4720e6bec94d",
  "url": "https://www.screenshotrender.com/api/v1/crawl/01a23bd3-b4d2-74ba-97bd-4720e6bec94d",
  "creditsReserved": 3
}
```

`creditsReserved` is set aside from your balance when the crawl starts: `limit` pages at the cost of one page. When the crawl ends, you pay for the pages it read and the rest comes back.

## Checking crawl status

```python Python
from screenshotrender import ScreenshotRender

screenshotrender = ScreenshotRender(api_key="sr-YOUR-API-KEY")

job = screenshotrender.get_crawl_status("YOUR_CRAWL_ID")
print(job.status, f"{job.completed} of {job.total} pages")
```

```js Node
import ScreenshotRender from "screenshotrender";

const screenshotrender = new ScreenshotRender({ apiKey: "sr-YOUR-API-KEY" });

const job = await screenshotrender.getCrawlStatus("YOUR_CRAWL_ID");
console.log(job.status, `${job.completed} of ${job.total} pages`);
```

```bash cURL
curl -s "https://www.screenshotrender.com/api/v1/crawl/YOUR_CRAWL_ID" \
  -H "Authorization: Bearer $SCREENSHOTRENDER_API_KEY"
```

### Response

```json Response
{
  "success": true,
  "status": "completed",
  "total": 3,
  "completed": 3,
  "creditsUsed": 3,
  "expiresAt": "2026-12-04T12:18:26.000Z",
  "next": null,
  "data": [
    {
      "markdown": "### Navigation\n\n- [index](https://docs.python.org/3/genindex.html \"General Index\")\n- [modules](https://docs.python.org/3/py-modindex.html \"Python Module Index\")...",
      "metadata": {
        "title": "The Python Tutorial — Python 3.15.2 documentation",
        "description": "Python is an easy to learn, powerful programming language. It has efficient high-level data structures and a simple but...",
        "language": "en",
        "sourceURL": "https://docs.python.org/3/tutorial/",
        "url": "https://docs.python.org/3/tutorial/",
        "statusCode": 200,
        "contentType": "text/html",
        "proxyUsed": "basic",
        "cacheState": "hit",
        "cachedAt": "2026-12-03T11:23:49.362Z"
      }
    },
    "... 2 more pages"
  ]
}
```

| Field | Description |
| - | - |
| `status` | `completed` when the crawl is done, `cancelled` after a cancel. |
| `total` | Pages found so far. |
| `completed` | Pages read so far. |
| `creditsUsed` | Credits the crawl has used. |
| `expiresAt` | When the results stop being available: 24 hours after the crawl. |
| `next` | `null` when every page is in `data`. |
| `data` | The pages, each with its formats and `metadata`. |

## Choose which pages to read

| Option | Description |
| - | - |
| `limit` | Most pages to read. 10 by default, up to 10,000. |
| `includePaths` | Only read URL paths that match these regular expressions. |
| `maxDiscoveryDepth` | How many links deep to go from the start URL. |
| `scrapeOptions` | Formats and page options for every page. |

```bash cURL
curl -s -X POST "https://www.screenshotrender.com/api/v1/crawl" \
  -H "Authorization: Bearer $SCREENSHOTRENDER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://docs.python.org/3/",
    "limit": 3,
    "includePaths": ["^/3/library/.*"],
    "maxDiscoveryDepth": 1
  }'
```

This crawl starts at `/3/` and reads three pages, all under `/3/library/`.

## Cancelling a crawl

```python Python
from screenshotrender import ScreenshotRender

screenshotrender = ScreenshotRender(api_key="sr-YOUR-API-KEY")

stopped = screenshotrender.cancel_crawl("YOUR_CRAWL_ID")
print(stopped)  # False when the crawl had already finished
```

```js Node
import ScreenshotRender from "screenshotrender";

const screenshotrender = new ScreenshotRender({ apiKey: "sr-YOUR-API-KEY" });

const stopped = await screenshotrender.cancelCrawl("YOUR_CRAWL_ID");
console.log(stopped); // false when the crawl had already finished
```

```bash cURL
curl -s -X DELETE "https://www.screenshotrender.com/api/v1/crawl/YOUR_CRAWL_ID" \
  -H "Authorization: Bearer $SCREENSHOTRENDER_API_KEY"
```

```json Response
{
  "success": true,
  "status": "cancelled"
}
```

The pages read before the cancel stay available, and you pay only for them. Cancelling a crawl that already finished changes nothing and answers with its final status, like `completed`.

## Failed and blocked pages

Add `?errors=1` to the status URL to see the pages that failed, and the ones robots.txt doesn't allow.

```python Python
from screenshotrender import ScreenshotRender

screenshotrender = ScreenshotRender(api_key="sr-YOUR-API-KEY")

report = screenshotrender.get_crawl_errors("YOUR_CRAWL_ID")
print(report.errors, report.robots_blocked)
```

```js Node
import ScreenshotRender from "screenshotrender";

const screenshotrender = new ScreenshotRender({ apiKey: "sr-YOUR-API-KEY" });

const { errors, robotsBlocked } = await screenshotrender.getCrawlErrors("YOUR_CRAWL_ID");
console.log(errors, robotsBlocked);
```

```bash cURL
curl -s "https://www.screenshotrender.com/api/v1/crawl/YOUR_CRAWL_ID?errors=1" \
  -H "Authorization: Bearer $SCREENSHOTRENDER_API_KEY"
```

```json Response
{
  "success": true,
  "data": {
    "errors": [],
    "robotsBlocked": []
  }
}
```

## Important details

* Each page costs what a [scrape](/billing.md#credit-costs) of it costs: 1 credit, 5 with `json`, `question` or `highlights`.
* A crawl needs enough credits for its reservation. Lower `limit` if your balance is short.
* robots.txt is always respected.
* Results are kept for 24 hours after the crawl ends.
