Search tools
List every search instance POST /api/v1/search can name, or with ?kind=fetch every fetch instance.
stored are the editable rows written through this API; config are the config-file entries, which are still honored and are reported so the operator can see the whole set, builtin_fetch first among the fetch instances. Keys are never returned, only last4.
Enter your API key here (sent as Otari-Key header).
Which instances to list: 'search' (the default) or 'fetch'.
searchPossible values: Successful Response
Every search instance POST /api/v1/search can name, or every fetch instance, by where it came from.
Validation Error
GET /api/v1/search-tools HTTP/1.1
Otari-Key: YOUR_API_KEY
Accept: */*
{
"config": [
{
"api_base": "text",
"fetch_tool": "text",
"has_api_key": true,
"kind": "search",
"name": "text",
"price_per_call": 1,
"price_source": "own",
"provider": "text",
"shadowed": false
}
],
"stored": [
{
"api_base": "text",
"created_at": "text",
"decryptable": true,
"fetch_tool": "text",
"kind": "search",
"last4": "text",
"name": "text",
"options": {
"ANY_ADDITIONAL_PROPERTY": "anything"
},
"price_per_call": 1,
"price_source": "own",
"provider": "text",
"shadows_config": false,
"timeout": 1,
"updated_at": "text"
}
]
}Add a search or fetch instance at runtime. Storing an API key requires OTARI_SECRET_KEY.
Creating a second search instance, while the first is the in-loop default only because it is the only one, first sets web_search_default_tool to the first in the same commit, and says so in the response, so that adding an instance never turns in-loop search off. That runtime value wins over the configuration file until it is cleared.
Enter your API key here (sent as Otari-Key header).
Create a stored search or fetch instance. api_key is write-only and requires OTARI_SECRET_KEY.
Backend endpoint. Omit to inherit the provider's default (searxng inherits web_search_url).
Provider API key. Stored encrypted; never returned.
For a search instance: the fetch instance that enriches its results, a configured or stored one or builtin_fetch. Omit it for the fetch default.
'search' or 'fetch'. It cannot change once created.
searchPossible values: Name callers pass as 'search_tool_name' or in /api/v1/search/{tool}, or that names a fetch instance. It contains no '/' or ':', is not builtin_fetch or none in any case, and is unique across search and fetch instances.
^[^/:]+$Provider id. GET /api/v1/search-tools/providers lists the search providers, and with ?kind=fetch the fetch providers.
Per-request timeout in seconds.
Successful Response
A stored instance as created, with the default setting the create also stored, if any.
trueA search instance's enrichment fetch instance. Null means the fetch default enriches it.
Whether this is a search or a fetch instance.
searchPossible values: What else the create changed, for the operator to read.
Set when this create also stored web_search_default_tool, naming the search instance that was the in-loop default because it was the only one, so that adding a second does not turn in-loop search off. This runtime value wins over the configuration file until it is cleared.
True when a config-file search tool of the same name exists; the stored one is in effect.
falseValidation Error
POST /api/v1/search-tools HTTP/1.1
Otari-Key: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 70
{
"api_base": "http://searxng:8080",
"name": "local",
"provider": "searxng"
}{
"api_base": "text",
"created_at": "text",
"decryptable": true,
"fetch_tool": "text",
"kind": "search",
"last4": "text",
"name": "text",
"notice": "text",
"options": {
"ANY_ADDITIONAL_PROPERTY": "anything"
},
"pinned_web_search_default_tool": "text",
"provider": "text",
"shadows_config": false,
"timeout": 1,
"updated_at": "text"
}List the providers a search or fetch tool may name, for the add-tool form.
The list comes from the metadata any-search and any-fetch publish, so a provider either library adds appears with no change to the gateway. Reports per provider whether an API key is required, what endpoint a tool inherits when it declares none, and the native options a tool may set. Providers that exist only for tests are left out, and so is the fetch provider builtin, which only the implicit builtin_fetch tool uses.
What belongs to this deployment rather than to the libraries, its own tools on each provider and an endpoint a tool inherits from its settings, is shown only to a caller who operates the deployment: the tool settings reader withholds the same from anyone else.
Enter your API key here (sent as Otari-Key header).
Which providers to list: search providers (the default) or fetch providers.
searchPossible values: Successful Response
One provider a search or fetch instance may name, for the add-tool form.
One schema for both capabilities: the fields they share, then each one's own, which are null on the other's entries.
The endpoint a tool on this provider uses when it declares no api_base. Null means nothing supplies one, so an api_base is required. One that comes from the deployment's own settings, such as the web_search_url a searxng tool inherits, is shown only to a caller who operates the deployment: nothing else inherits it, an organization's key included.
The provider's API documentation.
Fetch: the formats the page text comes back in.
Value to send as 'provider'.
The names of this deployment's configured and stored tools on this provider, shown only to a caller who operates the deployment.
Search: true when the API key travels in the request URL.
Whether this is a search provider or a fetch provider.
Search: the most results one call can ask for.
Fetch: the most pages one call can fetch.
Search: true when the query travels in the request URL.
Fetch: true when the provider runs a page's JavaScript before reading it.
True when the provider's answer says what each call cost, which is then what the call is billed.
falseFetch: true when the provider reports where a page was found after redirects. When false it answers with the URL as asked, so a redirect it follows is not checked against the domain policy.
True when this provider has no endpoint of its own, so the tool must say where the backend is.
True when a tool on this provider must carry an API key.
The library's tier for the provider.
Validation Error
GET /api/v1/search-tools/providers HTTP/1.1
Otari-Key: YOUR_API_KEY
Accept: */*
[
{
"default_api_base": "text",
"doc_url": "text",
"formats": [
"text"
],
"id": "text",
"instances": [
"text"
],
"key_in_url": true,
"kind": "search",
"max_results": 1,
"max_urls_per_call": 1,
"options": [
{
"cost_tier": false,
"default": null,
"description": "",
"enum": [
"text"
],
"name": "text",
"operator_only": false,
"type": "string"
}
],
"query_in_url": true,
"renders_javascript": true,
"reports_cost": false,
"reports_final_url": true,
"requires_api_base": true,
"requires_api_key": true,
"tier": "text"
}
]Re-encrypt stored search-tool keys with the primary OTARI_SECRET_KEY.
The search-tool half of the OTARI_SECRET_KEY rotation procedure; run it alongside POST /api/v1/hosted-providers/reencrypt. Rows that cannot be decrypted are left untouched and must be recovered by replacing the affected tool's key.
Enter your API key here (sent as Otari-Key header).
Successful Response
Result of re-encrypting stored search-tool keys with the primary secret key.
Number of stored search-tool keys re-encrypted.
Number of rows whose stored key changed between the read and the write, so the re-encryption was not applied. They already hold whoever wrote them last.
0Number of encrypted keys left untouched because they could not be decrypted.
POST /api/v1/search-tools/reencrypt HTTP/1.1
Otari-Key: YOUR_API_KEY
Accept: */*
Successful Response
{
"reencrypted": 1,
"skipped": 0,
"unreadable": 1
}Test an instance before saving it, with one search or one fetch.
Takes the create request's fields, held to the create's checks against the instances this worker has loaded, plus query for a search instance or url for a fetch instance. Answers whether the provider answered without an error, the error's tag when it did not, and how many hits or characters came back, never the results or the page.
Enter your API key here (sent as Otari-Key header).
An unsaved search or fetch instance to test, and what to test it with.
Backend endpoint. Omit to inherit the provider's default (searxng inherits web_search_url).
Provider API key. Stored encrypted; never returned.
For a search instance: the fetch instance that enriches its results, a configured or stored one or builtin_fetch. Omit it for the fetch default.
'search' or 'fetch'. It cannot change once created.
searchPossible values: Name callers pass as 'search_tool_name' or in /api/v1/search/{tool}, or that names a fetch instance. It contains no '/' or ':', is not builtin_fetch or none in any case, and is unique across search and fetch instances.
^[^/:]+$Provider id. GET /api/v1/search-tools/providers lists the search providers, and with ?kind=fetch the fetch providers.
For a search instance: the query to run.
Per-request timeout in seconds.
For a fetch instance: the page to fetch.
Successful Response
How one search or one fetch went. Never the results or the page.
For a fetch that worked: how many characters of page text came back.
When not ok, the error's tag: timeout, network, http_error, invalid_response, unexpected_response (an answer whose shape the provider changed), or the provider's own.
For a search that worked: how many hits came back.
Whether the provider answered the call without an error.
Validation Error
POST /api/v1/search-tools/test HTTP/1.1
Otari-Key: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 70
{
"api_base": "http://searxng:8080",
"name": "local",
"provider": "searxng"
}{
"characters": 1,
"error": "text",
"hits": 1,
"ok": true
}Update a stored search or fetch instance. Omitted fields are left as-is; an explicit null clears them.
api_key follows the same rule: omit it to keep the stored key, send a new one to rotate, or send null to clear it (a keyless SearXNG backend). The row is locked FOR UPDATE so the expected_updated_at check and the write it guards are atomic. The tool as it will be after the update is validated, so a change that would leave it unusable (clearing the key of a provider that needs one) is refused rather than stored. Its options are checked against the provider's when the update sets them or changes the provider, and fetch_tool when the update sets it, so rotating the key of an instance stored before those rules never trips on them. kind cannot change, so an instance never moves between the search and fetch maps.
Enter your API key here (sent as Otari-Key header).
Update a stored search or fetch instance. Omitted fields are unchanged; api_key rotates in place.
New API key. Omit to keep the existing one. Never returned.
Optimistic concurrency: if set, the update 412s unless it matches the stored updated_at.
For a search instance: the fetch instance that enriches its results. Null clears it.
Accepted only when it matches the stored kind, which cannot change.
Successful Response
A runtime-stored search or fetch instance. The API key is never returned, only last4.
trueA search instance's enrichment fetch instance. Null means the fetch default enriches it.
Whether this is a search or a fetch instance.
searchPossible values: True when a config-file search tool of the same name exists; the stored one is in effect.
falseValidation Error
PATCH /api/v1/search-tools/{name} HTTP/1.1
Otari-Key: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 180
{
"api_base": "text",
"api_key": "text",
"expected_updated_at": "text",
"fetch_tool": "text",
"kind": "search",
"options": {
"ANY_ADDITIONAL_PROPERTY": "anything"
},
"provider": "text",
"timeout": 1
}{
"api_base": "text",
"created_at": "text",
"decryptable": true,
"fetch_tool": "text",
"kind": "search",
"last4": "text",
"name": "text",
"options": {
"ANY_ADDITIONAL_PROPERTY": "anything"
},
"provider": "text",
"shadows_config": false,
"timeout": 1,
"updated_at": "text"
}Delete a stored search or fetch instance. A config-file one, or builtin_fetch, cannot be deleted here.
Enter your API key here (sent as Otari-Key header).
Successful Response
No content
Validation Error
DELETE /api/v1/search-tools/{name} HTTP/1.1
Otari-Key: YOUR_API_KEY
Accept: */*
No content
Test a configured or stored instance with one search or one fetch.
Takes query for a search instance or url for a fetch instance, and answers as POST /search-tools/test does. builtin_fetch, the built-in fetcher, fetches as a fetch tool call does, with no domain policy.
Enter your API key here (sent as Otari-Key header).
What to test a configured or stored instance with.
For a search instance: the query to run.
For a fetch instance: the page to fetch.
Successful Response
How one search or one fetch went. Never the results or the page.
For a fetch that worked: how many characters of page text came back.
When not ok, the error's tag: timeout, network, http_error, invalid_response, unexpected_response (an answer whose shape the provider changed), or the provider's own.
For a search that worked: how many hits came back.
Whether the provider answered the call without an error.
Validation Error
POST /api/v1/search-tools/{name}/test HTTP/1.1
Otari-Key: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 29
{
"query": "text",
"url": "text"
}{
"characters": 1,
"error": "text",
"hits": 1,
"ok": true
}Last updated
Was this helpful?
