# Wayback Machine Snapshot Lookup (`nuhemugames/wayback-snapshot-lookup`) Actor

Full archive history of any URL from the Internet Archive's official CDX API: every snapshot with date, archive link, HTTP status and content digest - or a per-URL summary with first/last capture, snapshots per year and unique content versions. Polite rate control built in. No credentials needed.

- **URL**: https://apify.com/nuhemugames/wayback-snapshot-lookup.md
- **Developed by:** [kuon](https://apify.com/nuhemugames) (community)
- **Categories:** Developer tools, Other
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.50 / 1,000 results

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 Snapshot Lookup

Get the full archive history of any URL from the Internet Archive's **official
CDX API**: every snapshot with capture date, direct archive.org link, HTTP
status and content digest — or a per-URL summary with first/last capture,
snapshots per year and how many distinct content versions exist. Polite rate
control towards archive.org is built in. No credentials or API keys needed.

### What it does

Give it a list of URLs and pick an output mode:

**Snapshots mode** (default) — one dataset item per archived capture:

- `capturedAt` (ISO 8601) and the raw Wayback `timestamp`
- `archiveUrl` — click-through link to view that capture on web.archive.org
- `httpStatus`, `mimeType`, `lengthBytes` recorded at capture time
- `digest` — content hash; identical digests mean the page didn't change

**Summary mode** — one dataset item per URL:

- `archived` (does any snapshot exist), `totalSnapshots` (+ `totalIsLowerBound`
  when the URL has more than your cap)
- `firstSnapshot` and `lastSnapshot` — the **true latest capture is fetched even
  when the list is truncated**
- `snapshotsPerYear` — capture counts by year (archival activity profile)
- `uniqueVersions` — distinct content digests among retrieved snapshots

URLs that were never archived produce a summary item with `archived: false`;
lookup failures produce a failed item with a clear error. Batch jobs always finish.

### Input

| Field | Type | Default | Description |
|---|---|---|---|
| `urls` | array | — | URLs to look up (exact match, duplicates removed) |
| `outputMode` | select | `snapshots` | `snapshots` (one item per capture) or `summary` (one per URL) |
| `maxSnapshotsPerUrl` | integer | `500` | Cap per URL, oldest first (max 5000) |
| `fromDate` / `toDate` | string | — | Filter captures, `YYYY`, `YYYYMM` or `YYYYMMDD` |

### Example output (summary mode, abridged)

```json
{
    "url": "https://example.com",
    "type": "summary",
    "status": "success",
    "archived": true,
    "totalSnapshots": 200,
    "totalIsLowerBound": true,
    "firstSnapshot": {"capturedAt": "2002-01-20T14:25:10Z", "archiveUrl": "https://web.archive.org/web/20020120142510/http://example.com:80/"},
    "lastSnapshot": {"capturedAt": "2026-08-17T16:50:07Z", "archiveUrl": "https://web.archive.org/web/..."},
    "snapshotsPerYear": {"2002": 7, "2003": 12},
    "uniqueVersions": 3,
    "checkedAt": "2026-08-18T09:30:00Z"
}
```

### Typical uses

- Due diligence: how old is a site really, and how has it changed over the years
- Recover link targets that have gone dead (find the last good capture)
- Research and journalism: build a timeline of a page's revisions
- SEO forensics: when did a page first appear, when did it change

### Politeness & terms

- Uses only the Internet Archive's public CDX API with an honest User-Agent
- 2 concurrent workers, a pause before every request, and backoff on 429/5xx —
  wired into the code, not optional
- No page content is downloaded — only the archive index metadata

### Limitations

- Exact URL matching (no prefix/domain wildcards in this version)
- `snapshotsPerYear` and `uniqueVersions` are computed over retrieved snapshots,
  so they cover the first `maxSnapshotsPerUrl` captures for heavily archived URLs
- The Wayback Machine itself decides what gets archived; unarchived URLs return `archived: false`

### Development (local)

```bash
cd actors/wayback-snapshot-lookup
uv venv --python 3.13 .venv && uv pip install -p .venv/bin/python -r requirements.txt

.venv/bin/python tests/run_local_test.py           # end-to-end test (apify run equivalent), exit 0 = ALL PASS
../../node_modules/.bin/apify run                  # real apify CLI local run (input: storage/key_value_stores/default/INPUT.json)
```

The test runs against a local CDX mock (truncation, revisit rows, retry on 503,
unarchived and invalid URLs); expected results live in `tests/expected_output.json`.
Publishing → `../../docs/publishing.md`.

# Actor input Schema

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

URLs to look up in the Wayback Machine (one per line). Exact URL match; duplicates are removed.

## `outputMode` (type: `string`):

Snapshots gives the full capture list; summary gives one aggregate row per URL.

## `maxSnapshotsPerUrl` (type: `integer`):

Retrieve at most this many snapshots per URL (oldest first). Heavily archived URLs can have hundreds of thousands.

## `fromDate` (type: `string`):

Only snapshots at or after this date. Format: YYYY, YYYYMM, YYYYMMDD (e.g. 2020 or 20200315).

## `toDate` (type: `string`):

Only snapshots at or before this date. Same format as From date.

## Actor input object example

```json
{
  "urls": [
    "https://example.com"
  ],
  "outputMode": "snapshots",
  "maxSnapshotsPerUrl": 500
}
```

# Actor output Schema

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

All dataset items: snapshots and/or per-URL summaries with archive.org links.

# 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://example.com"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("nuhemugames/wayback-snapshot-lookup").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://example.com"] }

# Run the Actor and wait for it to finish
run = client.actor("nuhemugames/wayback-snapshot-lookup").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://example.com"
  ]
}' |
apify call nuhemugames/wayback-snapshot-lookup --silent --output-dataset

```

## MCP server setup

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

```

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/tVc0LggHKmPcnjfZh/builds/RkGqA96KnnI97Pzdb/openapi.json
