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

# Filter web search results by date

> How to keep search results inside a date window with published_after and published_before, relative offsets such as 7d, and the acquired filters.

Keep your agent's search results inside a date window, so it cites pages from the period the question is about. Set `published_after` for recent pages, add `published_before` to close the window, and use `acquired_after` when you want pages that are new to the index whatever their publish date.

## Parameters

| Parameter | In | Type | Default | Limits | What it does |
| - | - | - | - | - | - |
| `published_after` | Body, `/v1/search` | string | None | None | Keep pages published at or after this point. Pages with no known publish date are left out. Takes a date (`YYYY-MM-DD`, which includes that whole day), an ISO 8601 timestamp (UTC if it has no offset), or a relative delta counted back from the request time: `<number><unit>` with units `min`, `h`, `d`, `w` (weeks), `mo` (30 days) or `y` (365 days), such as `7d`. |
| `published_before` | Body, `/v1/search` | string | None | None | Keep pages published at or before this point. A bare `YYYY-MM-DD` includes that whole day; pass a timestamp to cut at an exact instant. |
| `acquired_after` | Body, `/v1/search` | string | None | None | Keep pages Keenable indexed at or after this point. Same formats as `published_after`. |
| `acquired_before` | Body, `/v1/search` | string | None | None | Keep pages Keenable indexed at or before this point. A bare `YYYY-MM-DD` includes that whole day; pass a timestamp to cut at an exact instant. |
| `query_time` | Body, `/v1/search` | string | None | None | Search the index as it stood at this moment: pages acquired after it are left out. It sets no lower bound, so it isn't a recency filter. |

