Create an API key, send your first POST /v1/scrape request, and read the response.

On this page

Run your first POST /v1/scrape call with cURL, TypeScript, or Python. If you want your coding agent to wire crawlapi into a repo for you, start with the Agent quickstart or connect the MCP server.

  1. Create an API key

    Sign in at app.crawlapi.dev/keys and generate a key. Keys start with ck_ and are displayed once. Buy a credit pack at app.crawlapi.dev/billing, or try 10 pages in the web playground first.

  2. Export your key

    Keep the key in your server environment or a gitignored .env file. Keep it out of git history and client-side browser bundles.

    export CRAWLAPI_API_KEY="ck_..."
  3. Send your first request

    POST /v1/scrape takes url (required), optional format (markdown or json), and optional timeout (1000–60000 ms, default 30000). Set your HTTP client timeout slightly longer than timeout.

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

    Check body.success before reading data. Optional metadata flags (truncated, login_required) appear only when true.

    {
      "success": true,
      "request_id": "req_1dc0a514d6ee71c4524b",
      "data": {
        "metadata": {
          "title": "Example Domain",
          "description": "",
          "language": "en",
          "status": 200,
          "final_url": "https://example.com/"
        },
        "links": [],
        "markdown": "# Example Domain\n\nThis domain is for use in documentation examples without needing permission. This is not a service; avoid relying on it for testing and monitoring purposes."
      },
      "usage": {
        "credits": 1,
        "remaining": 9999
      }
    }
    Field Meaning
    success true on success, false on failure
    request_id Echoed in x-request-id; include it when contacting support
    data.markdown Clean page text (present when format is markdown)
    data.json Structured page data (present when format is json)
    data.metadata title, description, language, status, final_url, plus optional truncated and login_required
    data.links Unique absolute http(s) URLs from the page (entry links for RSS/Atom feeds; [] for other documents)
    usage credits charged for this request and your remaining balance

Try other inputs

Every scrape uses the same endpoint and Authorization header:

Goal Request body Guide
Structured entities & tables {"url": "https://www.imdb.com/title/tt0111161/", "format": "json"} Structured JSON
PDF, Office, CSV, or feed {"url": "https://arxiv.org/pdf/1706.03762"} PDFs & documents
X post or YouTube video {"url": "https://www.youtube.com/watch?v=rfscVS0vtbw"} X & YouTube
Custom request deadline {"url": "https://example.com", "timeout": 45000} Timeouts

If the request fails

Failed requests return success: false with a machine-readable error.code.

Status What to do
400 Fix the field named in error.param and error.message before retrying.
401 Verify that CRAWLAPI_API_KEY is exported and active at app.crawlapi.dev/keys.
402 Buy credits at app.crawlapi.dev/billing before retrying.
408 The page exceeded your timeout deadline. Raise timeout up to 60000 ms or see Timeouts.
422 / 429 Branch on error.code and error.retryable; wait Retry-After seconds on 429.

See Errors and retries for retry helpers and every error code.

Next steps

esc
↑↓navigate↵openescclose
Documentation