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

# Migrate from the Perplexity Search API to Keenable

> Move a Perplexity Search API integration to Keenable: map POST /search filters, dates and result fields to POST /v1/search, with before and after code.

Replace Perplexity Search API calls with Keenable's `POST /v1/search`. This page maps each parameter and response field of Perplexity's `POST /search` to Keenable, and shows the same request on both APIs. It doesn't cover the Sonar chat completions API.

## Migrate with your coding agent

Paste this prompt into your coding agent. Your agent reads this page as markdown and rewrites your calls.

```text theme={"theme":{"light":"github-light-high-contrast","dark":"dark-plus"}}
Migrate this project from Perplexity to Keenable. Read https://docs.keenable.ai/migrate/perplexity.md for the endpoint, parameter and response maps. Replace every call with the Keenable SDK call or REST request it maps to, remove the parameters marked None, and read KEENABLE_API_KEY from the environment. Then run one request and show me the result. If a call fails, stop and show me the error.
```

Your agent finishes by running one Keenable request and showing you the result. The prompt works with Claude Code, Cursor, Codex and any other agent that can read a URL.

## What changes

| | Perplexity Search API | Keenable |
| - | - | - |
| Search request | `POST https://api.perplexity.ai/search` with a JSON body | `POST https://api.keenable.ai/v1/search` with a JSON body. Only `query` is required. |
| Auth header | `Authorization: Bearer <token>` | `X-API-Key: $KEENABLE_API_KEY`, or no key on `/v1/search/public` |
| Date format | `MM/DD/YYYY` | `YYYY-MM-DD`, an ISO 8601 timestamp, or a relative delta such as `7d` |

## Endpoint map

| Perplexity Search API | Keenable | Match | Notes |
| - | - | - | - |
| `POST /search` | `POST /v1/search` | Exact | This page maps the Search API, not the Sonar chat completions API. |

## Parameter map

A parameter Keenable doesn't list returns `400` with `Unknown parameter(s)`, so remove Perplexity Search API parameters instead of sending them along. "Closest" means the Keenable parameter does a similar job with a different format or behavior, described in the notes.

| Perplexity Search API parameter | Keenable | Match | Notes |
| - | - | - | - |
| `query` | `query` | Exact | |
| `max_results` | `max_results` | Exact | Perplexity takes `1` to `20`, or up to `50` only with `search_type: people`. Keenable takes `1` to `50`. Both default to `10`. |
| `search_type` | `mode` | Closest | `fast` is closest to `realtime`, and `web` (the default) to `pro`, which is also Keenable's default. `people` has no equivalent. |
| `search_domain_filter` | `site` | Closest | `site` takes one site. For several, put `site:a.com OR site:b.com` in `query`. To leave sites out, use `exclude_domains`. |
| `search_recency_filter` | `published_after` | Closest | `1h` for `hour`, `1d` for `day`, `1w` for `week`, `1mo` for `month`, `1y` for `year`. |
| `search_after_date_filter` | `published_after` | Closest | Rewrite `MM/DD/YYYY` as `YYYY-MM-DD`. |
| `search_before_date_filter` | `published_before` | Closest | Rewrite `MM/DD/YYYY` as `YYYY-MM-DD`. |
| `last_updated_after_filter` | None | None | Keenable filters by publish date (`published_after`) or index date (`acquired_after`), not last-updated date. Remove `last_updated_before_filter` too. |
| `country` | None | None | Remove it. |
| `search_language_filter` | None | None | Remove it. |

## Response map

| Perplexity Search API field | Keenable | Match | Notes |
| - | - | - | - |
| `results` | `results` | Exact | |
| `results[].title` | `results[].title` | Exact | |
| `results[].url` | `results[].url` | Exact | |
| `results[].snippet` | `results[].snippet` | Exact | Markdown, capped by `snippet_max_length`. |
| `results[].date` | `results[].published_at` | Closest | An ISO 8601 timestamp in UTC, not a bare date. Left out when unknown. |
| `results[].last_updated` | `results[].acquired_at` | Closest | When Keenable indexed the page, which isn't the page's own last-updated date. |
| `id` | The `X-Request-Id` response header | Closest | |

## Before and after

This search asks both APIs for 5 pages published in the past week. The Keenable request runs without a key.

```bash Perplexity (before) theme={"theme":{"light":"github-light-high-contrast","dark":"dark-plus"}}
curl -X POST https://api.perplexity.ai/search \
  -H "Authorization: Bearer $PERPLEXITY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "query": "solid state battery research",
    "max_results": 5,
    "search_recency_filter": "week"
  }'
```

```bash Keenable (after) theme={"theme":{"light":"github-light-high-contrast","dark":"dark-plus"}}
curl -X POST https://api.keenable.ai/v1/search/public \
  -H "Content-Type: application/json" \
  -H "X-Keenable-Title: My App" \
  -d '{
    "query": "solid state battery research",
    "max_results": 5,
    "published_after": "1w"
  }'
```

The Keenable response has `query`, `mode` and up to 5 `results`. Each result has a `title` and a `url`, and usually a `snippet`, a `published_at` and an `acquired_at`.

## No equivalent in Keenable

