# Bulk File Downloader - Save Files and Images from URLs (`illimitable_cord/bulk-file-downloader`) Actor

Save the files behind a list of URLs (images, PDFs, archives, documents) into the run's key-value store. One dataset item per file with name, content type, size and SHA-256. Files that fail are returned with a clear error code and are not charged.

- **URL**: https://apify.com/illimitable_cord/bulk-file-downloader.md
- **Developed by:** [A C](https://apify.com/illimitable_cord) (community)
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $4.00 / 1,000 file saveds

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 Downloader

Save the files behind a list of URLs — images, PDFs, archives, documents — into your run's key-value store, with one dataset item per file that tells you its name, type, size and checksum.

### What it does

- Downloads the file at each URL you provide and stores it under a unique, safe key.
- Names the file from the server's `Content-Disposition` header or from the URL, and adds an extension when it is missing.
- Reports content type, size in bytes and SHA-256, so you can deduplicate and verify.
- Optionally keeps only the content types you list (for example images and PDFs).
- Returns a clear error code for every file that could not be saved.

### What it does not do

- It does not parse pages. A URL that points to a web page saves that page's HTML; it does not find the images or videos inside it.
- No video or audio extraction from streaming or social platforms.
- No login, no paywalls, no cookies.
- No proxy rotation and no anti-bot bypass. If a site blocks automated downloads, the file fails with a clear error.

### Pricing

One event, `file-saved`: charged once for each file stored. Files that fail are returned with `ok: false` and are not charged.

### Input

| Field | Type | Default | Notes |
|---|---|---|---|
| `fileUrls` | list of URLs | required | Public http(s) links. Each distinct URL is fetched once. |
| `allowedContentTypes` | list of strings | empty (any) | Full type (`application/pdf`) or prefix ending with a slash (`image/`). |
| `maxFileSizeMb` | integer | 50 | 1 to 100. Larger files fail with `too_large`. |
| `respectRobotsTxt` | boolean | true | Turn off only for sites you own or are allowed to fetch. |

```json
{
  "fileUrls": [{ "url": "https://www.python.org/static/img/python-logo.png" }],
  "allowedContentTypes": ["image/"]
}
```

### Output

```json
{
  "url": "https://www.python.org/static/img/python-logo.png",
  "ok": true,
  "finalUrl": "https://www.python.org/static/img/python-logo.png",
  "key": "00001-python-logo.png",
  "fileName": "python-logo.png",
  "contentType": "image/png",
  "bytes": 15770,
  "sha256": "…",
  "keyValueStoreId": "…",
  "recordUrl": "https://api.apify.com/v2/key-value-stores/…/records/00001-python-logo.png",
  "elapsedMs": 219
}
```

`recordUrl` is the Apify API address of the stored file. It is not public: read it with your API token in the `Authorization: Bearer` header, or open the run's key-value store in Apify Console.

When a file fails:

```json
{
  "url": "https://www.w3.org/nonexistent-file-xyz.png",
  "ok": false,
  "error": { "code": "http_error", "message": "The server answered HTTP 404." },
  "elapsedMs": 172
}
```

Error codes: `blocked_url`, `dns_error`, `robots_disallowed`, `http_error`, `too_large`, `timeout`, `network_error`, `too_many_redirects`, `empty_file`, `type_not_allowed`, `storage_error`.

### Limits

- 100 MB per file at most, 120 seconds per file, 5 redirects. One file is downloaded at a time.
- File names keep only letters, digits, dot, dash and underscore; other characters become underscores.
- Files stay in the run's key-value store for as long as your Apify plan keeps unnamed storages.

### Privacy and data handling

The Actor runs in your Apify account. Downloaded files stay in your run's storage. It sends no telemetry and calls no third-party service: the only network requests are to the URLs you provide and to the `robots.txt` of the same sites.

You are responsible for having the right to download and store the files you request.

### Support

Issues are answered within 48 hours. Development and maintenance of this Actor are assisted by AI tools; changes are released only after automated tests pass.

# Actor input Schema

## `fileUrls` (type: `array`):

Public http(s) links to the files to save: images, PDFs, archives, documents. Each distinct URL is fetched once. The file at the URL is saved as it is: pages are not parsed and media is not extracted from them.

## `allowedContentTypes` (type: `array`):

Optional. Save only files of these types; others are reported as failed and not charged. Use a full type (application/pdf) or a prefix ending with a slash (image/). Leave empty to accept any type.

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

Larger files are reported as failed and not charged.

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

Skip files that the site's robots.txt disallows. Turn off only for sites you own or are allowed to fetch.

## Actor input object example

```json
{
  "fileUrls": [
    {
      "url": "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf"
    }
  ],
  "maxFileSizeMb": 50,
  "respectRobotsTxt": true
}
```

# Actor output Schema

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

One item per URL: storage key, file name, content type, size and SHA-256, or an error code.

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

Keys of the files stored in the run's default key-value store.

# 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 = {
    "fileUrls": [
        {
            "url": "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("illimitable_cord/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 = { "fileUrls": [{ "url": "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("illimitable_cord/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 '{
  "fileUrls": [
    {
      "url": "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf"
    }
  ]
}' |
apify call illimitable_cord/bulk-file-downloader --silent --output-dataset

```

## MCP server setup

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