Search the web (JSON body)

Changed on

Same contract as GET /api/v1/search, but accepts parameters as a JSON body. Preferred for location-bearing requests because GET-style location encoding is awkward and keeps latitude/longitude out of HTTP access logs. All GET query parameters are accepted as body fields, plus optional location fields (latitude, longitude, accuracy, city, state, countryCode, postalCode, timezone, location).

post/api/v1/search

Request

  • Base URL
    https://api.andiai.com
  • URL
    https://api.andiai.com/api/v1/search
  • Auth
    API key in header x-api-key

Request body

qstring required

Search query string. Same semantics as the GET q parameter.

limitinteger

Maximum number of results to return.

offsetinteger

Number of results to skip for pagination.

searchMode'auto' | 'low-cost' | 'fast' | 'balanced' | 'deep' | 'exhaustive'

Search effort control. auto (default) sets the effort per query automatically — simple lookups resolve fast, complex questions get deeper treatment. The fixed modes pin an effort level: low-cost caps the work done per request for budget-constrained callers. fast returns results in about 1.2 seconds. balanced is everyday web search, about 3–4 seconds. deep searches from multiple angles with spell correction, about 6.5 seconds. exhaustive is Andi's most thorough mode: more sources and more time, up to about 15 seconds; for a question with several parts or steps it searches each part. Deeper modes add query expansion, follow-up searches fanned out from initial results, and stronger reranking. Requests are billed on outcome-based pricing (see metrics.cost_dollars).

effort'low' | 'medium' | 'high' | 'max'

Thoroughness dial, independent of searchMode: low favors speed, medium is balanced, high searches from multiple angles with spell correction, max gives the most complete results and also searches each part of a question that has several parts or steps — the same tiers as pinning searchMode to fast, balanced, deep, and exhaustive respectively. An explicit searchMode always wins over effort. With the default auto mode, an explicit effort pins its equivalent mode. Omit for the adaptive default. Invalid values return a 400 listing the valid tiers.

reranker'auto' | 'small' | 'medium' | 'large' | 'xl'

Semantic reranker size hint. small is the lightest and fastest; medium and above apply stronger relevance scoring but need a deeper searchMode and may be clamped by the request's time and cost budget (for example, xl needs deep or exhaustive). auto (default) selects a tier automatically based on the query and search mode.

intentstring

Force a specific search intent. When not set, the API auto-detects intent from the query. Accepts common aliases like search, news, video, images, weather, wiki, code, recipe, place, time, and others.

format'json' | 'context'

Response format. json returns a JSON object. context returns results as markdown text, suitable for passing to language models.

metadata'basic' | 'full'

Level of metadata to include. basic includes standard search metrics. full includes extended metadata with content type details and reader data on results.

extractsboolean

Include text extracts from result pages in the response. Defaults to true when format=context, content=true or content=focused; pass extracts=false to turn them off in those cases. Also returned by default with metadata=full.

enrichContentboolean

Deprecated alias of content.

maxContentLengthinteger

Maximum number of characters of page text to return per result. Only applies when content is true.

timeoutinteger

Target time in milliseconds for ranked results (1000–30000). It is a target, not a hard ceiling. Omit it for the mode's normal speed; a larger value (e.g. 30000) lets slower sources run longer, so deep/exhaustive searches can take close to that long. The search may run a little past it when it needs a moment more to return a useful page. Requested page text (content/extracts) is fetched afterward, on top of the target. Values below 1000 are raised to 1000; values above 30000 are lowered to 30000; 0, empty or non-numeric values are ignored. With searchMode=auto (the default), a timeout steps the resolved mode down to the richest one that fits it. An explicit searchMode is always honored.

safe'off' | 'moderate' | 'strict'

Safe search filtering level. off disables filtering, moderate filters most explicit content, strict applies maximum filtering.

countrystring

Two-letter ISO 3166-1 country code to localize results. When you name a country, its main languages also count as target languages for ranking and for languageMode=strict. It does not narrow what Andi retrieves.

sourceCountrystring

Two-letter ISO 3166-1 country code to restrict results to sources from this country. Unlike country, which biases results by locale, sourceCountry excludes results from other countries.

languagestring

Language tag for the search, up to 13 characters. Accepts a primary language with optional region or script subtags, for example en, de, zh-Hans or es-419; matching uses the primary subtag. Omit it and Andi detects the query language. A language you state is used for language filtering, ranking, reranking and page retrieval. The lang: query operator takes precedence. The language Andi used is returned in locale.

