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

# Introduction

> REST API reference for ScrapeGraphAI v2

## Overview

The ScrapeGraphAI v2 API exposes five core services behind a single host. All endpoints accept JSON, return JSON, and are authenticated with an API key header.

* **Scrape** — fetch a URL in one or more formats (markdown, HTML, screenshot, JSON extraction, …) in a single call.
* **Extract** — structured data extraction from a URL, raw HTML, or markdown using a natural-language prompt.
* **Search** — web search with page content returned inline and optional AI extraction across results.
* **Crawl** — async multi-page traversal with URL patterns, depth limits, and per-page formats.
* **Monitor** — cron-scheduled watches with change detection and optional webhooks.
* **History** — look up past requests by ID, including the formatted content of crawled pages via each `scrapeRefId`.

Prefer using an SDK? See the [Python SDK](/sdks/python) or [JavaScript SDK](/sdks/javascript) — both wrap this same API.

## Base URL

```bash theme={null}
https://v2-api.scrapegraphai.com
```

All endpoints are prefixed with `/api/`, e.g. `POST https://v2-api.scrapegraphai.com/api/scrape`.

<Warning>
  The v1 host (`https://api.scrapegraphai.com/v1`) and its endpoint names (`smartscraper`, `searchscraper`, `markdownify`, `smartcrawler`) are deprecated. See the [v1 → v2 transition guide](/transition-from-v1-to-v2) for the endpoint mapping.
</Warning>

## Authentication

All requests require an API key in the `SGAI-APIKEY` header. Get yours from the [dashboard](https://scrapegraphai.com/dashboard).

```bash theme={null}
SGAI-APIKEY: sgai-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
```

<Note>
  Keep your API key secret. Never ship it in client-side code — load it from an environment variable or a server-side secret store.
</Note>

## Endpoints

<CardGroup cols={2}>
  <Card title="Scrape" icon="code" href="/api-reference/endpoint/scrape">
    `POST /api/scrape` — multi-format page fetch.
  </Card>

  <Card title="Extract" icon="robot" href="/api-reference/endpoint/extract">
    `POST /api/extract` — structured data with an LLM prompt.
  </Card>

  <Card title="Search" icon="magnifying-glass" href="/api-reference/endpoint/search">
    `POST /api/search` — web search + content fetch.
  </Card>

  <Card title="Crawl · start" icon="spider" href="/api-reference/endpoint/crawl/start">
    `POST /api/crawl` — start an async crawl job.
  </Card>

  <Card title="Crawl · status" icon="list-check" href="/api-reference/endpoint/crawl/get-status">
    `GET /api/crawl/:id` — poll a crawl job.
  </Card>

  <Card title="Monitor · create" icon="clock" href="/api-reference/endpoint/monitor/create">
    `POST /api/monitor` — schedule a recurring fetch.
  </Card>

  <Card title="Monitor · manage" icon="sliders" href="/api-reference/endpoint/monitor/manage">
    List, pause, resume, update, delete monitors; fetch activity.
  </Card>

  <Card title="History" icon="clock-rotate-left" href="/api-reference/endpoint/history">
    `GET /api/history[/:id]` — list past requests or fetch a single result by ID (including content for crawled pages).
  </Card>

  <Card title="Credits" icon="coins" href="/api-reference/endpoint/credits">
    `GET /api/credits` — remaining balance and job quotas.
  </Card>
</CardGroup>

## HTTP status codes

| Code  | Meaning                                                        |
| ----- | -------------------------------------------------------------- |
| `200` | Success                                                        |
| `400` | Validation error — the request body didn't pass schema checks. |
| `401` | Missing `SGAI-APIKEY` header.                                  |
| `402` | Insufficient credits.                                          |
| `403` | Invalid or deprecated API key.                                 |
| `404` | Not found — the resource ID does not exist for this account.   |
| `429` | Rate limit exceeded.                                           |
| `500` | Server error.                                                  |

See [Error handling](/api-reference/errors) for the full response shape and examples.
