# SearXNG

> Point a SearXNG instance URL at Search1API to keep using SearXNG's JSON search API, engine selection and categories without running an instance.

Canonical URL: https://s1.dev/docs/compatibility/searxng

Search1API answers SearXNG's JSON search API. Replace the address of your SearXNG instance with:

```text
https://api.search1api.com/compat/searxng/YOUR_API_KEY
```

Clients append `/search` to this address, or call it directly; both work. `GET` with query parameters and `POST` with a form body are accepted.

> **warn:** SearXNG clients cannot send an authentication header, so the key is part of the URL. Treat the whole URL as a secret. Search1API masks the key in its own logs. Create a separate key in the [dashboard](https://app.s1.dev) for this URL so you can revoke it on its own.

For the migration overview and configuration changes, see [Migrate from SearXNG](https://s1.dev/compatible-apis/searxng).

## Configure your client

<Tabs items={['Open WebUI', 'Perplexica (Vane)', 'gpt-researcher', 'LangChain']}>

<Tab value="Open WebUI">

In **Admin Settings → Web Search**, choose **searxng** and set **Searxng Query URL**, or set the environment variable:

```bash
SEARXNG_QUERY_URL="https://api.search1api.com/compat/searxng/YOUR_API_KEY/search?q=<query>"
```

</Tab>

<Tab value="Perplexica (Vane)">

```bash
SEARXNG_API_URL="https://api.search1api.com/compat/searxng/YOUR_API_KEY"
```

</Tab>

<Tab value="gpt-researcher">

```bash
RETRIEVER=searx
SEARX_URL="https://api.search1api.com/compat/searxng/YOUR_API_KEY"
```

</Tab>

<Tab value="LangChain">

```python
from langchain_community.utilities import SearxSearchWrapper

search = SearxSearchWrapper(
    searx_host="https://api.search1api.com/compat/searxng/YOUR_API_KEY"
)
results = search.results("hono cloudflare workers", num_results=5)
```

</Tab>

</Tabs>

Or call it directly:

```bash
curl "https://api.search1api.com/compat/searxng/YOUR_API_KEY/search?q=hono+workers&format=json"
```

## Parameters

| Parameter | Behavior |
| --- | --- |
| `q` | The query. Leading `!go`-style engine bangs, `!news`-style category bangs and `:de`-style language prefixes are applied, as in SearXNG. |
| `format` | `json` or omitted. Other formats return `400`. |
| `engines` | Comma-separated SearXNG engine names; see the table below. |
| `categories` | Used when `engines` is not given: `general`, `news`, `images`, `videos` (YouTube), `science` (arXiv) and `it` (GitHub). Other categories search the web. |
| `language` | `en`, `en-US` and similar codes use the primary language. `all` and `auto` mean no filter. |
| `time_range` | `day`, `week`, `month` or `year`. |
| `pageno` | Result page, 10 results per engine. See [Result pages](https://s1.dev/docs/compatibility/overview#how-requests-are-handled). |

Other parameters, such as `safesearch`, `theme` and `image_proxy`, are ignored.

## Engines

| SearXNG engine | Bang | Searches |
| --- | --- | --- |
| `google`, `bing`, `duckduckgo`, `yahoo`, `yandex`, `baidu`, `360search`, `quark` | `!go`, `!bi`, `!ddg`, `!yh`, `!yd`, `!bd`, `!360so`, `!qk` | The same engine |
| `wikipedia`, `grokipedia` | `!wp`, `!gp` | The same source |
| `youtube`, `bilibili`, `imdb` | `!yt`, `!bil`, `!imdb` | The same source |
| `github`, `arxiv`, `reddit` | `!gh`, `!arx` | The same source |
| `sogou wechat` | `!sogouw` | WeChat articles |
| `google news`, `bing news`, `yahoo news`, `duckduckgo news`, `hackernews`, `reuters` | `!gon`, `!bin`, `!yhn`, `!ddn`, `!hn`, `!reu` | News from the same source |
| `google images`, `bing images`, `duckduckgo images` | `!goi`, `!bii`, `!ddi` | Images from the same engine |

When `engines` lists names that are not in this table, they appear in `unresponsive_engines` with the reason `engine not supported`. If none of the listed engines is supported, the request falls back to `categories`, or to a web search.

## Credits

Each engine searched costs 1 credit, the price of a native search. A request without `engines` searches one default engine for each category and costs 1 credit per category. Engines that cannot serve the requested page are skipped and not charged.

## Response

The response has SearXNG's JSON shape: `query`, `number_of_results`, `results`, `answers`, `corrections`, `infoboxes`, `suggestions` and `unresponsive_engines`.

- Results from several engines are merged. A URL found by more than one engine appears once, with every engine in `engines` and its ranks in `positions`.
- `score` is calculated with SearXNG's formula from those ranks, so clients that sort by score keep working.
- Each result has `url`, `title`, `content`, `engine`, `engines`, `positions`, `score`, `category`, `template`, `parsed_url` and `publishedDate`.
- Image results also have `img_src` and `thumbnail_src`. Their `url` is the image URL, not the page it appears on.
- `number_of_results` is always `0`, and `answers`, `corrections`, `infoboxes` and `suggestions` are always empty.

## Errors

Errors return `{ "error": "message" }` with the status code. When every selected engine fails, the request returns the most relevant error, such as `401` for an invalid key or `429` for the rate limit. When only some engines fail, the request succeeds and lists them in `unresponsive_engines`.