# Access the API

The DuckDuckGo API works as a custom engine of our **SERP API** suite. Accessing the API is possible by sending GET requests via our official SERP API endpoint and by specifying the `engine=duckduckgo` parameter.

The official SERP API endpoint is:

* `https://serpapi.webscrapingapi.com/v2`

{% hint style="info" %}
You can use this as the base URL for the DuckDuckGo API **`https://serpapi.webscrapingapi.com/v2?api_key=<YOUR_API_KEY>&engine=duckduckgo`**
{% endhint %}

### The API Key

All requests sent to our SERP API have to include an API key, used for authorization. Failing to pass the  <mark style="color:yellow;">**required**</mark> `api_key` parameter to your request will result in a `401: Unauthorised` status.&#x20;

If you haven't obtained your API key, you can do so by [registering an account](/readme/registration.md) here, followed by subscribing to our SERP API service. Once subscribed, your private API key will be available inside the Dashboard, under the SERP API section.&#x20;

In the following documentation, we will refer to the API key by using this syntax:**`<YOUR_API_KEY>`**

{% hint style="warning" %}
Make sure you store the API key in a safe, private file. Making your API key publicly available can affect the usage on your subscription plan.
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.webscrapingapi.com/duckduckgo-search-api/getting-started/access-the-api.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
