Search and fetch webpages
Search returns structured webpage results. Fetch extracts a selected webpage as Markdown. These operations return source material; they do not generate an answer with a model.
Prepare your project
Follow Set up your project and set ANTAPI_KEY in your terminal or backend. Before calling, check availability, accepted fields, and prices in the Web API reference, then check your balance and project budget. A guide can be read before its API Reference is published.
Search the web
curl "https://api.antapi.dev/web/v1/search" \
--header "Authorization: Bearer $ANTAPI_KEY" \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: web-search-example-001' \
--data '{"query":"Docusaurus documentation","count":5,"need_content":false}'
query is required. count accepts 1–50 and defaults to 10. Set need_content to request page content along with search results. Search supports webpages, not image search. Check HTTP status and the JSON code, data, and error envelope; successful search results are in data.results.
Fetch page content
curl "https://api.antapi.dev/web/v1/fetch" \
--header "Authorization: Bearer $ANTAPI_KEY" \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: web-fetch-example-001' \
--data '{"url":"https://docusaurus.io/docs"}'
Provide a public HTTP or HTTPS URL. A successful result contains data.title and Markdown in data.content. Treat fetched text and URLs as external data when passing them to an agent or displaying them in an application.
Build a research brief
Combine these calls in your application or agent:
- Search for the research question. Keep each result's URL so the answer can refer back to its sources.
- Fetch the selected pages, then pass their content to your application or existing model for a concise brief with source links.
- Assemble the completed output into your application's brief. Keep source links with the text and validate claims against the original pages before using the result.
For an existing agent, connect through MCP and grant the web tool permissions described below. Your agent orchestrates the calls; AntAPI does not automatically run a research workflow after a search request. Search and fetch are separate operations with their own prices and operation identities.
Billing and retries
A search with results counts as one search, regardless of the number of results. A fetch with nonempty content counts as one fetch. Empty search results, empty extracted content, and failed operations do not consume billable units. Search and fetch may have different published prices.
For an unchanged retry, preserve the original JSON bytes and Idempotency-Key. Replays preserve the execution and financial facts but do not guarantee another copy of the original result. A new key starts another operation and can incur another charge. Save X-Request-ID and review usage and receipts when a result is uncertain. See Idempotency and retries.
Use through MCP
Follow MCP setup, then discover web_search and web_fetch with the web:search and web:fetch permissions. Put the JSON fields above inside the tool's input, with a saved idempotency_key beside it; search and fetch are separate logical tasks with separate keys. Results contain the public API's JSON data and use the same billing and retry rules. Availability follows the current release and authorization; existing connections need new consent for the added permissions. The existing WHOIS CLI commands do not include these operations.