Skip to main content
This guide makes a single GET request with the ZenRows Node.js SDK: create a client, send the request, read the response.
Haven’t installed the SDK yet? Follow Installation first.

Basic usage

1

Create a client

Import ZenRows and instantiate it with your API key:
const { ZenRows } = require("zenrows");

const client = new ZenRows("YOUR_ZENROWS_API_KEY");
2

Send a GET request

Call client.get() with the URL you want to scrape:
const { ZenRows } = require("zenrows");

const client = new ZenRows("YOUR_ZENROWS_API_KEY");
const url = "https://www.scrapingcourse.com/ecommerce/";

(async () => {
  const response = await client.get(url);
  const html = await response.text();

  console.log(html);
})();
response is a standard fetch Response object.
See The Response Object for everything available on it.
3

Add request parameters

Pass a config object as the second argument to enable Universal Scraper API features like JavaScript rendering or Premium Proxies:
const { ZenRows } = require("zenrows");

const client = new ZenRows("YOUR_ZENROWS_API_KEY");
const url = "https://www.scrapingcourse.com/ecommerce/";

(async () => {
  const response = await client.get(url, {
    js_render: true,
    premium_proxy: true,
    proxy_country: "us",
  });

  const html = await response.text();

  console.log(html);
})();
The config object accepts every parameter documented in the Universal Scraper API setup guide, including autoparse, css_extractor, wait_for, block_resources, and outputs. They all work exactly the same way through the SDK.
4

Check the result

Since the SDK doesn’t throw an exception on non-2xx responses, always check the status before using the content:
if (response.ok) {
  const html = await response.text();
  console.log(html);
} else {
  console.log(`Request failed with status ${response.status}: ${await response.text()}`);
}
See Error Handling and Retries for how to configure automatic retries so you don’t have to handle every transient failure manually.

Troubleshooting

  • response.status is 401 or similar auth error: Double-check your API key was copied correctly from the ZenRows Request Builder with no extra whitespace. See AUTH002.
  • The response body is empty or looks like an error page, not the target site: The target likely needs js_render: true and/or premium_proxy: true. See REQS002.
  • await response.text() hangs or the script never finishes: Make sure the call is wrapped in an async function and awaited; the SDK doesn’t have a timeout option, so a hung request will wait indefinitely unless your own code aborts it (e.g. with AbortController).
  • 429 Too Many Requests: You’ve hit your plan’s concurrency or rate limit. See Concurrency.

Pricing

Cost depends on the config you send, not on the SDK itself:
ConfigurationCost multiplier vs. basic
Basic request (no js_render/premium_proxy)1x
js_render: true5x
premium_proxy: true10x
js_render: true + premium_proxy: true25x
Only successful requests are billed. See ZenRows Pricing for exact per-plan rates.

FAQ (Frequently Asked Questions)

No, the config argument is optional. client.get(url) alone works for public pages with no anti-bot protection.
By design, the SDK resolves with the Response object even for error status codes, matching how native fetch behaves. Check response.ok or response.status yourself. See Error Handling and Retries.
Yes. Create one ZenRows instance and call .get()/.post() on it as many times as needed, there’s no need to recreate it per request.

What’s next

POST Requests

Submit forms or data payloads.

Concurrency

Scrape many URLs in parallel.

Custom Headers

Forward specific headers to the target site.