Scrapinghub API Reference

Crawlera API


Check also the Help Center for general guides and articles.

Proxy API

Crawlera works with a standard HTTP web proxy API, where you only need an API key for authentication. This is the standard way to perform a request via Crawlera:

curl -vx -U <API key>:


When an error occurs, Crawlera sends a response containing an X-Crawlera-Error header and an error message in the body.


These errors are internal to Crawlera and are subject to change at any time, so should not be relied on and only used for debugging.

X-Crawlera-Error Response Code Error Message
bad_session_id 400 Bad session ID
user_session_limit 400 Session limit exceeded
bad_proxy_auth 407 Incorrect authentication data
too_many_conns 429 Parallel connections limit has been reached*
header_auth 470 Unauthorized header
500 Unexpected error
nxdomain 502 Error looking up domain
ehostunreach 502 Host is unreachable
econnrefused 502 Connection refused
econnreset 502 Connection reset by peer
socket_closed_remotely 502 The socket has been closed remotely
client_conn_closed 503 Connection closed by client
noslaves 503 No available proxies
banned 503 Proxy has been banned
serverbusy 503 Server busy: too many outstanding requests
timeout 504 Connection timed out
msgtimeout 504 Message passing timeout
domain_forbidden 523 The domain is forbidden for crawling
bad_header 540 Bad header value
data_error 541 Response size is too big

* Crawlera limits the number of concurrent connections based on your Crawlera plan. See: Crawlera pricing table for more information on plans.

* Crawlera limits the size of response. If you attempt to download file larger than 500MB it will return an error.



Sessions allow reusing the same slave for every request. Sessions expire 30 minutes after their last use and Crawlera limits the number of concurrent sessions to 100 for C10 plans, and 5000 for all other plans.

Sessions are managed using the X-Crawlera-Session header. To create a new session send:

X-Crawlera-Session: create

Crawlera will respond with the session ID in the same header:

X-Crawlera-Session: <session ID>

From then onward, subsequent requests can be made through the same slave by sending the session ID in the request header:

X-Crawlera-Session: <session ID>

Another way to create sessions is using the /sessions endpoint:

curl -u <API key>: -X POST

This will also return a session ID which you can pass to future requests with the X-Crawlera-Session header like before. This is helpful when you can’t get the next request using X-Crawlera-Session.

If an incorrect session ID is sent, Crawlera responds with a bad_session_id error.

List sessions

Issue the endpoint List sessions with the GET method to list your sessions. The endpoint returns a JSON document in which each key is a session ID and the associated value is a slave.


curl -u <API key>:
{"1836172": "<SLAVE1>", "1691272": "<SLAVE2>"}

Delete a session

Issue the endpoint Delete a session with the DELETE method in order to delete a session.


curl -u <API key>: -X DELETE

Session Request Limits

There is a default delay of 12 seconds between each request using the same IP. These delays can differ for more popular domains. If the requests per second limit is exceeded, further requests will be delayed for up to 15 minutes. Each request made after exceeding the limit will increase the request delay. If the request delay reaches the soft limit (120 seconds), then each subsequent request will contain X-Crawlera-Next-Request-In header with the calculated delay as the value.

Request Headers

Crawlera supports multiple HTTP headers to control its behaviour.

Not all headers are available in every plan, here is a chart of the headers available in each plan (C10, C50, etc):

Header C10 C50 C100 C200 Enterprise


Only available on C50, C100, C200 and Enterprise plans.

Deprecated. Use X-Crawlera-Profile instead.

This header controls Crawlera User-Agent behaviour. The supported values are:

  • pass - pass the User-Agent as it comes on the client request
  • desktop - use a random desktop browser User-Agent
  • mobile - use a random mobile browser User-Agent

If X-Crawlera-UA isn’t specified, it will default to desktop. If an unsupported value is passed in X-Crawlera-UA header, Crawlera replies with a 540 Bad Header Value.

More User-Agent types will be supported in the future (chrome, firefox) and added to the list above.


Only available on C50, C100, C200 and Enterprise plans.

This is a replacement of X-Crawlera-UA header with slightly different behaviour: X-Crawlera-UA only sets User-Agent header but X-Crawlera-Profile applies a set of headers which actually used by the browser. For example, all modern browsers set Accept-Language and Accept-Encoding headers. Also, some browsers set DNT and Upgrade-Insecure-Requests headers.

We provide correct default values for the headers sent by the mimicked browser. If you want to use your own header, please use complimentary header X-Crawlera-Profile-Pass. The value of X-Crawlera-Profile-Pass is the name of the header you need to use. In that case, Crawlera won’t override you value. You can put several header names there, delimited by comma.


You want to use your own specific browser locale (de_DE) instead of default en_US. In that case, you need to put Accept-Language as a value of X-Crawlera-Profile-Pass and provide de_DE as a value of Accept-Language.

X-Crawlera-Profile: desktop
X-Crawlera-Profile-Pass: Accept-Language
Accept-Language: de_DE

This header’s intent is to replace legacy X-Crawlera-UA so if you pass both X-Crawlera-UA and X-Crawlera-Profile, the latter supersedes X-Crawlera-UA.


X-Crawlera-UA: desktop
X-Crawlera-Profile: pass

Crawlera won’t respect X-Crawlera-UA setting here because X-Crawlera-Profile is set.

