Tutorials

Bing Search Data API: Extract Structured JSON in 2026

Learn how to build a reliable bing search data api pipeline to extract titles, URLs, and snippets into typed JSON using AlterLab's schema-based extraction.

6 min read
22 views

AlterLab handles this automaticallyscrape any URL with one API call. No infrastructure required.

Try it free

Disclaimer: This guide covers extracting publicly accessible data. Always review a site's robots.txt and Terms of Service before scraping.

TL;DR

To get structured Bing Search data via API, use a data API that combines headless browsing with LLM-powered extraction. By sending the target search URL and a JSON schema to an extraction endpoint, you can receive validated, typed JSON containing titles, URLs, and snippets without writing custom CSS selectors or parsing HTML.

Why use Bing Search data?

Search engine results pages (SERPs) are the most accurate reflection of web authority and public sentiment. For data engineers, this data is a critical input for several pipelines:

AI Training and RAG Retrieval-Augmented Generation (RAG) systems require fresh, high-quality web data to ground LLM responses. Extracting structured search results allows AI agents to identify the most relevant sources before performing deeper page crawls.

Competitive Intelligence Tracking organic position for specific keywords allows companies to monitor their visibility against competitors. By automating the extraction of result positions and snippets, teams can build dashboards that track SEO performance in real-time.

Market Analysis and Trend Detection Monitoring search result shifts helps analysts identify emerging trends. When new domains or specific types of content (e.g., forums, news sites) begin appearing in the top 10 results for a query, it signals a shift in user intent or market demand.

What data can you extract?

When treating Bing as a data source, you can target specific fields to build a clean dataset. Because you define the schema, you are not limited to a fixed set of fields. Common extraction targets include:

Title: The clickable headline of the search result. – URL: The direct link to the destination page. – Snippet: The descriptive text appearing below the title. – Position: The numerical rank of the result on the page. – Type: Classification of the result (e.g., organic, advertisement, related search, or a knowledge graph entry).

99.2%Extraction Accuracy
1.4sAvg Response Time
100%Typed JSON Output

The extraction approach

Traditional web scraping relies on the "Request $\rightarrow$ Parse $\rightarrow$ Clean" workflow. This approach is fragile. Search engines frequently update their HTML classes and DOM structure. A selector that works today (e.g., .b_algo h2) will likely break tomorrow, leading to pipeline failures and data loss.

A data API approach replaces brittle selectors with semantic extraction. Instead of telling the system where the data is located in the HTML, you tell the system what the data is. By defining a JSON schema, the API identifies the relevant information regardless of the underlying HTML structure. This decouples your data pipeline from the website's frontend changes.

Quick start with AlterLab Extract API

To begin extracting structured data, you need an API key and a target URL. You can find detailed setup instructions in the Getting started guide.

The Extract API takes a URL and a schema, then returns the data as a structured object. You can review the full technical specifications in the Extract API docs.

Python Implementation

Using the Python SDK is the fastest way to integrate this into a data pipeline.

Python
import alterlab

client = alterlab.Client("YOUR_API_KEY")

schema = {
  "type": "object",
  "properties": {
    "results": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "title": {"type": "string", "description": "The title field"},
          "url": {"type": "string", "description": "The url field"},
          "snippet": {"type": "string", "description": "The snippet field"},
          "position": {"type": "integer", "description": "The position field"},
          "type": {"type": "string", "description": "The type field"}
        }
      }
    }
  }
}

result = client.extract(
    url="https://www.bing.com/search?q=data+engineering+trends+2026",
    schema=schema,
)
print(result.data)

cURL Implementation

For simple integrations or shell scripts, the REST endpoint is the most direct route.

Bash
curl -X POST https://api.alterlab.io/v1/extract \
  -H "X-API-Key: YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://www.bing.com/search?q=data+engineering+trends+2026",
    "schema": {
      "properties": {
        "results": {
          "type": "array",
          "items": {
            "properties": {
              "title": {"type": "string"},
              "url": {"type": "string"},
              "snippet": {"type": "string"}
            }
          }
        }
      }
    }
  }'
Try it yourself

Extract structured search data from Bing Search

Define your schema

The schema is the core of the extraction process. It acts as a contract between the API and your application. By using JSON Schema standards, you ensure that the output is always typed and predictable.

When the API processes the page, it uses the description field within the schema to understand the context of the data. For example, specifying "description": "The numerical rank of the result" ensures the API doesn't confuse the result position with a number found within the snippet text.

Expected JSON Output

When the request completes, the API returns a clean JSON object that matches your schema exactly:

JSON
{
  "results": [
    {
      "title": "Top 10 Data Engineering Trends for 2026",
      "url": "https://example.com/trends-2026",
      "snippet": "Explore the evolution of data mesh and real-time streaming...",
      "position": 1,
      "type": "organic"
    },
    {
      "title": "Modern Data Stack Overview",
      "url": "https://example.com/mds",
      "snippet": "A comprehensive guide to the modern data stack...",
      "position": 2,
      "type": "organic"
    }
  ]
}

Handle pagination and scale

Scaling a search data pipeline requires managing multiple requests without hitting rate limits or incurring unnecessary costs.

Async Execution for High Volume

For large-scale extraction (thousands of queries), synchronous requests are inefficient. Use asynchronous jobs to submit requests in batches and poll for results.

Python
import alterlab
import time

client = alterlab.Client("YOUR_API_KEY")
urls = [f"https://www.bing.com/search?q=query_{i}" for i in range(100)]

# Submit jobs in bulk
job_ids = []
for url in urls:
    job = client.extract_async(url=url, schema=schema)
    job_ids.append(job.id)

# Poll for completion
while job_ids:
    for j_id in job_ids[:]:
        status = client.get_job_status(j_id)
        if status.state == "completed":
            print(f"Job {j_id} finished: {status.result}")
            job_ids.remove(j_id)
    time.sleep(2)

Cost Management

Managing the balance of your account is straightforward. AlterLab provides a cost estimation endpoint that allows you to preview the cost of a POST /v1/extract call before committing. This is critical for building client-facing tools where you need to display cost previews.

Cost is clamped between a minimum of $0.001 and a maximum of $0.50 per request. If you register your own LLM key (BYOK), the orchestration fee is reduced to 300 µ¢ per call. Without a BYOK key, the platform rate is 1000 µ¢. You can view full details on AlterLab pricing.

Key takeaways

Avoid CSS Selectors: Use a data API to prevent pipeline breakage when HTML changes. – Typed Output: Define a JSON schema to ensure your data pipeline receives consistent, validated types. – Scale with Async: Use asynchronous jobs for high-volume extraction to maximize throughput. – Cost Control: Use the cost estimation endpoint to manage spend and implement BYOK for lower orchestration fees.

Share

Was this article helpful?

Frequently Asked Questions

Yes, Microsoft provides the Bing Search API via Azure, but it can be restrictive and expensive. AlterLab provides a flexible data API alternative for extracting publicly accessible search results into custom JSON schemas.
You can extract any publicly visible search result data, including page titles, URLs, snippets, organic positions, and result types. All output is delivered as typed JSON based on your provided schema.
AlterLab uses a pay-as-you-go model with no monthly minimums. You pay based on the complexity of the request and the LLM orchestration fee, which varies depending on whether you use your own API key.