# Wayback Machine API – Website History & Change Detection (`capi2/wayback-change-api`) Actor

Query Internet Archive Wayback Machine history and compare archived website versions at scale. List snapshots, extract archived text, detect content changes, and export structured JSON for SEO research, competitor tracking, compliance evidence, and website monitoring. Public URLs only.

- **URL**: https://apify.com/capi2/wayback-change-api.md
- **Developed by:** [Dries Van Durme](https://apify.com/capi2) (community)
- **Categories:**
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $25.00 / 1,000 website version comparisons

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?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## Wayback Machine API – Website History & Change Detection

**Compare archived website content, not just capture metadata.**

Turn public Internet Archive history into structured dataset records without writing CDX queries, constructing replay URLs, cleaning archived HTML, or building a diff engine.

### What this Actor does

| Mode | Result |
|---|---|
| `snapshots` | Distinct archived HTML versions with timestamps, metadata, and replay URLs |
| `extract` | Archived title, word count, preview, and optional normalized full text |
| `compare` | Oldest-versus-newest comparison with change score and added/removed sentence samples |

Each URL produces one structured dataset record. Failed URLs also produce a record with an `error`, so batch results remain usable.

### Best for

- **SEO recovery** — find historical page versions after migrations, redesigns, or accidental edits
- **Competitor research** — compare past and present messaging, pricing, and landing pages
- **Compliance evidence** — collect structured public historical evidence with timestamps and source URLs
- **Website monitoring** — quantify how archived content changed across a selected date range
- **Data and AI pipelines** — export normalized JSON instead of parsing Wayback responses downstream

### Example input

```json
{
  "mode": "compare",
  "urls": ["https://example.com"],
  "from": "2020",
  "to": "2026",
  "maxSnapshots": 100,
  "includeText": false
}
```

Dates accept `YYYY`, `YYYYMMDD`, or a full Wayback timestamp. You can process up to 50 public URLs per run.

### Example output

```json
{
  "mode": "compare",
  "url": "https://example.com/",
  "from": "2020",
  "to": "2026",
  "snapshotCount": 3,
  "oldVersion": {
    "timestamp": "20200101213728",
    "title": "Example Domain"
  },
  "newVersion": {
    "timestamp": "20200108211718",
    "title": "Example Domain"
  },
  "comparison": {
    "changed": false,
    "changePercentage": 0,
    "oldWordCount": 30,
    "newWordCount": 30,
    "addedSentenceCount": 0,
    "removedSentenceCount": 0,
    "addedSamples": [],
    "removedSamples": []
  }
}
```

### API quick start

#### JavaScript

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

const client = new ApifyClient({ token: process.env.APIFY_TOKEN });
const input = {
  mode: 'compare',
  urls: ['https://example.com'],
  from: '2020',
  to: '2026',
  maxSnapshots: 100,
  includeText: false,
};

const run = await client.actor('capi2/wayback-change-api').call(input);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
console.dir(items, { depth: null });
```

#### Python

```python
import os
from apify_client import ApifyClient

client = ApifyClient(os.environ["APIFY_TOKEN"])
run = client.actor("capi2/wayback-change-api").call(run_input={
    "mode": "compare",
    "urls": ["https://example.com"],
    "from": "2020",
    "to": "2026",
    "maxSnapshots": 100,
    "includeText": False,
})

for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)
```

#### cURL

```bash
curl --request POST \
  --url "https://api.apify.com/v2/actors/capi2~wayback-change-api/run-sync-get-dataset-items?clean=true" \
  --header "Authorization: Bearer $APIFY_TOKEN" \
  --header "Content-Type: application/json" \
  --data '{
    "mode": "compare",
    "urls": ["https://example.com"],
    "from": "2020",
    "to": "2026",
    "maxSnapshots": 100,
    "includeText": false
  }'
```

### Transparent pay-per-event pricing

A mode can emit multiple events because extraction and comparison build on a snapshot query.

| Event | Price |
|---|---:|
| Snapshot query | $0.002 each |
| Archived page extraction | $0.010 each |
| Website version comparison | $0.025 each |
| Dataset result | $0.00001 each |
| Actor start | $0.00005 per run |

Customers do not pay the Actor's platform usage costs. Review the estimate and set a maximum charge appropriate for your batch.

### Safeguards and limits

- Public HTTP(S) URLs only
- URL validation and credential stripping
- 50 URLs per run
- 1,000 snapshots per URL
- 2 MB per archived HTML response
- 45-second archived-page fetch timeout
- At most 20 added and 20 removed sentence samples

These limits reduce accidental cost and unexpectedly large outputs. Archive availability and coverage depend on the Internet Archive. This Actor does not bypass authentication or access controls.

### Data delivery

Results are available as an Apify dataset and can be exported as JSON, CSV, Excel, XML, or RSS. Connect runs to schedules, webhooks, or your existing Apify integrations for repeatable workflows.

# Actor input Schema

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

Choose whether to list snapshots, extract the latest archived page, or compare the oldest and newest distinct versions.

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

One HTTP or HTTPS URL per line. Maximum 50 URLs per run.

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

Start date as YYYY, YYYYMMDD, or a full Wayback timestamp.

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

End date as YYYY, YYYYMMDD, or a full Wayback timestamp.

## `maxSnapshots` (type: `integer`):

Caps the number of distinct archived versions returned by the Wayback CDX API.

## `includeText` (type: `boolean`):

Return full archived text. Leave off for smaller, safer datasets.

## Actor input object example

```json
{
  "mode": "compare",
  "urls": [
    "https://example.com"
  ],
  "from": "2020",
  "to": "2026",
  "maxSnapshots": 100,
  "includeText": false
}
```

# Actor output Schema

## `results` (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 = {};

// Run the Actor and wait for it to finish
const run = await client.actor("capi2/wayback-change-api").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 = {}

# Run the Actor and wait for it to finish
run = client.actor("capi2/wayback-change-api").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 '{}' |
apify call capi2/wayback-change-api --silent --output-dataset

```

## MCP server setup

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

```

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/bA7yBXYBpS8Psg1Db/builds/2ieIb4cHEQ0JOpXPx/openapi.json
