Search API

    Search API

    Use Search (POST /search) to search the web from the Desearch index. It returns ranked pages, each with the passage that best matches the query. Set summary: true to also get a short answer written from the results, with numbered citations.

    Use AI Search (POST /desearch/ai/search) when you need X posts, or X posts and web results together, with an optional summary. See AI Search below.

    Full schemas: Search API reference · AI Search API reference. Typed clients: Python SDK · JavaScript SDK.

    Who this page is for

    Humans

    Create a Console account, mint an API key, copy one of the tabs below, and confirm a 200.

    Agents / tool authors

    Same endpoint, auth, and minimal JSON. Treat results[] (and summary when requested) as the tool result. Read billing fields on every response.

    Before you call

    1. Create an account in Desearch Console.
    2. Create an API key under API Keys. Details: Auth and API keys.
    3. Store the key as DESEARCH_API_KEY (server-side only).

    Auth (preferred): Authorization: $DESEARCH_API_KEY (raw key).
    Prefer no Bearer prefix in examples. The API also accepts a Bearer-prefixed value; examples stay raw for Console copy-paste.

    Base URL: https://api.desearch.ai

    First successful call

    Endpoint: POST /search. Only query is required.

    Install if needed: pip install desearch-py · npm install desearch-js (Node.js 20.18.1 or later).

    bash
    curl --request POST 'https://api.desearch.ai/search' \ --header "Authorization: $DESEARCH_API_KEY" \ --header 'Content-Type: application/json' \ --data '{ "query": "Who won the 2024 Nobel Prize in Physics?", "count": 10, "summary": true }'

    Response

    json
    { "results": [ { "url": "https://www.nobelprize.org/prizes/physics/2024/summary/", "title": "The Nobel Prize in Physics 2024", "published_date": "2024-10-08", "highlights": [ "The Nobel Prize in Physics 2024 was awarded jointly to John J. Hopfield and Geoffrey Hinton." ] } ], "summary": { "text": "John J. Hopfield and Geoffrey Hinton won the 2024 Nobel Prize in Physics [1].", "citations": [ { "index": 1, "url": "https://www.nobelprize.org/prizes/physics/2024/summary/", "title": "The Nobel Prize in Physics 2024" } ] }, "meta": { "notices": [] }, "cost_usd": 0.003, "usage_count": 10, "service": "Search API", "currency": "USD" }
    FieldRole
    results[].url / titleCiteable page
    results[].highlightsPassages that best match the query. Left out when highlights is false
    results[].published_dateDate (YYYY-MM-DD) when known; can be null
    summary.textShort answer. [n] marks the citation with that index
    summary.citations[]index, url, and title of each cited page. Every cited page is also in results
    meta.noticesNotes on the answer

    summary is only returned when the request sets summary: true. If the summary could not be written, summary is null, meta.notices contains "Summary unavailable.", and the results are still returned.

    Parameters

    FieldRequiredNotes
    queryyesSearch query, 1 to 2,000 characters
    modenofast returns results sooner. balanced (default) favors relevance
    countno10 (default), 15, or 20 results
    start_date / end_datenoOnly pages published in this range (YYYY-MM-DD)
    highlightsnoInclude the best matching passage. Default true
    page_textnoInclude the full page text. Default false
    include_domainsnoOnly return pages on these domains or their subdomains (at most 100)
    exclude_domainsnoNever return pages on these domains (at most 1,200)
    summarynoAlso return a short answer with numbered citations. Default false

    Pricing

    Search costs $0.30 per 1,000 results. At least 10 results are billed, so a default search (count 10) costs $0.003, which is $3 per 1,000 default searches. A search that returns no results is free. The summary has no extra charge. The summary is not streamed.

    AI Search (X posts and web)

    AI Search, the Desearch AI search API (POST /desearch/ai/search), takes a natural-language prompt and searches X posts (twitter) and the web (web). Web results come from the Desearch index, up to 20 per request. By default it also writes a summary over the results in completion. Supported tools: web, twitter. Other values are unsupported and may be rejected (for example, youtube returns 422). For web results only, use POST /search. For what one call returns across the web and X, with cited sources and REST or MCP access, see the AI Search API overview.

    Endpoint: POST /desearch/ai/search

    First AI Search call

    Minimal REST body: prompt, tools, and streaming: false. Optional: count, date_filter.
    SDK tabs use the same prompt / tools / count / date_filter. Do not pass streaming into Python or JavaScript SDK methods (not in current signatures).

    bash
    curl --request POST 'https://api.desearch.ai/desearch/ai/search' \ --header "Authorization: $DESEARCH_API_KEY" \ --header 'Content-Type: application/json' \ --data '{ "prompt": "latest research on AI search benchmarks", "tools": ["web", "twitter"], "streaming": false, "count": 10 }'

    What success looks like

    A typical 200 JSON object includes:

    • search: array of citeable result objects (web-family tools)
    • tweets: array of X post objects when twitter is in tools (can appear together with search)
    • completion: optional summary when you request the summary path (see Annotated response)
    • warnings: optional list when a requested tool returns no results (for example code: tool_no_results)

    When tools includes both web and twitter, a successful non-streaming call can return both search and tweets in the same JSON body. An empty search or tweets array (or a tool_no_results warning) means that tool finished with no hits; it does not mean the other tool failed.

    Annotated AI Search response

    result_type defaults to LINKS_WITH_FINAL_SUMMARY, which returns the summary in completion.

    json
    { "search": [ { "title": "What is Bittensor?", "link": "https://www.thebigwhale.io/tokens/bittensor", "snippet": "Bittensor (TAO) is a decentralized, open-source, and permissionless machine learning network that transforms machine intelligence into a tradable commodity.", "highlights": [ "Bittensor transforms machine intelligence into a tradable commodity." ] } ], "completion": "Bittensor is a decentralized, open-source machine learning network that transforms AI models into tradable commodities." }
    FieldRole
    search[].linkCiteable URL
    search[].title / snippet / highlightsEvidence text (highlights is a list)
    completionModel summary on the summary path
    search[].published_datePublish date (YYYY-MM-DD) when known; can be null or missing on an item

    Web + X in one call

    REST short enum: tools: ["web", "twitter"] (with streaming: false). A live check returned both search and tweets in one JSON object (each length matched count on that run). Truncated shape (placeholders, not live URLs):

    json
    { "search": [ { "title": "Example result", "link": "https://example.com/result", "snippet": "Short source text.", "highlights": ["Short source text."] } ], "tweets": [ { "id": "0000000000000000000", "text": "Example post text.", "url": "https://x.com/example/status/0000000000000000000" } ], "completion": "Short summary of the sources." }

    Do not promise that LINKS_WITH_FINAL_SUMMARY always fills both arrays. Hosted checks have returned tweets with hits while search was empty and warnings included tool_no_results for web. Treat empty arrays and warnings as valid outcomes.

    For X sources without a completion, as one JSON object, use POST /desearch/ai/search/links/twitter (miner_tweets). For web sources, use POST /search. POST /desearch/ai/search/links/web is deprecated; use POST /search instead.

    result_type: ONLY_LINKS on POST /desearch/ai/search is not a cost-only JSON object. The 2026-10-01 live check returned text/event-stream: events with "type": "search" and a content array of link objects (title, link, snippet, highlights). It is not the first-call example on this page. Hosted MCP ai-search with ONLY_LINKS returns JSON search instead of that stream. See MCP.

    Billing metadata

    HeaderMeaning
    X-Desearch-Cost-UsdRequest cost in USD
    X-Desearch-Usage-CountBillable usage units
    X-Desearch-ServicePricing service key for the request
    X-Desearch-CurrencyCurrency code

    JSON object bodies may also include cost_usd, usage_count, service, and currency. JSON arrays, plain text, and streaming responses expose billing only via headers. Always read headers when you stream or when the body is not a JSON object.

    Check Console for the rates on your account.

    AI Search parameters

    FieldRequiredNotes
    promptyesNatural-language question
    toolsyesSupported tools: web, twitter. Other values are unsupported and may be rejected (for example, youtube returns 422). To search Reddit, call POST /search with include_domains: ["reddit.com"]
    streamingREST onlySet false on curl for a single JSON body. Not an SDK ai_search / aiSearch argument
    countnoInteger results per source. Min 10, max 200, default 10. Web results are capped at 20 per request. Send a JSON number ("count": 10), not a string.
    date_filternoOptional enum (e.g. PAST_24_HOURS, PAST_WEEK, PAST_MONTH, PAST_YEAR). On AI Search, date filtering applies to X results. When omitted, no date window is sent. For web date ranges, use start_date / end_date on POST /search; for X absolute dates use the X API
    result_typeREST optionalLINKS_WITH_FINAL_SUMMARY (default) returns completion. ONLY_LINKS on this REST endpoint returns SSE search events (link objects, no completion). For web links without a summary, use POST /search

    count is an integer. For AI Search and AI Search links, send a JSON number from 10 to 200 (default 10). It is results per source. A numeric string such as "10" can be coerced; a non-numeric string returns 422. Send a JSON number.

    Next steps