# File Info & Checksum: Size, MIME Type, SHA-256 for URL Lists (`data-done-right/file-info-checksum`) Actor

Check file size, MIME type, redirects and last-modified for a list of file URLs using HEAD requests, with an optional streamed SHA-256 and MD5 checksum. Pre-flight for downloads and integrity checks. No download unless you ask for a hash.

- **URL**: https://apify.com/data-done-right/file-info-checksum.md
- **Developed by:** [Data Done Right](https://apify.com/data-done-right) (community)
- **Categories:** Developer tools, Automation, Other
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.64 / 1,000 file infos

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

## File Info & Checksum: Size, MIME Type, SHA-256 for URL Lists

This **file info and checksum checker** reads the file size, MIME type, redirect chain and last-modified date of every URL in a list from the HTTP headers, and can stream each file once to compute its SHA-256 and MD5 checksum. No API key. Built as a pre-flight for bulk downloads and as a fingerprint tool for integrity checks.

> **What it does not do.** It does **not download or store files**: header mode sends a `HEAD` request (or a 2 KB ranged `GET` when a server refuses HEAD), and checksum mode streams the file through the hash and discards the bytes. It does **not crawl pages** or find file links (give it direct file URLs), **never logs in**, and **does not get around blocks**: a 401, 403 or 451 gives a `blocked` row and costs nothing. It follows `robots.txt` and refuses private or internal addresses. Sizes come from what the server says, so a server that omits or misreports `Content-Length` gives `null` or a wrong size (turn on checksums for the measured size). Files over `maxHashFileMb` (default 100 MB, at most 1,000 MB) are not hashed. It does not scan files for viruses, and MD5 is offered only to compare with legacy checksums, not for security.

**What you get**

- Per URL: final URL after redirects with the whole chain, size in bytes, MIME type, charset, file name, extension, last-modified (ISO 8601), ETag, Accept-Ranges, server.
- Optional: the real file type from the first bytes (pdf, png, zip, html...), with a warning when a server sends an HTML login or error page instead of the file.
- Optional: SHA-256 and MD5 plus the exact measured size, and `duplicateOf` when two URLs in the run have identical content.

### How to check file size and MIME type from a list of URLs

1. Paste the file URLs in `urls`, one per line.
2. Leave `computeHash` off and run. Each row has `sizeBytes`, `sizeHuman`, `contentType`, `lastModified`, `redirects` and `finalUrl`.
3. Filter the dataset (for example `sizeBytes` above your limit, or `contentType` not `application/pdf`) and pass the survivors to **Bulk File Downloader: Download Files from URLs to ZIP**.

If a server answers HEAD with 405 or 501, or gives no size, the Actor asks for the first 2 KB with a `Range` request and reads the total size from `Content-Range`. `sizeSource` tells you where the number came from: `content-length`, `content-range` or `measured`.

### How to get a SHA-256 or MD5 checksum from a URL

Set `computeHash` to `true`. Each file is streamed once through SHA-256 and MD5 (nothing is written to disk), `sizeBytes` becomes the exact number of bytes received, and `hashStatus` is `hashed`. Compare `sha256` with the value a vendor publishes. Files larger than `maxHashFileMb` get `hashStatus: "skipped-too-large"` and keep their header info.

### How to find duplicate files and fake download links

Turn on `computeHash` (it also reads the first bytes). Rows with the same content share a `sha256`, and later ones carry `duplicateOf` with the URL of the first. Dead or fake links show up as `http-error`, as `blocked`, or as `typeNote` such as "The URL ends in .pdf but the file starts like an HTML page". The type check works from the first 2 KB only and covers common formats (PDF, images, ZIP and Office files, gzip, 7z, RAR, audio and video containers, executables, HTML, plain text); unknown formats give `detectedType: null`.

### Input

| Field | Default | What it does |
|---|---|---|
| `urls` | 3 sample files | Direct file links, one per line. Required. |
| `computeHash` | `false` | Stream each file to compute SHA-256 and MD5 and the exact size. |
| `maxHashFileMb` | 100 | Largest file to hash, 1 to 1,000 MB (1 MB = 1,000,000 bytes). Bigger files keep their header info. |
| `sniffType` | `false` | Also read the first 2 KB to report the real type. Always on with checksums. |
| `respectRobots` | `true` | Skip URLs that robots.txt disallows for this bot. |
| `maxUrls` | 100 | Most URLs per run (max 10,000). Extra URLs are skipped and free. |
| `concurrency` | 5 | URLs processed at once (1 to 20); at most 3 at once per host. |
| `perHostDelayMs` | 200 | Minimum pause between requests to the same host. |
| `timeoutSecs` | 30 | Seconds before a header request is abandoned. |
| `hashTimeoutSecs` | 300 | Seconds before one file's hashing is abandoned. |

Input example:

```json
{
  "urls": [
    "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf",
    "https://www.w3.org/Icons/w3c_main.png"
  ],
  "computeHash": true
}
```

### Output

From a real run of the input above (shortened):

```json
{
  "url": "https://www.w3.org/Icons/w3c_main.png",
  "finalUrl": "https://www.w3.org/assets/logos/w3c-2025-transitional/w3c-full-315x48.png",
  "status": "ok",
  "statusCode": 200,
  "redirects": 1,
  "redirectChain": [{"url": "https://www.w3.org/Icons/w3c_main.png", "status": 301}],
  "fileName": "w3c-full-315x48.png",
  "extension": "png",
  "sizeBytes": 7816,
  "sizeHuman": "7.8 KB",
  "sizeSource": "measured",
  "contentType": "image/png",
  "detectedType": "png",
  "lastModified": "2025-10-24T15:06:28+00:00",
  "hashStatus": "hashed",
  "sha256": "03ab7291bbb7f7e8bb31f13144e107d48293a87e4bcfb2f25e77cdb2f4e183ab",
  "md5": "bc9037e9c29da5b58a747ee76fb84e68",
  "duplicateOf": null,
  "checkedAt": "2026-11-13T05:38:55+00:00"
}
```

`status` is `ok`, `http-error`, `blocked` (401/403/451), `robots-disallowed`, `invalid-url` or `failed`. Rows that are not `ok` explain why in `error` and are listed in the `FAILED` record, together with hashes that were skipped or failed. The `SUMMARY` record counts rows, hashes, duplicates and charges; `NOTES` lists skipped duplicate URLs and the `maxUrls` cut.

### Use with the Apify API, MCP, n8n and Make

Python:

```python
from apify_client import ApifyClient

client = ApifyClient("<APIFY_TOKEN>")
run = client.actor("data-done-right/file-info-checksum").call(run_input={
    "urls": ["https://example.com/report.pdf"], "computeHash": True})
for row in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(row["url"], row["status"], row["sizeBytes"], row["sha256"])
```

JavaScript:

```js
import { ApifyClient } from 'apify-client';
const client = new ApifyClient({ token: '<APIFY_TOKEN>' });
const run = await client.actor('data-done-right/file-info-checksum').call({ urls: ['https://example.com/report.pdf'] });
const { items } = await client.dataset(run.defaultDatasetId).listItems();
```

In n8n or Make use the Apify node with the actor name and the same JSON. Through Apify's MCP server (mcp.apify.com) an AI assistant can ask "how big is this file and what is its SHA-256?". Only URLs are needed.

### Use cases

- Estimate the size of a download list before you run a bulk download, and drop files that are too big or the wrong type.
- Verify a download against a vendor's published SHA-256 without keeping the file.
- Fingerprint a set of public files and detect later changes (compare `sha256`, `etag`, `lastModified`).
- Find duplicate files hidden behind different URLs.
- Audit links on a site or in a data catalogue: dead, redirected, or serving an HTML page instead of the file.

### How much does it cost

Pay per event, no start fee:

- **$0.0008 per URL for header info** (`file-info`, $0.80 per 1,000).
- **$0.002 per URL hashed** (`file-hashed`, $2 per 1,000). It replaces the info charge for that URL.

Free: invalid URLs, duplicates, URLs over `maxUrls`, robots.txt refusals, HTTP errors, blocked URLs and failures. A file that is too large to hash is charged as info. Plan discounts apply.

- 1,000 URLs, headers only: $0.80. Hashed: $2.
- 10,000 URLs, headers only: $8. Hashed: $20.
- 100,000 URLs, headers only: $80. Hashed: $200.

`maxUrls` caps a run and `maxHashFileMb` caps each hashed file. If you set a maximum spend per run the Actor stops cleanly when it is reached. Apify platform usage is included in this price.

### FAQ

#### Does it download the files?

Header mode does not: it sends a HEAD request, or a ranged GET for the first 2 KB if the server refuses HEAD or you turn on `sniffType`. Checksum mode downloads each file once to hash it in memory and keeps nothing.

#### Why is `sizeBytes` empty for some URLs?

Some servers do not send `Content-Length` (dynamic or chunked responses), send it compressed, or refuse HEAD. The Actor tries a ranged GET for `Content-Range`; if the server still does not say, the size is `null`. Turn on `computeHash` to measure it exactly, up to `maxHashFileMb`.

#### Can I trust `contentType`?

It is what the server says, and servers are often wrong (for example `application/octet-stream` for a PDF). `mimeFromExtension` shows what the file name implies and `detectedType` (with `sniffType` or checksums on) shows what the first bytes say.

#### Does it work on Google Drive, Dropbox or login-protected links?

Only on direct links that answer anonymously. Share pages are HTML, so you will see `text/html` and, with type checking, a warning. Links that need a login give a `blocked` row; the Actor does not log in.

#### How big a file can it hash?

Up to 1,000 MB with `maxHashFileMb`; the default is 100 MB. Each file has `hashTimeoutSecs` (default 300) to finish streaming. Slow hosts may time out on large files, which gives `hashStatus: "failed"` with the reason.

#### Is it safe to give internal addresses?

Links to private, loopback and cloud-metadata addresses are refused, including after redirects, and cost nothing. At most 5 redirects are followed and every hop is checked.

### Related tools

- **Bulk File Downloader: Download Files from URLs to ZIP** to download the files that pass your size and type checks.
- **Download Images from URLs: Bulk Image & File Downloader** for image lists.
- **HTTP Status Code Checker: Bulk URL, Website & Redirect Chains** to check page URLs and redirect chains.

# Actor input Schema

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

Direct links to the files to check, one per line. Example: https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf. A link without https:// gets https:// added. Only public http(s) links; private and internal addresses are refused.

## `computeHash` (type: `boolean`):

Stream each file once to compute its SHA-256 and MD5 and measure its exact size. Nothing is stored. Charged at the higher file-hashed price instead of the file-info price. Default: off (headers only).

## `maxHashFileMb` (type: `integer`):

Files larger than this are not downloaded for hashing; the row still has the size and headers and is charged as file info. 1 MB = 1,000,000 bytes. Example: 100.

## `sniffType` (type: `boolean`):

Also read the first 2 KB of each file (one extra ranged request) and report the type the bytes show (pdf, png, zip, html...). Flags servers that send an HTML error or login page instead of the file. Always on when checksums are on. Default: off.

## `respectRobots` (type: `boolean`):

Skip URLs that the host's robots.txt disallows for this bot (the row says so and is free). Default: on.

## `maxUrls` (type: `integer`):

Most URLs processed in this run. URLs beyond this are skipped and not charged. Example: 100.

## `concurrency` (type: `integer`):

How many URLs are processed at the same time. At most 3 run at once against one host. Default 5.

## `perHostDelayMs` (type: `integer`):

Minimum pause between two requests to the same host, to stay polite. Default 200.

## `timeoutSecs` (type: `integer`):

Give up on one header request after this many seconds. Default 30.

## `hashTimeoutSecs` (type: `integer`):

Give up streaming one file for hashing after this many seconds. Default 300.

## Actor input object example

```json
{
  "urls": [
    "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf",
    "https://www.w3.org/Icons/w3c_main.png",
    "https://jsonplaceholder.typicode.com/todos/1"
  ],
  "computeHash": false,
  "maxHashFileMb": 100,
  "sniffType": false,
  "respectRobots": true,
  "maxUrls": 100,
  "concurrency": 5,
  "perHostDelayMs": 200,
  "timeoutSecs": 30,
  "hashTimeoutSecs": 300
}
```

# Actor output Schema

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

One row per URL with size, MIME type, redirects, last-modified and optional SHA-256 and MD5, as JSON, CSV, Excel and more.

## `records` (type: `string`):

Key-value store records: the run summary, a FAILED list with reasons, and NOTES.

# 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://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf",
        "https://www.w3.org/Icons/w3c_main.png",
        "https://jsonplaceholder.typicode.com/todos/1"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("data-done-right/file-info-checksum").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://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf",
        "https://www.w3.org/Icons/w3c_main.png",
        "https://jsonplaceholder.typicode.com/todos/1",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("data-done-right/file-info-checksum").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://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf",
    "https://www.w3.org/Icons/w3c_main.png",
    "https://jsonplaceholder.typicode.com/todos/1"
  ]
}' |
apify call data-done-right/file-info-checksum --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,data-done-right/file-info-checksum"
        }
    }
}
```

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/Rfrjfs7rKHUeBdTt6/builds/nkfZAgkRmVPpZurIR/openapi.json
