Direct Web Search API
Endpoint Examples
Direct Web Search API
Run direct web search requests with explicit query control, provider-specific options, and Sofya search, fetch, extract, and research operations
POST
Direct Web Search API
Overview
UsePOST /api/web when you want direct control over search requests and output formatting.
You can also call this tool through the unified Data API at POST /api/v1/data/web/search. The Data API preserves this endpoint’s request body, response body, billing, and provider behavior while adding discovery and dispatch metadata.
For chat-first workflows, use POST /api/v1/chat/completions with model suffixes like :online, :online/linkup, or :online/sofya, including provider-specific suffixes such as :online/exa-instant, :online/exa-deep-reasoning, :online/brave, and :online/valyu-web-deep. See Model Suffixes.
Sofya can do more than search on this endpoint. Set provider: "sofya" and choose the search, fetch, extract, or research operation.
When to use which endpoint
Authentication
Either auth header is supported:string
Bearer
YOUR_API_KEYstring
YOUR_API_KEYAccountless x402 Payment
For accountless payment, prefer the public Data API path:Authorization or x-api-key, and include x-x402: true. NanoGPT will return 402 Payment Required with available payment options. This endpoint supports accountless x402 payments where listed by GET /api/v1/x402/endpoints, including Lightning L402 when advertised. See Accountless x402 API Payments for the full flow.
If you receive 401 missing_api_key immediately, check that the initial quote request includes x-x402: true. Without that header, NanoGPT does not enter the x402 quote flow.
Request body
string
Search or research query. Required for every provider’s search operation and for Sofya research. Not used by Sofya fetch or extract.
string
default:"linkup"
Search provider:
linkup, tavily, exa, kagi, perplexity, valyu, brave, sofya, or firecrawl. openai-native is not allowed on /api/web.string
default:"search"
Sofya operation:
search, fetch, extract, or research. Other providers support search only.string
default:"standard"
Search depth. For Linkup:
standard or deep.For Linkup,
depth: "standard" is executed as Linkup fast under the hood.string
default:"searchResults"
Output mode. Allowed values:
searchResults, sourcedAnswer, structured.string
Required when
outputType is structured. Pass a JSON schema string.boolean
default:false
Include image results.
string
Earliest result date (
YYYY-MM-DD).string
Latest result date (
YYYY-MM-DD).string[]
Restrict results to these domains.
string[]
Exclude these domains.
Linkup supports
outputType: "searchResults", "sourcedAnswer", and "structured".
Non-Linkup providers currently support only outputType: "searchResults".Sofya operations
Sofya Search returns extracted page content instead of snippets alone. The other operations let you fetch known URLs, extract requested information from one page, or produce a cited multi-source research report.Search
Useoperation: "search" or omit operation.
query(string, required)maxResults(integer, 1-20; default 10)topic(generalornews)freshness(day,week,month,year, orYYYY-MM-DD:YYYY-MM-DD)includeDomains/excludeDomains(up to 10 strings each)
Fetch
Useoperation: "fetch" with:
urls(array of 1-10 URL strings, required)includeRawHtmlorinclude_raw_html(boolean)
Extract
Useoperation: "extract" with:
url(string, required)prompt(string, required), describing what to extract
Research
Useoperation: "research" with:
query(string, required)topic(generalornews)freshness(day,week,month,year, orYYYY-MM-DD:YYYY-MM-DD)maxSourcesormax_sources(integer, 5-30)
Response shape
array|object
Provider-formatted payload.
object
searchResults, data is normally an array of normalized results. Sofya extract and research return an object, while Sofya fetch returns an array.
For sourcedAnswer and structured, data is the provider response object.