# DuckDuckGo Search API

### Parameters

#### Scrapingdog Parameters

| Parameter                                                          | Description                                                                                                                                                        |
| ------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| <p>api\_key<br></p><p><mark style="color:red;">required</mark></p> | <p>Your personal API key. Available on your dashboard.<br><br>Type: <em><strong>String</strong></em></p>                                                           |
| html                                                               | <p>This will return the full HTML of the Google page. <br><br>Default Value - <strong><code>false</code></strong> </p><p></p><p>Type - <strong>String</strong></p> |

#### Search Query

| Parameter                                                    | Description                                                                                                                                                                                                                                                       |
| ------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| <p>query<br><br><mark style="color:red;">required</mark></p> | <p>This parameter specifies the search query. You can enter any terms or operators you would normally use in a standard DuckDuckGo search (e.g., <code>inurl:</code>, <code>site:</code>, <code>intitle:</code>, etc.).<br><br>Type - <strong>String</strong></p> |

#### Localization

| Parameter | Description                                                                                                                                                                                                                                                                                                                                                            |
| --------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| kl        | <p>This parameter sets the region for the DuckDuckGo search. For example: <code>us-en</code> for the United States, <code>uk-en</code> for the United Kingdom, or <code>fr-fr</code> for France. Refer to the <a href="/pages/UaqKb5R9NczBjiXPIcy7">DuckDuckGo regions</a> page for the full list of supported region codes.<br><br>Type - <strong>String</strong></p> |

#### Advanced DuckduckGo Filters

| Parameter | Description                                                                                                                                                                                                                                                                                                                                                                                                                            |
| --------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| df        | <p><strong>This parameter filters results by date. Options include:</strong><br></p><ul><li><strong>d</strong>: Past day</li><li><strong>w</strong>: Past week</li><li><strong>m</strong>: Past month</li><li><strong>y</strong>: Past year</li></ul><p>You can also specify a custom range using the format: <code>from\_date..to\_date</code> (e.g., <code>2021-06-15..2024-06-16</code>).<br><br>Type - <strong>String</strong></p> |

#### Pagination

| Parameter         | Descriptio                                                                                                                                                 |
| ----------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- |
| next\_page\_token | <p>This parameter specifies the next page token, used to fetch subsequent results. Each page returns 15 results.<br><br>Type - <strong>String</strong></p> |

### API Example

{% tabs %}
{% tab title="cURL" %}

```bash
curl "https://api.scrapingdog.com/duckduckgo/search/?api_key=5eaa61a6e562fc52fe763tr516e4653&query=football"
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

api_key = "5eaa61a6e562fc52fe763tr516e4653"
url = "https://api.scrapingdog.com/duckduckgo/search/"

params = {
    "api_key": api_key,
    "query": "football"
}

response = requests.get(url, params=params)

if response.status_code == 200:
    data = response.json()
    print(data)
else:
    print(f"Request failed with status code: {response.status_code}")

```

{% endtab %}

{% tab title="Node JS" %}

```javascript
const axios = require('axios');

const api_key = '5eaa61a6e562fc52fe763tr516e4653';
const url = 'https://api.scrapingdog.com/duckduckgo/search/';

const params = {
  api_key: api_key,
  query: 'football'
};

axios
  .get(url, { params: params })
  .then(function (response) {
    if (response.status === 200) {
      const data = response.data;
      console.log(data)
    } else {
      console.log('Request failed with status code: ' + response.status);
    }
  })
  .catch(function (error) {
    console.error('Error making the request: ' + error.message);
  });

```

{% endtab %}

{% tab title="PHP" %}

```php
<?php

// Set the API key and request parameters
$api_key = '5eaa61a6e562fc52fe763tr516e4653';
$query = 'football';

// Set the API endpoint
$url = 'https://api.scrapingdog.com/duckduckgo/search/?api_key=' . $api_key . '&query=' . $query;

// Initialize cURL session
$ch = curl_init($url);

// Set cURL options
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

// Execute the cURL request
$response = curl_exec($ch);

// Check if the request was successful
if ($response === false) {
    echo 'cURL error: ' . curl_error($ch);
} else {
    // Process the response data as needed
    echo $response;
}

// Close the cURL session
curl_close($ch);

```

{% endtab %}

{% tab title="Ruby" %}

```ruby
require 'net/http'
require 'uri'

# Set the API key and request parameters
api_key = '5eaa61a6e562fc52fe763tr516e4653'
query = 'football'

# Construct the API endpoint URL
url = URI.parse("https://api.scrapingdog.com/duckduckgo/search/?api_key=#{api_key}&query=#{query}")

# Create an HTTP GET request
request = Net::HTTP::Get.new(url)

# Create an HTTP client
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true # Enable SSL (https)

# Send the request and get the response
response = http.request(request)

# Check if the request was successful
if response.is_a?(Net::HTTPSuccess)
  puts response.body # Process the response data as needed
else
  puts "HTTP request failed with code: #{response.code}, message: #{response.message}"
end

```

