Parameters
querystringrequiredWhat to look for. Missing or not a string raises query_required (400).
actionobjectsearchChoose search, keyword_research, site_discovery, seo_audit, or competitor_gap.
maxResultsinteger10Requested result ceiling, 1–10000. This does not force an upstream index to return that many.
pageinteger1SearXNG result page, starting at 1.
safeSearchinteger10 off · 1 moderate · 2 strict.
recencyDaysintegerRestrict to the last 1, 7, 30, or 365 days.
language / regionstringPrefer a language such as fr and region such as TN.
Actions
The service uses the configured SearXNG instance only; callers cannot select an engine. keyword_research combines suggestions with a seed search. site_discovery checks sitemaps, public archives, then a bounded same-site crawl. seo_audit inspects one rendered page. competitor_gap compares sampled URL paths for one site and 1–5 competitors.
Returns
{
ok: true,
query: "ISO 8601 week numbering",
results: [{
title: "ISO week date",
url: "https://example.com/iso-week-date",
snippet: "The ISO week date system is…",
score: 0.92
}],
action: "search",
page: 1,
maxResults: 20,
cached: false,
creditsUsed: 1,
timing: { durationMs: 1840 }
}{
"ok": True,
"query": "ISO 8601 week numbering",
"results": [
{
"title": "ISO week date",
"url": "https://en.wikipedia.org/wiki/ISO_week_date",
"snippet": "The ISO week date system is…",
"engine": "wikipedia", # the source's own label
"engineKey": "wiki", # the name you passed
"score": 1,
}
],
"enginesUsed": ["wiki", "arxiv", "searxng"],
"engineErrors": {"stackex": "timeout"},
"cached": False,
"creditsUsed": 1,
"timing": {"durationMs": 1840},
}How the list is built
- The request is sent to the configured SearXNG instance; the public API does not let callers select upstream engines.
- Duplicate result URLs are collapsed and results are ordered by score.
- The returned list is cut to
maxResults. - Use
pageto request a later SearXNG result page.
A source that answers slowly is simply not in the merge; the call returns with what arrived.
SearXNG and its upstream indexes may return fewer results than requested. Increase <code>maxResults</code> only to allow a larger response, and use <code>page</code> to request later results.
What is charged
| Action | Credits when uncached |
|---|---|
search | 1 per result page; empty results are refunded |
keyword_research | 0–2, one per suggestions or result operation returning data |
site_discovery | 1 per 20 URLs returned; unused reservation refunded |
seo_audit | 1 for an uncached rendered page capture |
competitor_gap | 1 for each of the site/competitor result sets that returns data (up to 6) |
| A cache hit | 0 credits |
The cache key includes the action, query, page and relevant filters. Changing maxResults or recencyDays creates a new request.
const found = await api.tools.search({ query, page: 1, maxResults: 20, language: "fr", region: "TN" });
if (found.noResults) {
// Nothing was charged. Broaden the query rather than retrying it.
}found = api.tools.search({"query": query, "engines": ["all"], "recencyDays": 7})
if found.get("noResults"):
pass # Nothing was charged. Broaden the query rather than retrying it.Errors
| Code | Status | When |
|---|---|---|
| query_required | 400 | query is missing or is not a string. |
| NotEnoughCredits | 402 | The balance will not cover the price, surcharge included. |
As a tool
Declared as an agent tool, the SearXNG-backed action has no caller-selected engine and costs according to the selected action. Site discovery may reserve more than one credit and refunds unused capacity.
tools: {
search: { run: api.tools.search, options: { maxResults: 5 }, cost: 1 },
}tools = {
"search": {"run": api.tools.search, "options": {"engines": ["all"], "maxResults": 5}, "cost": 5},
}