> Searlo API Docs — Advanced Search
> Source: https://searlo.tech/docs#search-advanced
> Full docs: https://searlo.tech/docs/full.md

# Advanced Search

Run complex queries with filters: date range, file type, exact phrases, excluded terms and site restriction. Available as **GET** (query params) or **POST** (JSON body).

### Endpoint

```
GET  /search/advanced
POST /search/advanced
```

**Credits:** 1 per request

### Parameters

Provide the query as either `query` or `q` (one is required).

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `query` / `q` | string | Yes | Search query (1–500 chars) |
| `limit` | number | No | Results (1–10, default: 10) |
| `dateRange` | string | No | One of `day`, `week`, `month`, `year` |
| `timeRange` | string | No | Alias of `dateRange` (`day`/`week`/`month`/`year`) |
| `dateRestrict` | string | No | A window as `d7`, `w2`, `m1`, `y1` (see Date filter under [Web Search](#search-web)). Takes precedence over `dateRange` |
| `fileType` | string | No | File type filter, max 20 chars (e.g. `pdf`) |
| `exactTerms` | string | No | Exact phrase to include, max 200 chars |
| `excludeTerms` | string | No | Terms to exclude, max 200 chars |
| `site` | string | No | Restrict to a domain/URL (e.g. `example.com`) |
| `siteSearch` | string | No | Another name for `site` |
| `gl` | string | No | Country code, max 5 chars (e.g. `us`) |
| `hl` | string | No | Interface language code, max 5 chars (e.g. `en`) |

A date filter (`dateRange`, `timeRange` or `dateRestrict`) cannot be combined with `site`, `fileType` or search operators in `q`: that request returns `400` `DATE_FILTER_UNAVAILABLE` and is not charged. `exactTerms` and `excludeTerms` work with a date.

### Response

The same response as Web Search (results in `organic[]`).

## Code Examples

### cURL (GET)

```bash
# A date and excluded terms
curl "https://api.searlo.tech/api/v1/search/advanced?q=climate+report&dateRange=year&excludeTerms=opinion" \
  -H "x-api-key: sk_your_api_key"

# A file type on one site (no date)
curl "https://api.searlo.tech/api/v1/search/advanced?q=climate+report&fileType=pdf&site=nasa.gov" \
  -H "x-api-key: sk_your_api_key"
```

### cURL (POST)

```bash
curl -X POST "https://api.searlo.tech/api/v1/search/advanced" \
  -H "x-api-key: sk_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "query": "climate report",
    "fileType": "pdf",
    "exactTerms": "sea level rise",
    "excludeTerms": "opinion",
    "site": "nasa.gov",
    "limit": 10
  }'
```

### Python (POST)

```python
import os
import requests

res = requests.post(
    "https://api.searlo.tech/api/v1/search/advanced",
    json={
        "query": "climate report",
        "dateRestrict": "m6",
        "excludeTerms": "opinion",
        "gl": "us",
        "limit": 10,
    },
    headers={"x-api-key": os.environ["SEARLO_API_KEY"]},
)
print(res.json()["organic"])
```


---
*From https://searlo.tech/docs — see full docs at https://searlo.tech/docs/full.md*