POST /v1/search

The exact contract for Flux web search: the request field, the response, the limits and every error.

Answer a question from the current web, with the source links. For a guided tour, including search inside a chat request, see Search the web.

EndpointPOST https://api.fluxrouter.ai/v1/search (also /search)
BodyJSON
AuthAuthorization: Bearer sk-flux... (or x-api-key) on a paid, cleared plan
StreamingNo
StatusRolling out

Request

FieldTypeRequiredNotes
querystringYesThe question. Up to 2,000 characters, and not blank.

Send query only. A body with model, tools or search_parameters is refused with 400: the search setup is fixed, and billing depends on it.

bash
curl https://api.fluxrouter.ai/v1/search \
  -H "Authorization: Bearer $FLUX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "query": "What is the current Node.js LTS version?" }'

Response

200 with:

FieldTypeMeaning
answerstringThe written answer.
citationsstring[]The URLs the answer drew on. Can be empty.
searchesintegerHow many searches ran. One question can take more than one.
cost_microcentsintegerWhat the call cost, in millionths of a US dollar.
cost_usdstringThe same amount in US dollars, as a decimal string.

The response may carry other fields. Ignore any you do not use.

Limits

  • A search answers within 30 seconds or fails with a 502. A failed search is not billed.
  • Search shares a per-account limit of 60 requests a minute with transcription and speech.

Errors

Errors use the ability shape: {"error": {"message": "...", "type": "...", "code": "...", "param": "..."}}. code and param appear when they apply.

StatuscodeMeaningFix
400none (param is query)query missing, blank or too longSend a shorter, non-empty query.
400noneThe body was not JSON, not an object, or carried a field search does not takeSend {"query": "..."} only.
401noneThe key is missing, wrong, revoked or expiredCheck the key on your keys page.
402premium_lockedSearch needs a paid, cleared plan. Not charged.Upgrade in Billing.
402credit_unresolvedYour credit balance could not be checked. Not charged.Retry shortly.
402otherYour balance or a spend cap stopped the call. Not charged.Add credit, or raise the cap. See Spend caps.
404noneSearch is not switched on for this account.Contact support.
429rate_limit_errorOver the shared per-minute limitWait, then retry.
502capability_unavailableSearch is not available right nowRetry shortly.
502upstream_error, upstream_incomplete, upstream_emptyThe search failed, did not finish or found no answer. Not charged.Retry, or reword the query.
502usage_unavailable, settlement_unavailableThe search ran but could not be priced or settled. Not charged.Retry shortly.

Fixes in more detail are on Web search problems.

From the tools server

The web_search tool on the Flux tools server takes query and calls this endpoint with your key, so it bills the same. Its result carries the same fields, and errors come back as tool results; see the tools server reference.