> ## Documentation Index
> Fetch the complete documentation index at: https://docs.keenable.ai/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Every page is listed in https://docs.keenable.ai/llms.txt. To pick a product for a job, read https://docs.keenable.ai/choose.md
> Setup steps for agents, covering the SDKs, the MCP server and the CLI: https://docs.keenable.ai/skill.md
> Keenable search and fetch work without an API key. To add them to code, use the official SDK for the project's language: https://docs.keenable.ai/sdks.md
> Without a key, call POST https://api.keenable.ai/v1/search/public or POST https://api.keenable.ai/v1/fetch/public with an X-Keenable-Title header that names your app.
> With a key, send it in the X-API-Key header and read it from the KEENABLE_API_KEY environment variable. Never ask a user to paste a key into chat. Every access method: https://docs.keenable.ai/auth.md
> To search and then read a page with a key, call POST https://api.keenable.ai/v1/search, then POST https://api.keenable.ai/v1/fetch with the result URLs. Check the fetch's HTTP status first, then each entry in results: a page that can't be read has error instead of content. A complete program, the request bodies and the response shapes are at the top of https://docs.keenable.ai/llms.txt
> To get an API key without the console, use device login: https://docs.keenable.ai/authentication.md#device-login
> MCP server: https://api.keenable.ai/mcp (no key, or X-API-Key; keyless Codex uses https://api.keenable.ai/mcp-public), or https://api.keenable.ai/mcp-oauth for OAuth sign-in. These docs are an MCP server at https://docs.keenable.ai/mcp and the OpenAPI spec is at https://docs.keenable.ai/api-reference/openapi.json
> Keenable searches and fetches public web pages. If a question needs no web information, skip the call.
> On 402 with an API key (code insufficient_credits), stop and ask a human to add credits; don't retry. On 429, wait the number of seconds in Retry-After, then retry. Before you ship, follow https://docs.keenable.ai/production.md
> Every error, with its cause and fix, is in https://docs.keenable.ai/errors.md and moving from another search API is covered in https://docs.keenable.ai/migrate.md
> Before you compare Keenable with another search API, read https://docs.keenable.ai/guides/evaluate-search-apis.md

# Research the web as of a past date with Time Machine

> Search the web as of a past date, list the versions Keenable captured of a page, and read one, with Time Machine and curl. What it costs. Early Access.

Find out what the web said on a past date, and how a page changed over time. Time Machine searches and reads the copies of pages that Keenable captured at or before the moment you give in `as_of`, so nothing published or edited later can appear. Use it to research what was known before an event, to backtest an agent or a forecast, or to cite a page as it stood when a decision was made.

> [!NOTE]
>
> No SDK, CLI command or MCP tool calls Time Machine yet. Every example on this page uses curl against `POST /v1/time-machine/*`. Call the same endpoints from your language's HTTP client.

## Before you start