Supported values for this headers are:

  • pass - do not use any browser profile, use User-Agent, provided by the client
  • desktop- use a random desktop browser profile ignoring client User-Agent header
  • mobile - use a random mobile browser profile ignoring client User-Agent header

By default, no profile is used. Crawlera starts to process X-Crawlera-UA header. If an unsupported value is passed in X-Crawlera-Profile header, Crawlera replies with a 540 Bad Header Value.


Only available on C50, C100, C200 and Enterprise plans.

This header instructs Crawlera not to check responses against its ban rules and pass any received response to the client. The presence of this header (with any value) is assumed to be a flag to disable ban checks.


X-Crawlera-No-Bancheck: 1


This header allows to disable internal cookies tracking performed by Crawlera.


X-Crawlera-Cookies: disable


This header instructs Crawlera to use sessions which will tie requests to a particular slave until it gets banned.


X-Crawlera-Session: create

When create value is passed, Crawlera creates a new session an ID of which will be returned in the response header with the same name. All subsequent requests should use that returned session ID to prevent random slave switching between requests. Crawlera sessions currently have maximum lifetime of 30 minutes. See Sessions for information on the maximum number of sessions.


This header sets the job ID for the request (useful for tracking requests in the Crawlera logs).


X-Crawlera-JobId: 999



This header has no effect when using X-Crawlera-Session header.

This header limits the number of retries performed by Crawlera.


X-Crawlera-Max-Retries: 1

Passing 1 in the header instructs Crawlera to do up to 1 retry. Default number of retries is 5 (which is also the allowed maximum value, the minimum being 0).


This header sets Crawlera’s timeout in milliseconds for receiving a response from the target website. The timeout must be specified in milliseconds and be between 30,000 and 180,000. It’s not possible to set the timeout higher than 180,000 milliseconds or lower than 30,000 milliseconds, it will be rounded to its nearest maximum or minimum value.


X-Crawlera-Timeout: 40000

The example above sets the response timeout to 40,000 milliseconds. In the case of a streaming response, each chunk has 40,000 milliseconds to be received. If no response is received after 40,000 milliseconds, a 504 response will be returned. If not specified, it will default to 30000.

[Deprecated] X-Crawlera-Use-Https

Previously the way to perform https requests needed the http variant of the url plus the header X-Crawlera-Use-Https with value 1 like the following example:

curl -x -U <API key>: -H x-crawlera-use-https:1

Now you can directly use the https url and remove the X-Crawlera-Use-Https header, like this:

curl -x -U <API key>:

If you don’t use curl for crawlera you can check the rest of the documentation and update your scripts in order to continue using crawlera without issues. Also some programming languages will ask for the Certificate file crawlera-ca.crt. You can install the certificate on your system or set it explicitely on the script.

Response Headers


This header is returned when response delay reaches the soft limit (120 seconds) and contains the calculated delay value. If the user ignores this header, the hard limit (1000 seconds) may be reached, after which Crawlera will return HTTP status code 503 with delay value in Retry-After header.


This header activates tracking of additional debug values which are returned in response headers. At the moment only request-time and ua values are supported, comma should be used as a separator. For example, to start tracking request time send:

X-Crawlera-Debug: request-time

or, to track both request time and User-Agent send:

X-Crawlera-Debug: request-time,ua

The request-time option forces Crawlera to output to the response header a request time (in seconds) of the last request retry (i.e. the time between Crawlera sending request to a slave and Crawlera receiving response headers from that slave):

X-Crawlera-Debug-Request-Time: 1.112218

The ua option allows to obtain information about the actual User-Agent which has been applied to the last request (useful for finding reasons behind redirects from a target website, for instance):

X-Crawlera-Debug-UA: Mozilla/5.0 (Windows; U; Windows NT 6.1; zh-CN) AppleWebKit/533+ (KHTML, like Gecko)


This header is returned when an error condition is met, stating a particular Crawlera error behind HTTP status codes (4xx or 5xx). The error message is sent in the response body.


X-Crawlera-Error: user_session_limit


Returned errors are internal to Crawlera and are subject to change at any time, so should not be relied on.

Using Crawlera with Scrapy Cloud

To employ Crawlera in Scrapy Cloud projects the Crawlera addon is used. Go to Settings > Addons > Crawlera to activate.


CRAWLERA_URL proxy URL (default:
CRAWLERA_ENABLED tick the checkbox to enable Crawlera
CRAWLERA_MAXBANS number of bans to ignore before closing the spider (default: 20)
CRAWLERA_DOWNLOAD_TIMEOUT timeout for requests (default: 190)

Using Crawlera from different languages

Check out our Knowledge Base for examples of using Crawlera with different programming languages:

Fetch API


The Fetch API is deprecated and will be removed soon. Use the standard proxy API instead.

Crawlera’s fetch API let’s you request URLs as an alternative to Crawlera’s proxy interface.



Field values should always be encoded.

Field Required Description Example
url yes URL to fetch
headers no Headers to send in the outgoing request header1:value1;header2:value2

Basic example:

curl -u <API key>:

Headers example:

curl -u <API key>: ''

Working with HTTPS

See Crawlera with HTTPS in our Knowledge Base

Working with Cookies

See Crawlera and Cookies in our Knowledge Base