Web Search API
Agent-Friendly
Instant Answers
Batch Queries

Web search. For agents.

Abstracts, related topics, and web results from the DuckDuckGo Instant Answer API in a clean JSON shape, with batch queries and built-in caching.

10 · queries per batch5 min · response cache256 · max query charsJSON · responses

Search the web from one endpoint.

This calls the live Web Search API. Type a query or pick a preset; the response includes an instant-answer abstract, related topics, and web results.

Request builder
One query in, structured results out.
GET /web-search/search
5 per section

Caps relatedTopics and results independently, from 1 to 10 each.

Batch mode for agents
POST the same endpoint with a queries array (up to 10) to fan out research in one round trip. Each result reports its own success flag.
Output preview
Live response from the API, plus the exact request to reproduce it.
  • Searching...

Why Web Search API

Search results your code can trust.

Built for agents

A stable JSON shape with abstracts, topics, and results that LLM tools can consume directly, without HTML parsing or SERP scraping.

Instant answers

Encyclopedic queries return an abstract with its source and URL, often enough to answer without visiting a single result.

Batch queries

POST up to 10 queries in one request. Each entry returns independently with its own success flag and a roll-up summary.

5-minute cache

Identical query and limit pairs are served from an in-memory cache, cutting latency and upstream load for repeated lookups.

Structured, predictable output

relatedTopics and results arrays with text, url, and result fields. Empty arrays are valid for niche queries, never surprise shapes.

No upstream keys

Backed by the DuckDuckGo Instant Answer API. No third-party search subscription or key management on your side.

/api/v1/web-search

Endpoints, at a glance.

One path, two verbs: GET for a single query, POST for batches of up to 10.
GET/api/v1/web-search/search

Single query

One query in, abstract plus related topics and web results out. Cap section sizes with limit.

PRIMARY
POST/api/v1/web-search/search

Batch queries

Up to 10 queries per request. Returns per-query results and a summary with total, succeeded, and failed counts.

GET/health

Service health

Status, service name, version, timestamp, and correlationId.

GET/metrics

Prometheus metrics

Request counts and latency histograms in Prometheus exposition format.

ParameterTypeRequiredDescription
qstringGETSearch query, 1 to 256 characters.
queriesstring[]POST1 to 10 non-empty queries, max 256 characters each, in the JSON body.
limitintegernoMax related topics and results per section, from 1 to 10. Default 10.

Error reference

Errors that keep agents moving.

Batch entries fail independently, and every response carries a correlationId. Empty result arrays are valid responses, not errors.

400Validation Error

Missing or invalid q, queries, or limit. Queries must be 1 to 256 characters; batches hold at most 10.

401Authentication Error

Missing or invalid API key at the gateway. Send x-api-key or api_key with every request.

429Rate Limit

More than 120 requests in a 15-minute window. Back off and retry.

502Upstream Unavailable

DuckDuckGo did not respond. Retry shortly; cached queries keep working during outages.

500Internal Error

Unexpected service failure. Include the correlationId when reporting the issue.

Example error response

{
  "success": false,
  "error": "Invalid query parameters",
  "details": ["\"q\" length must be less than or equal to 256 characters long"],
  "correlationId": "req_abc123"
}

FAQ

API questions developers ask first.

What does a Web Search API response contain?

An instant-answer abstract (abstractText with its source and URL), a relatedTopics array, and a results array of web links. All fields are structured JSON, so agents can consume them without parsing HTML.

Can I run multiple searches in one request?

Yes. POST the same /search path with a queries array of up to 10 entries. Each query resolves independently with its own success flag, and a summary reports total, succeeded, and failed counts.

How does caching work?

Identical query and limit pairs are cached in memory for 5 minutes. Cached responses set fromCache to true and return faster while reducing upstream load.

Why are results sometimes sparse?

The service uses the DuckDuckGo Instant Answer API, which favors encyclopedic queries. Niche or long-tail queries can return empty relatedTopics or results arrays; that is a valid response, not an error.

How do I authenticate requests?

Send your Datpaq API key as an x-api-key header or an api_key query parameter. Keys are created in the Datpaq dashboard and a free tier is included.

Give your agent a search tool.

Structured abstracts, topics, and results from one endpoint, with batching and caching built in. No SERP scraping, no upstream keys.