How to Use Bing Search Engine API with Python: Free Testing with DataForSEO

SERP API
Table of Contents

Microsoft retired every Bing Search API on August 11, 2025. Existing instances were decommissioned and new signups closed, so if your old key stopped returning data, you are now seeking a replacement. That puts you in an awkward spot. You have to write real integration code against a provider you have not paid yet, just to find out whether the data fits.

This article covers how to use a Bing search engine API for free in Python. You build the whole integration against our Sandbox, verify that your parser handles the response, and then change one string to fetch real data.

What you get for free with a Bing search engine API

“Free” means two different things here, and mixing them up is the quickest way to build against the wrong assumption.

No provider scrapes Bing indefinitely at no cost, and it is worth being skeptical of any that claims to. What we offer instead are two free paths that solve different problems.

  • The Sandbox lets you send requests to any endpoint and get back responses whose structure and fields are identical to production, without your account being charged. Every value in them is dummy data.
  • The $1 trial credit lands in your balance when you register and you can use it to fetch real Bing SERPs. Based on our published trial figures, $1 covers around 833 SERPs with high-priority tasks, depending on the parameters you set.

Each one answers a different question. The Sandbox tells you whether your code handles the response correctly, and you can hammer it while you build. The trial credit allows you to check whether the data is accurate for your keywords and markets, which require real values rather than placeholders. For most evaluations, $1 goes further than you would expect.

So the sequence is: build against the Sandbox, then verify against production.

Which Bing SERP API endpoints your Python code will call

Our Bing SERP API delivers Bing Organic results through two methods, and the choice shapes how your Python code is structured.

  • Live sends one request and returns results in the same response. Use it when a SERP has to reach a user on demand, such as in an in-app preview or an ad hoc rank check.
  • Standard splits the work into a POST that sets the task and a GET that collects it. It costs less per call and is built for batch processing, since a single Bing Organic Task POST can include up to 100 tasks. Use it for nightly rank tracking, where a few minutes of latency costs you nothing.

Each method comes in three functions. Advanced returns the full structured SERP, including any extra elements Bing rendered for the query. Regular returns organic, paid, and related searches without parsing extra SERP features. HTML gives you the raw SERP page, the same markup a browser would render.

A rule of thumb: Live Advanced for on-demand checks, Standard Advanced for batch rank tracking. For the full endpoint matrix and what each response contains, our guide on how to scrape Bing search results goes into more detail than we will here.

Setting up Python and your API credentials

Setup is short. Create a free account, open the API Access tab in the dashboard, and copy your API login and password. The API password is generated automatically and is not the same as your account password. Most failed first calls trace back to exactly that. The same credentials work in both environments, so there is nothing extra to provision before you start testing.

Our API uses HTTP Basic auth over REST, so the requests library is all you need on the Python side. You pass the login and password on every call and move on, with no token exchange or SDK in between. Install it with pip install requests if it is not already in your environment.

The snippet below is a small client wrapper. The line worth attention is BASE_URL, which decides whether your code talks to the Sandbox or to production. Keep it in one place now and switching environments later costs you nothing.

import requests

LOGIN = "your_login"
PASSWORD = "your_api_password"  # from the API Access tab, not your account password

# The only line that changes between free testing and paid production calls.
BASE_URL = "https://sandbox.dataforseo.com/v3"
# BASE_URL = "https://api.dataforseo.com/v3"

def call(path, payload):
    response = requests.post(
        f"{BASE_URL}/{path}",
        auth=(LOGIN, PASSWORD),   # Basic auth, no token exchange step
        json=payload,             # tasks always go in a list, even when there is one
        timeout=120,              # Live holds the connection open until the SERP is parsed
    )
    response.raise_for_status()
    return response.json()

Testing the Bing search engine API for free in Python

Switching environments means changing the hostname from api.dataforseo.com/v3/ to sandbox.dataforseo.com/v3/. Your POST data stays exactly the same. You do not adjust the code, generate separate credentials, or open a second account.

With the client above already pointed at the Sandbox, a Bing Organic request needs four fields.

result = call("serp/bing/organic/live/advanced", [{
    "keyword": "bing search engine api",
    "location_code": 2840,   # United States, full list at serp/bing/locations
    "language_code": "en",
    "depth": 10,             # billing counts SERPs of 10 results, so depth 10 is one unit
}])

Endpoint used: https://api.dataforseo.com/v3/serp/bing/organic/live/advanced. See the Live Bing Organic SERP Advanced documentation.

Request example:

[
    {
        "keyword": "bing search engine api",
        "location_code": 2840,
        "language_code": "en",
        "device": "desktop",
        "depth": 10
    }
]

Response example:

