> ## Documentation Index
> Fetch the complete documentation index at: https://docs.crawleo.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Bing Search API

> Bing-powered real-time web search API with auto-crawling, page content extraction, and multiple output formats. Optimized for RAG pipelines, LLM context, and AI agents.

## Overview

The Bing Search API provides real-time web search powered by Bing, with optional automatic crawling and content extraction of search results. It supports granular control over SERP enrichments and multiple output formats (HTML, Markdown, plain text) — making it the ideal choice for **LLM applications, RAG pipelines, and AI agents**.

<Info>
  **Which Search API should I use?** Use the **Bing Search API** for LLM/RAG workflows — it supports auto-crawling and returns page content in Markdown. Use the [Google Search API](/api-reference/endpoint/google-search) for SEO monitoring, lead generation, and structured SERP analysis.
</Info>

## Endpoint

```
GET https://api.crawleo.dev/search
```

## Parameters

### Required Headers

<ParamField header="x-api-key" type="string" required>
  Your Crawleo API key for authentication. (Alternatively, use the `Authorization: Bearer YOUR_API_KEY` header.)

  Example: `x-api-key: YOUR_API_KEY` or `Authorization: Bearer YOUR_API_KEY`
</ParamField>

### Required Parameters

<ParamField query="query" type="string" required>
  The search query string.
</ParamField>

### Pagination Parameters

<ParamField query="max_pages" default="1" type="integer">
  Maximum number of search result pages to fetch. **Each page costs 10 credits.**
</ParamField>

### Localization Parameters

<ParamField query="setLang" type="string">
  Language code for search results (e.g., `en`, `es`, `fr`, `de`).
</ParamField>

<ParamField query="cc" type="string">
  Country code for search results (e.g., `US`, `GB`, `DE`).
</ParamField>

<ParamField query="geolocation" type="string">
  Geographic location for localized results. Use `random` for randomized geolocation.
</ParamField>

### Device Simulation

<ParamField query="device" default="desktop" type="string">
  Device type to simulate. Options: `desktop`, `mobile`, `tablet`.
</ParamField>

### SERP Enrichment Toggles

<ParamField query="copilot_answer" default="true" type="boolean">
  Include Copilot AI-generated answers in the SERP results.
</ParamField>

<ParamField query="questions_answers" default="true" type="boolean">
  Include "People Also Ask" question-and-answer cards in the results.
</ParamField>

<ParamField query="related_queries" default="true" type="boolean">
  Include related search queries suggestions.
</ParamField>

<ParamField query="sidebar" default="true" type="boolean">
  Include sidebar data (knowledge panels, local results, etc.).
</ParamField>

<ParamField query="direct_answer" default="true" type="boolean">
  Include direct answer boxes and instant answers.
</ParamField>

### Page Content Format Parameters

<ParamField query="raw_html" default="false" type="boolean">
  Return the original HTML source of each result page.
</ParamField>

<ParamField query="enhanced_html" default="false" type="boolean">
  Return clean HTML with ads, scripts, and tracking removed.
</ParamField>

<ParamField query="page_text" default="false" type="boolean">
  Return plain text content extracted from each result page.
</ParamField>

<ParamField query="markdown" default="false" type="boolean">
  Return content as structured Markdown (recommended for RAG/LLM).
</ParamField>

### Auto-Crawling

<ParamField query="auto_crawling" default="false" type="boolean">
  Automatically crawl each search result URL and include page content.
</ParamField>

## Example Requests

### Basic Search

<CodeGroup>
  ```bash cURL theme={null}
  curl -X GET "https://api.crawleo.dev/search?query=machine%20learning&count=10" \
    -H "x-api-key: YOUR_API_KEY" \
    -H "Accept: application/json"
  ```

  ```python Python theme={null}
  import requests

  response = requests.get(
      "https://api.crawleo.dev/search",
      headers={"x-api-key": "YOUR_API_KEY"},
      params={
          "query": "machine learning",
          "count": 10
      }
  )

  data = response.json()
  print(data)
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch(
    "https://api.crawleo.dev/search?query=machine%20learning&count=10",
    {
      headers: { "x-api-key": "YOUR_API_KEY" }
    }
  );

  const data = await response.json();
  console.log(data);
  ```
</CodeGroup>

### Search with Auto-Crawling and Markdown Output

