The JavaScript SDK returns the site's status code

When a site returns an error, the SDK now gives you its HTTP status code in returnedStatusCode.

Changelog1 min read

Written by

Dmytro Krasun

Published on

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.

Read more product updates

New features, bug fixes, and optimizations...

View all product updates
ScreenshotOne skill for OpenClaw is available

ScreenshotOne skill for OpenClaw is available

Use the ScreenshotOne Render Website Screenshot skill in OpenClaw via ClawHub.

Read more

1 min read

Fewer failed requests

Fewer failed requests

Requests that reach a busy rendering server are retried on another one, HTML and markdown of pages that redirect themselves no longer fail, and storage errors say what to fix.

Read more

1 min read

Download request content in the dashboard

Download request content in the dashboard

You can now download request content in the dashboard.

Read more

1 min read

Automate website screenshots

Exhaustive documentation, ready SDKs, no-code tools, and other automation to help you render website screenshots and outsource all the boring work related to that to us.