主题
百度 SERP 地区列表
接口概述
通过本接口可获取百度 SERP 支持的地区列表。 你也可以在请求路径中附带国家 ISO 代码返回指定国家下的地区。
该接口常用于创建 SERP 查询任务前,确认可用的 location_code 与地区层级。
计费说明: 调用本接口不收费,扣费以响应头 X-SeerMarTech-Charge-CNY 为准。
请求方式
获取地区
GET /v3/serp/wp/locations
按国家筛选地区
GET /v3/serp/wp/locations/{country}
说明:虽然原页面标题对应百度地区列表,但技术路径以接口容路径为准,请按返回结果使用。
country为可选路径参数,用于按国家过滤地区。
此外,你也可以下载完整支持地区单作为离线参考文档。
特别说明
由于平台服务策略限制,俄罗斯和白俄罗斯的所有地区在服务中均不再支持。
路径参数
| 字段名 | 类型 | 是否填 | 说明 |
|---|---|---|---|
country | string | 否 | 国家 ISO 代码。填写后返回该国家的地区列表,例如:us |
响应结构
接口返回 JSON 数据,顶层 tasks 数组,每个任务对象中本次请求的执行状态与结果。
顶层字段
| 字段名 | 类型 | 说明 |
|---|---|---|
version | string | 当前 API 版本 |
status_code | integer | 通用状态码,完整列表见 /v3/appendix/errors |
status_message | string | 通用状态信息,完整列表见 /v3/appendix/errors |
time | string | 执行耗时,单位秒 |
cost | float | 本次请求总费用,单位 USD |
tasks_count | integer | tasks 数组中的任务数量 |
tasks_error | integer | tasks 数组中返回错误的任务数量 |
tasks | array | 任务结果数组 |
tasks[] 字段
| 字段名 | 类型 | 说明 |
|---|---|---|
id | string | 任务唯一标识,UUID 格式 |
status_code | integer | 任务状态码,范围通常为 10000-60000 |
status_message | string | 任务状态说明 |
time | string | 任务执行耗时,单位秒 |
cost | float | 该任务费用,单位 USD |
result_count | integer | result 数组中的结果数量 |
path | array | 请求路径 |
data | object | GET 请求 URL 中传的参数 |
result | array | 地区结果列表 |
result[] 字段
| 字段名 | 类型 | 说明 |
|---|---|---|
location_code | integer | 地区编码 |
location_name | string | 地区完整名称 |
location_code_parent | integer | 上级地区编码 |
country_iso_code | string | 地区所属国家的 ISO 代码 |
location_type | string | 地区类型 |
地区层级说明
百度 SERP 地区支持存在以下限制:
- 除中国外,国家通常支持
City - 中国除
City外,还支持Country - 不要依赖
location_code_parent做通用层级匹 因为大多数国家并不支持Region和Country级别的百度 SERP 结果
调用示例
cURL
bash
curl --request GET "https://api.seermartech.cn/v3/serp/wp/locations" \
--header "Authorization: Bearer smt_live_YOUR_KEY" \
--header "Content-Type: application/json"Python
python
import requests
url = "https://api.seermartech.cn/v3/serp/baidu/locations"
headers = {
"Authorization": "Bearer smt_live_YOUR_KEY",
"Content-Type": "application/json"
}
response = requests.get(url, headers=headers)
data = response.json
if data.get("status_code") == 20000:
print(data)
else:
print(f"error. Code: {data.get('status_code')} Message: {data.get('status_message')}")TypeScript
typescript
import axios from "axios";
axios({
method: "get",
url: "https://api.seermartech.cn/v3/serp/baidu/locations",
headers: {
"Authorization": "Bearer smt_live_YOUR_KEY",
"Content-Type": "application/json"
}
})
.then((response) => {
// 返回结果
console.log(response.data);
})
.catch((error) => {
console.log(error);
});响应示例
json
{
"version": "0.1.20201026",
"status_code": 20000,
"status_message": "Ok.",
"time": "0.2246 sec.",
"cost": 0,
"tasks_count": 1,
"tasks_error": 0,
"tasks": [
{
"data": {
"api": "serp",
"function": "locations",
"se": "baidu"
},
"result": []
}
]
}状态码说明
| 状态码字段 | 说明 |
|---|---|
status_code | 通用或任务级状态码 |
status_message | 对应状态说明 |
完整错误码与说明请参考:/v3/appendix/errors
使用建议
- 在创建百度 SERP 任务前,调用本接口确认
location_code - 如果你的业务只针对某个国家,建议使用
/v3/serp/wp/locations/{country}缩小返回范围 - 对百度地区进行映射时,应优使用
location_code,不要依赖名称字符串匹 - 涉及中国以外国家时,应预期大多数结果支持城市级定位
实用场景
- 校验投放地区:在提交百度 SERP 抓取任务前校验地区是否受支持,因地区参数错误导致任务失败
- 生成地区下拉选项:为 SEO 平台后台生成可选城市列表,提升任务效率并减少人工维护
- 映射地理维度:将企业城市库与平台
location_code对齐,便于后续批量排名监控 - 过滤无效市场:在化 SEO 研究中筛除不支持的国家或层级,减少无效请求
- 构建本地化监控方案:基于城市级地区编码百度本地搜索可见性监控,提升区域 SEO 分析精度