# Wayback Machine API - First Seen, Last Seen & Versions (`stas_k/wayback-machine-api`) Actor

A page that was never archived is not data, yet it lands as a billed row. This one bills only URLs the archive really holds: earliest snapshot, latest change and the distinct versions, read from the Internet Archive CDX API with no key and no browser.

- **URL**: https://apify.com/stas_k/wayback-machine-api.md
- **Developed by:** [Stas K](https://apify.com/stas_k) (community)
- **Categories:** SEO tools, Developer tools, Automation
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 1 bookmarks
- **User rating**: No ratings yet

## Pricing

$0.90 / 1,000 urls

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 API - First Seen, Last Seen & Versions

Answers the question SEO audits, link-rot checks and research work actually ask: was this
page ever archived, when did it first appear, when did it change last, and which distinct
versions exist.

It reads the Internet Archive CDX API. No API key, no proxy, no browser, no HTML parsing.

### What you get per URL

| field | meaning |
|---|---|
| `url` | the URL as the archive sees it, normalized |
| `host` | the host name |
| `firstSnapshotAt` | when the archive first captured this page, inside your window if you set one |
| `firstSnapshotStatus` | the HTTP status of that earliest capture |
| `lastSnapshotAt` | the newest capture inside your window |
| `versionsReturned` | how many distinct versions are in `latestVersions` |
| `capturesRead` | how many raw captures were read to get them |
| `latestVersions` | the newest versions, each with `at`, `timestamp`, `url`, `statusCode`, `mimeType`, `digest`, `lengthBytes` |
| `windowFrom`, `windowTo` | the date filter you sent, echoed back |
| `partial` | true when the newest versions could not be read and only `firstSnapshotAt` is filled |
| `source` | where the row came from |

Versions are collapsed by content digest, so ten identical copies of a page count as one
version and the list stays short. The archive collapses only neighbouring captures, and two
variants of one page alternate, so the reader pulls up to three times the requested number of
captures and keeps the newest capture of each digest. `capturesRead` says how many raw
captures that took.

### What you pay for, and what you do not

One `url-checked` event per URL that the archive really holds history for. The row is
written and charged in one call, so a row you paid for is always a row you can download.

These come back **free**, with a status and a plain reason, and carry no history fields:

| status | when |
|---|---|
| `NOT_FOUND` | the archive never captured that URL, or nothing inside your date window |
| `INVALID_INPUT` | not a public http/https page: no dot in the host, a private or loopback address, another scheme, an empty line |
| `DUPLICATE` | the same URL was already sent in this run |
| `NOT_CHECKED_CAP` | the run hit `maxUrls` or the spending limit |
| `NOT_CHECKED_TIME` | the run ran out of time before this line |
| `NOT_CHECKED_ERROR` | the archive could not be read |
| `NOT_CHECKED_BILLING` | the price list could not be read, so nothing can be sold |

The lowest spending limit you can set per run is $0.05. That is a floor on the cap the
buyer sets, not a price you pay to start: ten URLs at the default price cost well under it.

### Speed and limits

Two calls per URL, about 0.3 to 3 seconds depending on how deep the archive has to search.
`maxUrls` defaults to 200. `maxSnapshotsPerUrl` defaults to 20 and caps at 100. A date
filter that is not `YYYY`, `YYYYMM`, `YYYYMMDD` or `YYYYMMDDhhmmss` stops the run before the
first request instead of being silently ignored.

### What this actor does not do

- It does not download the archived page bodies. It reports that a capture exists and what
  its status, MIME type, digest and size are.
- `lengthBytes` is the length of the archive's WARC record, not the size of the page as the
  browser would see it.
- It does not search by domain or prefix. One URL per line, exactly as the archive indexes
  them; a domain-wide sweep is a different tool.
- It does not bypass anything and it does not need to: the CDX API is public.

### Run summary

`RUN_SUMMARY` in the run's key-value store, plus a copy under `RUN_SUMMARY-<runId>` in the
named store `wayback-machine-summary`, so two simultaneous runs do not overwrite each other.
It names `delivered`, `chargedEvents`, `deliveredUncharged`, `deliveredUnverified`,
`chargeUncertain`, `urlsNotFound`, `stopReason`, `datasetNote` and `firstFailure`: when the
platform cannot confirm a charge, the summary says the outcome is unknown instead of
claiming either delivery or a refusal.

### Example input

```json
{
  "urls": ["example.com", "https://apify.com/pricing", "this-domain-never-existed-xyz-2026.com"],
  "maxSnapshotsPerUrl": 20
}
```

The third line has no snapshots, so it comes back as a free `NOT_FOUND` row with the reason.

Source: Internet Archive CDX API. This actor is not affiliated with or endorsed by the
Internet Archive.

# Actor input Schema

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

Pages to look up: a bare host such as example.com, a host with a path such as apify.com/pricing, or a full http/https link. The last line in the default list has no snapshots, so it comes back free.

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

How many of the newest distinct versions to return for each URL, collapsed by content digest so identical copies do not repeat. Default 20, maximum 100.

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

Only count snapshots taken on or after this moment. Format YYYY, YYYYMM, YYYYMMDD or YYYYMMDDhhmmss. An empty value means the whole history; a malformed value stops the run before any request.

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

Only count snapshots taken on or before this moment, same formats as the window start.

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

How many lines of the list this run reads. Default and maximum 200; a line past the cap comes back as a free NOT_CHECKED_CAP row that names the cap.

## Actor input object example

```json
{
  "urls": [
    "example.com",
    "https://apify.com/pricing",
    "this-domain-never-existed-xyz-2026.com"
  ],
  "maxSnapshotsPerUrl": 20,
  "from": "",
  "to": "",
  "maxUrls": 200
}
```

# Actor output Schema

## `dataset` (type: `string`):

One row per URL. Paid rows carry firstSnapshotAt, lastSnapshotAt, versionsReturned, capturesRead and latestVersions with billable true; every other row is a free status row with a reason and no history. Status rows are written in batches of up to 100, so sort by actorIndex to get the input order back.

## `summary` (type: `string`):

Counters of the run: requested, attempted, delivered, chargedEvents, deliveredUncharged, deliveredUnverified, chargeUncertain, urlsNotFound, urlsInvalid, cutByLimit, byStatus, counterMismatch, stopReason, datasetNote, firstFailure and priceNote. The bare RUN_SUMMARY lives in the default store of the run; a copy under RUN_SUMMARY-<runId> is kept in the named store wayback-machine-summary so two runs do not overwrite each other.

# 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",
        "https://apify.com/pricing",
        "this-domain-never-existed-xyz-2026.com"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("stas_k/wayback-machine-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 = { "urls": [
        "example.com",
        "https://apify.com/pricing",
        "this-domain-never-existed-xyz-2026.com",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("stas_k/wayback-machine-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 '{
  "urls": [
    "example.com",
    "https://apify.com/pricing",
    "this-domain-never-existed-xyz-2026.com"
  ]
}' |
apify call stas_k/wayback-machine-api --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,stas_k/wayback-machine-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/J95WtMdHjEWhNZX9h/builds/qLURb0YmG59swpMvZ/openapi.json