{% endtab %}

{% tab title="Java" %}

```java
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.io.IOException;

public class Main {
    public static void main(String[] args) {
        try {
            // Set the API key and request parameters
            String apiKey = "5eaa61a6e562fc52fe763tr516e4653";
            String query = "football";

            // Construct the API endpoint URL
            String apiUrl = "https://api.scrapingdog.com/duckduckgo/search/?api_key=" + apiKey
                    + "&query=" + query

            // Create a URL object from the API URL string
            URL url = new URL(apiUrl);

            // Open a connection to the URL
            HttpURLConnection connection = (HttpURLConnection) url.openConnection();

            // Set the request method to GET
            connection.setRequestMethod("GET");

            // Get the response code
            int responseCode = connection.getResponseCode();

            if (responseCode == 200) {
                // Read the response from the connection
                BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
                String inputLine;
                StringBuilder response = new StringBuilder();

                while ((inputLine = reader.readLine()) != null) {
                    response.append(inputLine);
                }
                reader.close();

                // Process the response data as needed
                System.out.println(response.toString());
            } else {
                System.out.println("HTTP request failed with response code: " + responseCode);
            }

            // Close the connection
            connection.disconnect();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}

```

{% endtab %}
{% endtabs %}

### API Response

```json
{
    "organic_results": [
        {
            "title": "Order NFL Football Tickets - 2025 Full Event Schedule\n                        \n                        \n                          Ad\n                          \n                            \n                              \n                              \n                              Viewing ads is privacy protected by DuckDuckGo. Ad clicks are managed by Microsoft's ad network (more info).",
            "displayed_link": "tickets-center.com",
            "link": "https://duckduckgo.com/y.js?ad_domain=tickets%2Dcenter.com&ad_provider=bingv7aa&ad_type=txad&click_metadata=76yq5Y4rVBfTC32JMaySnAyqkP8H62qgnwSaTdL_s1UMj5fNf73LRbFyZAMvzviTss04tKL0nmxWRZuTQ895KwNTpuc12cyTddGcxr4s%2DOsNPCyVWoIB80j9fMJAceXq.NHyn3mzwVl0QCcLuXU8VUg&rut=4ce402ee837ef78c250951b1b8d18bc8edd3407001b66b3622cbcad79a2a2113&u3=https%3A%2F%2Fwww.bing.com%2Faclick%3Fld%3De8LSHDwdUdVBsO4wXUlTN0FTVUCUwIwAcycvWjBIWly6abxw0Fq_b_Nd%2D4IxdWA9K8XqQMXz7DKoWksNO1GocZ23jJA5upjliO6cc8aPjaDyJweRYtjCE%2DjfiZFdZpiZrX325WIkx6CsN604dRjvswe1zIEfBF_8lNAtigBeD4ZVdaBBl_oj6tMMwUD_Cexo1afXEGxQ%26u%3DaHR0cHMlM2ElMmYlMmZ0aWNrZXRzLWNlbnRlci5jb20lMmZwaXR0c2J1cmdoLXN0ZWVsZXJzJTNmYWNjaWQlM2QxMzg4ODMxOTklMjZuaWQlM2QyJTI2Y2FtcGFpZ25pZCUzZDU3MDA4MTg4MyUyNmFkZ3JvdXBpZCUzZDExODE5NzY5MjcwNTIxMzclMjZjaWQlM2Q3Mzg3Mzc3MTA0Mjc0MiUyNmt3aWQlM2Q3Mzg3Mzk4NDg3Nzg4OCUyNmFrd2QlM2RzdGVlbGVycyUyNTIwZm9vdGJhbGwlMjZkbXQlM2RiJTI2Ym10JTNkYmIlMjZkaXN0JTNkcyUyNnVxJTNkZm9vdGJhbGwlMjZkZXZpY2UlM2RjJTI2bXNjbGtpZCUzZGQxYTkzYWVmZmQ1ZTEyZGI1MWQzNTI0YzZiNmZmMDQyJTI2bG9jX3BoeXNpY2FsX21zJTNkOTc1NzclMjZsb2NfaW50ZXJlc3RfbXMlM2QlMjZleGlkJTNkJTI2dnglM2Qw%26rlid%3Dd1a93aeffd5e12db51d3524c6b6ff042&vqd=4-61017887125293066834037761681581729412&iurl=%7B1%7DIG%3D0117BB6E013C4F3D9333117B22B45922%26CID%3D29D2F99D738966061607EFD1724E673E%26ID%3DDevEx%2C5045.1",
            "snippet": "2025 Pittsburgh Steelers Tickets & Schedule. Order Resale Sports Tickets Online. Find Great Tickets with Seat Maps, Fast Checkout & Trusted Support. Order Resale Tickets.",
            "rank": 1
        },
        {
            "title": "NFL.com | Official Site of the National Football League",
            "displayed_link": "www.nfl.com",
            "link": "https://www.nfl.com/",
            "snippet": "The official source for NFL news, video highlights, fantasy football, game-day coverage, schedules, stats, scores and more.",
            "rank": 2
        },
        {
            "title": "NFL on ESPN - Scores, Stats and Highlights",
            "displayed_link": "www.espn.com/nfl/",
            "link": "https://www.espn.com/nfl/",
            "snippet": "Visit ESPN for NFL live scores, video highlights and latest news. Stream Monday Night Football on ESPN+ and play Fantasy Football.",
            "rank": 3
        },
        {
            "title": "NFL Football - News, Scores, Stats, Standings, and Rumors - National ...",
            "displayed_link": "www.cbssports.com/nfl/",
            "link": "https://www.cbssports.com/nfl/",
            "snippet": "CBS Sports has the latest NFL Football news, live scores, player stats, standings, fantasy games, and projections.",
            "rank": 4
        },
        {
            "title": "NFL News, Video, Rumors, Scores, Stats, Standings",
            "displayed_link": "sports.yahoo.com/nfl/",
            "link": "https://sports.yahoo.com/nfl/",
            "snippet": "Fantasy Football Rankings 2025: Justin Boone's Top Kickers Fantasy football analyst Justin Boone shares his kicker rankings for the 2025 NFL season.",
            "rank": 5
        },
        {
            "title": "NFL News, Scores, Standings & Stats | FOX Sports",
            "displayed_link": "www.foxsports.com/nfl",
            "link": "https://www.foxsports.com/nfl",
            "snippet": "Get NFL news, scores, stats, standings & more for your favorite teams and players -- plus watch highlights and live games! All on FoxSports.com.",
            "rank": 6
        },
        {
            "title": "College football Re-Rank: Penn State leads NCAA 1-136",
            "displayed_link": "www.usatoday.com/story/sports/ncaaf/2025/08/18/college-football-re-rank-penn-state/85665982007/",
            "link": "https://www.usatoday.com/story/sports/ncaaf/2025/08/18/college-football-re-rank-penn-state/85665982007/",
            "snippet": "Where do all of the teams in the Bowl Subdivision stack up ahead of the season? We break it down in our NCAA Re-Rank 1-136.",
            "rank": 7
        },
        {
            "title": "NFL Football: News, Videos, Stats, Highlights, Results & More - NBC ...",
            "displayed_link": "www.nbcsports.com/nfl",
            "link": "https://www.nbcsports.com/nfl",
            "snippet": "Find all the latest NFL news, live coverage, videos, highlights, stats, predictions, and results right here on NBC Sports.",
            "rank": 8
        },
        {
            "title": "NFL News | Latest NFL Football News | NFL.com",
            "displayed_link": "www.nfl.com/news/",
            "link": "https://www.nfl.com/news/",
            "snippet": "The official source for NFL news, video highlights, fantasy football, game-day coverage, schedules, stats, scores and more.",
            "rank": 9
        },
        {
            "title": "NFL Schedule - 2025 Season - ESPN",
            "displayed_link": "www.espn.com/nfl/schedule",
            "link": "https://www.espn.com/nfl/schedule",
            "snippet": "The complete 2025 NFL season schedule on ESPN. Includes game times, TV listings and ticket information for all NFL games.",
            "rank": 10
        },
        {
            "title": "2025 NFL Scores - Live Updates for Today's Games | FOX Sports",
            "displayed_link": "www.foxsports.com/nfl/scores",
            "link": "https://www.foxsports.com/nfl/scores",
            "snippet": "View live NFL scores for today's games. Real time NFL scores include box scores, updated odds, video highlights and stats.",
            "rank": 11
        }
    ],
    "next_page_token": "eyJxIjoiZm9vdGJhbGwiLCJzIjoiMTAiLCJuZXh0UGFyYW1zIjoiIiwidiI6ImwiLCJvIjoianNvbiIsImRjIjoiMTIiLCJhcGkiOiJkLmpzIiwidnFkIjoiNC0zMzQxOTE5MjEyNTg5NDgzNDE2MDg3OTA1MzY0MDQ0Mzk0ODMxODkiLCJrbCI6Ind0LXd0In0="
}
```


---

# 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.scrapingdog.com/duckduckgo-scraper-api/duckduckgo-search-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.