Every date filter takes a date, an ISO 8601 timestamp or a relative offset. See [Choose a value](#choose-a-value).

## Search a date window

This sample keeps pages published between 365 and 90 days before the request, and prints the publish date, title and URL of each of the top 5 results. It runs with no API key:

```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("Kubernetes release announcement", {
    publishedAfter: "1y", // published in the last 365 days...
    publishedBefore: "3mo", // ...but not in the last 90 days
    maxResults: 5,
  });
  for (const result of results) {
    console.log(result.publishedAt?.slice(0, 10), result.title, result.url);
  }
}

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(
    "Kubernetes release announcement",
    published_after="1y",  # published in the last 365 days...
    published_before="3mo",  # ...but not in the last 90 days
    max_results=5,
)
for result in results:
    print(result.published_at[:10], result.title, result.url)
```

```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(), "Kubernetes release announcement",
		&keenable.SearchOptions{
			PublishedAfter:  "1y",  // published in the last 365 days...
			PublishedBefore: "3mo", // ...but not in the last 90 days
			MaxResults:      5,
		})
	if err != nil {
		log.Fatal(err)
	}
	for _, result := range results.Results {
		date := ""
		if result.PublishedAt != nil {
			date = (*result.PublishedAt)[:10]
		}
		fmt.Println(date, result.Title, result.URL)
	}
}
```

```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(
            "Kubernetes release announcement",
            &SearchOptions {
                published_after: Some("1y".into()),   // published in the last 365 days...
                published_before: Some("3mo".into()), // ...but not in the last 90 days
                max_results: Some(5),
                ..Default::default()
            },
        )
        .await?;
    for result in &results {
        let date = result.published_at.as_deref().unwrap_or("").get(..10).unwrap_or("");
        println!("{} {} {}", date, result.title, result.url);
    }
    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": "Kubernetes release announcement",
    "published_after": "1y",
    "published_before": "3mo",
    "max_results": 5
  }'
```

You see 5 results, each published inside the window. This run was made on 19 November 2026:

```text Example output · results vary theme={"theme":{"light":"github-light-high-contrast","dark":"dark-plus"}}
2025-12-31 Kubernetes 1.35 Released with In-Place Pod Resize and AI-Optimized Scheduling https://infoq.com/news/2025/12/kubernetes-1-35
2025-12-17 Kubernetes v1.35: Timbernetes (The World Tree Release) https://kubernetes.io/blog/2025/12/17/kubernetes-v1-35-release
2026-05-14 Kubernetes v1.36 Released: Security Defaults Tighten as AI Workload Support Matures https://infoq.com/news/2026/05/kubernetes-1-36-released
2026-05-28 Kubernetes v1.36 is now available on OCI Kubernetes Engine (OKE) https://blogs.oracle.com/cloud-infrastructure/kubernetes-v1-36-is-now-available-on-oke
2026-07-31 Kubernetes v1.37 Sneak Peek https://kubernetes.io/blog/2026/07/31/kubernetes-v1-37-sneak-peek
```

Results come in rank order, not date order. Sort them by `published_at` if your agent needs a timeline.

## Read the dates in the response

Each result carries `published_at` and `acquired_at` as ISO 8601 timestamps in UTC, so your code can check the window or show the date next to a citation. This excerpt is from the curl request above, with `max_results` set to 2 and `snippet_max_length` to 180:

```json Response excerpt · results vary theme={"theme":{"light":"github-light-high-contrast","dark":"dark-plus"}}
{
  "query": "Kubernetes release announcement",
  "mode": "pro",
  "results": [
    {
      "title": "Kubernetes 1.35 Released with In-Place Pod Resize and AI-Optimized Scheduling",
      "url": "https://infoq.com/news/2025/12/kubernetes-1-35",
      "description": "",
      "snippet": "on mutability and the optimization of high-performance AI/ML workloads.\nA key feature in version 1.35 is the general availability of [In-Place Pod",
      "published_at": "2025-12-31T10:00:00Z",
      "acquired_at": "2026-11-14T12:42:35Z"
    }
  ]
}
```

`published_at` is when the page was published. `acquired_at` is when Keenable indexed it.

## Choose a value

Each date filter takes one value in one of three formats. You can mix formats across the two ends of a window.

| Value | On an `_after` filter | On a `_before` filter |
| - | - | - |
| `2026-01-15` | From `2026-01-15T00:00:00Z` | Through `2026-01-15T23:59:59.999Z`, the whole day |
| `2026-01-15T10:30:00Z` | From that instant | Up to that instant |
| `2026-01-15T10:30:00` | Read as UTC, because it has no offset | Read as UTC, because it has no offset |
| `7d` | From 7 days before the request time | Up to 7 days before the request time |

A relative offset is `<number><unit>`, counted back from the request time and truncated to the minute. The units are `min` (minutes), `h` (hours), `d` (days), `w` (weeks), `mo` (30 days) and `y` (365 days).

## Publish date or index date

Use the `published_` filters when the question is about when something was written: news, release notes, papers. If you set `published_after`, the results leave out pages with no known publish date.

Use the `acquired_` filters when the question is about what is new to the index, or when the pages you want often have no publish date, such as documentation and product pages. This body returns pages Keenable indexed in the last 24 hours:

```json theme={"theme":{"light":"github-light-high-contrast","dark":"dark-plus"}}
{
  "query": "security advisory for the OpenSSL library",
  "acquired_after": "24h"
}
```

## Common mistakes

| Wrong | Right | Why |
| - | - | - |
| `"query_time": "7d"` to get recent pages | `"published_after": "7d"` | `query_time` sets only an upper bound. It searches the index as it stood 7 days ago and leaves out everything newer. |
| `"published_after": "last week"` | `"published_after": "7d"` | The API returns `400` with `Invalid published_after value "last week": value must not contain whitespace`. |
| `"published_after": "30m"` for 30 minutes | `"published_after": "30min"` | `m` isn't a unit, so the API returns `400`. Minutes are `min` and months are `mo`. |
| `"published_before": "2026-05-01T00:00:00Z"` to include 1 May | `"published_before": "2026-05-01"` | The date form covers the whole day. The timestamp cuts at midnight and drops pages from that day. |
| `published_after` for docs pages that rarely state a date | `acquired_after` | `published_after` leaves out every page with no known publish date. |

## In the SDKs, CLI and MCP

The filters keep their names in every client: `published_after` in Python and Rust, `publishedAfter` in TypeScript, `PublishedAfter` in Go. The CLI takes `--published-after`, `--published-before`, `--acquired-after` and `--acquired-before` (see [CLI](https://docs.keenable.ai/cli.md)). Over MCP, `search_web_pages` takes the same four arguments (see [MCP server](https://docs.keenable.ai/mcp-server.md#available-tools)).

## API reference

* [Date and time filters](https://docs.keenable.ai/api-reference/search.md#date-and-time-filters): every format, with resolved examples.
* [Search request](https://docs.keenable.ai/api-reference/search.md#request): `published_after`, `acquired_after` and `query_time` in full.
* [Filter by domain](https://docs.keenable.ai/guides/filter-by-domain.md): combine a date window with a site.


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