必应搜索结果页
GET/v1/serp/bing/search
自然结果和相关搜索;完整版加 AI 摘要和广告。
价格
- 价格
- 每次 $0.0013,完整版 $0.00375
- 没有结果
- 没有结果时不收费
- 没取到数据
- 不收费
每次调用先冻结这个价格,取到数据才收费,没取到就退回。这条规则只适用于数据接口:采集 AI 回答时,没有出现 AI 回答和 AI 拒绝回答也是结果,会收费。
参数
query文字必填
搜索词。最多 500 个字符。
countryUS,默认 US
两位国家代码。只开放测过的国家。
tierbasic 或 full,默认 basic
基础版或完整版。完整版字段更多,价格不同。
请求头
Authorization必填
Bearer 加你的 API Key。
Idempotency-Key建议每次都带
自己定的编号,最多 255 个字符,不能有空格。网络出错时用同一个值重发,不会重复执行和收费;24 小时内有效。同一个值配不同的参数,会返回 idempotency_conflict。
X-Max-Price可选
最多愿意花多少美元,例如 0.50。最高费用超过它就拒绝,不执行,也不收费。
X-Source可选
自己的标记,例如来自哪个产品,最多 100 个字符。可以按它看用量。
X-End-User可选
自己的标记:这次是给哪个最终用户用的,最多 100 个字符。不要放姓名、邮箱等个人信息。
返回
成功时返回 HTTP 200,数据在 data.item,是一个 SearchPage。字段一直都在:[] 是这次没有,null 是平台不提供或看不出来。 这次收了多少在 meta.billing。
| 字段 | 类型 | 说明 |
|---|---|---|
results | SearchResult[] | 自然结果 |
features | Feature[] | 搜索引擎自己的聚合块,不占自然排名 |
ads | Ad[] | null | 广告 |
related_searches | string[] | null | 相关搜索 |
people_also_ask | string[] | null | 相关问题 |
videos | Video[] | null | 视频结果 |
products | Product[] | null | 商品结果 |
ai_summary | { text: string, citations: Citation[] } | null | 页面上的 AI 摘要和它的来源 |
里面的对象
SearchResult6 个字段
| 字段 | 类型 | 说明 |
|---|---|---|
position | integer | 排在第几个,从 1 开始 |
title | string | null | 标题 |
url | string | 网址 |
domain | string | 域名 |
snippet | string | null | 摘要 |
published_at | string | null | 发布时间。平台没给就是 null |
Feature3 个字段
| 字段 | 类型 | 说明 |
|---|---|---|
type | "engine_block" | 聚合块的类型 |
title | string | null | 标题 |
url | string | null | 网址 |
Ad8 个字段
| 字段 | 类型 | 说明 |
|---|---|---|
position | integer | null | 排在第几个,从 1 开始 |
title | string | null | 标题 |
url | string | null | 网址 |
advertiser | string | null | 广告主 |
text | string | null | 广告文案 |
block | string | null | 广告所在的位置 |
sitelinks | (string | null)[] | null | 附加链接 |
badges | (string | null)[] | null | 标记 |
Video9 个字段
| 字段 | 类型 | 说明 |
|---|---|---|
position | integer | 排在第几个,从 1 开始 |
title | string | null | 标题 |
url | string | null | 网址 |
platform | string | null | 所在的平台 |
author | string | null | 作者 |
duration_seconds | integer | null | 时长,秒 |
video_id | string | null | 视频编号 |
views | integer | null | 播放量 |
published_at | string | null | 发布时间。平台没给就是 null |
Product21 个字段
| 字段 | 类型 | 说明 |
|---|---|---|
position | integer | 排在第几个,从 1 开始 |
title | string | null | 标题 |
url | string | null | 网址 |
price | number | null | 价格。读得准才给;打码的价格和价格区间是 null |
currency | string | null | 货币 |
price_text | string | null | 平台显示的价格原文 |
original_price | number | null | 原价 |
seller | string | null | 卖家 |
platform | string | null | 所在的平台 |
rating | number | null | 评分 |
review_count | integer | null | 评论数 |
product_id | string | null | 商品编号 |
sku_id | string | null | 规格编号 |
brand | string | null | 品牌 |
image_url | string | null | 商品图片 |
label | string | null | 平台给的推荐语或促销标签 |
availability | string | null | 有没有货 |
delivery | string | null | 配送说明 |
discount | string | null | 折扣说明 |
offers | Offer[] | null | 各个卖家的报价 |
sponsored | boolean | null | 是不是广告 |
Offer7 个字段
| 字段 | 类型 | 说明 |
|---|---|---|
seller | string | null | 卖家 |
price | number | null | 价格 |
currency | string | null | 货币 |
price_text | string | null | 平台显示的价格原文 |
url | string | null | 网址 |
available | boolean | null | 有没有货 |
label | string | null | 平台给的推荐语或促销标签 |
Citation12 个字段
| 字段 | 类型 | 说明 |
|---|---|---|
position | integer | 排在第几个,从 1 开始 |
url | string | 真实网址,跳转链接已经还原 |
domain | string | 域名 |
title | string | null | 标题 |
snippet | string | null | 摘要 |
site_name | string | null | 网站名 |
published_at | string | null | 发布时间。平台没给就是 null |
author | string | null | 作者 |
platform | string | null | 来源所在的平台,例如某个博客平台 |
quotes | string[] | null | 来源里被用到的原文 |
anchors | Anchor[] | null | 这条来源对应回答里的哪一段 |
cited | boolean | null | true 用在了回答里;false 只在搜索时找到;null 看不出来 |
Anchor2 个字段
| 字段 | 类型 | 说明 |
|---|---|---|
text | string | null | 这条来源对应的那段回答,不是来源的原文 |
offset | integer | null | 在 markdown 里的字符位置 |
meta7 个字段
| 字段 | 类型 | 说明 |
|---|---|---|
capability | string | 接口编号 |
result_status | "complete" | "partial" | "empty" | complete 完整;partial 只拿到一部分;empty 没有结果 |
fetched_at | string | 取到数据的时间 |
cached | boolean | 是不是缓存的结果。现在一直是 false |
replayed | boolean | 是不是用同一个 Idempotency-Key 取回的上一次结果 |
unavailable | string[] | 这次给不了的字段 |
billing | { amount: string, currency: "USD", balance_after: string | null } | 这次收了多少,收完后的余额 |
常见错误
返回错误就没有收费,只有 settlement_unknown:它表示暂时不知道有没有扣费,要用同一个 Idempotency-Key 再查。查看每个错误码。
| 错误 | HTTP | 意思 | 收费吗 |
|---|---|---|---|
invalid_params | 400 | 参数不合法 | 没有收费 |
max_price_exceeded | 400 | 最高费用超过了你设的上限 | 没有收费 |
insufficient_balance | 402 | 余额不足 | 没有收费 |
key_budget_exceeded | 402 | 超出这把 Key 的金额上限 | 没有收费 |
idempotency_conflict | 409 | 这个 Idempotency-Key 已用于另一个请求 | 没有收费 |
upstream_failed | 502 | 这次没有取到结果,没有扣费,可以稍后重试 | 没有收费 |
timeout | 504 | 没有在时限内取到数据,没有扣费 | 没有收费 |
upstream_busy | 503 | 现在请求较多,请稍后重试 | 没有收费 |
call_in_progress | 409 | 这个 Idempotency-Key 的调用还在执行,稍后用同一个再取 | 没有收费 |
settlement_unknown | 500 | 还不确定这次有没有扣费,请用同一个 Idempotency-Key 再查 | 暂时不知道 |
unauthorized | 401 | 没有带凭证,或凭证无效、已停用、已过期 | 没有收费 |
rate_limited | 429 | 请求过快,或同时进行的调用过多 | 没有收费 |