Instant Answer API
Our Instant Answer API gives you free access to many of our instant answers like: topic summaries (API example), categories (API example), disambiguation (API example), and !bang redirects (API example).
This API does not include all of our links, however. That is, it is not a full search results API or a way to get DuckDuckGo results into your applications beyond our instant answers. Because of the way we generate our search results, we unfortunately do not have the rights to fully syndicate our results. For the same reason, we cannot allow framing our results without our branding. Please see our partnerships page for more info on guidelines and getting in touch with us.
Our long-term goal is for all of our instant answers to be available through this open API. Many of these instant answers are open source via our DuckDuckHack platform. Using that platform, you can add your own APIs and data sources as well.

Our instant answers come from a variety of sources, including Wikipedia, Wikia, CrunchBase, GitHub, WikiHow, The Free Dictionary – over 100 in total.

This API serves over 10,000,000 queries a day for a variety of uses, e.g.:

  • Defining people, places, things, words and concepts, e.g. for side-bars, onMouseover or onHiglight.
  • Providing direct links to other services (via !bang syntax).
  • Listing related topics.
  • Giving official sites when available.

To consume it yourself, you can use one of the language libraries listed below or simply add '&format=json' (or xml if you prefer) onto any query URL in the api subdomain, e.g.
http://api.duckduckgo.com/?q=DuckDuckGo&format=json

Here are the requirements for use:

  • Attribution in each place you use our API for both us and any underlying source. For the source, you can link to the source's relevant detail page. For us, you can say Results from DuckDuckGo with our logo (and link to the specific result page).
  • Non-commercial use unless you get email approval from us (though we're generally fine with anything that isn't sketchy).
  • Use a descriptive t parameter, i.e. append &t=nameofapp to your requests.
Our overall goal is to get more people using DuckDuckGo, so please keep that in mind as well.

Here are the return fields:

Abstract: topic summary (can contain HTML, e.g. italics)
AbstractText: topic summary (with no HTML)
AbstractSource: name of Abstract source
AbstractURL: deep link to expanded topic page in AbstractSource
Image: link to image that goes with Abstract
Heading: name of topic that goes with Abstract

Answer: instant answer
AnswerType: type of Answer, e.g. calc, color, digest, info, ip, iploc, phone, pw, rand, regexp, unicode, upc, or zip (see the tour page for examples).

Definition: dictionary definition (may differ from Abstract)
DefinitionSource: name of Definition source
DefinitionURL: deep link to expanded definition page in DefinitionSource

RelatedTopics: array of internal links to related topics associated with Abstract
  Result: HTML link(s) to related topic(s)
  FirstURL: first URL in Result
  Icon: icon associated with related topic(s)
    URL: URL of icon
    Height: height of icon (px)
    Width: width of icon (px)
  Text: text from first URL

Results: array of external links associated with Abstract
  Result: HTML link(s) to external site(s)
  FirstURL: first URL in Result
  Icon: icon associated with FirstURL
    URL: URL of icon
    Height: height of icon (px)
    Width: width of icon (px)
  Text: text from FirstURL

Type: response category, i.e. A (article), D (disambiguation), C (category), N (name), E (exclusive), or nothing.

Redirect: !bang redirect URL

Here are all the parameters:

q: query


format: output format (json or xml)

If format=='json', you can also pass:

callback: function to callback (JSONP format)
pretty: 1 to make JSON look pretty (like JSONView for Chrome/Firefox)


no_redirect: 1 to skip HTTP redirects (for !bang commands).


no_html: 1 to remove HTML from text, e.g. bold and italics.


skip_disambig: 1 to skip disambiguation (D) Type.

Notes

  • As this is an instant answer API, most deep queries (non topic names) will be blank.
    {
    Abstract: ""
    AbstractText: ""
    AbstractSource: ""
    AbstractURL: ""
    Image: ""
    Heading: ""
    Answer: ""
    Redirect: ""
    AnswerType: ""
    Definition: ""
    DefinitionSource: ""
    DefinitionURL: ""
    RelatedTopics: [ ]
    Results: [ ]
    Type: ""
    }
    

  • Icons, i.e. the underlying images, may be greater than their specified Width/Height. You should explicitly set them to the specified measurements (if provided).

  • For disambiguation pages (Type=='D'), RelatedTopics can be grouped into sections. In that case, RelatedTopics is an array of hashes. Each hash has a Name key and a Topics array matching the above RelatedTopics description. If you want to avoid this case altogether, use the disambiguation skip parameter (skip_disambig).

  • For !bang commands, the redirect will happen at the HTTP level (since that is fastest), but it will also be returned in the content (for parsing). If you don't want the redirect to happen in the HTTP header, use the no_redirect flag.

  • Queries can be case sensitive e.g. blackberry (API example) vs BlackBerry (API example). In the first case (lowercase blackberry) it returns a disambiguation page; in the latter case (MixedCase BlackBerry) it returns info primarily about the device (inferring what you meant from the case).

  • This API can work over an encrypted (SSL/HTTPS) connection.

FAQ

Are there supporting library integrations?

Why is x query blank? Where are all the Web links like on the main site?

This is an Instant Answer API, and not a full results API. However, there are some Web links within it, e.g. official sites. Please see the second paragraph at the top for more info.

Why is my query blank? I see an Instant Answer on the main site!

Not all of our instant answers are available right now via this API for a variety of reasons, though it is our long term goal to make them so. However, if you would like to see something in particular please let us know, and perhaps we can prioritize making it happen.

Can I use the DuckDuckGo name to help promote what I've developed with the API?

Yes and no. We do not want to confuse users into thinking that your application was made by us. Please see our partnerships page for more info on guidelines and getting in touch with us.

Is this API open source?

No, though many of the instant answers it provides are open source via our DuckDuckHack platform, which is completely open source. For more information on DuckDuckGo open source, please see this help article.

Are there technical limits on API use?

We simply do not have the resources to support high queries per second (QPS) for a single machine. Generally, this isn't a problem because our API is designed to be used client-side by individual users after they take some specific action (like a search or right-click). We also get a lot of botnet attacks. As a result, there is automatic throttling for API requests that will probably not effect you if you use the API in a distributed fashion (i.e. on your application's front-end). For specific situations we also provide higher limits. If you feel you may be in such a situation, please reach out. For legal limits, please see above for attribution and other requirements.

If you have more questions, please let us know.