{
    "version": "0.1.20260917",
    "status_code": 20000,
    "status_message": "Ok.",
    "time": "2.1240 sec.",
    "cost": 0.002,
    "tasks_count": 1,
    "tasks_error": 0,
    "tasks": [
        {
            "id": "09251529-1535-0139-0000-ea429d772fd7",
            "status_code": 20000,
            "status_message": "Ok.",
            "time": "2.0187 sec.",
            "cost": 0.002,
            "result_count": 1,
            "path": [
                "v3",
                "serp",
                "bing",
                "organic",
                "live",
                "advanced"
            ],
            "data": {
                "api": "serp",
                "function": "live",
                "se": "bing",
                "se_type": "organic",
                "keyword": "bing search engine api",
                "location_code": 2840,
                "language_code": "en",
                "device": "desktop",
                "depth": 10,
                "os": "windows"
            },
            "result": [
                {
                    "keyword": "bing search engine api",
                    "type": "organic",
                    "se_domain": "bing.com",
                    "location_code": 2840,
                    "language_code": "en",
                    "check_url": "https://www.bing.com/search?q=bing+search+engine+api&form=QBLH&cc=us",
                    "datetime": "2026-09-25 15:29:52 +00:00",
                    "spell": null,
                    "refinement_chips": null,
                    "item_types": [
                        "organic"
                    ],
                    "se_results_count": 204000,
                    "pages_count": 1,
                    "items_count": 9,
                    "items": [
                        {
                            "type": "organic",
                            "rank_group": 1,
                            "rank_absolute": 1,
                            "page": 1,
                            "position": "left",
                            "xpath": "/html[1]/body[1]/div[1]/main[1]/ol[1]/li[1]",
                            "domain": "www.bing.com",
                            "title": "Search - Microsoft Bing",
                            "url": "https://www.bing.com/",
                            "cache_url": null,
                            "related_search_url": null,
                            "breadcrumb": "https://www.bing.com",
                            "website_name": "bing.com",
                            "is_image": false,
                            "is_video": false,
                            "is_featured_snippet": false,
                            "is_malicious": false,
                            "is_web_story": false,
                            "checks": null,
                            "description": "Search with Microsoft Bing and use the power of AI to find information, explore webpages, images, videos, maps, and more.",
                            "pre_snippet": null,
                            "extended_snippet": null,
                            "images": null,
                            "amp_version": false,
                            "rating": null,
                            "price": null,
                            "highlighted": null,
                            "links": null,
                            "faq": null,
                            "extended_people_also_search": null,
                            "about_this_result": null,
                            "related_result": null,
                            "timestamp": null,
                            "rectangle": null
                        },
                        ...
                    ]
                }
            ]
        }
    ]
}

The shape is the same in both environments. In the Sandbox, every title, URL, and description comes back as a placeholder and your balance stays untouched. Against production, this call took 2.12 seconds and cost $0.002.

One Sandbox detail is worth building into your test suite. Request task_get/advanced with the all-zero task ID at https://sandbox.dataforseo.com/v3/serp/bing/organic/task_get/advanced/00000000-0000-0000-0000-000000000000, and the response returns every item type the Bing Organic Advanced endpoint can produce, each field populated with dummy data. That gives you a complete parser fixture covering SERP features that this particular query never returned, before you have spent anything.

Rate limits match production as well: 2,000 API calls per minute, with Live capped at one task per call and Standard POSTs carrying up to 100.

Parsing Bing results in Python

A Bing SERP response nests three levels deep before you reach anything useful: tasks, then result, then items. Each item carries a type, so a parser is mostly a filter.

task = result["tasks"][0]

# A failed task still arrives inside an HTTP 200, so check the task-level code too.
if task["status_code"] != 20000:
    raise RuntimeError(task["status_message"])

serp = task["result"][0]
organic = [item for item in serp["items"] if item["type"] == "organic"]

for item in organic:
    # rank_absolute counts every block on the page; rank_group counts within one type
    print(item["rank_absolute"], item["domain"], item["title"])

print(serp["item_types"])  # which features Bing actually rendered for this query

Two habits save debugging time later. First, status_code appears at both the response and task levels, and they can disagree, so check both, as the snippet does.

Second, write assertions against field presence and type, never against values. Sandbox titles and positions are placeholders that will not match production. A test asserting that rank_absolute equals 1 for a given domain will pass in the Sandbox and fail the moment you go live. Our Sandbox best practices cover the rest of these edges.

The item_types is the field to watch as you expand coverage. It lists what Bing returned for that query, which is how you find out whether your parser needs to handle a feature it has not seen before.

Moving from Sandbox to live Bing data

Going live is the line you commented out earlier. Point BASE_URL at https://api.dataforseo.com/v3, keep everything else, and the same code returns real Bing SERPs.

Three things are worth checking on the first production run, because the Sandbox cannot tell you any of them.

  • Location and language codes. Confirm your values against the Bing locations and Bing languages endpoints instead of assuming Google codes carry over.
  • Real values. Open the check_url from the response in an incognito window and compare it against what your parser extracted.
  • Cost per call. The request above cost $0.002 at Live Advanced rates with depth set to 10. Standard-queue tasks cost less, and the final figure depends on method, priority, and the parameters you set. The Bing Organic SERP API pricing page has the full calculation.

At those rates, the $1 trial credit can cover a genuine evaluation: enough calls across several keywords and markets to judge accuracy before you top up.

Common mistakes when testing for free

  1. Treating Sandbox output as real data. A Sandbox response looks like a full Bing SERP, so it is easy to assume the values are up to date. They are not. Every successful call returns the same dummy payload, which makes it a schema to build against rather than a dataset to read.
  2. Asserting on values instead of structure. Tests pinned to specific titles, URLs, or positions pass in the Sandbox and break in production. Assert on field presence and types instead.
  3. Sending batches to a Live endpoint. Live accepts one task per call, while Standard task_post accepts up to 100. Loop over your keywords when you use Live, and batch them when you use Standard.
  4. Hardcoding the hostname. Scatter api.dataforseo.com across a dozen call sites and switching between free testing and production turns into a find-and-replace job. One constant avoids it.
  5. Authenticating with your account password. API calls use the generated API password from the API Access tab, not the password you log into the dashboard with.

Start testing Bing SERP data for free

Adopting a Bing search engine API costs less in data than it does in the work of finding out whether the integration holds up. That part does not have to cost anything at all. Build your Python client against the Sandbox, assert on structure rather than values, confirm accuracy with the trial credit, then change one constant to go live. If something behaves oddly along the way, our support manager will do their best to help. You can try for free and send your first Bing Organic request today.

Was this article helpful?