# Bulk File & Image Downloader: URLs or Datasets to ZIP (`4b47/bulk-file-downloader`) Actor

Download images, PDFs, documents, audio and video from URL lists, Apify dataset fields or web pages into one ZIP and/or storage with direct links. Type and size checks, retries, duplicate skipping, optional resize and WebP/JPEG/AVIF conversion. $1 per 1,000 files.

- **URL**: https://apify.com/4b47/bulk-file-downloader.md
- **Developed by:** [Kacper Gumieniuk](https://apify.com/4b47) (community)
- **Categories:** Developer tools, Automation, Integrations
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.00 / 1,000 file downloadeds

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

**Bulk File & Image Downloader saves files from a list of URLs into one ZIP and/or your Apify storage with a direct
link per file.** Images, PDFs, Word/Excel files, audio, video and archives. Take the URLs from a pasted list, from
fields of an **Apify dataset** (e.g. every `images` of a product scraper's output) or let it **find the files on web
pages**. It checks each file's real type from its first bytes, enforces a size limit, retries flaky servers, skips
identical files and can **resize images and convert them to WebP, JPEG, PNG or AVIF**.

**Try it now:** press **Start**. The prefilled input downloads 4 files (a JPEG, a PNG, an SVG and a PDF) into
`files.zip` and the key-value store in a few seconds for $0.004. Price: **$1 per 1,000 files** (first 1 MB of each
file included, then $0.0005 per MB). Failed URLs, refused types, oversized files and duplicates are free. Apify's
free plan ($5 of monthly credit) covers about **4,900 typical images a month**.

### Use cases

- **Product images for e-commerce:** run it on a product scraper's dataset (`images`, `imageUrl`) and get every
  photo resized to 1,600 px WebP in one ZIP, named `{index}-{name}.webp`, ready to upload to your shop.
- **Document collection:** download PDFs, reports and spreadsheets from a list of links (tenders, filings, manuals)
  and archive them with SHA-256 hashes.
- **Back up media you own:** pull the images and attachments of your website, CMS export or CDN into one archive.
- **Datasets for machine learning:** collect and normalize images (format, max size) with their source URL and hash.
- **Page asset grabbing:** give page URLs and *Find files on web pages* to fetch their images (largest `srcset`
  candidate), `og:image`, video/audio and linked PDFs.
- **Pipelines and agents:** each dataset item has a `fileUrl`, so the next step (OCR, AI vision, upload) can use the
  file directly.

### How to use Bulk File & Image Downloader

1. Paste direct file links into **File URLs**, or pick **Datasets** and name the **URL fields** (a field may hold one
   URL, a list of URLs or objects like `{"url": ...}`).
2. Optionally narrow **File types**, set **Max file size**, a **File name template** and image conversion.
3. Press **Start**. The run's **Output** tab links `files.zip`, the stored files and the dataset with one item per URL.
4. To process a scraper's results automatically: in that actor, **Integrations** → *Connect Actor or Task* → this
   actor with `{"datasetIds": ["{{resource.defaultDatasetId}}"], "urlFields": ["images"]}`.

### Input

```json
{
  "urls": [
    "https://upload.wikimedia.org/wikipedia/commons/a/a9/Example.jpg",
    "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf"
  ],
  "datasetIds": ["aBcDeFgHiJkLmNoPq"],
  "urlFields": ["images", "manualPdf"],
  "fileTypes": ["image", "pdf"],
  "imageFormat": "webp",
  "imageMaxWidth": 1600,
  "fileNameTemplate": "{host}/{index}-{name}.{ext}"
}
```

| Field | What it does |
| --- | --- |
| `urls` | Direct file links (up to 100,000), or base64 `data:` URLs. |
| `datasetIds` + `urlFields` | Apify datasets (via the picker) and the fields holding the URLs; nested paths like `media.images`. |
| `fileTypes` | `any` (default), `image`, `pdf`, `document`, `audio`, `video`, `archive`, `text`. Checked from the file content. |
| `createZip` / `saveToKeyValueStore` | Put files into `files.zip` (parts of `zipPartSizeMb`, default 500 MB) / store each file with a direct link. Both on by default. |
| `maxFileSizeMb` | Default 100 MB, up to 2,000. Announced sizes are refused before downloading. |
| `fileNameTemplate` | `{name}`, `{ext}`, `{index}`, `{hash}`, `{host}`; `/` makes ZIP folders. Repeats get `-2`, `-3`. |
| `dedupeByContent` | Skip files identical (SHA-256) to an earlier one. On by default. |
| `imageFormat`, `imageMaxWidth`, `imageMaxHeight`, `imageQuality` | Convert to `jpeg`/`png`/`webp`/`avif` and/or shrink (never enlarges; EXIF rotation applied). |
| `scanPages`, `maxFilesPerPage` | For page URLs: download the files they show or link to (one level deep). |
| `maxFiles`, `maxConcurrency` | Limits. Requests to one website are spaced at least 250 ms apart. |

### Output

One dataset item per URL (real result from `examples/input-advanced.json`, image converted to WebP at 800 px):

```json
{
  "url": "https://upload.wikimedia.org/wikipedia/commons/4/47/PNG_transparency_demonstration_1.png?utm_source=...",
  "status": "downloaded",
  "fileName": "upload.wikimedia.org/00006-PNG_transparency_demonstration_1.webp",
  "key": "upload.wikimedia.org_00006-PNG_transparency_demonstration_1.webp",
  "fileUrl": "https://api.apify.com/v2/key-value-stores/<storeId>/records/upload.wikimedia.org_00006-PNG_transparency_demonstration_1.webp",
  "zipFile": "files.zip",
  "fileType": "webp",
  "category": "image",
  "bytes": 70384,
  "downloadedBytes": 224566,
  "sha256": "c4e870d358d64ce677e958c156d0e3fba466993d8e915fc81c5dc64937a9b696",
  "width": 800,
  "height": 600,
  "converted": { "from": "png", "to": "webp", "originalBytes": 224566, "originalWidth": 800, "originalHeight": 600 },
  "from": "page https://en.wikipedia.org/wiki/Portable_Network_Graphics",
  "charged": { "file-downloaded": 1 }
}
```

Other statuses: `duplicate` (with `duplicateOf`), `page-scanned` (with `filesFound`) and `error` with a code and an
explanation: `web_page_not_file`, `type_not_allowed`, `too_large`, `robots_disallowed`, `target_http_404`,
`target_timeout`, `empty_file`. The `SUMMARY` record lists counts, bytes, error codes and every ZIP part with its link.

### How much does downloading cost?

| Event | Price | Example |
| --- | --- | --- |
| File downloaded and stored (first 1 MB included) | **$0.001** | 1,000 product images = **$1** |
| Each started MB above 1 MB | $0.0005 | a 5.3 MB photo = $0.001 + 5 x $0.0005 = $0.0035 |
| Web page scanned that led to files | $0.001 | |
| Actor start (per GB of run memory) | $0.001 | default 1 GB run = $0.001 |
| Failed URL, refused type, oversized file, duplicate | free | |

The per-MB part covers the data transfer of big files (Apify bills every downloaded gigabyte). Converting images is
included. Set a **maximum cost per run** and the actor stops before going over it.

### FAQ

#### Why did I get `web_page_not_file`?

The URL opened a web page, not a file. Open the image or document itself and copy that address (it usually ends in
`.jpg`, `.png`, `.pdf`), or turn on **Find files on web pages**. Such errors are free.

#### Does it respect robots.txt and site limits?

Yes. It reads each site's robots.txt (its token is `BulkFileDownloader`), identifies itself in the user agent, spaces
requests to one site at least 250 ms apart, and uses no proxies or anti-bot tricks. Download only files you have the
right to use: you are responsible for the content you download.

#### How large can a run be?

Up to 100,000 URLs and 2 GB per file. ZIPs are split into parts (`files.zip`, `files-2.zip`, ...) so disk use stays
bounded; the run's disk is 2x its memory, so for many large files give it more memory or lower the parallel downloads.

#### Can it download from Google Drive, Dropbox, YouTube or Instagram?

Only links that return the file itself (e.g. a Dropbox link with `?dl=1`, a public S3 or CDN URL). It does not log in
anywhere or extract videos from social platforms.

#### Can I call it from code or an AI agent?

Yes: the Apify API, the JavaScript and Python clients, or the Apify MCP server. Each item's `fileUrl` is a direct
link, so an agent can pass files on to OCR or vision models.

### Integrations and API

Attach it to any scraper (Integrations → Connect Actor), schedule it, or call it via the API; export the item list to
JSON, CSV or Excel; send results to Make, Zapier, n8n or webhooks.

### Related actors

- [Merge & Dedupe Datasets](https://apify.com/4b47/merge-dedupe-datasets): combine and deduplicate several
  datasets before downloading their files.
- [Image to Text OCR](https://apify.com/4b47/image-pdf-ocr): extract text from the downloaded images and
  PDFs.
- [URL to Markdown for LLM & RAG](https://apify.com/4b47/llm-ready-markdown): the text of web pages and
  PDFs as Markdown.

# Actor input Schema

## `urls` (type: `array`):

Direct links to files, one per line (up to 100,000): images, PDFs, documents, audio, video, archives. base64 data: URLs work too. Links to web pages are refused unless "Find files on web pages" is on.

## `datasetIds` (type: `array`):

Apify datasets whose rows contain file URLs (e.g. the output of a product or real-estate scraper). Name the fields in "URL fields". Picking a dataset gives this actor read access to it only.

## `urlFields` (type: `array`):

Dataset fields that hold file URLs: a URL, a list of URLs, or objects with a url/src field (e.g. images: \[{"url": ...}]). Nested paths: media.images. Example: imageUrl, images, pdfLink.

## `fileTypes` (type: `array`):

Keep only these types (checked from the file's first bytes, not just its extension). Other files are refused before they download and are free.

## `createZip` (type: `boolean`):

Put all files into files.zip (more parts if it grows past the part size). Download it from the run's Output tab.

## `saveToKeyValueStore` (type: `boolean`):

Store every file as its own record in the run's key-value store; each dataset item gets a fileUrl you can open or pass on.

## `maxFileSizeMb` (type: `integer`):

Larger files are skipped (free); when the server announces the size they are not even downloaded. Keep (parallel downloads x this size + ZIP part size) under the run's disk, which is 2x its memory.

## `fileNameTemplate` (type: `string`):

{name} = original name (from Content-Disposition or the URL), {ext} = extension of the stored file, {index} = position in the input (00001), {hash} = first 12 characters of the SHA-256, {host} = website. "/" makes folders in the ZIP, e.g. {host}/{index}-{name}.{ext}. Repeated names get -2, -3.

## `dedupeByContent` (type: `boolean`):

Files with the same content (SHA-256) as an earlier one are not stored again and not charged; the item says which file it duplicates.

## `imageFormat` (type: `string`):

Convert JPEG, PNG, WebP, GIF, AVIF and TIFF images. Other files (and SVG) stay as they are.

## `imageMaxWidth` (type: `integer`):

Shrink larger images to this width, keeping the aspect ratio (never enlarges). Empty = no resize.

## `imageMaxHeight` (type: `integer`):

Shrink larger images to this height, keeping the aspect ratio. Empty = no resize.

## `imageQuality` (type: `integer`):

1-100 for JPEG, WebP and AVIF output.

## `scanPages` (type: `boolean`):

When a URL is a web page, download the images (img, srcset, og:image), video/audio sources and linked files (PDF, ZIP, DOCX, ...) it contains, filtered by File types. One level deep; robots.txt is respected.

## `maxFilesPerPage` (type: `integer`):

Upper limit of files taken from one web page.

## `maxFiles` (type: `integer`):

Stop after this many downloaded files. Empty = all.

## `zipPartSizeMb` (type: `integer`):

A new ZIP part starts when the current one would pass this size (also keeps disk use bounded: the run's disk is 2x its memory).

## `maxConcurrency` (type: `integer`):

Files downloaded at the same time. Requests to one website are spaced at least 250 ms apart.

## Actor input object example

```json
{
  "urls": [
    "https://upload.wikimedia.org/wikipedia/commons/a/a9/Example.jpg",
    "https://upload.wikimedia.org/wikipedia/commons/4/47/PNG_transparency_demonstration_1.png",
    "https://upload.wikimedia.org/wikipedia/commons/0/02/SVG_logo.svg",
    "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf"
  ],
  "fileTypes": [
    "any"
  ],
  "createZip": true,
  "saveToKeyValueStore": true,
  "maxFileSizeMb": 100,
  "fileNameTemplate": "{name}.{ext}",
  "dedupeByContent": true,
  "imageFormat": "original",
  "imageQuality": 82,
  "scanPages": false,
  "maxFilesPerPage": 200,
  "zipPartSizeMb": 500,
  "maxConcurrency": 8
}
```

# Actor output Schema

## `results` (type: `string`):

One item per URL: file name, direct link (fileUrl), ZIP part, type, size, SHA-256, image size; failed URLs with the reason (not charged).

## `zip` (type: `string`):

files.zip with every downloaded file (large runs continue in files-2.zip, files-3.zip: see the run summary).

## `files` (type: `string`):

Every file as its own key-value store record (the fileUrl of each item points here).

## `summary` (type: `string`):

Counts, bytes, error codes and the list of ZIP parts with links.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "urls": [
        "https://upload.wikimedia.org/wikipedia/commons/a/a9/Example.jpg",
        "https://upload.wikimedia.org/wikipedia/commons/4/47/PNG_transparency_demonstration_1.png",
        "https://upload.wikimedia.org/wikipedia/commons/0/02/SVG_logo.svg",
        "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("4b47/bulk-file-downloader").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "urls": [
        "https://upload.wikimedia.org/wikipedia/commons/a/a9/Example.jpg",
        "https://upload.wikimedia.org/wikipedia/commons/4/47/PNG_transparency_demonstration_1.png",
        "https://upload.wikimedia.org/wikipedia/commons/0/02/SVG_logo.svg",
        "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("4b47/bulk-file-downloader").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "urls": [
    "https://upload.wikimedia.org/wikipedia/commons/a/a9/Example.jpg",
    "https://upload.wikimedia.org/wikipedia/commons/4/47/PNG_transparency_demonstration_1.png",
    "https://upload.wikimedia.org/wikipedia/commons/0/02/SVG_logo.svg",
    "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf"
  ]
}' |
apify call 4b47/bulk-file-downloader --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,4b47/bulk-file-downloader"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/TfMQ801csBSaWGscK/builds/08UTykaymBJgTbizv/openapi.json
