开发文档
Bing 搜索 API 技术参考
Bing 搜索 API 参考:查询与市场输入、翻页、时间范围和安全搜索的行为、索引选择,以及返回行内部的字段含义。
另见: Bing 搜索 API 概览与价格 · Bing 搜索 API 指南:查询、翻页与市场
本页内容
Bing 搜索 API 的查询与市场输入
body.q 也可以写成 query 或 keyword。查询词中的搜索运算符会生效,例如 site:example.com 和双引号包住的精确短语。
市场输入同样有替代名称。market 被接受为 body.mkt 的替代。cc 和 country 被接受为 body.gl 的替代,setlang 和 lang 被接受为 body.hl 的替代。
缺少 body.mkt 时由 body.gl 和 body.hl 共同顶替它,三者都不发送的调用在 en-US 市场中运行,三者中任何一个无法识别的取值都会被忽略。body.gl 需要两位字母的 ISO-3166 国家代码(us、gb、de、in、br),body.hl 需要 ISO-639 语言代码(en、de、fr)。
本节涉及的字段(9)
bing-autocomplete, bing-images, bing-news, bing-search, bing-videos, body.q, body.mkt, body.gl, body.hl
Bing 搜索 API 自动补全参考
suggestions 是查询建议的有序列表,它的顺序就是 Bing 在输入查询时展示这些建议的顺序。
query 显示被应答的文本,mkt 显示生效的市场,count 显示返回了多少条建议。换用其他 body.gl 或 body.mkt 再次调用该操作,就能读取另一个市场的建议,因此可以比较不同国家的关键词思路。
本节涉及的字段(5)
bing-autocomplete, body.q, body.mkt, body.gl, body.hl
Bing 图片搜索参考
bing-images 每页约有 35 张图片,页码用 body.page 表示,从 1 开始。body.first 是从 1 开始的结果偏移量,可以用来代替页码,start 被接受为 body.first 的另一个名称。body.count 也可以写成 num。
无效的 body.page 或 body.first 会被忽略。body.count 超出 1 到 60 的范围时同样被忽略,返回 35 张图片。
body.safe 设定安全搜索级别,其中 off 表示不过滤。它也可以写成 safesearch,无法识别的级别会被忽略。
在 images 的每一行中,image_url 是原图文件,source_url 是展示它的页面,thumbnail_url 是缩略图,domain 是来源页面的主机。width 和 height 给出像素尺寸,description 是描述图片的文字,Bing 能提供时才会带上这几项。
本节涉及的字段(5)
bing-images, body.page, body.first, body.count, body.safe
Bing 新闻搜索参考
bing-news 按从新到旧列出文章。body.freshness 把文章限制在某个时间范围内:hour 是过去一小时,day 是过去一天,week 是过去 7 天,month 是过去 30 天。
24h、7d、30d 以及 d、w、m 这类简写也被接受,time_range 是替代名称,无法识别的取值会被忽略。body.count 也可以写成 num;超出 1 到 100 的取值会被忽略,返回 15 篇文章。
news 的每一行都有说明媒体的 source,以及显示文章发布至今时长的 published 字段。Bing 新闻只收录较近的文章,所以针对很久以前或非常冷门主题的查询可能匹配不到任何文章。
本节涉及的字段(3)
bing-news, body.freshness, body.count
Bing 搜索 API 网页搜索参考
bing-search 每页约有 10 条结果。body.page 是从 1 开始的页码,body.first 是从 1 开始的偏移量,可以用来代替页码,因此 11 对应第 2 页;start 被接受为它的另一个名称。
body.count 也可以写成 num,数量超过 10 时,该操作会一口气读取多个结果页。body.count 超出 1 到 50 的范围时会被忽略,返回 10 条结果;无效的 body.page 或 body.first 同样被忽略。
在网页搜索中,body.freshness 只提供 day、week 和 month,简写与 time_range 名称都与新闻操作相同,无法识别的取值会被忽略。body.safe 及其 safesearch 名称的行为与图片操作一致。body.device 接受 desktop 与 mobile,而 mobile 返回的是桌面端排名。
people_also_ask 的每一项都是带有 question 的相关问题,而 related_searches 是 Bing 展示的相关查询。total_estimate 是估计的匹配数量,page_offset 显示所返回页面的偏移量。
本节涉及的字段(7)
bing-search, body.page, body.first, body.count, body.freshness, body.safe, body.device
用 engine 输入选择索引
body.engine 默认是 auto,它查询 Bing,bing 的含义相同。brave 查询一个独立的索引。gnews 返回的是普通网页而不是新闻,每一行都带有发布日期,没有摘要,site:example.com 与精确短语都会生效。
gemini 每次请求约返回 5 条结果,每行只带有网址和域名,它是唯一支持 after:2026-06-01 和 before:2020-01-01 这类日期运算符的索引,并且会丢弃 site:。yandex 目前不可用。
body.depth 只适用于 gemini,其他索引会忽略它。exact 只运行一次查询,而 deep 会围绕查询继续搜索并返回几十条结果,这些结果可能偏离原始查询。
本节涉及的字段(3)
bing-search, body.engine, body.depth
Bing 视频搜索参考
bing-videos 每页约有 30 个视频。body.page、body.first、body.count 和 body.safe 的行为与图片操作相同,包括它们的替代名称,无效或无法识别的取值会被忽略。body.count 超出 1 到 60 的范围时回到 30 个视频。
videos 的行里既有始终出现的字段,也有可选字段。position、title、url、duration 和 platform 出现在每一行。
其中 url 通向观看页,duration 给出视频的长度,platform 指明托管网站,例如 YouTube、TikTok 或 Dailymotion。thumbnail_url、publisher、views、published 和 description 在 Bing 展示时才会出现,它们分别给出缩略图地址、发布视频的频道或发布者、视频被观看的次数、上传至今的时间以及文字描述。
本节涉及的字段(5)
bing-videos, body.page, body.first, body.count, body.safe
操作
公共网关操作统一使用 POST /api/v1/{project}/{action}。
使用 JSON 对象,按文档将参数放入 path、query、headers 和 body,省略未使用的位置。input.headers 是供操作使用的 JSON 数据,不是浏览器请求头。请勿在此填写凭证。按文档保留 body 的数组、标量或 null;省略与 null 含义不同。
自动补全建议
POST /api/v1/bing/bing-autocomplete
返回 Bing 针对输入片段给出的有序查询建议,适合用于关键词研究。
输入字段
| 字段 | 类型 | 是否必填 | 允许的值 | 范围限制 |
|---|---|---|---|---|
body.q | string | 必填 | — | — |
body.gl | string | 可选 | — | — |
body.hl | string | 可选 | — | — |
body.mkt | string | 可选 | — | — |
请求示例
# Server-side only. Set KAKIAPI_API_KEY in your secret manager.
# Every gateway operation is called with POST.
# Only operations shown as enabled on the API page can be called.
# Generate once per intent; retain the same value on status checks.
REQUEST_ID="$(uuidgen)"
curl --request POST 'https://kakiapi.com/api/v1/bing/bing-autocomplete' \
--header "Content-Type: application/json" \
--header "x-api-key: $KAKIAPI_API_KEY" \
--header "Idempotency-Key: $REQUEST_ID" \
--data '{"body":{"gl":"us","q":"best lap"}}'响应字段
enginequerymktcountsuggestions[]
图片搜索
POST /api/v1/bing/bing-images
搜索 Bing 图片,返回原图地址、所在页面、缩略图和域名,并在可得时附带像素尺寸。
输入字段
| 字段 | 类型 | 是否必填 | 默认值 | 允许的值 | 范围限制 |
|---|---|---|---|---|---|
body.q | string | 必填 | — | — | — |
body.count | integer | 可选 | 35 | — | 1–60 |
body.first | integer | 可选 | — | — | 1–9007199254740991 |
body.gl | string | 可选 | — | — | — |
body.hl | string | 可选 | — | — | — |
body.mkt | string | 可选 | — | — | — |
body.page | integer | 可选 | — | — | 1–9007199254740991 |
body.safe | string | 可选 | — | "off""moderate""strict" | — |
请求示例
# Server-side only. Set KAKIAPI_API_KEY in your secret manager.
# Every gateway operation is called with POST.
# Only operations shown as enabled on the API page can be called.
# Generate once per intent; retain the same value on status checks.
REQUEST_ID="$(uuidgen)"
curl --request POST 'https://kakiapi.com/api/v1/bing/bing-images' \
--header "Content-Type: application/json" \
--header "x-api-key: $KAKIAPI_API_KEY" \
--header "Idempotency-Key: $REQUEST_ID" \
--data '{"body":{"gl":"us","q":"eiffel tower at night"}}'响应字段
enginequerymktpage_offsetcountimages[]positiontitleimage_urlsource_urlthumbnail_urldomainwidthheightdescription
新闻搜索
POST /api/v1/bing/bing-news
按关键词返回 Bing 新闻文章,含来源、摘要、发布时长和缩略图,按从新到旧排列。
输入字段
| 字段 | 类型 | 是否必填 | 默认值 | 允许的值 | 范围限制 |
|---|---|---|---|---|---|
body.q | string | 必填 | — | — | — |
body.count | integer | 可选 | 15 | — | 1–100 |
body.freshness | string | 可选 | — | "hour""day""week""month" | — |
body.gl | string | 可选 | — | — | — |
body.hl | string | 可选 | — | — | — |
body.mkt | string | 可选 | — | — | — |
请求示例
# Server-side only. Set KAKIAPI_API_KEY in your secret manager.
# Every gateway operation is called with POST.
# Only operations shown as enabled on the API page can be called.
# Generate once per intent; retain the same value on status checks.
REQUEST_ID="$(uuidgen)"
curl --request POST 'https://kakiapi.com/api/v1/bing/bing-news' \
--header "Content-Type: application/json" \
--header "x-api-key: $KAKIAPI_API_KEY" \
--header "Idempotency-Key: $REQUEST_ID" \
--data '{"body":{"gl":"us","q":"tesla"}}'响应字段
enginequerymktcountnews[]positiontitleurlsourcesnippetpublishedthumbnail_url
网页搜索
POST /api/v1/bing/bing-search
返回 Bing 网页搜索的排序结果,含标题、地址、摘要和日期,并在 Bing 展示时附上结果页的其他内容块。
输入字段
| 字段 | 类型 | 是否必填 | 默认值 | 允许的值 | 范围限制 |
|---|---|---|---|---|---|
body.q | string | 必填 | — | — | — |
body.count | integer | 可选 | 10 | — | 1–50 |
body.depth | string | 可选 | "exact" | "exact""deep" | — |
body.device | string | 可选 | — | "desktop""mobile" | — |
body.engine | string | 可选 | "auto" | "auto""bing""brave""gnews""gemini""yandex" | — |
body.first | integer | 可选 | — | — | 1–9007199254740991 |
body.freshness | string | 可选 | — | "day""week""month" | — |
body.gl | string | 可选 | — | — | — |
body.hl | string | 可选 | — | — | — |
body.mkt | string | 可选 | — | — | — |
body.page | integer | 可选 | — | — | 1–9007199254740991 |
body.safe | string | 可选 | — | "off""moderate""strict" | — |
请求示例
# Server-side only. Set KAKIAPI_API_KEY in your secret manager.
# Every gateway operation is called with POST.
# Only operations shown as enabled on the API page can be called.
# Generate once per intent; retain the same value on status checks.
REQUEST_ID="$(uuidgen)"
curl --request POST 'https://kakiapi.com/api/v1/bing/bing-search' \
--header "Content-Type: application/json" \
--header "x-api-key: $KAKIAPI_API_KEY" \
--header "Idempotency-Key: $REQUEST_ID" \
--data '{"body":{"gl":"us","q":"best laptop 2026"}}'响应字段
enginequerymktpagepage_offsettotal_estimatecountresults[]positiontitleurldisplayed_urldomainsite_namefaviconsnippetdate
related_searches[]people_also_ask[]ads[]positionblocktitleurldisplayed_urldomaindescription
knowledge_paneltitledescriptionurl
answer_box
视频搜索
POST /api/v1/bing/bing-videos
搜索 Bing 视频,返回观看页地址、标题、时长和托管平台,并在 Bing 展示时附带频道、观看次数和上传时间。
输入字段
| 字段 | 类型 | 是否必填 | 默认值 | 允许的值 | 范围限制 |
|---|---|---|---|---|---|
body.q | string | 必填 | — | — | — |
body.count | integer | 可选 | 30 | — | 1–60 |
body.first | integer | 可选 | — | — | 1–9007199254740991 |
body.gl | string | 可选 | — | — | — |
body.hl | string | 可选 | — | — | — |
body.mkt | string | 可选 | — | — | — |
body.page | integer | 可选 | — | — | 1–9007199254740991 |
body.safe | string | 可选 | — | "off""moderate""strict" | — |
请求示例
# Server-side only. Set KAKIAPI_API_KEY in your secret manager.
# Every gateway operation is called with POST.
# Only operations shown as enabled on the API page can be called.
# Generate once per intent; retain the same value on status checks.
REQUEST_ID="$(uuidgen)"
curl --request POST 'https://kakiapi.com/api/v1/bing/bing-videos' \
--header "Content-Type: application/json" \
--header "x-api-key: $KAKIAPI_API_KEY" \
--header "Idempotency-Key: $REQUEST_ID" \
--data '{"body":{"gl":"us","q":"how to make pizza"}}'响应字段
enginequerymktpage_offsetcountvideos[]
调用方式
- 使用
POST /api/v1/bing/<action>,并携带x-api-key、Content-Type: application/json和必需的Idempotency-Key。 - 调用成功时返回
ok: true:data是操作的结果,meta.requestId标识已记录的请求,meta.chargedCreditUnits是实际扣费金额。否则ok为false,error.code说明原因;请读取ok和error.code,不要只依赖 HTTP 状态码。每个网关响应都带有供支持使用的请求 ID:meta.requestId;没有meta的响应(如受理前被拒绝)则为顶层requestId。 - 只有调用成功才按标价扣费。失败不扣费;结果无法确认时,最多 900 秒后释放,不扣费。
- 请求完成后,以同一个 Idempotency-Key 重复发送相同请求,24 小时内返回已保存的响应,不会再次扣费。
网关调用参考: