# Bulk File Downloader: URLs or Dataset Fields to Files & ZIP (`klarto/bulk-file-downloader`) Actor

Bulk file downloader: download images, PDFs, audio, video and other files from direct links or from a URL field of your datasets into one key-value store, with a ZIP link for all files. Same-content files saved once. From $0.002 per file; failed downloads free.

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

## Pricing

from $1.40 / 1,000 downloaded files

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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 Downloader: URLs or Dataset Fields to Files & ZIP

**Bulk file downloader** for Apify. Give it direct links, or pick datasets whose rows hold file links, and it saves every file into one key-value store, with one ZIP link for all of them. **$0.002 per file** (files up to 10 MB), **$0.0015 per extra 10 MB**. Failed, skipped and duplicate files are free.

Why use it:

- **Links from your datasets.** Pick the output of another Actor and name the field: `imageUrl`, `media.url`, `images.*.url`. Lists of links and objects with a `url`, `src` or `href` key work too.
- **One ZIP for everything.** `zipUrl` in the run's `OUTPUT` downloads all saved files as one archive, with no Apify token needed.
- **Identical files saved once.** The same content from two links (SHA-256) is stored once. The second link gets status `duplicate` and is free.
- **Honest per-file results.** Each link gets a row with its status, HTTP status, type, size, SHA-256 and a reason when it failed.
- **Safe by design.** Only public addresses, every redirect re-checked, no cookies kept, and size and time limits per file that also hold for compressed answers.

### What it does

- **Input:** direct file links (any type: images, PDF, Office files, audio, video, archives) and/or datasets plus the fields that hold the links.
- **Output:**
  - The files in the run's key-value store, as `file-00001-<name>`, `file-00002-<name>` and so on.
  - One dataset row per unique link.
  - An `OUTPUT` summary with `zipUrl`.
- A link that opens a web page saves that page's HTML. It does not save the images or files on the page. Use a direct file link.

### How it works

1. **Collect links.** It reads `URLs`, then the picked datasets, page by page. It keeps the unique links in input order, up to `Max files`.
2. **Check each address.** The host must resolve to a public IP address; private and reserved networks are refused. The connection is pinned to the checked IP, and every redirect hop is checked again.
3. **Download.** The file streams to disk with the size limit applied while reading. The Actor asks for `gzip` or `deflate` compression only and decodes it in small steps, so a small compressed answer cannot expand past the limit; other encodings (br, zstd, nested) give an error row. At most 2 downloads at once go to the same site. HTTP 408, 425, 429, 500, 502, 503 and 504 answers, connect or read timeouts, dropped connections and compressed answers cut before their end are tried 2 more times (a download that reaches `fileTimeoutSecs` is not). For 429 and 503 a `Retry-After` in seconds is followed, up to 30 s. A try is not started when the run is close to its timeout, so every link still gets a row.
4. **Check the content.** The `File types` filter is applied from the server's Content-Type before the body is read. SHA-256 is computed while downloading, and identical content is stored once.
5. **Save, then charge.** The file is streamed from disk to the key-value store, the row is written, and only then is the file charged.

The User-Agent is `KlartoDownloader/0.1 (+https://apify.com/klarto)`. Your files are not sent to any outside service.

### Input

| Field | Default | What it does |
|---|---|---|
| `urls` | — | Direct file links, one per line. A bare host such as `example.com/file.pdf` gets `https://`. |
| `datasets` | — | Datasets whose rows hold links. Picking one gives the Actor read access to it (limited permissions). |
| `urlFields` | `["url"]` | Fields with links: `url`, `media.url`, `images.0`, `images.*.url`. |
| `fileTypes` | `any` | `any`, `images`, `documents`, `audio`, `video` or `archives`. Other files get status `skipped`, are free and their body is not downloaded. |
| `maxFiles` | 1000 | Unique links per run, up to 10,000. |
| `maxFileSizeMb` | 100 | Bigger files are not downloaded and are free. A file must also fit on the run's disk, which Apify sizes at twice the run memory. |
| `skipDuplicateFiles` | true | Save the same content once. |
| `fileTimeoutSecs` | 120 | Time limit per download. |
| `maxConcurrency` | 8 | Downloads at once (at most 2 per site). |
| `respectRobotsTxt` | false | Check each site's robots.txt first, also for the target of every redirect. Disallowed links get status `blocked` and are free. |

Minimal input:

```json
{ "urls": ["https://www.irs.gov/pub/irs-pdf/fw9.pdf", "https://images-assets.nasa.gov/image/as11-37-5505/as11-37-5505~small.jpg"] }
```

From another Actor's dataset:

```json
{ "datasets": ["<datasetId>"], "urlFields": ["imageUrl", "images.*.url"], "fileTypes": "images" }
```

### Output

A real row from a platform run (2026-11-19):

```json
{
  "fileIndex": 2,
  "url": "https://www.irs.gov/pub/irs-pdf/fw9.pdf",
  "status": "ok",
  "error": null,
  "finalUrl": "https://www.irs.gov/pub/irs-pdf/fw9.pdf",
  "httpStatus": 200,
  "contentType": "application/pdf",
  "fileName": "fw9.pdf",
  "key": "file-00003-fw9.pdf",
  "bytes": 140815,
  "sha256": "2d420cbb4123dcf1fb82595b2359cfbb5d81f00b9df9d359fcc7af361d093f53",
  "fileUrl": "https://api.apify.com/v2/key-value-stores/UGSuxcm8BefAWfSoa/records/file-00003-fw9.pdf?signature=1jemUJkNe9pAkB3sFzDMR",
  "duplicateOf": null,
  "sources": ["input"],
  "occurrences": 1,
  "charged": true,
  "ms": 27,
  "downloadedAt": "2026-11-19T00:04:10Z"
}
```

| Field | Type | Meaning |
|---|---|---|
| `fileIndex` | number | Position among the unique links (from 0): a repeated link gets no second row. A value in `urls` that is not an http(s) link gets an `error` row; such values inside datasets are only counted (`invalidLinks` in `OUTPUT`). Rows are written as downloads finish, so sort by this field to get the input order. |
| `status` | text | One of `ok`, `duplicate`, `error`, `skipped` or `blocked`. |
| `error` | text | Why the link was not saved; `null` when `ok` or `duplicate`. |
| `httpStatus`, `finalUrl` | number, text | The final answer after redirects. |
| `contentType`, `fileName`, `bytes`, `sha256` | text, text, number, text | What was downloaded. `fileName` is the file's own name in any script (`отчет.pdf`); the record `key` keeps only the characters Apify allows. |
| `key`, `fileUrl` | text | Record key and a signed link that opens without a token. |
| `duplicateOf` | text | For `duplicate`: the link whose file has the same content. `key` and `fileUrl` point to that file. |
| `sources`, `occurrences` | list, number | Where the link came from: `input` or `<datasetId>#<row>` (first 20), and how many times it appeared. |
| `charged` | boolean | Whether this row was charged. |

The `OUTPUT` record holds:

- the counts (`ok`, `duplicates`, `errors`, `skipped`, `blocked`), `bytes` and the charged counts;
- `failures` (the last 200 reasons);
- `zipUrl`, a signed link that downloads all saved files as one ZIP.

Files follow Apify data retention. Copy them if you need permanent links.

### Pricing

| Event | When | Price |
|---|---|---|
| `file-downloaded` | A file saved to the key-value store (its first 10 MB included) | $0.002 |
| `extra-10mb` | Each further started 10 MB (10,485,760 bytes) of a saved file | $0.0015 |

**Paid Apify plans pay less.** Apify Store discounts apply automatically: Bronze 10% off, Silver 20% off, Gold and higher 30% off. The prices above are Free-plan prices; the Store card shows the lowest (Gold) price. The start event (`apify-actor-start`) has no discount.

These are free:

- errors and HTTP 4xx/5xx answers;
- files filtered out by `fileTypes`;
- files over the size limit;
- duplicates;
- links blocked by robots.txt;
- links not started.

Apify also charges its start event, `apify-actor-start`: $0.00005 per GB of run memory, which is $0.00005 per run at the default 1 GB.

Examples:

- 3 small files: 3 × $0.002 = $0.006.
- 1,000 images under 10 MB each: **$2.00**.
- One 134 MB file: $0.002 + 13 × $0.0015 = $0.0215.

Set a maximum charge per run in Console or with `maxTotalChargeUsd`. The Actor stops cleanly when the limit is reached. Links it could not afford get status `skipped`.

### Limits

- Up to 10,000 unique links per run, each file up to 2,000 MB (`maxFileSizeMb`). Files are written to the run's disk and streamed from there to the key-value store, so memory stays low. The disk is twice the run memory: at the default 1 GB a file can be up to 1,843 MB, and fewer downloads run at once when the size limit is large.
- Measured on the platform at 1 GB (2026-11-19):
  - 3 small files (JPEG, PDF, TIFF): a 4 s run.
  - A 134 MB archive: a 4 s run (build 0.1.3, streamed upload; 1 file + 13 extra-10mb events charged).
  - Speed depends on the source server.
- Downloads that take longer than `fileTimeoutSecs` (default 120 s) are stopped and free.
- Only `http` and `https` links to public addresses. Links with `user:password@` are refused.
- No login, cookies or proxies: links that need a sign-in fail with HTTP 401/403.
- Web pages are saved as HTML. The Actor does not crawl pages for the files on them.

### Use it from your stack

You need an Apify account and token. No third-party API keys are needed.

- **API** (returns the dataset rows):
  ```bash
  curl -X POST "https://api.apify.com/v2/acts/klarto~bulk-file-downloader/run-sync-get-dataset-items?token=$APIFY_TOKEN" \
    -H 'Content-Type: application/json' -d '{"urls":["https://www.irs.gov/pub/irs-pdf/fw9.pdf"]}'
  ```
- **Python** (`apify-client` 3.x):
  ```python
  from apify_client import ApifyClient
  client = ApifyClient("<APIFY_TOKEN>")
  run = client.actor("klarto/bulk-file-downloader").call(run_input={"urls": ["https://www.irs.gov/pub/irs-pdf/fw9.pdf"]})
  print(client.key_value_store(run.default_key_value_store_id).get_record("OUTPUT")["value"]["zipUrl"])
  ```
- **n8n:** use the Apify node, choose *Run an Actor* with `klarto/bulk-file-downloader`, then read the dataset or the `OUTPUT` record.
- **Make / Zapier:** use the Apify app with the same Actor.
- **MCP / AI agents:** `https://mcp.apify.com?tools=klarto/bulk-file-downloader`.

### FAQ

**Can it download all images from a web page?** No. It downloads the links you give. Collect the image links first, for example with a scraper, and pass its dataset with the field that holds them.

**Google Drive or Dropbox links?** Only direct download links work. A share page of a cloud drive is a web page, so the Actor saves its HTML. Links that need a sign-in fail with HTTP 401/403 and are free.

**Which of two identical files is kept?** The one that finishes first. The other gets status `duplicate` and points to it. Turn off `skipDuplicateFiles` to keep both.

**Why is a file `skipped`?** Its type did not match `fileTypes`, the run reached its maximum charge, or the run was close to its timeout. The reason is in `error`.

**How do I get all files at once?** Open `zipUrl` from the `OUTPUT` record. In Console, the run's Storage tab also lists the records.

**Are failed downloads charged?** No. Only files saved to the key-value store are charged.

**Is my data kept?** Files stay in your run's storage under Apify's data retention. Nothing is sent to other services.

### Fair use and licences

- Download only files you own or may download. Respect each site's terms.
- The Actor does not crawl and does not bypass logins or blocks.
- Turn on `respectRobotsTxt` to follow robots.txt.
- Libraries: httpx (BSD-3-Clause), Protego (BSD-3-Clause), Apify SDK (Apache-2.0).

### Ready-made examples

Saved inputs for common jobs: open one and run it as it is, or change the input first.

- [Bulk download images from URLs into one ZIP](https://apify.com/klarto/bulk-file-downloader/examples/bulk-download-images-to-zip)
- [Download PDF files from a list of links](https://apify.com/klarto/bulk-file-downloader/examples/download-pdf-files-from-links)

### Related Actors

- [PDF & Image OCR to Text and Markdown](https://apify.com/klarto/pdf-ocr-markdown): turn the downloaded PDFs and scans into text.
- [Audio & Video Transcription to Text, SRT and VTT](https://apify.com/klarto/audio-video-transcription): transcribe downloaded audio and video files.
- [Merge & Deduplicate Datasets](https://apify.com/klarto/dataset-merge-dedup): merge and clean the datasets before downloading their files.
- [Image Upscaler 2x / 4x](https://apify.com/klarto/image-upscaler-cpu): upscale downloaded images.

### Support

Open an issue on the Actor page. We aim to answer within a week.

# Actor input Schema

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

Direct links to files, one per line (images, PDFs, audio, video, archives, any type). A link that opens a web page saves that page's HTML, not the files on it. Repeated links are downloaded once. Only files you own or may download.

## `datasets` (type: `array`):

Optional: datasets whose rows hold file links, e.g. the output of another Actor. Picking a dataset gives this Actor read access to it (limited permissions). Through the API pass dataset IDs or 'username~name'. Used together with 'Link fields'.

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

Fields of the dataset rows that hold the links. Use dots for nested fields (media.url), numbers for list items (images.0) and \* for every item of a list (images.\*.url). A field may hold one link, a list of links, or objects with a url, src or href key. Ignored without 'Datasets with links'.

## `fileTypes` (type: `string`):

Keep only files of this kind, judged by the server's Content-Type (and the file extension when the type is generic). Other links get status 'skipped' and are free; their body is not downloaded.

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

Stop after this many unique links (up to 10,000 per run). Split bigger jobs into several runs.

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

Bigger files are not downloaded and are free. A file must also fit on the run's disk, which Apify sizes at twice the run memory (about 1,800 MB at the default 1 GB): give the run more memory for bigger files.

## `skipDuplicateFiles` (type: `boolean`):

Files with the same content (SHA-256) from different links are saved once. Later copies get status 'duplicate', point to the saved file and are free.

## `fileTimeoutSecs` (type: `integer`):

A download that takes longer is stopped and free. Raise it for large files on slow servers.

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

Downloads at once. At most 2 at once go to the same site, whatever this value.

## `respectRobotsTxt` (type: `boolean`):

Read each site's robots.txt (user agent 'KlartoDownloader') before downloading. Disallowed links, and sites whose robots.txt fails (5xx, no answer), get status 'blocked' and are free.

## Actor input object example

```json
{
  "urls": [
    "https://images-assets.nasa.gov/image/as11-37-5505/as11-37-5505~small.jpg",
    "https://www.irs.gov/pub/irs-pdf/fw9.pdf",
    "https://raw.githubusercontent.com/tesseract-ocr/test/main/testing/phototest.tif"
  ],
  "urlFields": [
    "url"
  ],
  "fileTypes": "any",
  "maxFiles": 1000,
  "maxFileSizeMb": 100,
  "skipDuplicateFiles": true,
  "fileTimeoutSecs": 120,
  "maxConcurrency": 8,
  "respectRobotsTxt": false
}
```

# Actor output Schema

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

One record per link: status, link to the saved file, name, type, size, SHA-256, HTTP status, charged.

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

Files downloaded, duplicates, failed and skipped, MB, charges, failure reasons, and zipUrl (all files as one ZIP).

# 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://images-assets.nasa.gov/image/as11-37-5505/as11-37-5505~small.jpg",
        "https://www.irs.gov/pub/irs-pdf/fw9.pdf",
        "https://raw.githubusercontent.com/tesseract-ocr/test/main/testing/phototest.tif"
    ],
    "urlFields": [
        "url"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("klarto/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://images-assets.nasa.gov/image/as11-37-5505/as11-37-5505~small.jpg",
        "https://www.irs.gov/pub/irs-pdf/fw9.pdf",
        "https://raw.githubusercontent.com/tesseract-ocr/test/main/testing/phototest.tif",
    ],
    "urlFields": ["url"],
}

# Run the Actor and wait for it to finish
run = client.actor("klarto/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://images-assets.nasa.gov/image/as11-37-5505/as11-37-5505~small.jpg",
    "https://www.irs.gov/pub/irs-pdf/fw9.pdf",
    "https://raw.githubusercontent.com/tesseract-ocr/test/main/testing/phototest.tif"
  ],
  "urlFields": [
    "url"
  ]
}' |
apify call klarto/bulk-file-downloader --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,klarto/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/vs6kkixQeE1aBrcmW/builds/Spg1Rh2qyestOFBGn/openapi.json
