> ## 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

# Use Keenable in RL training without the live web

> Give an RL environment web search and fetch that never reach a live site: stored copies only, an organization-wide setting, and a fixed snapshot.

Give the policy in an RL environment web search and page reads while no request from the run reaches a live site. You read pages only from Keenable's stored copies, can ask Keenable to enforce that for a whole organization, and can pin the web to a fixed date.

## Keep a run off the live web

Search returns results from Keenable's index, with one exception: when `query` is a URL and `exclude_domains` is empty, Keenable fetches that page instead, and can read it live. Keep URLs out of search queries in a training environment, or send `exclude_domains`. Fetch reads a page live from its source in some cases, such as when Keenable has no stored copy of it. See [Where pages come from](https://docs.keenable.ai/api-reference/fetch-post.md#where-pages-come-from).

To stop fetch from reading live, send `max_age_hours: -1` on every fetch your environment makes. Keenable then reads only its stored copy, runs `prompt` or `schema` over that copy, and doesn't contact the page's site. This request reads one page with `-1` and a prompt:

```typescript TypeScript theme={"theme":{"light":"github-light-high-contrast","dark":"dark-plus"}}
import { Keenable } from "keenable";

async function main() {
  // reads KEENABLE_API_KEY from the environment
  const client = new Keenable();
  const { results } = await client.fetch(["https://www.postgresql.org/support/versioning/"], {
    prompt: "List the supported major versions, one per line.",
    maxAgeHours: -1, // the indexed copy only, never the live page
  });
  const page = results[0];
  if (page.error) {
    console.log("failed:", page.url, page.error.code); // not_stored: no indexed copy
    return;
  }
  console.log(page.title);
  console.log(page.content);
}

main();
```

```python Python theme={"theme":{"light":"github-light-high-contrast","dark":"dark-plus"}}
from keenable import Keenable

# reads KEENABLE_API_KEY from the environment
client = Keenable()
page = client.fetch(
    ["https://www.postgresql.org/support/versioning/"],
    prompt="List the supported major versions, one per line.",
    max_age_hours=-1,  # the indexed copy only, never the live page
).results[0]
if page.error:
    print("failed:", page.url, page.error.code)  # not_stored: no indexed copy
else:
    print(page.title)
    print(page.content)
```

```go Go theme={"theme":{"light":"github-light-high-contrast","dark":"dark-plus"}}
package main

import (
	"context"
	"fmt"
	"log"

	"github.com/keenableai/keenable-sdk/go"
)

func main() {
	// reads KEENABLE_API_KEY from the environment
	client, err := keenable.New(nil)
	if err != nil {
		log.Fatal(err)
	}
	defer client.Close()

	storedOnly := -1.0 // the indexed copy only, never the live page
	resp, err := client.FetchWithOptions(context.Background(),
		[]string{"https://www.postgresql.org/support/versioning/"},
		&keenable.FetchOptions{
			Prompt:      "List the supported major versions, one per line.",
			MaxAgeHours: &storedOnly,
		})
	if err != nil {
		log.Fatal(err)
	}
	page := resp.Results[0]
	if page.Error != nil {
		fmt.Println("failed:", page.URL, page.Error.Code) // not_stored: no indexed copy
		return
	}
	fmt.Println(page.Title)
	fmt.Println(page.Content)
}
```

```rust Rust theme={"theme":{"light":"github-light-high-contrast","dark":"dark-plus"}}
use keenable::{Client, FetchOptions};

#[tokio::main]
async fn main() -> Result<(), keenable::Error> {
    let client = Client::new()?; // reads KEENABLE_API_KEY from the environment
    let opts = FetchOptions {
        prompt: Some("List the supported major versions, one per line.".into()),
        max_age_hours: Some(-1.0), // the indexed copy only, never the live page
        ..Default::default()
    };
    let response = client
        .fetch_with(["https://www.postgresql.org/support/versioning/"], &opts)
        .await?;
    let page = &response.results[0];
    if let Some(error) = &page.error {
        // not_stored: no indexed copy
        println!("failed: {} {}", page.url, error.code.as_deref().unwrap_or_default());
        return Ok(());
    }
    println!("{}", page.title);
    println!("{}", page.content);
    Ok(())
}
```

```bash curl theme={"theme":{"light":"github-light-high-contrast","dark":"dark-plus"}}
curl https://api.keenable.ai/v1/fetch \
  -H "X-API-Key: $KEENABLE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "urls": ["https://www.postgresql.org/support/versioning/"],
    "content": {"prompt": "List the supported major versions, one per line."},
    "retrieval": {"max_age_hours": -1}
  }'
```

You see the page title and the answer read from the stored copy. A page with no stored copy fails in its own entry with `404` and [`not_stored`](https://docs.keenable.ai/errors#not-stored), and the other pages in the call still come back. Treat `not_stored` as a page the policy can't read, the same as a dead link. Retrying returns the same error.

The MCP tool [`fetch_page_content`](https://docs.keenable.ai/mcp-server) takes the same `max_age_hours`. Over MCP the model chooses the arguments, so set `-1` in your environment's tool wrapper rather than relying on the model to send it.

## Turn off live reads for an organization

Keenable can turn off live reads for your whole organization. Every fetch made with that organization's API keys then reads only the stored copy, whatever `max_age_hours` the request sends. A search whose `query` is a URL is fetched the same way. A page with no stored copy fails with the same `not_stored` error as `-1`.

Use it when a security review needs the guarantee on Keenable's side, not only in your environment's code. To turn it on, email [support@keenable.ai](mailto:support@keenable.ai) and name the organization.

The setting covers every key in the organization. Ask for a separate organization for training runs, so evaluations and production apps on your main organization keep live reads.

## Pin the web to a date

To make rollouts reproducible, use the [Time Machine API](https://docs.keenable.ai/api-reference/time-machine.md). It searches and reads pages as Keenable captured them at or before the moment you give in `as_of`, so nothing published or edited later can appear. Time Machine never reads a page live. Search ranking can still change between runs, so save the URLs or responses a rollout used if it must replay exactly. It is in Early Access and must be turned on for your organization. See [Historical research](https://docs.keenable.ai/guides/historical-research.md) for a walkthrough.

## Evaluate in the mode you train in

Fetch results can differ with and without live reads. A page Keenable stored long ago, or never stored, reads differently from the live page. Run your evaluation with the same settings your training runs will use, and compare both modes if you plan to use live reads in production. See [Evaluate search APIs](https://docs.keenable.ai/guides/evaluate-search-apis.md) for how to compare providers fairly.

## Move to production

In production, live reads are usually what you want. Leave `max_age_hours` out to get a stored copy when it can be used and a live read otherwise, or send `0` for a page that changes often. See [Live fetch](https://docs.keenable.ai/guides/live-fetch.md).

Training runs send many calls in parallel. See [High-volume research](https://docs.keenable.ai/guides/high-volume-research.md) for concurrency and `429` handling, and [Raise your limit](https://docs.keenable.ai/rate-limits.md#raise-your-limit) for higher limits.


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