---
title: "DuckDuckGo API (2026): Search API Options and a Replacement"
description: "DuckDuckGo has no web search API, and the duckduckgo_search library breaks with RatelimitException under load. A drop-in replacement that returns the same title, href and body keys, what the Instant Answer API really returns (we tested it), and the alternatives."
category: "guides"
url: https://keirolabs.cloud/blog/duckduckgo-search-api
published: 2026-10-19
updated: 2026-10-27
---

# DuckDuckGo search API in 2026: the drop-in for DDGS().text()

## The 60-second version

**DuckDuckGo has no official web search API.** What it offers is the Instant Answer API at `api.duckduckgo.com`, which returns a short summary for well-known entities (a Wikipedia abstract, an official website, related topics), not a list of web results. For a query like "best web search api" it returns nothing useful.

- **What exists:** the free Instant Answer API: no key, JSON output, answers for entities and definitions only.
- **What does not exist:** an endpoint that returns DuckDuckGo's ten blue links.
- **What most developers actually use:** the `duckduckgo_search` Python library (now `ddgs`), which scrapes the results page and fails with `RatelimitException` as soon as you send real traffic.
- **The drop-in fix:** Keirolabs `/search/fast` takes a query and returns title, URL and snippet, with an API key and published [rate limits](/blog/search-api-rate-limits-2026) instead of a scraper. The replacement for `DDGS().text()` is below, returning the same `title`, `href` and `body` keys.

## Replace `DDGS().text()` without touching the rest of your code

**If your agent or script calls `DDGS().text(query, max_results=10)`, this function returns the same list of dicts, so nothing downstream changes.**

```python
# Before: duckduckgo_search / ddgs (scrapes the results page)
# from duckduckgo_search import DDGS
# results = DDGS().text("best vector database", max_results=10)
# -> fails under load with RatelimitException

# After: Keirolabs /search/fast, same keys out
import os, requests

def ddg_text(query: str, max_results: int = 10) -> list[dict]:
    r = requests.post(
        "https://api.keirolabs.cloud/api/v2/search/fast",
        headers={"Authorization": f"Bearer {os.environ['KEIRO_API_KEY']}"},
        json={"query": query, "maxResults": max_results},
        timeout=30,
    )
    r.raise_for_status()
    return [{"title": h["title"], "href": h["url"], "body": h.get("snippet", "")}
            for h in r.json()["results"]]

for hit in ddg_text("best vector database"):
    print(hit["title"], hit["href"])
```

The same call in Node.js:

```js
async function ddgText(query, maxResults = 10) {
  const r = await fetch("https://api.keirolabs.cloud/api/v2/search/fast", {
    method: "POST",
    headers: {
      Authorization: `Bearer ${process.env.KEIRO_API_KEY}`,
      "Content-Type": "application/json",
    },
    body: JSON.stringify({ query, maxResults }),
  });
  if (!r.ok) throw new Error(`search failed: ${r.status}`);
  const { results } = await r.json();
  return results.map((h) => ({ title: h.title, href: h.url, body: h.snippet }));
}
```

| `duckduckgo_search` / `ddgs` | Keirolabs `/search/fast` |
|---|---|
| `DDGS().text(query, max_results=10)` | `POST /api/v2/search/fast` with `query`, `maxResults` (up to 20) |
| No key, scrapes `html.duckduckgo.com` | API key, a supported interface |
| `RatelimitException` under load | Published rate limits per plan |
| `title`, `href`, `body` | `title`, `url`, `snippet` (mapped back above) |
| Free until it breaks | 1 credit a search; 0.5 on a plan, which is $1.33 per 1,000 on Essential and $0.44 on Startup |

