ZenRows lets you download images, PDFs, and other binary files directly from web pages as part of your scraping workflow. Instead of scraping HTML and then fetching assets separately, you can point the API at a file URL and receive the binary content ready to save. This is useful for collecting product images, downloadable reports, manuals, or any non-text content that lives at a direct URL.Documentation Index
Fetch the complete documentation index at: https://docs.zenrows.com/llms.txt
Use this file to discover all available pages before exploring further.
How it works
There are two scenarios where ZenRows can return a file download:Direct file response
Triggered download via JS Instructions
Basic usage
Pass the direct file URL as theurl parameter. ZenRows returns the binary content of the file, which you can then save to disk:
When to use file downloads
File download is the right approach when the content you need is a binary asset rather than scraped HTML. It works well for:- Product images: download images directly from e-commerce product pages or media libraries.
- PDFs and documents: collect downloadable reports, whitepapers, manuals, or invoices.
- Data exports: fetch CSV, JSON, or XML files served at direct URLs.
- Media assets: download audio or video files linked directly on a page.
File size limits
ZenRows enforces a maximum file size per request to ensure stable performance across all plans. If the file you are trying to download exceeds your plan’s limit, the API returns a413 Content Too Large error.
Best practices
Save as binary, not text:All file downloads return binary content. Always write the response body in binary mode (for example,
"wb" mode in Python and Ruby, Buffer in Node.js, or FileOutputStream in Java). Writing binary content as text will produce a corrupt file.
Enable js_render for pages that load content dynamically: If the page loads content dynamically after the initial render, enable
js_render to ensure the full page is visible before the file is downloaded.
Enable premium_proxy for pages that are blocked by anti-bot systems: If the page is blocked by an anti-bot system, enable
premium_proxy to bypass the block.
Check the status code before saving: Always verify that the response returned a
200 status code before writing to disk. Saving an error response as a file will produce an unreadable or corrupt output.
Use direct file URLs where possible: Direct file URLs (ending in
.pdf, .jpg, .csv, etc.) are the most reliable download method. If you need to navigate to a page first to trigger the download, use JS Instructions to simulate the click and capture the resulting file.
Credits are charged on successful responses: File download requests are charged when the API returns a
200 status code, regardless of what the file contains. Test with a small set of URLs before running large download batches.
Troubleshooting
The downloaded file is corrupt or cannot be opened
The downloaded file is corrupt or cannot be opened
"wb" in Python and Ruby, Buffer in Node.js, FileOutputStream in Java) and writing the raw response body rather than a text representation of it. This applies to all binary file types including PDFs, images, and archives.The API returns HTML instead of the file
The API returns HTML instead of the file
.pdf or .jpg) rather than to a page that contains a download button or link. For page-triggered downloads, use JS Instructions to simulate the interaction.I receive a 413 Content Too Large error
I receive a 413 Content Too Large error
The download is triggered by a button click and ZenRows returns nothing
The download is triggered by a button click and ZenRows returns nothing
Pricing
File download requests are included at no additional cost with all ZenRows requests. You only pay extra for JS Render and Premium Proxy when used.FAQ (Frequently Asked Questions)
What file types can ZenRows download?
What file types can ZenRows download?
Do I need js_render=true to download files?
Do I need js_render=true to download files?
js_render=true if the file download is triggered by a JavaScript interaction on a page.Can I download multiple files in one request?
Can I download multiple files in one request?
Can I download files that require authentication?
Can I download files that require authentication?
Authorization or session cookies) using the custom_headers parameter to authenticate with the target server before the file is returned. Another method is to use the JS Instructions to simulate the user action that triggers the download.What happens if the file exceeds the size limit?
What happens if the file exceeds the size limit?
413 Content Too Large error. The request is still counted toward your usage. Check your plan’s file size limit in the Pricing Documentation before downloading large files at scale.