Replace engines

Replaces the platform's web search engine setting and answers the result.

PUT /v1/websearch/engines

Addresshttps://api.hanzo.ai/v1/websearch/engines
MethodPUT
Operationset_search_engines
AuthAuthorization: Bearer $HANZO_API_KEY

Replaces the platform's web search engine setting and answers the result.

enabled lists the engines searches run, in order — at least one, each a registered engine named once, and at least one that is available (needs no key here, or its key is held). options gives each engine's values by name; an engine or a field left out takes its default, because the setting replaces the stored one whole. A count must lie within the engine's bounds, a language is a tag like en or en-US, a region a two-letter country code, and an option the engine does not support is refused.

SuperAdmin only. 400 names every problem with the setting at once; 503 when the settings store or KMS cannot answer. The answer is the engine list as it now stands, so the caller sees the effect without a second read.

Request

6 fields, body application/json (required).

FieldInTypeRequiredDescription
enabledbodystring[]—Enabled are the engines searches run, in order.
optionsbodyobject—Options are each engine's values, by engine name — for any registered engine, enabled or not.
options.*bodywebsearch.searchEngineOptions—
options.*.countbodyinteger (int64)—Count is how many hits the engine is asked for per search.
options.*.languagebodystring—Language is the default language the engine is asked in, as a tag like en or en-US.
options.*.regionbodystring—Region is a two-letter country code the engine favours, like GB.

Response

StatusBodyMeaning
200websearch.searchEnginesok
defaultproblem-detailsrefused

200 body — 19 fields.

FieldInTypeAlwaysDescription
enginesbodywebsearch.searchEngine[]—Engines are the enabled engines in the order they run, then the rest by name.
engines[].acceptsKeybodyboolean—AcceptsKey is whether the engine takes an API key at all.
engines[].availablebodyboolean—Available is whether the engine answers from this cluster as things stand: it needs no key there (bing, ddg), or its key is held.
engines[].enabledbodyboolean—Enabled is whether searches run it.
engines[].keyedbodyboolean—Keyed is whether the platform holds a key for it in KMS.
engines[].namebodystring—Name is the engine: mojeek, bing, brave or ddg.
engines[].needsKeybodyboolean—NeedsKey is whether the engine answers only with a key.
engines[].optionsbodywebsearch.searchEngineOptions—
engines[].options.countbodyinteger (int64)—Count is how many hits the engine is asked for per search.
engines[].options.languagebodystring—Language is the default language the engine is asked in, as a tag like en or en-US.
engines[].options.regionbodystring—Region is a two-letter country code the engine favours, like GB.
engines[].orderbodyinteger (int64)—Order is its place among the enabled engines, from 1; 0 when disabled.
engines[].supportsbodywebsearch.searchEngineOption[]—Supports lists the options the engine reads, with each one's bounds.
engines[].supports[].defaultbodyinteger (int64)—Default is the count used when none is set.
engines[].supports[].maxbodyinteger (int64)—Max is the most count the engine accepts.
engines[].supports[].minbodyinteger (int64)—Min is the least count the engine accepts.
engines[].supports[].namebodystring—Name is the option: count, language or region.
engines[].supports[].parambodystring—Param is the engine's own query parameter the option sets, such as t or rb for Mojeek.
savedbodyboolean—Saved is whether a setting is stored.

Failure carries the platform error shape — see Errors.

Examples

hanzo websearch engines replace
import { Configuration, WebsearchApi } from 'hanzoai';

const api = new WebsearchApi(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data } = await api.setSearchEngines({ enabled: ["<enabled>"], options: {} });
from hanzoai.cloud import ApiClient, Configuration
from hanzoai.cloud.api import WebsearchApi

client = ApiClient(Configuration(access_token=os.environ["HANZO_API_KEY"]))
result = WebsearchApi(client).set_search_engines(enabled=["<enabled>"], options={})
cfg := hanzoai.NewConfiguration()
cfg.AddDefaultHeader("Authorization", "Bearer "+os.Getenv("HANZO_API_KEY"))
client := hanzoai.NewAPIClient(cfg)

resp, _, err := client.WebsearchAPI.SetSearchEngines(context.Background()).Execute()
if err != nil {
	return err
}
use hanzo_client::apis::{configuration::Configuration, websearch_api};

let mut cfg = Configuration::new();
cfg.bearer_access_token = std::env::var("HANZO_API_KEY").ok();

let result = websearch_api::set_search_engines(&cfg, Default::default()).await?;
import ai.hanzo.cloud.ApiClient;
import ai.hanzo.cloud.api.WebsearchApi;

ApiClient client = new ApiClient();
client.setBearerToken(System.getenv("HANZO_API_KEY"));

var result = new WebsearchApi(client).setSearchEngines();
curl -X PUT https://api.hanzo.ai/v1/websearch/engines \
  -H "Authorization: Bearer $HANZO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
       "enabled": [
         "<enabled>"
       ],
       "options": {}
     }'

Tool websearch, op set_search_engines — POST the JSON-RPC envelope to https://api.hanzo.ai/v1/mcp.

curl -X POST https://api.hanzo.ai/v1/mcp \
  -H "Authorization: Bearer $HANZO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
       "jsonrpc": "2.0",
       "id": 1,
       "method": "tools/call",
       "params": {
         "name": "websearch",
         "arguments": {
           "op": "set_search_engines",
           "input": {
             "enabled": [
               "<enabled>"
             ],
             "options": {}
           }
         }
       }
     }'

Websearch API · All Hanzo APIs · Interactive reference

Was this page useful?
Broken link or missing step? Drop it in #docs on Discord or open a PR.