These Perplexity Search API features have no Keenable counterpart. Remove them from the request, or handle them in your own code as described.

* `last_updated_after_filter`: Keenable has no last-updated filter. Use `published_after` for the publish date or `acquired_after` for when Keenable indexed the page.
* `search_type: people`: Keenable has no people search. Search the web with a query that names the person.
* `country`: Keenable has no country targeting.
* `search_language_filter`: Keenable has no language filter.

Mapping checked on 2026-11-19 against [docs.perplexity.ai/api-reference/search-post](https://docs.perplexity.ai/api-reference/search-post).

## Use an SDK

This program sends the same search as the Keenable tab above with the official SDK. It runs without a key and prints the title, URL and publish date of each result.

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

async function main() {
  const client = new Keenable(); // keyless: no API key needed to try it
  const results = await client.search("solid state battery research", {
    maxResults: 5,
    publishedAfter: "1w",
  });
  for (const result of results.results) {
    console.log(result.title);
    console.log(result.url);
    console.log(result.publishedAt ?? "no publish date");
  }
}

main();
```

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

client = Keenable()  # keyless: no API key needed to try it
results = client.search(
    "solid state battery research",
    max_results=5,
    published_after="1w",
)
for result in results:
    print(result.title)
    print(result.url)
    print(result.published_at or "no publish date")
```

```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() {
	client, err := keenable.New(nil) // keyless: no API key needed to try it
	if err != nil {
		log.Fatal(err)
	}
	defer client.Close()

	results, err := client.Search(context.Background(), "solid state battery research",
		&keenable.SearchOptions{
			MaxResults:     5,
			PublishedAfter: "1w",
		})
	if err != nil {
		log.Fatal(err)
	}
	for _, result := range results.Results {
		fmt.Println(result.Title)
		fmt.Println(result.URL)
		if result.PublishedAt != nil {
			fmt.Println(*result.PublishedAt)
		} else {
			fmt.Println("no publish date")
		}
	}
}
```

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

#[tokio::main]
async fn main() -> Result<(), keenable::Error> {
    let client = Client::new()?; // keyless: no API key needed to try it
    let results = client
        .search_with(
            "solid state battery research",
            &SearchOptions {
                max_results: Some(5),
                published_after: Some("1w".into()),
                ..Default::default()
            },
        )
        .await?;
    for result in &results {
        println!("{}", result.title);
        println!("{}", result.url);
        println!("{}", result.published_at.as_deref().unwrap_or("no publish date"));
    }
    Ok(())
}
```

```bash curl theme={"theme":{"light":"github-light-high-contrast","dark":"dark-plus"}}
curl -X POST https://api.keenable.ai/v1/search/public \
  -H "Content-Type: application/json" \
  -H "X-Keenable-Title: My App" \
  -d '{
    "query": "solid state battery research",
    "max_results": 5,
    "published_after": "1w"
  }'
```

You see up to 5 results, each published in the past week, with its publish date as an ISO 8601 timestamp. Install the SDK for your language from [SDKs](https://docs.keenable.ai/sdks.md).

## Verify the migration

Check each item before you remove the old client:

1. Run the Keenable request from [Before and after](#before-and-after). The status is `200`.
2. `results` has at most as many entries as `max_results`. Each entry has a `title` and a `url`.
3. Your code reads `published_at` as an ISO 8601 timestamp where it read `date`.
4. Every date you send is `YYYY-MM-DD` or a relative delta such as `1w`, not `MM/DD/YYYY`.
5. Your requests send no parameter from a None row. A leftover one returns `400` with `unknown_parameter`.
6. Change the path to `/v1/search` or `/v1/fetch` and send `X-API-Key`. The response gains a `usage` object. See [API keys](https://docs.keenable.ai/api-keys.md).

## Common questions

> [accordion] Trying Keenable without a key
>
> Send the request to `/v1/search/public` or `/v1/fetch/public` with an `X-Keenable-Title` header and no key. Without a key, each endpoint allows 1,000 requests per hour and 10 per second per IP address. See [Rate limits](https://docs.keenable.ai/rate-limits.md).

> [accordion] Sonar and chat completions
>
> This page maps the Search API only. Keenable returns ranked pages with snippets, not a generated answer. To answer a question, pass the snippets to your own model.

> [accordion] Date filters
>
> Keenable filters by publish date with `published_after` and `published_before`, and by index date with `acquired_after` and `acquired_before`. It has no last-updated filter. See [Date and time filters](https://docs.keenable.ai/api-reference/search.md#date-and-time-filters).

> [accordion] Cost of each call
>
> Each search mode and each kind of fetch is billed as its own SKU, and a call made with a key returns what it cost in `usage`. See [Pricing](https://docs.keenable.ai/pricing.md) and [Balance and usage](https://docs.keenable.ai/credits.md).

## Related

* [Migrate to Keenable](https://docs.keenable.ai/migrate.md): every provider Keenable has a mapping for.
* [Search API reference](https://docs.keenable.ai/api-reference/search.md): every search parameter and response field.
* [Fetch API reference](https://docs.keenable.ai/api-reference/fetch.md): every fetch parameter and response field.


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