Pair a web search API with a content extraction API because search results give your agent only a title, a link, and a short snippet, the page excerpt a structured search results API returns. That is enough to choose a page, but rarely enough to answer from it. The extraction call then returns the page text, so the agent can read and cite the source. Most agent tasks that touch the web follow this loop: first find candidate pages, then read the ones that look useful.
Desearch covers both steps with two plain GET calls:
GET /webreturns search results for a query.GET /web/extractreturns the text (or HTML) of one URL.
This guide walks through both calls, then joins them in a short Python script your agent can use as a tool. For the product pages, see the Web Search API and the Extract API.
The basics
- Base URL:
https://api.desearch.ai - Auth:
Authorization: $DESEARCH_API_KEY(the raw key from Desearch Console) - Endpoints:
GET /webandGET /web/extract
Both calls take query string parameters. There is no request body.
Step 1: Find pages with GET /web
GET /web takes two parameters:
| Parameter | Required | What it does |
|---|---|---|
query | yes | The search query string |
start | no | How many results to skip, for pagination. Default 0, maximum 100 |
Each request returns up to 20 results. There is no page size parameter. To get the next page, raise start by the number of results you already have (for example 20 after a full first page). A search with no results returns data: [] and is not charged.
The response is a JSON object with a data array. Each item has:
| Field | Use it for |
|---|---|
title | A short label for the page |
link | The URL to read in step 2 |
snippet | Short preview text. It can be empty, so do not rely on it |
Treat the snippet as a hint for ranking which links to open, not as evidence. The evidence comes from step 2.
Step 2: Read a page with GET /web/extract
GET /web/extract fetches one public URL and returns its content.
| Parameter | Required | What it does |
|---|---|---|
url | yes | The page to extract |
format | no | text (default), markdown, or html |
With format=text the response body is the page content as plain text, not JSON. Read it as a string. Send format=markdown if your agent reads Markdown better: headings, lists, tables, and code are kept. A page with no text returns 404 with error_code no_content, and failed extract requests are not charged.
/web/crawl still exists as a deprecated alias. Use /web/extract in new code.
Read what each call cost
Every successful billable response carries cost headers:
| Header | Meaning |
|---|---|
X-Desearch-Cost-Usd | Request cost in USD |
X-Desearch-Usage-Count | Billable usage units |
X-Desearch-Service | Pricing service for the request |
X-Desearch-Currency | Currency code |
The /web JSON body can also include cost_usd and usage_count. The extract body is plain text, so for extract, headers are the only place to read cost. Make headers your default for both.
Put it together in Python
This script searches, opens the top few links, and returns page text with its source URL. It uses plain HTTP so every field maps to the docs.
Hand the result to your model as the tool output. Each page keeps its url next to its text, so the agent can cite what it read. Trim text to fit your context budget, and skip pages that return empty text.
If your agent also needs a written answer with citations from one request, compare this pattern with links only or cited answers in one request. For the wider agent loop, read how to build AI agents with search APIs, and for the concept split, AI search vs web search APIs. For web and X sources your model can cite, see the AI search API.
What it costs
The pricing page lists Web Search at $1.00 per 1,000 searches and Extract at $0.50 per 1,000 pages. Confirm the current rates for your account in Console, and use the cost headers to see what each call used.
Frequently asked questions
How many results does GET /web return?
Up to 20 per request. There is no count parameter. Page through results with start, which skips that many results and accepts up to 100.
What formats can GET /web/extract return?
text (the default), markdown, or html, set with format.
Should I use /web/crawl or /web/extract?
Use /web/extract. /web/crawl is a deprecated alias.
How do I authenticate?
Send your API key in the Authorization header. Get a key in Desearch Console.
Start building
Create a key in Desearch Console, then keep the references open while you build: GET /web and GET /web/extract.
