---
agent:
  instructions: "Search crawlapi docs via GET /.well-known/search?q={query} (add &format=json or Accept: application/json for JSON)."
  endpoint: "https://docs.crawlapi.dev/.well-known/search?q={query}"
  method: "GET"
  documentation: "https://docs.crawlapi.dev/llms.txt"
---

> Documentation index: https://docs.crawlapi.dev/llms.txt
> Search docs: https://docs.crawlapi.dev/.well-known/search?q={query}
> OpenAPI 3.1 specification: https://docs.crawlapi.dev/openapi.json

# Introduction

> Turn any web page or document into clean markdown or structured JSON.

crawlapi handles JavaScript rendering, document parsing, and protected pages behind one API endpoint so your app or coding agent gets clean data from any URL.

Start with a single HTTP request, connect your coding agent through [MCP](https://docs.crawlapi.dev/mcp.md), or read pages from your terminal with the [CLI](https://docs.crawlapi.dev/cli.md).

- [Quickstart](https://docs.crawlapi.dev/quickstart.md) Create an API key and run your first `POST /v1/scrape` request.
- [Agent quickstart](https://docs.crawlapi.dev/agent-quickstart.md) Paste one prompt into your coding agent to integrate crawlapi safely.
- [MCP server](https://docs.crawlapi.dev/mcp.md) Give Claude Code, Codex, Cursor, VS Code, OpenCode, or pi live web-reading tools.
- [API reference](https://docs.crawlapi.dev/api-reference/scrape.md) Full request/response schema, headers, status codes, and live runner.

## Make a request

Set `CRAWLAPI_API_KEY` in your environment (see [Quickstart](https://docs.crawlapi.dev/quickstart.md)), then send a JSON body with `url` to `POST https://api.crawlapi.dev/v1/scrape`:

**cURL**

```bash
curl -sS https://api.crawlapi.dev/v1/scrape \
  -H "Authorization: Bearer $CRAWLAPI_API_KEY" \
  -H 'content-type: application/json' \
  --data '{"url": "https://example.com"}'
```

**TypeScript**

```typescript
const response = await fetch('https://api.crawlapi.dev/v1/scrape', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.CRAWLAPI_API_KEY}`,
    'content-type': 'application/json',
  },
  body: JSON.stringify({ url: 'https://example.com' }),
});
const body = await response.json();
if (!body.success) throw new Error(`${body.error.code}: ${body.error.message}`);
console.log(body.data.markdown);
```

**Python**

```python
import os
import requests

response = requests.post(
    "https://api.crawlapi.dev/v1/scrape",
    headers={"Authorization": f"Bearer {os.environ['CRAWLAPI_API_KEY']}"},
    json={"url": "https://example.com"},
    timeout=65,
)
body = response.json()
if not body["success"]:
    raise RuntimeError(f"{body['error']['code']}: {body['error']['message']}")
print(body["data"]["markdown"])
```

**Go**

```go
package main

import (
    "bytes"
    "encoding/json"
    "fmt"
    "net/http"
    "os"
    "time"
)

func main() {
    payload := []byte(`{"url":"https://example.com"}`)
    req, err := http.NewRequest("POST", "https://api.crawlapi.dev/v1/scrape", bytes.NewReader(payload))
    if err != nil {
        panic(err)
    }
    req.Header.Set("Authorization", "Bearer "+os.Getenv("CRAWLAPI_API_KEY"))
    req.Header.Set("Content-Type", "application/json")
    client := &http.Client{Timeout: 65 * time.Second}
    resp, err := client.Do(req)
    if err != nil {
        panic(err)
    }
    defer resp.Body.Close()
    var body struct {
        Success bool `json:"success"`
        Data    struct{ Markdown string `json:"markdown"` } `json:"data"`
        Error   struct{ Code, Message string } `json:"error"`
    }
    if err := json.NewDecoder(resp.Body).Decode(&body); err != nil {
        panic(err)
    }
    if !body.Success {
        panic(fmt.Sprintf("%s: %s", body.Error.Code, body.Error.Message))
    }
    fmt.Println(body.Data.Markdown)
}
```

**Ruby**

```ruby
require "json"
require "net/http"
require "uri"

uri = URI("https://api.crawlapi.dev/v1/scrape")
req = Net::HTTP::Post.new(uri)
req["Authorization"] = "Bearer #{ENV.fetch('CRAWLAPI_API_KEY')}"
req["Content-Type"] = "application/json"
req.body = JSON.generate({ url: "https://example.com" })

res = Net::HTTP.start(
  uri.host, uri.port, use_ssl: true, read_timeout: 65
) { |http| http.request(req) }
body = JSON.parse(res.body)
raise "#{body.dig("error", "code")}: #{body.dig("error", "message")}" unless body["success"]
puts body.dig("data", "markdown")
```

**PHP**

```php
<?php
$ch = curl_init('https://api.crawlapi.dev/v1/scrape');
curl_setopt_array($ch, [
    CURLOPT_POST => true,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_TIMEOUT => 65,
    CURLOPT_HTTPHEADER => [
        'Authorization: Bearer ' . getenv('CRAWLAPI_API_KEY'),
        'Content-Type: application/json',
    ],
    CURLOPT_POSTFIELDS => json_encode(['url' => 'https://example.com']),
]);
$raw = curl_exec($ch);
if ($raw === false) throw new RuntimeException(curl_error($ch));
$body = json_decode($raw, true, 512, JSON_THROW_ON_ERROR);
if (empty($body['success']))
    throw new RuntimeException($body['error']['code'] . ': ' . $body['error']['message']);
echo $body['data']['markdown'];
```

The cleaned page text is in `data.markdown`, unique page links in `data.links`, and page details in `data.metadata`.

## Output formats

| Format | Response field | What you get |
| --- | --- | --- |
| `markdown` (default) | `data.markdown` | Clean page text, headings, lists, code blocks, and Markdown tables, plus `data.links` |
| `json` | `data.json` | Normalized `structured` entity, `tables`, raw `jsonld`, and `embedded` page state |

## Built-in page handling

- **JavaScript rendering:** Dynamic apps and single-page sites render before extraction so you get the live page content, not an empty shell.
- **Protected pages:** Difficult sites are handled automatically with no extra flags, proxy setup, or browser configuration on your side.
- **Documents:** [PDF, Office, OpenDocument, EPUB, RTF, CSV, JSON, RSS/Atom feeds, and plain text](https://docs.crawlapi.dev/documents.md) convert through the same endpoint.
- **X and YouTube:** [X posts and YouTube videos](https://docs.crawlapi.dev/special-sites.md) return dedicated markdown layouts and structured fields.
- **Structured errors:** Every failure returns a machine-readable `error.code`, a `retryable` boolean, and a link to its remedy.

## Choose how to use crawlapi

| You have | You want | Use |
| --- | --- | --- |
| A web page URL | Clean markdown for LLMs, RAG, or search | [Markdown](https://docs.crawlapi.dev/markdown.md) |
| A product, article, listing, or entity URL | Normalized fields, tables, JSON-LD, or embedded state | [Structured JSON](https://docs.crawlapi.dev/json.md) |
| A PDF, Office file, CSV, JSON, or feed URL | Extracted text, tables, or feed links | [PDFs & documents](https://docs.crawlapi.dev/documents.md) |
| An X post or YouTube URL | Thread, replies, chapters, or transcript | [X & YouTube](https://docs.crawlapi.dev/special-sites.md) |
| A list of URLs or a site to crawl | Local files, resumable batches, or shell piping | [CLI](https://docs.crawlapi.dev/cli.md) |
| A coding agent (Claude Code, Codex, Cursor, VS Code) | Live web-reading tools inside chat | [MCP server](https://docs.crawlapi.dev/mcp.md) |
| A codebase with an AI coding agent | Accurate API usage without live MCP tools | [Agent skill](https://docs.crawlapi.dev/agent-skill.md) |

## Use crawlapi from an agent

The [Agent quickstart](https://docs.crawlapi.dev/agent-quickstart.md) gives your coding agent one prompt to wire crawlapi into your project, connect MCP, install the CLI, or add the skill. To set up one piece directly, connect the hosted [MCP server](https://docs.crawlapi.dev/mcp.md), configure [Use crawlapi as default](https://docs.crawlapi.dev/default-scrape.md), install the [Agent skill](https://docs.crawlapi.dev/agent-skill.md), or use the [`crawl` CLI](https://docs.crawlapi.dev/cli.md) in scripts.

## Before you ship

Call `POST https://api.crawlapi.dev/v1/scrape` from any language with standard HTTPS — no SDK required. Before launching, review [Timeouts](https://docs.crawlapi.dev/timeouts.md), [Rate limits](https://docs.crawlapi.dev/rate-limits.md), and [Errors and retries](https://docs.crawlapi.dev/errors.md) for production resilience, and see [Credits and pricing](https://docs.crawlapi.dev/credits.md) for request billing.

## Reading pages

- [Markdown](https://docs.crawlapi.dev/markdown.md) Clean article text, link normalization, and output size limits.
- [Structured JSON](https://docs.crawlapi.dev/json.md) The four JSON keys, 12 normalized entity types, and repeated card lists.
- [PDFs & documents](https://docs.crawlapi.dev/documents.md) Supported document formats, size limits, and table extraction.
- [X & YouTube](https://docs.crawlapi.dev/special-sites.md) Dedicated extractors for X threads, replies, and YouTube videos.

## Account and operations

- [Errors & retries](https://docs.crawlapi.dev/errors.md) Error response shape, retry code, and every API error code.
- [Rate limits](https://docs.crawlapi.dev/rate-limits.md) Per-minute and concurrency limits, `RateLimit` headers, and `429` handling.
- [Timeouts](https://docs.crawlapi.dev/timeouts.md) Request deadlines, client timeout margin, and disconnect behavior.
- [Credits & pricing](https://docs.crawlapi.dev/credits.md) Credit billing, holds, and response usage tracking.
- [API keys & billing](https://docs.crawlapi.dev/account.md) Key scopes, credit packs, automatic top-up, and the playground trial.
