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

# API keys

> Add an API key in three steps to lift the keyless hourly cap and get 100,000 free requests a month. Your code stays the same.

An API key removes the hourly cap of the keyless tier and gives your organization 100,000 free requests a month. Your code stays the same: the SDKs pick the key up from the environment.

**1. Create a key in the console**

Open the [Keenable console ↗](https://app.keenable.ai/console?utm_source=docs\&utm_medium=cta\&utm_campaign=api_keys\&utm_content=create_key) and create a key.

Keys start with `keen_`. Copy yours before you close the dialog.

**2. Set KEENABLE\_API\_KEY**

This command puts the key in your shell's environment, where the SDKs, the MCP server and the CLI look for it.

```bash bash theme={"theme":{"light":"github-light-high-contrast","dark":"dark-plus"}}
export KEENABLE_API_KEY=keen_<your_key>
```

```powershell PowerShell theme={"theme":{"light":"github-light-high-contrast","dark":"dark-plus"}}
$env:KEENABLE_API_KEY = "keen_<your_key>"
```

The variable lasts for this terminal session. Add the line to your shell profile, or to your secrets manager, to keep it.

**3. Re-run the same code**

Run the code from the [Quickstart](https://docs.keenable.ai/index.md) again. Nothing else changes.

With `KEENABLE_API_KEY` set, the TypeScript, Python, Go and Rust SDKs send the key and call the keyed endpoints instead of the `/public` ones. Responses now report what each call cost in a `usage` object (see [Balance and usage](https://docs.keenable.ai/credits.md#reading-usage-per-call)).

## Get a key from an agent or the CLI

An agent, a CLI or a CI job that can't open the console gets a key through device login. The tool shows a person a link and a code, the person approves it in the console, and the tool receives a new API key. The person signs in to the console to approve, or creates a free account at [app.keenable.ai/signup](https://app.keenable.ai/signup) first.

The Keenable CLI runs this flow for you:

```bash theme={"theme":{"light":"github-light-high-contrast","dark":"dark-plus"}}
keenable login
```

The command prints the link and the code, waits for the approval, and saves the key for the CLI and for `keenable configure-mcp`. To get a key for the SDKs or raw HTTP from your own tool, run the same flow over HTTP. See [Device login](https://docs.keenable.ai/authentication.md#device-login).

A person has to approve every device login. An agent that signs in with AgentID doesn't need one: that sign-in creates the agent's own organization, and the agent creates its own key with two calls. See [Getting a key as an agent](https://app.keenable.ai/agent-api-key.md). An agent with neither path can still search and fetch keyless with the `/public` endpoints. It can't use Monitors. It should stop, tell the person that a key is needed and share the approval link, not retry.

## Pass the key over raw HTTP

Without an SDK, send the key in the `X-API-Key` header and drop `/public` from the path. The keyed endpoints need no `X-Keenable-Title` header.

This request runs the Quickstart search with your key:

```bash theme={"theme":{"light":"github-light-high-contrast","dark":"dark-plus"}}
curl -X POST https://api.keenable.ai/v1/search \
  -H "Content-Type: application/json" \
  -H "X-API-Key: $KEENABLE_API_KEY" \
  -d '{"query": "fastest inference providers 2026", "max_results": 3}'
```

You get the same results as the keyless call, followed by a `usage` object.

If your client only supports bearer tokens, send `Authorization: Bearer keen_<your_key>` instead. If you send both headers, the API uses `X-API-Key`.

## Key lifetime and rotation

* Keys belong to your organization.
* Keys never expire on their own.
* You can rotate a key at any time in the [console ↗](https://app.keenable.ai/console). Create the new key, update `KEENABLE_API_KEY` everywhere it is set, then revoke the old one.

If the key is revoked, the API returns [`403`](https://docs.keenable.ai/errors#403). If the key isn't in Keenable's format, the API returns `401` with `Malformed API key` (see [401 Malformed key](https://docs.keenable.ai/errors.md#401-malformed-key)). If the key has the right format but Keenable has no key with that value, as with a typo, the API returns `401` with `Invalid API key` (see [401 Invalid key](https://docs.keenable.ai/errors.md#401-invalid-key)).

## Related

* [Authentication](https://docs.keenable.ai/authentication.md): the key for the MCP server and the CLI.
* [Rate limits](https://docs.keenable.ai/rate-limits.md): keyed and keyless limits side by side.
* [Errors](https://docs.keenable.ai/errors.md): every status the API returns and how to fix it.


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