# Bing Search Scraper API

Each successful request will cost you **`5`** API credits.

You have to send a GET request to **`http://api.scrapingdog.com/bing/search`** with the below-given parameters.

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> |

#### Search Query

| Parameter                                                    | Description                                                                                                                                                                                                                                                            |
| ------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| <p>query<br><br><mark style="color:red;">required</mark></p> | <p>The parameter specifies the search query, allowing you to use any terms or operators you would typically use in a standard Bing search (e.g., 'query', NOT, OR, site:, filetype:, near:, ip:, loc:, feed:, etc.).<br><br>Type: <em><strong>String</strong></em></p> |

#### Geographic Location

| Parameter | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| lat       | <p>Specifies the GPS latitude as the starting point for the search.<br><br>Type: <em><strong>String</strong></em></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| lon       | <p>Specifies the GPS longitude as the starting point for the search.<br><br>Type: <em><strong>String</strong></em></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| mkt       | <p>Specifies the market from which the results originate (e.g., en-US). Typically, this corresponds to the country where the request is made, but it may differ if the user is in a region where Bing does not provide results. The market should be formatted as <code>\<language code>-\<country code></code> (e.g., en-US) and is case-insensitive.</p><p>For a full list of supported markets, refer to <a href="https://learn.microsoft.com/en-us/bing/search-apis/bing-web-search/reference/market-codes">Market Codes</a>.</p><p><strong>Note:</strong> If known, it is recommended to always specify the market, as this helps Bing route the request efficiently and return the most relevant results. If an unsupported market is provided, Bing will map it to the closest available market, though this mapping may change over time.</p><p>This parameter is <strong>mutually exclusive</strong> with the <code>cc</code> query parameter—only one should be used.<br><br>Type: <em><strong>String</strong></em></p> |

#### Localization

| Parameter | Description                                                                                                                                                                                                                                                           |
| --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| cc        | <p>This parameter specifies the country from which the search is conducted. It follows the two-character ISO 3166-1 format (e.g., "us" for the United States, "de" for Germany, "gb" for the United Kingdom, etc.).<br><br>Type: <em><strong>String</strong></em></p> |

#### Pagination

| Parameter | Description                                                                                                                                                                                                                                                       |
| --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| first     | <p>This parameter adjusts the starting position of the organic search results. By default, it is set to 1. For example, setting <code>first=10</code> will shift the 10th organic result to the first position.<br><br>Type: <em><strong>String</strong></em></p> |
| count     | <p>This parameter determines the number of results displayed per page, ranging from a minimum of 1 to a maximum of 50. However, the actual number of results returned may vary.<br><br>Type: <em><strong>String</strong></em></p>                                 |

#### Advanced Filters

| Parameter  | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| ---------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| safeSearch | <p>This parameter controls the filtering level for adult content:</p><ul><li><strong>Off</strong>: Includes webpages with adult text, images, and videos.</li><li><strong>Moderate</strong>: Allows adult text but excludes adult images and videos.</li><li><strong>Strict</strong>: Blocks webpages containing adult text, images, and videos.</li></ul><p><br>Type: <em><strong>String</strong></em></p>                                                                                                                                         |
| filters    | <p>This parameter enables advanced filtering options, such as date range filtering (e.g., <code>ez5\_18169\_18230</code>) or specific display filters like:</p><p><code>ufn:"Wunderman+Thompson" sid:"5bede9a2-1bda-9887-e6eb-30b1b8b6b513" catguid:"5bede9a2-1bda-9887-e6eb-30b1b8b6b513\_cfb02057" segment:"generic.carousel" entitysegment:"Organization"</code></p><p>You can construct exact filter values by performing a Bing search and copying the <code>filters</code> query parameter.<br><br>Type: <em><strong>String</strong></em></p> |

### API Example

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

