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

# Search Within a Date Window

> Get results from a fixed calendar range using after_date and before_date

> [!NOTE]
>
> **Capability:**`after_date` + `before_date`

Use this when you need results from a specific period, such as coverage of an event between two dates. For a window relative to now, see [Find only recent results](https://docs.tinyfish.ai/tinysearch/how-to/recent-results.md).

![Search Playground with a published date range of 2026-06-01 to 2026-06-18 applied, searching for FIFA and returning results from that period](https://mintcdn.com/tinyfish/3y3w8j-_0LWUJKtn/images/tinysearch-howto/date-window.gif?s=f84f46047daa5ce2a960a920eb5483f7)

```python Python theme={null}
from tinyfish import TinyFish

client = TinyFish()
response = client.search.query(
    query="FIFA",
    after_date="2026-06-01",
    before_date="2026-06-18",
)

for r in response.results:
    print(f"{r.position}. {r.title}")
```

```typescript TypeScript theme={null}
import { TinyFish } from "@tiny-fish/sdk";

const client = new TinyFish();
const response = await client.search.query({
  query: "FIFA",
  after_date: "2026-06-01",
  before_date: "2026-06-18",
});

for (const r of response.results) {
  console.log(`${r.position}. ${r.title}`);
}
```

```bash cURL theme={null}
curl -G "https://api.search.tinyfish.ai" \
  --data-urlencode "query=FIFA" \
  --data-urlencode "after_date=2026-06-01" \
  --data-urlencode "before_date=2026-06-18" \
  -H "X-API-Key: $TINYFISH_API_KEY"
```

You can send only one of the two to set an open-ended range, such as everything after a launch date.

## Common Mistakes

> [accordion] Wrong date format
>
> Dates must be `YYYY-MM-DD`.

> [accordion] `after_date` later than `before_date`
>
> When you send both, `after_date` must be less than or equal to `before_date`.

> [accordion] Combining it with `recency_minutes`
>
> The two kinds of filter cannot be used together, and the request is rejected. Pick one.

> [accordion] Using it with `domain_type=research_paper`
>
> Research papers do not support date filters. Use `pub_year_min` and `pub_year_max` instead.

## Related

> [card] [Find Only Recent Results](https://docs.tinyfish.ai/tinysearch/how-to/recent-results.md)
>
> Get results relative to now instead of a fixed range

> [card] [TinySearch API Reference](https://docs.tinyfish.ai/tinysearch/reference)
>
> Every parameter, accepted value, and error code


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