Bing API key setup for MCP tools and agents

developer2026-11-20

On this page

A Bing API key is a secret credential that authorizes your code to send search requests to a Bing search endpoint. Get the key from your Microsoft Azure account, and confirm the current resource type before you plan a build, because no current standalone Bing key page was verified for this guide. Keep the key on the server side in an MCP tool, so the agent can run Bing searches without holding the credential.

What a Bing API key does

The key identifies your account. Your code sends the key with each search request. The search service checks the key before it returns results.

Each key ties requests to a quota. Once the quota runs out, requests fail until the period resets or you change your plan.

A key is a secret. Anyone who holds it can spend your quota. Treat it the way you treat a password.

How to get a Bing API key

Start in the Azure portal at portal.azure.com. Search for the Bing search resource type that your account can create. Then create the resource and open its keys page.

  • Sign in with an Azure account that can create resources.
  • Create the resource in a subscription you control.
  • Copy a key from the resource's keys page.
  • Review the pricing tier before you send any traffic.

Microsoft changes its search offerings over time. Confirm which resource type your account can create before you commit to a design.

Store the key outside your code

Keep the key in an environment variable or a secrets manager. Load it at runtime. Do not hard-code it into source files.

Never commit the key to a Git repository. A key in a commit stays in the history even after you delete the line.

export BING_API_KEY='paste-key-here'

Rotate the key when a teammate leaves the project or when a log exposes it.

Give an agent Bing search through an MCP tool

An MCP tool holds the key and exposes one search action to the agent. The agent sends a query string. The tool calls the search endpoint and returns the results as JSON.

This split keeps the key out of prompts and out of model logs. The agent does not need the credential to search.

Give the tool a narrow input schema. A query string and a result count cover most search tasks. Fewer inputs mean fewer ways for an agent to misuse the call.

Find a Bing tool in the APIbase catalog

APIbase is an MCP gateway with a large and growing catalog of tools across many categories. Search the catalog for web search or Bing to find tools that already wrap search providers. Each tool lists its inputs and outputs.

Tool calls cost money. Prices start at 0 USD and reach 29.99 USD per tool call, depending on the tool.

No public Bing pricing was verified for this guide. Check the pricing page for your Azure resource before you set a budget.

Fix common key errors

Most failed requests trace back to three causes. Check them in this order.

  • The key belongs to a different resource than the endpoint expects.
  • The quota for the current period is spent.
  • The environment variable is empty in the process that runs the tool.

Log the status code and the endpoint name. Never log the key itself. A status code tells you which cause applies.

Caveats before you ship

A valid key does not guarantee results. Quota and region limits still apply to every request.

Search results change between requests. Cache results only where the provider terms allow it.

Test with a low request volume first. Raise the volume after the tool handles errors and retries correctly.

Live pricing — developer

Price per call, developer tools Horizontal bar chart of the price per call and the cache-hit price, in US dollars, for 12 developer tools. The same values are in the table below the chart. Price per call Cache-hit price $0.0 $0.0005 $0.001 Usage Time SeriesUsage Time Series $0.0 $0.0 Per-Tool Usage BreakdownPer-Tool Usage Breakdown $0.0 $0.0 Usage SummaryUsage Summary $0.0 $0.0 Discover ToolsDiscover Tools $0.0 $0.0 Batch Tool CallsBatch Tool Calls $0.0 $0.0 Tool Quality MetricsTool Quality Metrics $0.0 $0.0 Tool Quality RankingsTool Quality Rankings $0.0 $0.0 List Programming LanguagesList Programming Languages $0.001 $0.0001 Check CVE ID Reservation Stat…Check CVE ID Reservation Status $0.001 $0.0001 Security Advisories (deps.dev)Security Advisories (deps.dev) $0.001 $0.0001 Dependency Tree (deps.dev)Dependency Tree (deps.dev) $0.001 $0.0001 Package Info (deps.dev)Package Info (deps.dev) $0.001 $0.0001 US dollars per call
Price per call for developer tools, cheapest first.

Data source: live tool catalog snapshot, fetched 2026-11-20.

Chart data as a table
ToolPrice per callCache-hit price
Usage Time Series$0.0$0.0
Per-Tool Usage Breakdown$0.0$0.0
Usage Summary$0.0$0.0
Discover Tools$0.0$0.0
Batch Tool Calls$0.0$0.0
Tool Quality Metrics$0.0$0.0
Tool Quality Rankings$0.0$0.0
List Programming Languages$0.001$0.0001
Check CVE ID Reservation Status$0.001$0.0001
Security Advisories (deps.dev)$0.001$0.0001
Dependency Tree (deps.dev)$0.001$0.0001
Package Info (deps.dev)$0.001$0.0001
ToolProviderPrice/callCache-hit
Usage Time Seriesaccount$0$0
Per-Tool Usage Breakdownaccount$0$0
Usage Summaryaccount$0$0
Discover Toolsapibase$0$0
Batch Tool Callsplatform$0$0
Tool Quality Metricsplatform$0$0
Tool Quality Rankingsplatform$0$0
List Programming Languagesjudge0$0.001$0.0001
Check CVE ID Reservation Statuscve-mitre$0.001$0.0001
Security Advisories (deps.dev)depsdev$0.001$0.0001
Dependency Tree (deps.dev)depsdev$0.001$0.0001
Package Info (deps.dev)depsdev$0.001$0.0001

Connect via MCP

How a tool call worksAn AI agent sends a tool call to the APIbase gateway. The gateway checks payment, calls the provider API, and returns the JSON result to the agent.Your agentAPIbase gatewayProvider API1. tool call2. paid call3. JSON result flows back to the agent
Diagram: the path of one tool call.

Data source: gateway design, no measured values.

$ curl -X POST https://apibase.pro/api/v1/tools/account.timeseries/call \
  -H "Content-Type: application/json" -d '{"params": {}}'

FAQ

Is a Bing API key free?

No public Bing pricing was verified for this guide. Check the pricing page of the Azure resource you create. APIbase tool calls start at 0 USD per call, and the price depends on the tool.

Where should I put a Bing API key in my code?

Load it from an environment variable or a secrets manager at runtime. Do not hard-code it or commit it to Git. An MCP tool can hold the key on the server side so that the agent never handles it.

Can an AI agent use a Bing API key directly?

An agent can run a search only when its runtime has the key available. Routing the call through an MCP tool keeps the key out of the prompt and out of model logs, which reduces exposure.

What do I do if the key stops working?

Check that the key belongs to the resource the endpoint expects. Check that the quota for the period is not spent. Check that the environment variable is set in the process that runs the tool. Rotate the key if you suspect a leak.

  1. STEP 1/2 Connect your MCP client
  2. STEP 2/2 Browse the full catalog

Written with AI assistance from APIbase's published documentation and public data; checked automatically against them. Corrections: https://apibase.pro/

Published: 2026-11-20Source: live apibase.pro catalog snapshot