**Need it cheaper?** `/search/lite` returns the same shape for $0.10 per 1,000 on a plan ([docs](https://docs.keirolabs.cloud/search/lite)). **Need page text, not snippets?** `/search/content` returns results with clean markdown in one call. New accounts get 750 credits with no card, enough to run your own queries before you switch.

## Does DuckDuckGo have a search API?

**Not for web results.** DuckDuckGo's results page is built from its own crawler and partner indexes, and none of that is exposed as a public, paid or free API. The only official programmatic access is the Instant Answer API, which predates the current search product and covers what DuckDuckGo calls zero-click information: the box that answers a question without a click.

That distinction matters because most search results for "duckduckgo api" are libraries that wrap the results page itself. Those are scrapers, not an API, and they break whenever the page changes.

## What does the Instant Answer API return?

We tested the endpoint ourselves on October 19, 2026.

**A structured summary of one topic, when DuckDuckGo has one.** The request is a single GET with no key:

```bash
curl "https://api.duckduckgo.com/?q=python+programming+language&format=json&no_html=1"
```

For that query the response (October 19, 2026) contained:

| Field | Value |
|---|---|
| `Heading` | Python (programming language) |
| `AbstractText` | A one-paragraph Wikipedia summary |
| `AbstractSource` / `AbstractURL` | Wikipedia, with the article link |
| `OfficialWebsite` | https://www.python.org/ |
| `Infobox` | Structured facts |
| `RelatedTopics` | 21 related entries |
| `Results` | 1 entry: the official site |
| `Type` | `A` (article) |

Now the same call for a query a developer would actually send:

```bash
curl "https://api.duckduckgo.com/?q=best+web+search+api&format=json"
```

Every content field came back empty; only the `meta` block was populated. **No abstract, no related topics, no results.** That is the API working as designed: it answers "what is X" for entities it knows, and nothing else.

## Can you scrape DuckDuckGo results instead?

**Technically yes, but you inherit every scraper problem.** The HTML results page (`html.duckduckgo.com`) and its JavaScript endpoints are not a supported interface. Libraries that parse them stop working when the markup changes, DuckDuckGo rate-limits automated traffic, and its terms do not grant a license to resell or store results.

If you need DuckDuckGo's results specifically, a SERP API vendor that supports the engine takes on the parsing and the blocking. SerpApi lists DuckDuckGo among its engines, priced like any other search on its plans; see [SerpApi pricing](/blog/serpapi-pricing). You are still paying for scraped results, with the same legal exposure that put SERP scraping in the news this year ([the search API crackdown](/blog/search-api-crackdown-2026-serpapi-lawsuit-bing-shutdown)).

## DuckDuckGo search API alternatives

**Most people searching for a DuckDuckGo API want one of two things: private search without tracking, or a free search API. Both exist, just not from DuckDuckGo.**

| Option | What you get | Price | Notes |
|---|---|---|---|
| DuckDuckGo Instant Answer API | Entity summaries only | Free, no key | No web results |
| SerpApi (DuckDuckGo engine) | Scraped DuckDuckGo results | $25 down to $1.96 per 1,000 | 250 free searches a month |
| [Brave Search API](/blog/brave-search-api-guide-2026) | Brave's own web index | $5 per 1,000 | $5 credit a month ([pricing](https://brave.com/search/api/)) |
| Keirolabs | Drop-in for `DDGS().text()`, plus clean page content on `/search/content` | $0.10 per 1,000 (lite, on a plan); $1.33 (fast, Essential) | 750 credits once at signup, no card |
| Google Custom Search JSON API | Google results for a set of sites | $5 per 1,000 | Closed to new customers, ends Jan 1, 2027 ([details](/blog/google-custom-search-api)) |
| Bing Web Search API | — | — | Retired August 11, 2025 ([alternatives](/blog/bing-search-api-alternatives)) |

**For privacy, read the vendor's data policy, not its marketing.** The reason most people reach for DuckDuckGo is that it does not profile searchers. When you pick an API, check two things: whether it logs your queries, and where it gets its results. Brave runs its own index and offers a zero-data-retention option on its enterprise plan.

**For a free search API, check whether the free tier refills.** Keirolabs gives 750 credits once at signup with no card. Brave gives a $5 credit each month. The full list is in [free web search APIs](/blog/best-free-web-search-apis-2026).

## When to keep the Instant Answer API

It is free and fast for "what is X" lookups like a definition, an official site or a Wikipedia summary. Send everything else to a real search API.
