Request Status Codes

You can tell if your request was successful by checking the status code when receiving an API response. If a response comes back unsuccessful, you can use the error type and error message to figure out what has gone wrong and do some rudimentary debugging (before contacting support). A successful request will be returned with status code 200.


Status codes

Here is a list of the different categories of status codes returned by the screenshotbase.com API. Use these to understand if a request was successful.

  • Name
    200
    Type
    Description

    A 200 status code indicates a successful response.

  • Name
    400
    Type
    Description

    A 400 status code indicates that the hostname of the target website could not be resolved (DNS failure). Check that the URL you passed actually exists.

  • Name
    401
    Type
    Description

    A 401 status code indicates that your API key is missing or invalid. A missing key returns the message No API key found in request (error code missing_api_key); an invalid key returns Invalid authentication credentials (error code invalid_api_key).

  • Name
    403
    Type
    Description

    A 403 status code indicates that your request was refused: either the API key belongs to a different everapi product (error code key_not_allowed_for_product), or the request came from a referrer that is not on your API key's whitelist (error code referrer_not_allowed).

  • Name
    404
    Type
    Description

    A 404 status code indicates that a requested endpoint does not exist.

  • Name
    408
    Type
    Description

    A 408 status code indicates that the target website took too long to load within the configured timeout. Try increasing the timeout parameter or a less strict wait_until value. A PDF, markdown (including its conversion), and any render of HTML input, must finish within about 12 seconds of the start of the request, whatever the timeout; a slower render is stopped with this status (see PDF time limit). Requests answered with 408 are not billed.

  • Name
    422
    Type
    Description

    A validation error has occurred. Parameter validation failures return a JSON response with an errors object describing which parameter failed and why, for example The delay field must not be greater than 7. for a PDF with a longer delay.

    URL-safety rejections return a plain message instead: Only http and https URLs are allowed., URLs targeting localhost are not allowed., URLs targeting private or reserved IP ranges are not allowed. or URLs targeting internal host names are not allowed. The API refuses URLs whose host is, or resolves to, a loopback, private, link-local (including cloud metadata), carrier-grade NAT or other reserved IPv4 or IPv6 address, and internal host names such as localhost, *.local, *.internal or single-label names. The same rules apply to every redirect and every resource the page loads: such resources are not fetched, and if the page itself redirects to such an address, the request fails with this status.

    For a PDF, The pdf_page_ranges select no page of the rendered document. means that none of the pages in pdf_page_ranges exists in the printed document. For markdown, The page is too large to convert to markdown. means that the page has too much HTML, or its conversion needs too much memory. For HTML input (POST /v1/take), the errors object can say Send either url or html, not both., Either the url or the html field is required., The html field must not be larger than 5 MB (5242880 bytes). or The html field is only accepted in the JSON body of a POST request. (also on GET). Requests answered with 422 are not billed.

  • Name
    429
    Type
    Description

    A 429 status code indicates that you have hit your rate limit or your monthly limit. For more requests please upgrade your plan. A PDF, markdown, and any render of HTML input, is checked against your quota before the page is rendered: if the quota does not cover it, the response carries an error.code such as quota_exceeded and quota.required, the number of requests the call would have cost, and nothing is billed.

  • Name
    500
    Type
    Description

    A 500 status code indicates an internal server error - let us know: support@screenshotbase.com. For HTML input, The page could not be rendered. means that the HTML could not be rendered for a reason not listed here; such requests are not billed.

  • Name
    502
    Type
    Description

    A 502 status code indicates that the target website could not be loaded. The message includes the underlying network error, e.g. The target website could not be loaded (ERR_CONNECTION_FAILED).; a connection that could not be established at all is reported as ERR_CONNECTION_FAILED. Requests answered with 502 are not billed.

  • Name
    503
    Type
    Description

    A 503 status code indicates that a PDF, markdown, or a render of HTML input, requested with upload=1 was rendered but could not be stored: The file could not be stored. Please try again. The request is not billed; send it again.