Zyte API error handling#
While using Zyte API, you may get the following type of responses:
Zyte API sends a successful response, i.e. a response with an HTTP status code of 200, when that response provides the requested data, ban-free.
A Zyte API response is considered successful even in the following scenarios:
Some browser actions have failed.
Bad website responses#
When a website sends a response with an HTTP status code other than 200, and that response is not the result of a ban, Zyte API sends that response to you.
For example, if you send a request to https://toscrape.com/not-found, you get a
successful response from Zyte API, where the value of the
Browser action failures#
Browser action failures, such as timeouts, do not cause Zyte API to send an unsuccessful response.
Zyte API returns your requested output (e.g. browser HTML, screenshot) the way
it was at the time of the action error, and the Zyte API response includes
actions key with details about the outcome of each action.
You are not charged for rate-limiting responses.
Zyte API client software handles rate limiting automatically.
Zyte API may send a response with an HTTP status code of 429 or 503 for rate-limiting purposes.
The right way to handle any rate-limiting response is to retry its request as many times as needed until you get a non-rate-limiting response.
Rate-limiting responses are sent in the following scenarios:
You have exceeded your account rate limit.
When making an efficient use of Zyte API, getting a small percentage of rate-limiting responses due to exceeding your account rate limit is expected and normal.
You have exceeded a website rate limit.
Each website has a different website rate limit. These limits exist to avoid causing issues on websites.
Website rate limits are global Zyte API limits, i.e. not specific to any Zyte API account. For example, if a website has a limit of 100 requests per minute, and an account is sending 75 requests per minute to that website, if then a second account starts sending 75 requests per minute to the same website, both accounts will see their traffic to that website limited to 50 requests per minute.
Zyte API is overloaded.
You are not charged for unsuccessful responses.
Zyte API sends an unsuccessful response, i.e. a response with an HTTP status code of 400 or higher that is not a rate-limiting response, when Zyte API cannot provide the requested data.
Zyte API sends unsuccessful responses in the following scenarios:
Your request is invalid
Your account has been suspended
Temporary download errors#
By default, Zyte API client software automatically retries temporary download errors up to 3 times before giving up.
Zyte API sends an HTTP 520 response when a temporary error prevents downloading the requested URL. You can retry your request until you get a different type of response.
If retries do not make a difference, please open a support ticket to report the issue.
Permanent download errors#
Zyte API sends an HTTP 521 response when a permanent error prevents downloading the requested URL.
You can wait for us to address the issue, or open a support ticket and ask to be notified when the issue is resolved.
For some websites, Zyte API may sometimes accidentally flag some temporary download errors as permanent download errors. If sending the same Zyte API request multiple times returns an HTTP 521 error only sometimes, you might want to treat HTTP 521 errors as HTTP 520 errors for the target website, i.e. retry them automatically, until we resolve your issue report.
If Zyte API sends an HTTP 500 response, it means there is an unexpected issue affecting Zyte API. If the issue persists, feel free to open a support ticket and ask to be notified when the issue is resolved.
Zyte API may send a response with an HTTP status code of 400, 401, or 422 if there is an error in your request, including:
You are using invalid parameters or parameter values
You are using incompatible parameters, such as mixing
httpResponseBodyin a data extraction request
Your request body is invalid JSON
Zyte API sends an HTTP 403 response if you Zyte API account is suspended.
Causes of account suspension include:
When retrying requests automatically, please use an exponential backoff algorithm: for any given request, increase the time between retries exponentially.
A banned response is a response from a website that is different from the response that a human would have received.
Zyte API handles banned responses automatically and transparently, so that you never get a banned response.
For a given request, if Zyte API cannot avoid a banned response in a reasonable time, Zyte API sends you a temporary download error response, for which you are not charged. You can then retry your request as many times as needed until Zyte API succeeds.
We monitor and proactively work on improving Zyte API success rates and response times. However, if you wish, you may open a support ticket and ask to be notified when an issue that affects you is resolved.
Zyte API uses many different techniques to avoid bans. However:
Zyte API does not solve CAPTCHAs automatically. Zyte API avoids getting CAPTCHAs in the first place instead. Zyte API cannot automatically get you data that is always locked behind a CAPTCHA.
Zyte API does not log into websites automatically. Zyte API cannot automatically get you data that is always locked behind a user login.