<CodeGroup>
  ```bash cURL theme={null}
  curl -X GET "https://api.crawleo.dev/search?query=python%20tutorials&count=5&auto_crawling=true&markdown=true" \
    -H "x-api-key: YOUR_API_KEY" \
    -H "Accept: application/json"
  ```

  ```python Python theme={null}
  import requests

  response = requests.get(
      "https://api.crawleo.dev/search",
      headers={"x-api-key": "YOUR_API_KEY"},
      params={
          "query": "python tutorials",
          "count": 5,
          "auto_crawling": True,
          "markdown": True
      }
  )

  data = response.json()
  for page in data["pages"].values():
      for result in page["search_results"]:
          print(result["title"], result["link"])
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch(
    "https://api.crawleo.dev/search?query=python%20tutorials&count=5&auto_crawling=true&markdown=true",
    {
      headers: { "x-api-key": "YOUR_API_KEY" }
    }
  );

  const data = await response.json();
  console.log(data);
  ```
</CodeGroup>

### Full-Featured Search

<CodeGroup>
  ```bash cURL theme={null}
  curl -X GET \
    "https://api.crawleo.dev/search?query=Who+is+Elon+Musk%3F&max_pages=1&device=desktop&setLang=en&geolocation=random&enhanced_html=true&raw_html=false&page_text=false&markdown=true&auto_crawling=true&copilot_answer=true&questions_answers=true&related_queries=true&sidebar=true&direct_answer=true" \
    -H "x-api-key: YOUR_API_KEY" \
    -H "Accept: application/json"
  ```

  ```python Python theme={null}
  import requests

  response = requests.get(
      "https://api.crawleo.dev/search",
      headers={"x-api-key": "YOUR_API_KEY"},
      params={
          "query": "Who is Elon Musk?",
          "max_pages": 1,
          "device": "desktop",
          "setLang": "en",
          "geolocation": "random",
          "enhanced_html": True,
          "markdown": True,
          "auto_crawling": True,
          "copilot_answer": True,
          "questions_answers": True,
          "related_queries": True,
          "sidebar": True,
          "direct_answer": True
      }
  )

  data = response.json()
  print(data)
  ```

  ```javascript JavaScript theme={null}
  const params = new URLSearchParams({
    query: "Who is Elon Musk?",
    max_pages: "1",
    device: "desktop",
    setLang: "en",
    geolocation: "random",
    enhanced_html: "true",
    markdown: "true",
    auto_crawling: "true",
    copilot_answer: "true",
    questions_answers: "true",
    related_queries: "true",
    sidebar: "true",
    direct_answer: "true"
  });

  const response = await fetch(
    `https://api.crawleo.dev/search?${params}`,
    {
      headers: { "x-api-key": "YOUR_API_KEY" }
    }
  );

  const data = await response.json();
  console.log(data);
  ```
</CodeGroup>

### Localized Search

<CodeGroup>
  ```bash cURL theme={null}
  curl -X GET "https://api.crawleo.dev/search?query=news&setLang=de&cc=DE&count=10" \
    -H "x-api-key: YOUR_API_KEY" \
    -H "Accept: application/json"
  ```

  ```python Python theme={null}
  import requests

  response = requests.get(
      "https://api.crawleo.dev/search",
      headers={"x-api-key": "YOUR_API_KEY"},
      params={
          "query": "news",
          "setLang": "de",
          "cc": "DE",
          "count": 10
      }
  )

  data = response.json()
  print(data)
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch(
    "https://api.crawleo.dev/search?query=news&setLang=de&cc=DE&count=10",
    {
      headers: { "x-api-key": "YOUR_API_KEY" }
    }
  );

  const data = await response.json();
  console.log(data);
  ```
</CodeGroup>

## Response

A successful response returns search results with optional crawled content:

```json theme={null}
{
  "query": "Now in Android",
  "pages_fetched": 1,
  "pages": {
    "1": {
      "total_results": "About 41,100 results",
      "search_results": [
        {
          "title": "GitHub - android/nowinandroid: A fully functional Android app built ...",
          "link": "https://github.com/android/nowinandroid",
          "date": null,
          "snippet": "Learn how this app was designed and built in the design case study, architecture learning journey and modularization learning journey.",
          "source": "Github"
        },
        {
          "title": "Now in Android | Android Developers",
          "link": "https://developer.android.com/series/now-in-android",
          "date": "Aug 8, 2025",
          "snippet": "Learn about the latest features and best practices of Android development with Now in Android app and podcast.",
          "source": "Android Developers"
        }
      ],
      "related_queries": [
        "latest Android now",
        "Android now gg",
        "what's new in Android development"
      ],
      "page_content": {
        "enhanced_html": "<body>...</body>",
        "page_markdown": "# Search Results\n..."
      }
    }
  },
  "credits": 10
}
```

<ResponseField name="query" type="string">
  The search query that was executed.
</ResponseField>

<ResponseField name="pages_fetched" type="integer">
  Number of pages fetched from the search engine.
</ResponseField>

<ResponseField name="pages" type="object">
  Object containing results keyed by page number (e.g., "1", "2").

  <Expandable title="Page object properties">
    <ResponseField name="total_results" type="string">
      Estimated total number of results from the search engine.
    </ResponseField>

    <ResponseField name="search_results" type="array">
      Array of search result objects.

      <Expandable title="Search result properties">
        <ResponseField name="title" type="string">
          Title of the search result.
        </ResponseField>

        <ResponseField name="link" type="string">
          URL of the search result.
        </ResponseField>

        <ResponseField name="date" type="string | null">
          Publication date (if available).
        </ResponseField>

        <ResponseField name="snippet" type="string">
          Short description/snippet from the search engine.
        </ResponseField>

        <ResponseField name="source" type="string">
          Source name or domain of the result.
        </ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="related_queries" type="array">
      Array of suggested related search queries (if `related_queries=true`).
    </ResponseField>

    <ResponseField name="page_content" type="object">
      Page content (when page content format options are enabled).

      <Expandable title="Page content properties">
        <ResponseField name="enhanced_html" type="string">
          Clean HTML with ads/scripts removed (if `enhanced_html=true`).
        </ResponseField>

        <ResponseField name="page_markdown" type="string">
          Markdown formatted content (if `markdown=true`).
        </ResponseField>
      </Expandable>
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="credits" type="integer">
  Number of credits consumed by this request.
</ResponseField>

Page content (when page content format options are enabled).

<Expandable title="Page content properties">
  <ResponseField name="enhanced_html" type="string">
    Clean HTML with ads/scripts removed (if `enhanced_html=true`).
  </ResponseField>

  <ResponseField name="page_markdown" type="string">
    Markdown formatted content (if `markdown=true`).
  </ResponseField>
</Expandable>

## Important Updates

<Callout type="info" title="SERP Extraction Controls">
  This endpoint provides granular control over SERP enrichments through five boolean query parameters:

  * `copilot_answer` - Control AI-generated answer cards
  * `questions_answers` - Control People Also Ask suggestions
  * `related_queries` - Control related search queries
  * `sidebar` - Control sidebar data and knowledge panels
  * `direct_answer` - Control instant answer boxes

  Advanced SERP features default to `true`, allowing you to selectively disable them as needed.
</Callout>

<Callout type="warning" title="Page Content Defaults Changed">
  **Breaking Change**: `enhanced_html` and `markdown` now default to `false`. To receive page content, explicitly set `enhanced_html=true` and/or `markdown=true` in your request. This makes default responses leaner and more focused on core search results.
</Callout>

## Use Cases

<AccordionGroup>
  <Accordion icon="brain" title="RAG Pipeline">
    Use `auto_crawling=true` with `markdown=true` to fetch search results and their full content in a single request, formatted for LLM consumption. This is the primary advantage over the Google Search API.
  </Accordion>

  <Accordion icon="robot" title="AI Agent Context">
    Feed real-time Bing search results with extracted page content directly into LLM agents. The auto-crawling and Markdown output minimize token usage and post-processing.
  </Accordion>

  <Accordion icon="magnifying-glass" title="Research Agent">
    Combine with localization parameters to gather region-specific information for AI research agents.
  </Accordion>

  <Accordion icon="layer-group" title="Content Aggregation">
    Use `enhanced_html=true` to collect clean content from multiple sources without ads and scripts.
  </Accordion>

  <Accordion icon="toggle-left" title="Fine-Grained SERP Control">
    Use the SERP enrichment toggles to customize which advanced search features are extracted. For example, set `questions_answers=false` if you only need core results and related queries.
  </Accordion>
</AccordionGroup>

<Card title="Need Google SERP data instead?" icon="google" href="/api-reference/endpoint/google-search">
  Use the Google Search API for SEO monitoring, lead generation, competitor research, and structured SERP analysis.
</Card>
