api.tools

search()

api.tools.search(options) → Promise<SearchResult>

Search runs on IaGenify’s SearXNG index. Use a simple query for web results, or choose keyword research, site discovery, a page audit, or a competitor URL gap. Result caps do not guarantee that upstream indexes contain that many matches.

POST /api/search1 creditcached for a day
Using Python?

Switch any code block to Python: the choice applies to every page. Python SDK guide and resource reference.

Parameters

querystringrequired

What to look for. Missing or not a string raises query_required (400).

actionobjectsearch

Choose search, keyword_research, site_discovery, seo_audit, or competitor_gap.

maxResultsinteger10

Requested result ceiling, 1–10000. This does not force an upstream index to return that many.

pageinteger1

SearXNG result page, starting at 1.

safeSearchinteger1

0 off · 1 moderate · 2 strict.

recencyDaysinteger

Restrict to the last 1, 7, 30, or 365 days.

language / regionstring

Prefer 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 page to request a later SearXNG result page.

A source that answers slowly is simply not in the merge; the call returns with what arrived.

A result ceiling is not a result promise

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

ActionCredits when uncached
search1 per result page; empty results are refunded
keyword_research0–2, one per suggestions or result operation returning data
site_discovery1 per 20 URLs returned; unused reservation refunded
seo_audit1 for an uncached rendered page capture
competitor_gap1 for each of the site/competitor result sets that returns data (up to 6)
A cache hit0 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

CodeStatusWhen
query_required400query is missing or is not a string.
NotEnoughCredits402The 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},
}