Zyte API error handling#

While using Zyte API, you may get the following type of responses:

Successful 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:

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 statusCode field is 404.

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 an actions key with details about the outcome of each action.

Rate-limiting responses#

Note

You are not charged for rate-limiting responses.

Tip

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.

    After signup, Zyte API accounts are allowed, by default, a maximum of 120 requests per minute. You may open a support ticket to request a higher rate limit for your account.

    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.

Unsuccessful responses#

Note

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:

Temporary download errors#

Tip

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.

Tip

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.

Service errors#

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.

Invalid requests#

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 browserHtml and httpResponseBody in a data extraction request

  • There is an issue with your authorization data: it is missing, not sent in the expected format, or you are using the wrong key

  • Your request body is invalid JSON

Account suspension#

Zyte API sends an HTTP 403 response if you Zyte API account is suspended.

Causes of account suspension include:

Retrying requests#

Tip

Zyte API client software handles retries for rate limiting and temporary download errors automatically.

You should automatically retry requests that get a rate-limiting or a temporary download error response.

When retrying requests automatically, please use an exponential backoff algorithm: for any given request, increase the time between retries exponentially.

Ban handling#

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.

If you ever get a successful Zyte API response that you believe is the result of a ban, please open a support ticket to report the issue.

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.