```json
curl "https://api.scrapingdog.com/bing/search/?api_key=5eaa61a6e562fc52fe763tr516e4653&query=what+is+api&cc=us"
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

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

params = {
    "api_key": api_key,
    "query": "what+is+api",
    "cc" : "us"
}

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/bing/search/';

const params = {
  api_key: api_key,
  query: 'what+is+api',
  cc: 'us',
};

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 = 'what+is+api';
$cc = 'us';

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

// 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 = 'what+is+api'
cc = 'us'

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

# 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 = "what+is+api";
            String cc = "us";

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

            // 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
{
"bing_data": [
  {
    "title": "What is an API? A Beginner's Guide to APIs - Postman",
    "displayed_link": "https://www.postman.com › what-is-an-api",
    "link": "https://www.postman.com/what-is-an-api/",
    "snippet": "Learn what an API is, how it works, and why it is important for modern applications. Explore the history, types, benefits, and examples of APIs with Postman, an API platform.",
    "rank": 1,
    "images": []
  },
  {
    "title": "API - Wikipedia",
    "displayed_link": "https://en.wikipedia.org › wiki › API",
    "link": "https://en.wikipedia.org/wiki/API",
    "snippet": "An API is a connection or interface between computers or software programs that allows them to communicate and interact. Learn about the origin, purpose, …",
    "rank": 2,
    "extensions": [
      {
        "title": "",
        "snippet": ""
      }
    ],
    "images": []
  },
  {
    "title": "What is an API (application programming interface)? - IBM",
    "displayed_link": "https://www.ibm.com › think › topics › api",
    "link": "https://www.ibm.com/think/topics/api",
    "snippet": "Learn what an API is, how it works, and why it is important for software development and integration. Explore different types of APIs, such as web, open, partner, internal and composite …",
    "rank": 3,
    "images": []
  },
  {
    "title": "What is an API and How Does it Work? APIs for …",
    "displayed_link": "https://www.freecodecamp.org › news …",
    "link": "https://www.freecodecamp.org/news/how-apis-work/",
    "snippet": "Dec 5, 2022 · Learn what API stands for, how it works, and what types of APIs exist. This guide explains the basics of HTTP protocol, methods, status codes, and examples of web APIs.",
    "rank": 4,
    "images": []
  },
  {
    "title": "What Is an API, and How Do Developers Use Them?",
    "displayed_link": "https://www.howtogeek.com › what-is-…",
    "link": "https://www.howtogeek.com/343877/what-is-an-api/",
    "snippet": "Dec 27, 2021 · An API is an Application Programming Interface that lists operations developers can use to access hardware, software, or online resources. APIs make life easier for developers by saving time, reducing code, and …",
    "rank": 5,
    "images": []
  },
  {
    "title": "What is an API? Full Form, Meaning, Definition, Types …",
    "displayed_link": "https://www.guru99.com › what-is-api.html",
    "link": "https://www.guru99.com/what-is-api.html",
    "snippet": "Aug 19, 2024 · API is a collection of software functions and procedures. In simple terms, API means a software code that can be accessed or executed. Application Programming Interface(API) is a software interface that allows two …",
    "rank": 6,
    "images": []
  },
  {
    "title": "What is an API? | API definition - Cloudflare",
    "displayed_link": "https://www.cloudflare.com › learning › se…",
    "link": "https://www.cloudflare.com/learning/security/api/what-is-an-api/",
    "snippet": "An application programming interface (API) is a set of rules that enable one program to transmit data to another program. Learn more about API calls, API security, and API integrations.",
    "rank": 7,
    "images": []
  },
  {
    "title": "What is an API? A Beginner's Guide to Understanding …",
    "displayed_link": "https://cosmoforge.io › insight › marketi…",
    "link": "https://cosmoforge.io/insight/marketing/what-is-an-api-a-beginners-guide-to-understanding-apis-with-real-world-examples/",
    "snippet": "Nov 21, 2024 · Learn what an API is, how it works, and why it matters for modern technology. Explore different types, components, and scenarios of APIs with simple explanations and relatable examples.",
    "rank": 8,
    "images": []
  },
  {
    "title": "What is an API? How APIs work, simply explained",
    "displayed_link": "https://www.contentful.com › api",
    "link": "https://www.contentful.com/api/",
    "snippet": "Jan 15, 2025 · Learn the fundamentals of APIs, how they enable seamless integration between systems, and why they are essential for modern digital experiences. Explore topics like API endpoints, keys, calls, and headless APIs …",
    "rank": 9,
    "images": []
  }
 ]
}
```
