# Wayback Machine Scraper: Snapshots, Archived URLs & History (`best_apis/wayback-machine-scraper`) Actor

Get Internet Archive Wayback Machine snapshots of any page, every archived URL of a domain, or the capture closest to a date, with optional archived page text. Date, status, MIME and change filters. $0.30 per 1,000 snapshots.

- **URL**: https://apify.com/best_apis/wayback-machine-scraper.md
- **Developed by:** [A Q](https://apify.com/best_apis) (community)
- **Categories:** SEO tools, Developer tools, Automation
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per event

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

## Wayback Machine Scraper: Snapshots, Archived URLs and Page History

Get data from the **Internet Archive Wayback Machine** for any website. You can list every snapshot of a page over time, extract every URL the archive holds for a domain, or find the capture closest to a date. You can also download the archived page text.

It uses the official Wayback CDX index and needs no login or API key. Requests are polite (2 at a time) and it waits and retries when the archive is busy.

### What you can do

- **Page history (snapshots mode).** Every capture of a URL, oldest first, with the date, HTTP status, MIME type, content digest and size. By default, captures with identical content are skipped, so you get only real changes. You can also thin the list to at most one capture per hour, day, month or year.
- **Archived URL extractor (urls mode).** Every unique URL archived under a domain, host or path, with its first capture. Use it to recover deleted pages, rebuild old sitemaps, plan SEO redirect maps after a migration, find old PDFs or run OSINT research.
- **Closest snapshot (closest mode).** One capture per URL, nearest to a date you choose, for example "what did these 500 homepages look like on 2019-01-01?"
- **Archived page text (optional).** Add the title, meta description, H1, language, word count, link count and clean plain text of each archived HTML page.
- **Filters.** Date range (`2015`, `2020-06`, `2024-01-31` or `"2 years"`), status codes (200, 301, 404 and others), MIME types (`text/html`, `application/pdf`), "URL contains" text, per-input and total caps.

### Pricing

Pay per event, with no subscription:

| | This Actor | Typical alternatives |
|---|---|---|
| Per 1,000 snapshots or archived URLs | **$0.30** | $1 – $5 |
| Per 1,000 archived pages with text | +$1.00 | $3 or more |
| Per run start | $0.0005 | up to $0.01 |

Inputs with no captures cost nothing beyond the start fee. Page text is charged only when a page was actually downloaded. If you set a spending limit, the run stops cleanly when it is reached.

### Input examples

Yearly history of a page:

```json
{ "urls": ["https://www.apple.com/iphone/"], "frequency": "year", "statusCodes": ["200"] }
```

All archived blog URLs of a domain:

```json
{ "urls": ["example.com"], "mode": "urls", "urlContains": "/blog/", "mimeTypes": ["text/html"], "maxResultsPerUrl": 5000 }
```

Homepages as they were on a given date, with text:

```json
{ "urls": ["nytimes.com", "bbc.co.uk"], "mode": "closest", "closestTo": "2010-01-01", "includeContent": true }
```

### Output

```json
{
  "url": "http://www.nytimes.com/",
  "capturedAt": "2010-01-01T17:32:18Z",
  "timestamp": "20100101173218",
  "statusCode": 200,
  "mimeType": "text/html",
  "archiveUrl": "https://web.archive.org/web/20100101173218/http://www.nytimes.com/",
  "rawArchiveUrl": "https://web.archive.org/web/20100101173218id_/http://www.nytimes.com/",
  "digest": "GIIGQHYAG2VIF4ZLPEW4ZOSZHJQQLYXY",
  "sizeBytes": 25811,
  "contentChanged": null,
  "urlKey": "com,nytimes)/",
  "inputUrl": "nytimes.com",
  "mode": "closest",
  "title": "The New York Times - Breaking News, World News & Multimedia",
  "metaDescription": "Find breaking news, multimedia, reviews & opinion on Washington, business, sports, movies, travel, books...",
  "language": null,
  "h1": null,
  "linksCount": 419,
  "wordCount": 2406,
  "text": "The New York Times - Breaking News, World News & Multimedia\nLog In\nRegister Now\n...",
  "textTruncated": false,
  "contentFetched": true,
  "scrapedAt": "2026-10-22T05:25:20.000Z"
}
```

`archiveUrl` opens the capture in the Wayback viewer. `rawArchiveUrl` returns the original archived file with no Wayback toolbar. In urls mode, `capturedAt` is the first time that URL was archived. Inputs with no results, or with errors, are listed in the `FAILURES` key-value record.

### Tips

- In urls mode a bare domain (`example.com`) matches all subdomains, and a URL with a path (`example.com/docs`) matches everything under that path. You can override this with **Match**.
- Domain-wide scans of very large sites with filters can take a minute per 5,000 rows, because the archive index scans them server-side. Narrow with a path, a date range or a cap for faster runs.
- Results run oldest to newest. To get recent captures only, set **From date** (for example `"1 year"`).

### Use via API

```bash
curl -X POST "https://api.apify.com/v2/acts/best_apis~wayback-machine-scraper/run-sync-get-dataset-items?token=YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"urls":["example.com"],"mode":"urls","maxResultsPerUrl":1000}'
```

### FAQ

**Is this legal?** It reads the Internet Archive's public CDX index and public archived copies, the same data anyone can view at web.archive.org. It doesn't log in or collect personal data. Respect the copyright of archived content when you reuse it.

**Why do some captures have status 301 or 404?** The archive also records redirects and error pages. Filter with `statusCodes: ["200"]` to keep only real pages.

**Can I save a page to the archive?** No. This Actor only reads existing captures.

**Something broke?** Open an issue on the Issues tab and it will be fixed quickly.

# Actor input Schema

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

Pages (https://example.com/pricing) or domains (example.com). Each one is looked up in the Internet Archive Wayback Machine.

## `mode` (type: `string`):

Snapshots lists captures over time. Archived URLs lists the unique URLs the archive holds for a site (with its first capture). Closest returns one capture per URL nearest to the date below.

## `matchType` (type: `string`):

Which archived URLs count as a match for each input.

## `from` (type: `string`):

Only captures on or after this date: 2015, 2020-06, 2024-01-31, or relative like "30 days", "2 years".

## `to` (type: `string`):

Only captures on or before this date (same formats).

## `closestTo` (type: `string`):

For the Closest snapshot mode: the target date (for example 2019-01-01). Defaults to now.

## `onlyChanges` (type: `boolean`):

Skip consecutive captures with identical content (same digest). Turn off to list every single capture.

## `frequency` (type: `string`):

Thin out the history, for example one snapshot per month.

## `statusCodes` (type: `array`):

Keep only captures with these status codes, for example 200 or 301. Leave empty for all.

## `mimeTypes` (type: `array`):

Keep only these content types, for example text/html or application/pdf. Leave empty for all.

## `urlContains` (type: `string`):

Keep only archived URLs containing this text (case-insensitive), for example /blog/ or .pdf.

## `maxResultsPerUrl` (type: `integer`):

Newest first is not available in the archive index: results run oldest to newest.

## `maxResults` (type: `integer`):

Hard cap for the whole run (keeps cost predictable).

## `includeContent` (type: `boolean`):

Download each archived HTML page and add its title, meta description, plain text and links count. Charged separately per page.

## `maxContentChars` (type: `integer`):

Longer page text is truncated.

## Actor input object example

```json
{
  "urls": [
    "apify.com"
  ],
  "mode": "snapshots",
  "matchType": "auto",
  "onlyChanges": true,
  "frequency": "any",
  "statusCodes": [
    "200"
  ],
  "maxResultsPerUrl": 50,
  "maxResults": 10000,
  "includeContent": false,
  "maxContentChars": 20000
}
```

# Actor output Schema

## `overview` (type: `string`):

No description

## `full` (type: `string`):

No description

## `failures` (type: `string`):

No description

# 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": [
        "apify.com"
    ],
    "statusCodes": [
        "200"
    ],
    "maxResultsPerUrl": 50
};

// Run the Actor and wait for it to finish
const run = await client.actor("best_apis/wayback-machine-scraper").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": ["apify.com"],
    "statusCodes": ["200"],
    "maxResultsPerUrl": 50,
}

# Run the Actor and wait for it to finish
run = client.actor("best_apis/wayback-machine-scraper").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": [
    "apify.com"
  ],
  "statusCodes": [
    "200"
  ],
  "maxResultsPerUrl": 50
}' |
apify call best_apis/wayback-machine-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,best_apis/wayback-machine-scraper"
        }
    }
}
```

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/NlzPH3YLsuou0vats/builds/tSeLhxdnTE80UPerI/openapi.json
