Skip to main content
Every method on ZenRows (get and post) resolves with a standard Response object, the same one native fetch returns. The SDK doesn’t wrap or transform it, so everything you already know about the Fetch API applies directly.

Commonly used properties and methods

response.text() and response.json() are asynchronous, they return a Promise and must be awaited. This is different from libraries where the body is already available as a plain property.

Reading ZenRows-specific headers

ZenRows adds monitoring headers to every response, useful for debugging and tracking usage:
If you ever contact ZenRows support about a failed request, include the X-Request-Id header value. It lets the team trace the exact request in the logs.
Headers coming from the target website itself are prefixed with Zr- to distinguish them from ZenRows’ own headers. See the full list in the Universal Scraper API setup guide.

Checking success before using the body

Because the SDK resolves with the response as-is rather than throwing on error status codes, always confirm the request succeeded first:

Error Handling and Retries

More on this pattern, plus how to configure automatic retries.

Troubleshooting

  • await response.json() throws a SyntaxError: The body isn’t JSON. Confirm you requested json_response: true or that the target actually returns JSON before calling .json().
  • Saved file (PDF, screenshot, image) is corrupted: You wrote response.text() instead of response.arrayBuffer(), or forgot to wrap it in Buffer.from(...) before writing to disk.
  • Calling response.text() twice throws an error: A Response body can only be read once. Store the result of the first call in a variable and reuse it instead of calling .text()/.json() again.
  • response.url doesn’t match the URL you passed: This is expected. It’s the full URL sent to ZenRows’ API (including your apikey and config as query parameters), not the target URL by itself.

Pricing

The response itself doesn’t add cost. ZenRows adds two headers to help you track usage:
  • X-Request-Cost: the dollar cost of the request (e.g., 0.001)
  • X-Request-Credits: the number of credits consumed by the request
Both values are based on the config used: See ZenRows Pricing.

FAQ (Frequently Asked Questions)

No. It’s the standard Response object from the Fetch API. Any Fetch API documentation or Stack Overflow answer about it applies here too.
Call await response.json() if the body is JSON. For example, when using json_response: true or autoparse: true on structured data.
Check the response headers: X-Request-Cost gives you the dollar cost (e.g., 0.001) and X-Request-Credits gives you the number of credits consumed. Read them with response.headers.get("X-Request-Cost") and response.headers.get("X-Request-Credits").