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

# TinySearch Reference — Search

> Search the web and get ranked results with titles, snippets, and URLs

Search the web and get structured results: titles, snippets, and URLs. All requests require the `X-API-Key` header. See [Authentication](https://docs.tinyfish.ai/authentication.md).

## Endpoints

| Endpoint | Method | Purpose |
| - | - | - |
| `https://api.search.tinyfish.ai` | `GET` | Search the web |

## Search the Web

```
GET https://api.search.tinyfish.ai?query=web+automation+tools&location=US&language=en
```

### Parameters

**query** `string` *required*

The search query string. **Deprecated for domain filtering:** the query string still
accepts `site:`/`-site:` operators (e.g. `python tutorial site:docs.python.org` or
`recipe ideas -site:facebook.com -site:youtube.com`), but prefer the dedicated
`include_domains` / `exclude_domains` params below — they don't collide with other
query syntax. Maximum 2000 characters.

**purpose** `string`

An optional short statement of **why** you are searching — the underlying goal or task the
results will be used for. A query is often a terse set of keywords; supplying the intent behind
it gives us additional signal to further inform and deliver better-quality results. When omitted,
search behaves exactly as before. Maximum 2000 characters. For example,
`Find an open-source library for parsing PDF invoices in Python`.

**location** `string`

Country code for geo-targeted results (e.g. `US`, `GB`, `FR`, `DE`). When omitted, auto-resolves based on `language` (e.g. `fr` → `FR`). Defaults to `US` if both `location` and `language` are omitted.

**language** `string`

Language code for result language (e.g. `en`, `fr`, `de`). When omitted, auto-resolves based on `location` (e.g. `FR` → `fr`). Defaults to `en` if both `location` and `language` are omitted.

**include\_domains** `string`

Comma-separated list of domains to restrict results to (e.g. `github.com,arxiv.org`).
`include_domains` and `exclude_domains` together can be at most 1000 characters.

**exclude\_domains** `string`

Comma-separated list of domains to exclude from results (e.g. `pinterest.com,quora.com`).
`include_domains` and `exclude_domains` together can be at most 1000 characters.

**recency\_minutes** `number`

Freshness window in minutes. Must be an integer from `1` to `5256000` (10 years). Use this when you want recent results relative to now, such as `60` for the last hour.

**after\_date** `string`

Lower date bound in `YYYY-MM-DD` format. Use this when you want results after a calendar date cutoff, such as `2026-06-01`.

**before\_date** `string`

Upper date bound in `YYYY-MM-DD` format. Use this when you want results before a calendar date cutoff, such as `2026-06-18`.

**domain\_type** `string`

Type of search to perform. One of `"web"` (default), `"news"`, or `"research_paper"`. Use `"news"` to retrieve recent news articles with publisher and date; use `"research_paper"` to search academic papers with authors, venue, and citation count.

**pub\_year\_min** `number`

Lower publication-year bound, inclusive. Must be an integer from `0` to `9999`, and no greater than `pub_year_max` if both are set. Only supported for `domain_type=research_paper`.

**pub\_year\_max** `number`

Upper publication-year bound, inclusive. Must be an integer from `0` to `9999`, and no less than `pub_year_min` if both are set. Only supported for `domain_type=research_paper`.

**page** `number`

Page number for pagination, starting from `0` (e.g. `2` to retrieve the third page of results). Maximum value is `10`.

> [!NOTE]
>
> **Freshness and date filter rules:** `recency_minutes` cannot be combined with `after_date` or `before_date`. If you send both `after_date` and `before_date`, they must be valid `YYYY-MM-DD` values and `after_date` must be less than or equal to `before_date`.

> [!NOTE]
>
> **Research paper date restrictions:** `after_date`, `before_date`, and `recency_minutes` are not supported for `domain_type=research_paper`. Use `pub_year_min` / `pub_year_max` to scope by publication year instead (e.g. `pub_year_min=2017&pub_year_max=2017`).

> [!NOTE]
>
> **Location & language auto-resolution:** If only one of `location` or `language` is provided, the other is automatically resolved to the most predominant pairing. For example, setting `location=BR` without `language` resolves to `language=pt`. Setting `language=ja` without `location` resolves to `location=JP`. If neither is set, they default to `US` and `en`.

***

## Response

```json theme={null}
{
  "query": "web automation tools",
  "results": [...],
  "total_results": 10,
  "page": 0
}
```

### Top-level fields

**query** `string`

The search query that was executed.

**results** `object[]`

Array of search results.

**total\_results** `number`

Total number of results returned.

**page** `number`

The current page number, starting from `0`.

### `results[]`

**position** `number`

Position in search results (1-indexed).

**site\_name** `string`

Domain name of the result.

**title** `string`

Page title.

**snippet** `string`

Text snippet from the result.

**url** `string`

URL of the result.

**date** `string`

Publication date. Present for news results and some web results.

**publisher** `string`

Publisher name. Present for news results (`domain_type=news`).

**authors** `string[]`

Author list. Present for academic results (`domain_type=research_paper`).

**venue** `string`

Journal or conference name. Present for academic results (`domain_type=research_paper`).

**year** `number`

Publication year. Present for academic results (`domain_type=research_paper`).

**cited\_by\_count** `number`

Citation count. Present for academic results (`domain_type=research_paper`).

**pdf\_url** `string`

PDF URL. Present for academic results when a PDF is available (`domain_type=research_paper`).

## SDK Methods

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

client = TinyFish()
response = client.search.query(query="web automation tools", location="US")
for r in response.results:
    print(r.title, "→", r.url)
```

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

const client = new TinyFish();
const response = await client.search.query({
  query: "web automation tools",
  location: "US",
});
response.results.forEach((r) => console.log(r.title, "→", r.url));
```

## Related

> [card] [TinySearch Reference](https://docs.tinyfish.ai/tinysearch/reference)
>
> Errors, rate limits, and billing for every endpoint

> [card] [How-to Guides](https://docs.tinyfish.ai/tinysearch/how-to)
>
> Filter by country, site, or date, and paginate


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