# Wayback Machine Snapshot Lister & Closest-Snapshot Lookup (`northgrid-data/wayback-snapshots-cdx`) Actor

- **URL**: https://apify.com/northgrid-data/wayback-snapshots-cdx.md
- **Developed by:** [Northgrid Data](https://apify.com/northgrid-data) (community)
- **Categories:** Developer tools, SEO tools
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$1.00 / 1,000 snapshot row returneds

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 Snapshot Lister & Closest-Snapshot Lookup

List every capture the Internet Archive's Wayback Machine holds for a URL, or find the capture closest to a date, using the Archive's public CDX Server and CDX closest searchs. Results are ready-to-open snapshot links plus metadata.

### Modes

- **snapshots**: all captures of a URL (or everything under a path, host or domain), with timestamp, HTTP status, MIME type, content digest, size, a snapshot link and a raw-content link (`id_`, no Wayback banner). Filter by date range, status code and MIME type.
- **closest**: for each URL and date, the capture nearest to that date.

### Typical uses

- Prove what a page said on a given date (compliance, evidence, journalism, legal-adjacent research).
- Find when a page changed: collapse by `digest` to get one row per distinct version.
- Recover lost pages or discover old URLs of a domain (`matchType: domain`).
- Build a monthly or yearly timeline of a site with one capture per period.

### Input example

```json
{ "mode": "snapshots", "urls": ["example.com"], "fromDate": "2018-01-01", "collapse": "timestamp:6", "statusCodes": ["200"] }
```

### Pricing

Pay per result: $0.001 per snapshot row. 1,000 snapshots cost $1.

### Notes

- The Actor paces its requests to respect archive.org rate limits, so very large pulls take time.
- It lists captures and links; it does not download page content.
- Questions or a field you need? Open an issue on the Actor page; we reply quickly.

# Actor input Schema

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

snapshots = list archived captures of a URL (CDX); closest = find the capture nearest to given dates (CDX closest search).

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

Pages or domains, e.g. example.com or https://news.ycombinator.com/.

## `dates` (type: `array`):

Dates like 2020-06-01. One lookup per URL and date. Leave empty for the most recent capture.

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

Only captures on/after this date, e.g. 2018-01-01.

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

Only captures on/before this date.

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

exact = this URL only; prefix = everything under the path; host = whole host; domain = host and subdomains.

## `collapse` (type: `string`):

Reduce output: one capture per day / month / year, or only when content changed (unique digest).

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

Only captures with these HTTP status codes, e.g. 200.

## `mimeType` (type: `string`):

e.g. text/html or application/pdf.

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

Upper bound on rows per URL.

## `newestFirst` (type: `boolean`):

Return the most recent captures first instead of the oldest.

## Actor input object example

```json
{
  "mode": "snapshots",
  "urls": [
    "example.com"
  ],
  "dates": [],
  "matchType": "exact",
  "collapse": "none",
  "statusCodes": [],
  "maxSnapshotsPerUrl": 500,
  "newestFirst": false
}
```

# Actor output Schema

## `snapshots` (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": [
        "example.com"
    ],
    "dates": [],
    "statusCodes": []
};

// Run the Actor and wait for it to finish
const run = await client.actor("northgrid-data/wayback-snapshots-cdx").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": ["example.com"],
    "dates": [],
    "statusCodes": [],
}

# Run the Actor and wait for it to finish
run = client.actor("northgrid-data/wayback-snapshots-cdx").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": [
    "example.com"
  ],
  "dates": [],
  "statusCodes": []
}' |
apify call northgrid-data/wayback-snapshots-cdx --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,northgrid-data/wayback-snapshots-cdx"
        }
    }
}
```

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/RCXoThBmxfJGKimpH/builds/H67PUNGZ2lyTSAyQh/openapi.json
