When the site you render returns an HTTP error, the API fails with host_returned_error and includes the site’s status code in the returned_status_code field.
Version 1.3.0 of the official JavaScript and TypeScript SDK now exposes it as returnedStatusCode on APIError, so you can tell a missing page (404) from a site that blocks automated access (401, 403, 429) or one that is down (5xx):
import * as screenshotone from "screenshotone-api-sdk";
try { const image = await client.take(options);} catch (error) { if ( error instanceof screenshotone.APIError && error.errorCode === "host_returned_error" ) { console.log(`The site returned ${error.returnedStatusCode}`); }}For other errors, returnedStatusCode is undefined.
To upgrade, run npm install screenshotone-api-sdk@latest. See how to handle API errors for more.
If you have any questions or suggestions, please contact support@screenshotone.com.