* **An API key.** Time Machine has no keyless endpoint. Send the key in the `X-API-Key` header. See [API keys](https://docs.keenable.ai/api-keys.md).
* **Early Access turned on for your organization.** Time Machine is off by default. Until it is on, every call returns `403` with `Feature not enabled` and the code [`time_machine_not_enabled`](https://docs.keenable.ai/errors#time-machine-not-enabled). To turn it on, email [support@keenable.ai](mailto:support@keenable.ai) with the `request_id` from that response, or ask your Keenable contact. Early Access endpoints can change before general availability. See [Versioning](https://docs.keenable.ai/versioning.md).

Set your key in the environment before you run the examples:

```bash theme={"theme":{"light":"github-light-high-contrast","dark":"dark-plus"}}
export KEENABLE_API_KEY=...   # your API key
```

## What it costs

| Call | SKU | Standard price |
| - | - | - |
| Search as of a date | `search.time_machine` | \$4 per 1,000 searches |
| Read pages as of a date | `fetch.time_machine` | \$4 per 1,000 pages |
| List the versions of a page | `fetch.time_machine_versions` | \$0 |

A fetch bills each page Keenable looked up in its store, including a page that comes back `not_captured` and a page that failed after Keenable started reading it. A page refused before the lookup, such as a URL on a private network, isn't billed. Reading a version is an ordinary Time Machine fetch. A response that billed something reports what it cost in `usage.total`, in US dollars. A fetch that billed no page, such as one whose only URL was refused before the lookup, has no `usage` object, so check for `usage` before you read it. Listing versions reports a `$0` item, so its `usage.total.amount` is `0`. Your organization can have its own prices. See [Pricing](https://docs.keenable.ai/pricing.md#what-each-call-costs) and [Usage](https://docs.keenable.ai/api-reference/time-machine.md#usage).

Time Machine requests count toward your organization's per-second limit, together with searches and fetches, and have a limit of their own inside it: 20 per second by default. See [Rate limits](https://docs.keenable.ai/rate-limits.md#limits-for-each-kind-of-request).

## Search as of a date

Send a query and an `as_of` time. Every result is a copy captured at or before `as_of`. This search asks what was known about the WeWork IPO on 1 September 2019, a month before the IPO was withdrawn:

```bash theme={"theme":{"light":"github-light-high-contrast","dark":"dark-plus"}}
curl -s -X POST "https://api.keenable.ai/v1/time-machine/search" \
  -H "X-API-Key: $KEENABLE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"query": "WeWork IPO", "as_of": "2019-09-01T00:00:00Z", "max_results": 3, "snippet_max_length": 200}' \
  | jq -r '.results[] | "\(.acquired_at) \(.url)"'
```

You see when Keenable captured each copy, then its URL. Every `acquired_at` is before `as_of`:

```text Example output · results vary theme={"theme":{"light":"github-light-high-contrast","dark":"dark-plus"}}
2019-08-25T03:19:43Z https://cnbc.com/2019/08/14/wework-releases-s-1-filing-for-ipo.html
2019-08-26T10:24:19Z https://techcrunch.com/2019/08/14/wework-reveals-ipo-filing
```

`as_of` is an RFC 3339 timestamp with a time zone, such as `2019-09-01T00:00:00Z`. A date without a time, a relative offset such as `30d` or a time in the future returns `400`. See [Time format](https://docs.keenable.ai/api-reference/time-machine.md#time-format).

### Narrow the search

Time Machine search takes its own filters:

| Field | What it does |
| - | - |
| `include_domains` | Only results from this domain, such as `["techcrunch.com"]`. One domain for now. |
| `published_after`, `published_before` | Only pages published in this window, as RFC 3339 timestamps. |
| `max_results` | `1` to `50` results. Defaults to `10`. |
| `snippet_max_length` | 180 to 10,000 characters per snippet. |

The search filters from `/v1/search` don't apply here. `site`, `exclude_domains`, `query_time`, `mode` and `moderation` return `400` with a hint. See [Time Machine search](https://docs.keenable.ai/api-reference/time-machine.md#search).

## List the versions of a page

To see how one page changed, list the times Keenable captured it. The list carries no text, and listing versions costs \$0. This call lists the newest version in each month of 2019, two per page:

```bash theme={"theme":{"light":"github-light-high-contrast","dark":"dark-plus"}}
curl -s -X POST "https://api.keenable.ai/v1/time-machine/versions" \
  -H "X-API-Key: $KEENABLE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"url": "https://www.wework.com/", "from": "2019-01-01T00:00:00Z", "to": "2019-12-31T23:59:59Z",
       "collapse": "month", "limit": 2}'
```

You get the versions newest first, with a cursor for older ones. The values are illustrative, and the `usage` object is left out:

```json theme={"theme":{"light":"github-light-high-contrast","dark":"dark-plus"}}
{
  "url": "https://www.wework.com/",
  "versions": [
    { "acquired_at": "2019-12-28T06:14:09Z" },
    { "acquired_at": "2019-11-30T21:40:52Z" }
  ],
  "has_more": true,
  "next_cursor": "<next_cursor>"
}
```

* `collapse` keeps the newest version in each `hour`, `day`, `week`, `month` or `year`. `none`, the default, lists every version.
* If `has_more` is `true`, send the same body with `cursor` set to `next_cursor` to get the next, older page.
* A page Keenable never captured, or captured no copy of in the range, returns `200` with an empty `versions` list.

## Read a version

To read a version, fetch the page with `as_of` set to that version's `acquired_at`. Fetch returns the newest copy captured at or before `as_of`, which is the version the list named:

```bash theme={"theme":{"light":"github-light-high-contrast","dark":"dark-plus"}}
curl -s -X POST "https://api.keenable.ai/v1/time-machine/fetch" \
  -H "X-API-Key: $KEENABLE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"urls": ["https://www.wework.com/"], "as_of": "2019-12-28T06:14:09Z", "content": {"max_chars": 500}}' \
  | jq '.results[0] | {status, acquired_at, title, truncated}'
```

Check each result's `status` before you use it:

| `status` | What it means | What to do |
| - | - | - |
| `ok` | The copy has text in `content`, and `acquired_at` says when Keenable captured it. | Use it. |
| `not_captured` | Keenable has no copy of this URL from at or before `as_of`. | For a backtest or any fixed cutoff, keep `as_of`: skip the page or find another source captured by then, because a later copy can hold what happened after the cutoff. If your question allows a later date, try a later `as_of`, or list the versions to see which dates exist. |
| `no_content` | The stored copy has no usable text, such as a bot check, a login wall or a paywall. `error.code` says which. | Pick another version or another page. |
| `failed` | The read failed. | Retry if `error.retryable` is `true`. |

Fetch takes 1 to 10 URLs and an optional `content.max_chars`, and never reads the live page. The fields that `/v1/fetch` takes for a prompt, a schema, links, images and `retrieval` return `400`. See [Time Machine fetch](https://docs.keenable.ai/api-reference/time-machine.md#fetch).

## Compare a page across dates

To track how a page changed, read it at several `as_of` times and compare the copies. Each `as_of` returns the copy that was current then:

```bash theme={"theme":{"light":"github-light-high-contrast","dark":"dark-plus"}}
# Runs in a subshell, so exit stops the loop, not your shell. Answers go to a temporary folder.
(
  tmp=$(mktemp -d) || exit 1
  trap 'rm -rf "$tmp"' EXIT
  url="https://www.businessinsider.com/wework-ipo-we-company-history-founder-story-timeline-adam-neumann-2019-8"
  for as_of in 2019-06-01T00:00:00Z 2019-09-01T00:00:00Z 2019-11-01T00:00:00Z; do
    http_status=$(curl -sS -o "$tmp/page.json" -w '%{http_code}' -X POST "https://api.keenable.ai/v1/time-machine/fetch" \
      -H "X-API-Key: $KEENABLE_API_KEY" \
      -H "Content-Type: application/json" \
      -d "$(jq -n --arg url "$url" --arg as_of "$as_of" '{urls: [$url], as_of: $as_of, content: {max_chars: 300}}')") || exit 1
    if [ "$http_status" != 200 ]; then
      # An API error, such as 403 time_machine_not_enabled: print it and stop.
      echo "$as_of: HTTP $http_status $(jq -r '"\(.code // .error): \(.message)"' "$tmp/page.json" 2>/dev/null)" >&2
      exit 1
    fi
    jq -er --arg as_of "$as_of" '.results[0] | select(.status) | "\($as_of): \(.status) \(.acquired_at // "") \(.title // "")"' \
      "$tmp/page.json" || { echo "$as_of: no result in the response" >&2; exit 1; }
  done
)
```

You see one line per date: `not_captured` before Keenable first captured the page, then the copy that was current on each date, with its capture time and title. Each line is a billed page, the `not_captured` one included. See [Fetch](https://docs.keenable.ai/api-reference/time-machine.md#fetch) for this page's copies on each date.

## Cite a page as it was

A claim taken from a past copy is true of that copy, not of the page today. Cite the URL with the copy's `acquired_at`, such as "techcrunch.com/2019/08/14/wework-reveals-ipo-filing, as captured on 2019-08-26". Readers who open the URL see today's version, which can differ. See [Ground answers with citations](https://docs.keenable.ai/guides/ground-answers-with-citations.md).

## Common mistakes

| Wrong | Right | Why |
| - | - | - |
| `"as_of": "2019-09-01"` or `"as_of": "2019-09-01T00:00:00"` | `"as_of": "2019-09-01T00:00:00Z"` | Time Machine takes only RFC 3339 timestamps with a time zone. The others return `400`. |
| `query_time` on `/v1/search` to get past copies of pages | `as_of` on `/v1/time-machine/search` | `query_time` is a filter on ordinary search, billed as a search. Over MCP, `query_time` on `search_web_pages` is ordinary search too. Only `/v1/time-machine/*` returns captured copies. |
| `site` or `exclude_domains` on Time Machine search | `include_domains` with one domain | Time Machine search returns `400` for the `/v1/search` filters. |
| Treat `not_captured` as an error and retry | Skip the page or use another source. Try a later `as_of` only if your cutoff can move. | Keenable doesn't have a copy of every page for every period. Retrying returns the same result, and bills the page again. |
| Call the old `/v1/time_machine/search` and `/v1/time_machine/fetch` | `POST /v1/time-machine/search` and `/fetch` | The old paths are deprecated and return `410` from 1 March 2027. See [Versioning](https://docs.keenable.ai/versioning.md#deprecated-now). |

## API reference

* [Time Machine](https://docs.keenable.ai/api-reference/time-machine.md): every request field, response field and error.
* [Pricing](https://docs.keenable.ai/pricing.md#what-each-call-costs): the Time Machine SKUs next to search and fetch.
* [Research loop](https://docs.keenable.ai/recipes/research-loop.md): the same search, filter, read and cite steps on today's web.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.