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.
-
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. -
Export your key
Keep the key in your server environment or a gitignored
.envfile. Keep it out of git history and client-side browser bundles.export CRAWLAPI_API_KEY="ck_..." -
Send your first request
POST /v1/scrapetakesurl(required), optionalformat(markdownorjson), and optionaltimeout(1000–60000ms, default30000). Set your HTTP client timeout slightly longer thantimeout.curl -sS https://api.crawlapi.dev/v1/scrape \ -H "Authorization: Bearer $CRAWLAPI_API_KEY" \ -H 'content-type: application/json' \ --data '{"url": "https://example.com"}'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(); console.log(body.success ? body.data.markdown : body.error);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() print(body["data"]["markdown"] if body["success"] else body["error"]) -
Read the response
Check
body.successbefore readingdata. Optional metadata flags (truncated,login_required) appear only whentrue.{ "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 successtrueon success,falseon failurerequest_idEchoed in x-request-id; include it when contacting supportdata.markdownClean page text (present when formatismarkdown)data.jsonStructured page data (present when formatisjson)data.metadatatitle,description,language,status,final_url, plus optionaltruncatedandlogin_requireddata.linksUnique absolute http(s)URLs from the page (entry links for RSS/Atom feeds;[]for other documents)usagecreditscharged for this request and yourremainingbalance
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.