主题
域名分类分布查询(容旧版)
接口说明
注意:该接口文档对应旧版响应结构(Legacy)。虽然平台 API 已在 2022-03-19 更新了 本平台 Labs 的请求与响应结构,但本容路径仍继续支持。若需新版结构,可参考对应新版文档。 容路径保持不变:
/v3/dataforseo_labs/categories_for_domain/live
该接口用于返回某个域名在 Google 搜索中已获得排名的所对应的产品或服务分类。同时,接口还会按分类聚合返回该域名在该分类下的排名表现与流量指标。
请求地址
POST https://api.seermartech.cn/v3/dataforseo_labs/categories_for_domain/live
计费说明
该接口按请求计费。原文未提供固定单价,因此无法直接换算参考人民币价格。 扣费以响应头 X-SeerMarTech-Charge-CNY 为准。
请求规则
- 请求方法:
POST - 请求体格式:JSON 数组
[{ ... }] - 编码:
UTF-8 - 单次请求中传任务参数对象
- 支持结果筛选、排序与分页
- API 调用频率上限:每分钟最多 2000 次
请求参数
| 字段名 | 类型 | 说明 |
|---|---|---|
target | string | 填。目标网站域名,不要 https:// 和 www. |
location_name | string | 地区名。未提供 location_code 时填。location_name 与 location_code 二选一填。可通过 /v3/dataforseo_labs/locations_and_languages 获取可用地区列表。示例:United Kingdom |
location_code | integer | 地区编码。未提供 location_name 时填。location_name 与 location_code 二选一填。可通过 /v3/dataforseo_labs/locations_and_languages 获取。示例:2840 |
language_name | string | 语言名。未提供 language_code 时填。language_name 与 language_code 二选一填。可通过 /v3/dataforseo_labs/locations_and_languages 获取。示例:English |
language_code | string | 语言编码。未提供 language_name 时填。language_name 与 language_code 二选一填。示例:en |
include_subcategories | boolean | 是否在搜索中子分类。可选。设为 false 时忽略子分类。默认值:false |
item_types | array | 按结果类型返回数据。可选。用于指定响应中哪些搜索结果类型。注意: 如果 item_types 中非 organic 类型,结果将按数组中的第一个类型排序;且无法对未在响应中的结果类型做排序与筛选。 |
filters | array | 结果筛选条件数组。可选。最多支持 8 个筛选条件。多个条件之间使用逻辑运算符 and / or 连接。支持操作符:<、<=、>、>=、=、<>、in、not_in |
order_by | array | 排序规则。可选。可使用与 filters 相同的字段进行排序。排序方向支持:asc、desc。单次请求最多支持 3 条排序规则。如果 item_types 中非 organic 类型,结果将按 item_types 的第一个类型排序。 |
limit | integer | 返回分类数量上限。可选。默认值:100,最大值:1000 |
offset | integer | 返回结果偏移量。可选。默认值:0。例如传 10 表示跳过前 10 个分类,从后续分类开始返回。 |
tag | string | 用户自定义任务标识。可选。最长 255 字符。可用于请求结果与业务侧任务,响应中的 data 对象会返回该值。 |
筛选与排序说明
filters 示例
json
[
["metrics.organic.count", ">=", 100],
"and",
[
["metrics.organic.pos_1", ">", 0],
"or",
["metrics.paid.count", "in", [1, 2]]
]
]说明:
metrics.organic.count >= 100- 并且满足以下任一条件:
metrics.organic.pos_1 > 0metrics.paid.count in [1, 2]
order_by 示例
json
["metrics.organic.etv,desc", "metrics.organic.count,desc"]返回结果
接口返回 JSON 数据,顶层 tasks 数组,每个任务对应一个结果对象。
顶层响应字段
| 字段名 | 类型 | 说明 |
|---|---|---|
version | string | 当前 API 版本 |
status_code | integer | 响应状态码。完整错误码请参考 /v3/appendix/errors |
status_message | string | 响应说明信息 |
time | string | 执行耗时,单位秒 |
cost | float | 本次请求总成本,单位 USD |
tasks_count | integer | tasks 数组中的任务数量 |
tasks_error | integer | 返回错误的任务数量 |
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 | URL 路径 |
data | object | 回显请求中提交的参数 |
result | array | 结果数组 |
result[] 字段
| 字段名 | 类型 | 说明 |
|---|---|---|
target | string | 请求中的目标域名 |
location_code | integer | 请求中的地区编码 |
language_code | string | 请求中的语言编码 |
total_count | integer | 数据库中与请求的总结果数 |
items_count | integer | items 数组返回的结果数 |
items | array | 分类及对应排名指标 |
items[] 字段
| 字段名 | 类型 | 说明 |
|---|---|---|
categories | array | 产品与服务分类列表。完整分类集合可参考 Google Ads 的产品/服务分类定义 |
metrics | object | 与目标域名的分类排名指标 |
metrics 指标说明
metrics 下可能以下结果类型对象:
organic:自然搜索paid:付费搜索featured_snippet:精选摘要local_pack:本地
这些对象的字段结构基本一致。
通用排名区间字段
以下字段适用于 organic / paid / featured_snippet / local_pack:
| 字段名 | 类型 | 说明 |
|---|---|---|
pos_1 | integer | 排名第 1 的结果数量 |
pos_2_3 | integer | 排名第 2-3 的结果数量 |
pos_4_10 | integer | 排名第 4-10 的结果数量 |
pos_11_20 | integer | 排名第 11-20 的结果数量 |
pos_21_30 | integer | 排名第 21-30 的结果数量 |
pos_31_40 | integer | 排名第 31-40 的结果数量 |
pos_41_50 | integer | 排名第 41-50 的结果数量 |
pos_51_60 | integer | 排名第 51-60 的结果数量 |
pos_61_70 | integer | 排名第 61-70 的结果数量 |
pos_71_80 | integer | 排名第 71-80 的结果数量 |
pos_81_90 | integer | 排名第 81-90 的结果数量 |
pos_91_100 | integer | 排名第 91-100 的结果数量 |
etv | float | 预估流量 |
impressions_etv | float | 基于量计算的预估流量 |
count | integer | 含该域名的 SERP 总数 |
estimated_paid_traffic_cost | float | 将对应流量通过付费广告获取的预估成本,单位 USD |
is_new | integer | 新增排名结果数量 |
is_up | integer | 排名上升的结果数量 |
is_down | integer | 排名下降的结果数量 |
is_lost | integer | 丢失排名的结果数量 |
各结果类型含义
organic
自然搜索下的排名与流量数据:
etv:基于 CTR 与搜索量估算的自然月流量impressions_etv:基于 CTR 与量估算的自然月流量estimated_paid_traffic_cost:若通过搜索广告获取同等自然流量的预估月成本
paid
付费搜索下的排名与流量数据:
etv:基于 CTR 与搜索量估算的付费月流量impressions_etv:基于 CTR 与量估算的付费月流量estimated_paid_traffic_cost:基于etv与cpc估算的付费月流量成本
featured_snippet
Google SERP 精选摘要下的排名与流量数据。
local_pack
本地结果下的排名与流量数据。
某些结果类型可能返回
null,表示当前分类下没有该类型数据。
请求示例
cURL
bash
curl --location --request POST "https://api.seermartech.cn/v3/dataforseo_labs/categories_for_domain/live" \
--header "Authorization: Bearer smt_live_YOUR_KEY" \
--header "Content-Type: application/json" \
--data-raw '[
{
"target": "example.com",
"language_name": "English",
"location_code": 2840,
"filters": [
["metrics.organic.count", ">=", 100],
"and",
[
["metrics.organic.pos_1", ">", 0],
"or",
["metrics.paid.count", "in", [1, 2]]
]
],
"limit": 5
}
]'Python
python
import requests
url = "https://api.seermartech.cn/v3/dataforseo_labs/categories_for_domain/live"
headers = {
"Authorization": "Bearer smt_live_YOUR_KEY",
"Content-Type": "application/json"
}
payload = [
{
"target": "example.com",
"location_name": "United States",
"language_name": "English",
"filters": [
["metrics.organic.count", ">=", 100],
"and",
[
["metrics.organic.pos_1", ">", 0],
"or",
["metrics.paid.count", "in", [1, 2]]
]
]
}
]
response = requests.post(url, json=payload, headers=headers)
print(response.json)TypeScript
typescript
import axios from "axios";
const postArray = [
{
target: "example.com",
location_name: "United States",
language_name: "English",
filters: [
["metrics.organic.count", ">=", 100],
"and",
[
["metrics.organic.pos_1", ">", 0],
"or",
["metrics.paid.count", "in", [1, 2]]
]
]
}
];
axios({
method: "post",
url: "https://api.seermartech.cn/v3/dataforseo_labs/categories_for_domain/live",
headers: {
Authorization: "Bearer smt_live_YOUR_KEY",
"Content-Type": "application/json"
},
data: postArray
}).then((response) => {
console.log(response.data);
}).catch((error) => {
console.error(error);
});响应示例
json
{
"version": "0.1.20210818",
"status_code": 20000,
"status_message": "Ok.",
"time": "0.2796 sec.",
"cost": 0.0105,
"tasks_count": 1,
"tasks_error": 0,
"tasks": [
{
"data": {
"api": "dataforseo_labs",
"function": "categories_for_domain",
"target": "example.com",
"language_name": "English",
"location_code": 2840,
"filters": [
["metrics.organic.count", ">=", 100],
"and",
[
["metrics.organic.pos_1", ">", 0],
"or",
["metrics.paid.count", "in", [1, 2]]
]
],
"limit": 5
},
"result": [
{
"items": [
{
"categories": ["Business & Industrial"],
"metrics": {
"organic": {
"pos_1": 4,
"pos_2_3": 13,
"pos_4_10": 25,
"pos_11_20": 61,
"pos_21_30": 69,
"pos_31_40": 83,
"pos_41_50": 97,
"pos_51_60": 104,
"pos_61_70": 84,
"pos_71_80": 77,
"pos_81_90": 73,
"pos_91_100": 51,
"etv": 971.3033153284341,
"impressions_etv": 172.2075118124485,
"count": 741,
"estimated_paid_traffic_cost": 8051.8685585763305,
"is_new": 185,
"is_up": 220,
"is_down": 300,
"is_lost": 0
},
"paid": {
"pos_1": 0,
"pos_2_3": 0,
"pos_4_10": 0,
"pos_11_20": 0,
"pos_21_30": 0,
"pos_31_40": 0,
"pos_41_50": 0,
"pos_51_60": 0,
"pos_61_70": 0,
"pos_71_80": 0,
"pos_81_90": 0,
"pos_91_100": 0,
"etv": 0,
"impressions_etv": 0,
"count": 0,
"estimated_paid_traffic_cost": 0,
"is_new": 0,
"is_up": 0,
"is_down": 0,
"is_lost": 0
},
"featured_snippet": null,
"local_pack": null
}
}
]
}
]
}
]
}状态码与错误处理
- 顶层
status_code表示整个请求状态 tasks[].status_code表示单个任务执行状态- 建议同时校验:
- HTTP 状态码
- 顶层
status_code - 各任务的
status_code
常见成功状态:
| 状态码 | 说明 |
|---|---|
20000 | 请求成功 |
完整错误码请参考 /v3/appendix/errors。 建议在接时建立统一的异常处理机制,覆盖参数错误、额限制、认证失败、任务级局部失败等。
使用建议
- 优使用
location_code和language_code,名称匹差异。 - 结合
filters缩小范围,例如优查看organic.count高、pos_1大于 0 的分类。 - 用
limit+offset分页获取大量结果。 - 当需要比较不同搜索结果类型时,谨设置
item_types,影响排序逻辑。 - 注意旧版结构容性:如果你同时接新版与旧版接口,请在解析层区分响应结构。
实用场景
- 识别高价值赛道:按分类汇总域名的自然排名与流量,快速判断网站主要覆盖哪些产品或服务领域。
- 筛选优优化的分类:结合
etv、count、pos_4_10等指标,找出最有机会冲刺首页或前三的分类。 - 分析竞价与自然协同机会:对比
organic与paid数据,识别自然流量强但付费覆盖弱的分类,优化投放策略。 - 监控分类级排名波动:通过
is_new、is_up、is_down、is_lost评估各业务分类近期 SEO 变化。 - 支持站点业务重心判断:从分类分布反推站点在搜索中的业务画像,为规划、栏目建设和品类扩展提供依据。