Skip to main content

Search API

A Search Engine can be re-exposed as a plain HTTP search API through the Cloud APIM - Search engine backend plugin.

Plugin setup

Add the Cloud APIM - Search engine backend plugin to your route:

{
"enabled": true,
"plugin": "cp:otoroshi_plugins.com.cloud.apim.otoroshi.extensions.aigateway.plugins.SearchEngineProxy",
"config": {
"refs": ["search-engine_xxxxxxxxx"]
}
}
ParameterTypeDefaultDescription
refsarray of stringsReferences to Search Engine entities

When several Search Engines are referenced, the first one is used by default. To target a specific entity, set the provider field to its id in the request body.

Request

Send a JSON body. Only query is required.

curl https://my-search-endpoint.example.com/search \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $OTOROSHI_API_KEY" \
-d '{
"query": "European sovereign AI news",
"max_results": 5
}'

Request parameters

ParameterTypeDescription
querystringThe search query (required). q is also accepted.
max_resultsnumberMaximum number of results to return. count is also accepted.
marketstringMarket / locale (e.g. fr-FR). locale is also accepted.
offsetnumberPagination offset
safe_searchstringoff, moderate, or strict (provider dependent). safesearch is also accepted.
include_domainsarray of stringsRestrict results to these domains (provider dependent)
exclude_domainsarray of stringsExclude these domains (provider dependent)
providerstringOptional Search Engine entity id to target when several refs are configured

A request with an empty query returns 400.

RAG knowledge base

When the referenced engine is a rag knowledge base, the same endpoint runs a semantic search over your embedding store: query is embedded and matched against the store, max_results caps the number of passages, and min_score (0–1) overrides the engine's minimum similarity threshold. The web-specific parameters (market, safe_search, include_domains, …) are ignored.

Response

The response is the normalized search result:

{
"provider": "staan",
"query": "European sovereign AI news",
"results": [
{
"title": "…",
"url": "https://…",
"snippet": "…",
"published_date": "2026-01-12T09:00:00Z"
}
]
}
FieldTypeDescription
providerstringThe provider that produced the results
querystringThe query that was searched
answerstringOptional synthetic answer (Tavily with include_answer, DuckDuckGo abstract)
resultsarrayNormalized results, each with title, url, snippet, and optional score / published_date

For a rag engine, provider is rag, each result's title is the matched document id, url is empty, snippet holds the retrieved passage, and score is the vector similarity.