# Spider API Quickstart - Python, Node and cURL | Spider

Spider API quickstart for Python, Node and cURL. Install a client, export an API key, then crawl your first page and read the markdown that comes back.

Canonical: https://spider.cloud/docs/quickstart/

Install a client, export an API key, run the first request. Three steps, or hand the setup to your AI agent.

set up with an AI agent

```
I want to integrate Spider (https://spider.cloud) into my project for web crawling, scraping, search, and screenshots.

Skill file (drop-in agent instructions): https://spider.cloud/agent-skill/SKILL.md
MCP server (Claude / Cursor / Windsurf): npx spider-cloud-mcp, or hosted at mcp.spider.cloud
Docs: https://spider.cloud/docs/overview
API reference: https://spider.cloud/docs/api

Spider is one REST API: crawl, scrape, search, screenshot, transform, links, browser-cloud. Bearer auth, JSON in, JSON out, optional streaming via Content-Type: application/jsonl. SDKs: spider_client (Python), @spider-cloud/spider-client (Node).

Please install the Python SDK, generate an API key from https://spider.cloud/api-keys (the user will paste it), export it as SPIDER_API_KEY, and write a small example that crawls https://example.com with limit=5 and prints the markdown content of each page.
```

Paste into Claude, Cursor, Windsurf or ChatGPT. [/agent-skill/SKILL.md ↗](https://spider.cloud/agent-skill/SKILL.md)

01

## Install a client

Pick the language you'll call the API from. The Python and Node SDKs wrap the REST endpoints; cURL hits the bare API.

```
pip install spider_client
```

02

## Export an API key

Create an [API key](https://spider.cloud/api-keys/) in the dashboard, then export it so the SDK and cURL examples can read it.

```
export SPIDER_API_KEY="your_api_key_here"
```

03

## Make your first request

Pick an endpoint and run the example. All three accept the same JSON body shape.

crawl

Request

```
import requests, os

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

json_data = {"limit":5,"url":"https://example.com"}

response = requests.post('https://api.spider.cloud/crawl', 
  headers=headers, json=json_data)

print(response.json())
```

## Handle the response

Every response is a JSON array. Each element carries the page URL, content in the requested format, an HTTP status code, and a `costs` breakdown. Check `status` before reading `content`.

Parse the response

```
import requests, os

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

response = requests.post(
    'https://api.spider.cloud/crawl',
    headers=headers,
    json={"url": "https://example.com", "limit": 5, "return_format": "markdown"}
)

data = response.json()

for page in data:
    if page.get('status') == 200:
        print(f"URL: {page['url']}")
        print(f"Content length: {len(page.get('content', ''))} chars")
        print(f"Cost: {page['costs']['total_cost_formatted']}")
    else:
        print(f"Failed: {page['url']} - {page.get('error', 'Unknown error')}")
```

Tip

For large crawls, switch to [streaming](https://spider.cloud/docs/core/concurrent-streaming/) and process pages as they arrive instead of waiting for the full response. Set `Content-Type: application/jsonl`.

## Next steps

1. [01 Concepts Request modes, output formats, streaming, and the credits system.](https://spider.cloud/docs/concepts/)
2. [02 Scraping and crawling Depth control, response fields, and cost breakdowns.](https://spider.cloud/docs/core/scraping-crawling/)
3. [03 Efficient scraping Batch requests, retries, timeouts, and multi-URL patterns.](https://spider.cloud/docs/core/efficient-scraping/)
4. [04 JSON scraping Extract structured data from JSON-LD, Next.js SSR, and other embedded formats.](https://spider.cloud/docs/advanced/json-scraping/)
5. [05 Recipes Copy-paste code for crawling, scraping, search, screenshots, streaming, and webhooks.](https://spider.cloud/docs/guides/recipes/)

Tip

No API key yet? [Create one from the dashboard](https://spider.cloud/api-keys/). No credit card required.
