POST /v1/scrape

Read one URL and return it as markdown or JSON. From 1 credit; a failure costs 0.

POSThttps://api.crawlapi.dev/v1/scrape

Request

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

Authorization

Every request carries a key from app.crawlapi.dev/keys. A missing, unknown, revoked or suspended key answers 401 UNAUTHORIZED, and so do two different keys in one request (both headers with the same key is one key).

Every request carries a key from app.crawlapi.dev/keys, as Authorization: Bearer <key> or x-api-key. A missing, unknown, revoked or suspended key answers 401 UNAUTHORIZED, and so do two different keys in one request (both headers with the same key is one key).

HeaderValue
AuthorizationBearer <key>
x-api-key<key>

Body

A JSON object, at most 64 KiB, sent within 5 seconds; it is read as JSON whatever its content-type. An unknown field, a wrong type or an out-of-range value answers 400 INVALID_REQUEST. Any method but POST answers 405, and a path with a trailing slash 404.

A JSON object, at most 64 KiB. An unknown field or an out-of-range value answers 400 INVALID_REQUEST.

urlstringrequired

The page to read. Public http and https on the ports 80, 443, 8080, 8443 only; private and reserved addresses, credentials in the URL and other ports are UNSAFE_URL.

1–8,192 characters
formatone of markdown, jsonoptional

markdown returns the page’s text; json returns its structured data.

default markdown
timeoutinteger or nulloptional

Deadline in milliseconds for the whole request. Defaults to 30000.

default 300001000–60000 ms

Response

One JSON object. data carries markdown or json, never both. usage.credits says what the page cost.

data carries markdown or json, never both. usage.credits says what the page cost.

successtruerequired

true on a success, including a login wall.

request_idstringrequired

The request’s id; the same value is in x-request-id.

dataobjectrequired

The page: its metadata and links, and markdown or json.

4 fields: metadata, links, markdown, json
metadataobjectrequired

What the page says about itself, and how the request ended.

7 fields: title, description, language, status, final_url, truncated, login_required
titlestringrequired

The page’s title, up to 1,000 characters.

descriptionstringrequired

The page’s meta description, up to 1,000 characters.

languagestring or nullrequired

The page’s language, when it declares one.

statusintegerrequired

The HTTP status the site answered with.

final_urlstringrequired

The URL the page was read from, after redirects, without the query parameters that only track visitors or that a bot check left behind; an X post’s own address.

truncatedbooleanoptional

A cap cut the page: a byte cap, or the 2 MiB output cap.

default false
login_requiredbooleanoptional

A sign-in wall: the wall’s own text, 0 credits.

default false
linksarray of stringrequired

Every absolute URL on the page, in document order, up to 5,000.

markdownstring or nulloptional

The page’s text, at most 2 MiB. Present when format is markdown.

jsonobject or nulloptional

The page’s structured data. Present when format is json.

4 fields: structured, tables, jsonld, embedded
structuredobject or nulloptional

The one object the page declares itself to be, read as its most specific type, or an X post; left out when the page declares none.

tablesarray of objectrequired

Record tables: JSON-LD and embedded arrays first, then HTML tables, then the page’s repeated cards.

jsonldarray of objectrequired

The page’s JSON-LD blocks, as written.

embeddedarray of objectrequired

The page’s state blobs (__NEXT_DATA__, application/json scripts, …), largest first.

usageobjectrequired

What this request charged, and what is left to spend.

2 fields: credits, remaining
creditsintegerrequired

The credits this request charged: the price of the page’s level, 0 on a failure or a login wall.

remainingintegerrequired

The balance left after this request.

1 credit
{
  "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 }
}
HeaderValue
x-request-idthe request’s id
retry-afteron a 429, and on a 500 while our database is down: seconds until you can try again
ratelimit-policyon every answer to a valid key: the account's limits, "minute";q= and "concurrency";q=
ratelimitwhat is left: "minute";r= requests that can start now, t= seconds until one more can, "concurrency";r= free slots. Rate limits

Errors

A failure answers success: false and an error. Every response carries x-request-id.

A failure answers success: false and an error with a code, a message and a retryable flag.

successfalseoptional

false on a failure.

request_idstringrequired

The request’s id; the same value is in x-request-id.

errorobjectrequired

Why it failed and whether a retry can help.

6 fields: code, message, retryable, doc_url, target_status, vendor
codeone of 17 codesrequired

The reason code. Every code is on Errors and retries.

messagestringrequired

One to three sentences for the caller, at most 220 characters.

retryablebooleanrequired

The same request may succeed later, after Retry-After when sent.

doc_urlstringrequired

This code’s entry on Errors and retries: what it means and what to do.

target_statusinteger or nulloptional

The HTTP status the site answered with, when the site answered.

vendorstring or nulloptional

The bot protection that refused the page, when it is known.

0 credits
{
  "success": false,
  "request_id": "req_41e813f088955c316776",
  "error": {
    "code": "BLOCKED",
    "message": "The site's bot protection (Akamai) refused access.",
    "retryable": true,
    "doc_url": "https://docs.crawlapi.dev/errors#BLOCKED",
    "target_status": 403,
    "vendor": "akamai"
  }
}
StatusCodes
200success
400INVALID_REQUEST, UNSAFE_URL
401UNAUTHORIZED
402INSUFFICIENT_CREDITS
404NOT_FOUND
405INVALID_REQUEST, the method is not allowed on this path
408TIMEOUT
410GONE
422BLOCKED, HOST_NOT_FOUND, LOGIN_REQUIRED, NO_CONTENT, SCANNED_PDF, TARGET_ERROR, UNSUPPORTED_CONTENT
429RATE_LIMITED
500ENGINE_FAILED, INTERNAL

What each code means and whether a retry can help: Errors and retries.

Limits

LimitValue
timeout1000–60000 ms, 30000 ms by default
urlat most 8,192 characters
Requestsper minute and at once, one limit per account: Rate limits
Creditsthe price of the page’s level; a failure costs 0: Credits
esc
↑↓navigate↵openescclose
Dashboard
Get API key