languageMode'prefer' | 'strict'

How strictly to hold results to the target languages. prefer ranks pages in the query language first. strict also drops pages whose known language is neither a target language nor English; pages with an unknown language are kept. It changes the response only, never what is cached. Target languages are the query language plus, when you name a country, that country's main languages.

units'metric' | 'imperial'

Unit system for weather and calculation results. Defaults based on the country parameter — imperial for US, metric for all other countries.

noCacheboolean

Bypass cached results and fetch fresh data.

dateRange'day' | 'week' | 'month' | 'year' | '24h' | '7d' | '30d' | '90d' | '1y'

Relative date range filter for results.

dateFromstring date

Filter results published on or after this date. Format: YYYY-MM-DD.

dateTostring date

Filter results published on or before this date. Format: YYYY-MM-DD.

includeDomainsstring

Comma-separated list of domains to restrict results to. Supports wildcards (*.example.com).

excludeDomainsstring

Comma-separated list of domains to exclude from results. Supports wildcards.

includeTermsstring

Comma-separated terms that must appear in results.

excludeTermsstring

Comma-separated terms to exclude from results.

parseOperatorsboolean

Parse query operators (like site:, filetype:, intitle:) from the query string. When disabled, the query is treated as literal text.

linkFormat'link' | 'url'

Field name for result URLs. Use url to receive the URL field as url instead of the default link. Only affects the /search endpoint.

imageFormat'short' | 'long'

Field naming for image results. long (default) uses full field names. short uses abbreviated field names.

filetypestring

Filter results by file type.

intitlestring

Filter results to pages with this term in the title.

inurlstring

Filter results to pages with this term in the URL.

intextstring

Filter results to pages with this term in the body text.

latitudenumber

Latitude in decimal degrees. Sent in the body to keep coordinates out of HTTP access logs.

longitudenumber

Longitude in decimal degrees.

accuracynumber

Location accuracy in meters.

citystring

City name for location-aware queries.

statestring

State or region name.

countryCodestring

Two-letter ISO 3166-1 country code for the caller's location.

postalCodestring

Postal or ZIP code.

timezonestring

IANA timezone, for example America/Los_Angeles.

locationstring

Display name for the caller's location, for example "San Francisco, CA".

Response

Search results. JSON by default; LLM-ready markdown with YAML frontmatter when format=context.

results_typestring required

The type of results returned (e.g., Search, News, Weather, Calculator). Determines which optional response sections are present.

answerstring required

Instant answer for the query when one is found — for example a definition, a weather line or a calculation — otherwise an empty string. On news feeds, a short summary of the headlines when available.

typestring required

Same as results_type. Indicates the category of results.

titlestring required

Your query text (for a news feed, the feed's description).

correctedQuerystring

Spell-corrected query. Present when a misspelling in the original query is detected and corrected — any mode can return it; deep and exhaustive modes run the strongest spell correction.

related_searchesstring[]

Related search suggestions. Present on some queries.

topicsstring[]

Related topics. Present on some queries.

related_topicsstring[]

Related topic names for entity answers.

Example response

{
  "locale": {
    "language": "de",
    "country": "DE"
  }
}

Changes

    • warning

      the request property's maxLength was set to 13

    • info

      added the new optional request property

    • info

      the request property default value en was removed

    • info

      added the optional property // to the response with the status

    • info

      added the optional property // to the response with the status

    • info

      added the optional property // to the response with the status

    • info

      added the optional property // to the response with the status

    • info

      added the optional property // to the response with the status

    • info

      added the optional property // to the response with the status

    • info

      added the optional property to the response with the status

    • info

      added the optional property // to the response with the status

    • info

      added the optional property // to the response with the status

    • info

      added the optional property // to the response with the status

    • info

      added the optional property // to the response with the status

    • info

      added the optional property // to the response with the status

    • info

      added the optional property // to the response with the status

    • info

      added the optional property // to the response with the status

    • info

      added the optional property // to the response with the status

    • info

      added the optional property // to the response with the status

    • info

      added the optional property // to the response with the status

    • info

      added the optional property // to the response with the status

    • info

      added the optional property // to the response with the status

    • info

      added the optional property to the response with the status

    • info

      added the optional property to the response with the status