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
- Create an account in Desearch Console.
- Create an API key under API Keys. Details: Auth and API keys.
- Store the key as
DESEARCH_API_KEY(server-side only).
Auth (preferred):
Authorization: $DESEARCH_API_KEY(raw key).
Prefer noBearerprefix 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).
Response
| Field | Role |
|---|---|
results[].url / title | Citeable page |
results[].highlights | Passages that best match the query. Left out when highlights is false |
results[].published_date | Date (YYYY-MM-DD) when known; can be null |
summary.text | Short 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.notices | Notes 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
| Field | Required | Notes |
|---|---|---|
query | yes | Search query, 1 to 2,000 characters |
mode | no | fast returns results sooner. balanced (default) favors relevance |
count | no | 10 (default), 15, or 20 results |
start_date / end_date | no | Only pages published in this range (YYYY-MM-DD) |
highlights | no | Include the best matching passage. Default true |
page_text | no | Include the full page text. Default false |
include_domains | no | Only return pages on these domains or their subdomains (at most 100) |
exclude_domains | no | Never return pages on these domains (at most 1,200) |
summary | no | Also 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).
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 whentwitteris intools(can appear together withsearch)completion: optional summary when you request the summary path (see Annotated response)warnings: optional list when a requested tool returns no results (for examplecode: 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.
| Field | Role |
|---|---|
search[].link | Citeable URL |
search[].title / snippet / highlights | Evidence text (highlights is a list) |
completion | Model summary on the summary path |
search[].published_date | Publish 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):
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
| Header | Meaning |
|---|---|
X-Desearch-Cost-Usd | Request cost in USD |
X-Desearch-Usage-Count | Billable usage units |
X-Desearch-Service | Pricing service key for the request |
X-Desearch-Currency | Currency 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
| Field | Required | Notes |
|---|---|---|
prompt | yes | Natural-language question |
tools | yes | Supported 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"] |
streaming | REST only | Set false on curl for a single JSON body. Not an SDK ai_search / aiSearch argument |
count | no | Integer 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_filter | no | Optional 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_type | REST optional | LINKS_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 |
countis 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
- Streaming AI Search when you need REST
streaming: true - Which endpoint should I use? for Search vs AI Search vs SERP vs Extract vs X/social
- Extract API guide when you already have a URL and need the page body
- Search API reference · AI Search API reference
- Python SDK · JavaScript SDK