# Spider API: endpoints, quick start and SDKs | Spider Guides

The Spider API turns any URL into markdown, HTML, text or JSON. Crawl, scrape and search endpoints, a Python quick start, SDKs, and $1 per 10,000 credits.

Canonical: https://spider.cloud/guides/spider-api/

One POST to `/crawl` follows the links from a URL and streams each page back as its own JSON line, already in markdown. This request is one we sent, field for field.

[Get an API key](https://spider.cloud/register/) [Run it in the playground](https://spider.cloud/playground/?mode=crawl\&url=https%3A%2F%2Fdoc.rust-lang.org%2Fbook%2F\&format=markdown\&p.limit=30\&src=guide_spider_api_hero)

From $0.16 per 1,000 pages on light static pages, pay as you go. Cost varies by site.

POST /crawl Sent September 9, 2026

```
curl https://api.spider.cloud/crawl \
  -H "Authorization: Bearer $SPIDER_API_KEY" \
  -H "Content-Type: application/jsonl" \
  -d '{"url": "https://doc.rust-lang.org/book/", "limit": 30, "return_format": "markdown", "request": "smart", "country_code": "de", "whitelist": ["doc\\.rust-lang\\.org/book/"], "blacklist": ["print\\.html", "/stable/"]}'
```

HTTP 200, 30 pages of markdown, 319 KB in all

First page back, /book/, first 3 lines of its markdown 1,482 B in all at 5.0 s

```
# The Rust Programming Language
*by Steve Klabnik, Carol Nichols, and Chris Krycho, with contributions from the
Rust Community*
```

## Quick start

The same crawl of the Rust book in Python. Each page arrives as one JSON line, and the loop prints it before the crawl ends.

```
import requests, json, os

headers = {
    'Authorization': f'Bearer {os.getenv("SPIDER_API_KEY")}',
    'Content-Type': 'application/jsonl',
}

response = requests.post('https://api.spider.cloud/crawl',
  headers=headers,
  json={
      "url": "https://doc.rust-lang.org/book/",
      "limit": 30,
      "return_format": "markdown",
      "request": "smart",
      "country_code": "de",
      "whitelist": [
          "doc\\.rust-lang\\.org/book/"
      ],
      "blacklist": [
          "print\\.html",
          "/stable/"
      ]
  },
  stream=True
)

for line in response.iter_lines(decode_unicode=True):
    if line:
        page = json.loads(line)
        print(page['url'], page['status'], len(page['content']))
```

What this request returned Captured on September 9, 2026: HTTP 200, 30 pages of markdown, 319 KB in all. The first page arrived after 5.0 s and the stream closed after 21.5 s.

Page Status Bytes Arrived

/ 200 1,482 5.0 s

/ch01-01-installation.html 200 6,012 8.3 s

/appendix-05-editions.html 200 3,293 8.3 s

/appendix-06-translation.html 200 2,237 8.3 s

/foreword.html 200 3,072 8.4 s

## What the API does

You send a URL and a few settings. You get back each page as HTML, markdown, plain text or JSON.

The API handles proxy rotation, JavaScript rendering, rate limits and protected pages for you.

### What the API handles

- Proxies

  Residential proxies rotate, and a failed IP fails over to another.

- Concurrency

  The Rust engine fetches the pages of one crawl in parallel.

- Smart mode

  The default. Each page gets plain HTTP or a browser, whichever it needs. Set request to http or browser to choose yourself.

- Caching

  On by default. It helps only a repeat crawl of pages already fetched, and you can turn it off per request.

- Formats

  Markdown, HTML, plain text or raw bytes, set with return_format.

- Extraction

  Opt in per request. An LLM step pulls structured fields from a page and bills on top of the fetch.

- Hard pages

  A real browser profile and proxy rotation keep blocks down.

See the full [API reference](https://spider.cloud/docs/api) for every endpoint and parameter.

## Endpoints

| Endpoint                     | Purpose                                                                                                          |
| ---------------------------- | ---------------------------------------------------------------------------------------------------------------- |
| `/crawl`                     | Start from a URL, follow links, return content for each page                                                     |
| `/scrape`                    | Fetch a single URL and return its content. The [web scraping API](/api/scrape/) page shows one recorded response |
| `/search`                    | Search the web and optionally scrape the results                                                                 |
| `/screenshot`                | Capture a full-page screenshot as base64 PNG                                                                     |
| `/links`                     | Get the link graph for a URL                                                                                     |
| `/pipeline/extract-contacts` | Extract contact information from pages                                                                           |

## Request modes

The `request` parameter controls how Spider fetches each page:

| Mode              | When to use                                                                                                       |
| ----------------- | ----------------------------------------------------------------------------------------------------------------- |
| `smart` (default) | Automatically picks HTTP or Chrome based on page requirements                                                     |
| `http`            | Static pages, sitemaps, APIs. Fastest and cheapest                                                                |
| `browser`         | SPAs, JS-rendered content, pages behind Cloudflare or similar protections (the legacy value `chrome` still works) |

## Output formats

Set `return_format` to control what you get back:

| Format     | Output         | Best for                     |
| ---------- | -------------- | ---------------------------- |
| `raw`      | Original HTML  | Parsing with your own tools  |
| `markdown` | Clean markdown | LLM ingestion, RAG pipelines |
| `text`     | Plain text     | Search indexing, NLP tasks   |
| `bytes`    | Raw bytes      | Binary content, downloads    |

For AI workflows, `markdown` strips navigation, ads, and boilerplate, giving you just the page content.

## Streaming large crawls

The quick start already streams. With `Content-Type` set to `application/jsonl` and `stream=True` in your HTTP client, each page arrives as its own line, so you can work on it before the crawl ends.

For a larger crawl, raise `limit` and set `max_credits_allowed` to cap what the crawl can spend. The [streaming docs](/docs/core/concurrent-streaming/) cover the rest.

## SDK libraries

Official SDKs handle authentication and provide typed methods for all endpoints:

- [Python SDK](https://github.com/spider-rs/spider-clients/tree/main/python): `pip install spider_client`
- [JavaScript SDK](https://github.com/spider-rs/spider-clients/tree/main/javascript): `npm install @spider-cloud/spider-client`
- [Rust SDK](https://github.com/spider-rs/spider-clients): `cargo add spider-client`

Spider also works as a document loader in [LangChain](/docs/integrations/langchain/), [LlamaIndex](/docs/integrations/llamaindex/), [CrewAI](/docs/integrations/crewai/) and other AI frameworks.

## Getting set up

1. [Register](https://spider.cloud/register) or sign in.
2. [Purchase credits](https://spider.cloud/credits/new). Pay-as-you-go at $1 per 10,000 credits.
3. Create an API key on the [API keys page](https://spider.cloud/api-keys).
4. Start making requests.

Track your usage on the [usage page](/account/plan/).
