主题
按分类获取(实时)
接口说明
该接口用于根据指定的产品/服务分类,返回与这些分类的列表。
每个可返回以下核心数据:
- 最近一个月的搜索量
- 过去 12 个月的搜索量趋势
- 当前平均点击单价(CPC)
- 竞价竞争度
- 可选的 SERP 信息
- 可选的点击流归一化数据
请求地址
POST https://api.seermartech.cn/v3/dataforseo_labs/google/keywords_for_categories/live
计费说明
该接口按请求计费。原文未提供固定单价,因此无法预估单次人民币参考价。 扣费以响应头 X-SeerMarTech-Charge-CNY 为准。
调用限制
- 每分钟最多可发起
2000次 API 调用 - 同时并发请求数上限为
30
请求格式
- 请求方法:
POST - 编码格式:
JSON(UTF-8) - 请求体为 JSON 数组:
[{ ... }]
请求参数
| 字段 | 类型 | 说明 |
|---|---|---|
category_codes | array | 填。产品/服务分类数组。最多可传 20 个分类编码。分类单可通过参考文档获取。 |
location_name | string | location_code 未提供时填。地区完整名称。需与 location_code 二选一。可通过 /v3/dataforseo_labs/locations_and_languages 获取可用地区名称。例如:United Kingdom |
location_code | integer | location_name 未提供时填。地区唯一编码。需与 location_name 二选一。可通过 /v3/dataforseo_labs/locations_and_languages 获取可用地区编码。例如:2840 |
language_name | string | language_code 未提供时填。语言完整名称。需与 language_code 二选一。可通过 /v3/dataforseo_labs/locations_and_languages 获取可用语言名称。例如:English |
language_code | string | language_name 未提供时填。语言编码。需与 language_name 二选一。可通过 /v3/dataforseo_labs/locations_and_languages 获取可用语言编码。例如:en |
category_intersection | boolean | 可选。是否返回同时属于所有指定分类的。true 表示取交集;false 表示取并集。默认:true |
include_serp_info | boolean | 可选。是否在结果中返回每个的 serp_info 数据搜索结果数、对应搜索 URL、SERP 特征等。默认:false |
include_clickstream_data | boolean | 可选。是否返回点击流指标。开启后,响应中将 clickstream_keyword_info、keyword_info_normalized_with_clickstream、keyword_info_normalized_with_bing。默认:false |
ignore_synonyms | boolean | 可选。是否忽略高度相似词。设为 true 时返回核心,不返回高相似度同义词。默认:false |
limit | integer | 可选。返回条数上限。默认:100,最大:1000 |
offset | integer | 可选。结果偏移量。默认:0。例如设置为 10 时,将跳过前 10 条结果。建议在获取不 10,000 条结果时使用 |
offset_token | string | 可选。用于翻页获取后续结果。适合拉取 10,000 条数据时使用,可时。如果请求中指定了 offset_token,除 limit 外余参数将被忽略 |
filters | array | 可选。结果过滤条件数组,最多支持 8 个过滤条件。条件之间可使用 and、or 连接 |
order_by | array | 可选。结果排序规则。排序字段与 filters 可用字段一致。支持 asc、desc。单次请求最多支持 3 条排序规则 |
tag | string | 可选。自定义任务标识,最大长度 255。便于在响应中识别和任务 |
filters 用法
filters 支持以下运算符:
regexnot_regex<<=>>==<>innot_inmatchnot_matchilikenot_ilikelikenot_like
说明:
like/not_like/ilike/not_ilike支持%通符%可匹任意长度字符串(空字符串)- 多个条件之间可通过
and、or组合
filters 示例
json
[
["keyword_info.search_volume", ">", 1000],
"and",
["keyword", "like", "%desktop%"]
]如需更复杂的过滤语法,可参考 /v3/dataforseo_labs/filters。
order_by 用法
支持使用与 filters 相同的字段路径进行排序。
单字段排序示例
json
["keyword_info.search_volume,desc"]多字段排序示例
json
[
"keyword_info.search_volume,desc",
"keyword_info.cpc,desc"
]默认排序规则以平台当前实现为准。单次请求最多支持 3 条排序规则。
请求示例
cURL
bash
curl --location --request POST "https://api.seermartech.cn/v3/dataforseo_labs/google/keywords_for_categories/live" \
--header "Authorization: Bearer smt_live_YOUR_KEY" \
--header "Content-Type: application/json" \
--data-raw '[
{
"category_codes": [12191, 12193],
"language_name": "English",
"location_code": 2840,
"include_serp_info": true,
"limit": 3
}
]'Python
python
import requests
url = "https://api.seermartech.cn/v3/dataforseo_labs/google/keywords_for_categories/live"
payload = [
{
"category_codes": [12191, 12193],
"location_name": "United States",
"language_name": "English",
"filters": [
["keyword_info.search_volume", ">", 10]
],
"limit": 3
}
]
headers = {
"Authorization": "Bearer smt_live_YOUR_KEY",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json)TypeScript
typescript
import axios from "axios";
const postArray = [
{
category_codes: [12191, 12193],
language_name: "English",
location_code: 2840,
filters: [
["keyword_info.search_volume", ">", 10]
],
limit: 3
}
];
axios({
method: "post",
url: "https://api.seermartech.cn/v3/dataforseo_labs/google/keywords_for_categories/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.response?.data || error.message);
});响应结构
接口返回 JSON 数据,顶层 tasks 数组。
顶层字段
| 字段 | 类型 | 说明 |
|---|---|---|
version | string | 当前 API 版本 |
status_code | integer | 通用状态码 |
status_message | string | 通用状态信息 |
time | string | 执行耗时,单位秒 |
cost | float | 本次请求总费用,单位 USD |
tasks_count | integer | tasks 数组中的任务数 |
tasks_error | integer | 返回错误的任务数 |
tasks | array | 任务结果数组 |
tasks 数组字段
| 字段 | 类型 | 说明 |
|---|---|---|
id | string | 任务唯一标识,UUID 格式 |
status_code | integer | 任务状态码 |
status_message | string | 任务状态信息 |
time | string | 任务执行耗时 |
cost | float | 单任务费用,单位 USD |
result_count | integer | result 数组个数 |
path | array | 请求路径 |
data | object | 与请求体中提交参数一致 |
result | array | 结果数组 |
result 数组字段
| 字段 | 类型 | 说明 |
|---|---|---|
se_type | string | 搜索引擎类型 |
seed_categories | array | 请求中提交的分类 |
location_code | integer | 请求中的地区编码 |
language_code | string | 请求中的语言编码 |
total_count | integer | 数据库中匹该请求的总结果数 |
items_count | integer | 当前 items 返回条数 |
offset | integer | 当前偏移量 |
offset_token | string | 后续翻页令牌 |
items | array | 及数据 |
items 字段说明
基础字段
| 字段 | 类型 | 说明 |
|---|---|---|
se_type | string | 搜索引擎类型 |
keyword | string | 找到的 |
location_code | integer | 地区编码 |
language_code | string | 语言编码 |
keyword_info 对象
返回的基础指标数据。
| 字段 | 类型 | 说明 |
|---|---|---|
se_type | string | 搜索引擎类型 |
last_updated_time | string | 数据更新时间,UTC 格式:yyyy-mm-dd hh-mm-ss +00:00 |
competition | float | 竞价竞争度,取值 0 到 1 |
competition_level | string | 竞争级别,可为 LOW、MEDIUM、HIGH,未知时为 null |
cpc | float | 平均点击单价,单位 USD |
search_volume | integer | 平均月搜索量 |
low_top_of_page_bid | float | 首页顶部广告展示的较低出价参考 |
high_top_of_page_bid | float | 首页顶部广告展示的较高出价参考 |
categories | array | 所属产品/服务分类 |
monthly_searches | array | 最近 12 个月月度搜索量 |
search_volume_trend | object | 搜索量趋势变化 |
monthly_searches 子字段
| 字段 | 类型 | 说明 |
|---|---|---|
year | integer | 年份 |
month | integer | 月份 |
search_volume | integer | 当月搜索量 |
search_volume_trend 子字段
| 字段 | 类型 | 说明 |
|---|---|---|
monthly | integer | 相比上个月的变化百分比 |
quarterly | integer | 相比上季度的变化百分比 |
yearly | integer | 相比去年的变化百分比 |
clickstream_keyword_info 对象
当 include_clickstream_data=true 时返回。
| 字段 | 类型 | 说明 |
|---|---|---|
search_volume | integer | 基于点击流估算的月搜索量 |
last_updated_time | string | 点击流数据集更新时间 |
gender_distribution | object | 性别分布 |
age_distribution | object | 年龄分布 |
monthly_searches | array | 月度点击流搜索量 |
gender_distribution
| 字段 | 类型 | 说明 |
|---|---|---|
female | integer | 女性用户数 |
male | integer | 男性用户数 |
age_distribution
| 字段 | 类型 | 说明 |
|---|---|---|
18-24 | integer | 18-24 岁用户数 |
25-34 | integer | 25-34 岁用户数 |
35-44 | integer | 35-44 岁用户数 |
45-54 | integer | 45-54 岁用户数 |
55-64 | integer | 55-64 岁用户数 |
keyword_properties 对象
附加属性信息。
| 字段 | 类型 | 说明 |
|---|---|---|
se_type | string | 搜索引擎类型 |
core_keyword | string | 同义词聚类中的核心 |
synonym_clustering_algorithm | string | 同义词识别算法,可为 keyword_metrics 或 text_processing |
keyword_difficulty | integer | 排名难度,范围 0-100 |
detected_language | string | 系统识别出的语言 |
is_another_language | boolean | 是否与请求设置语言不同 |
words_count | integer | 词数 |
serp_info 对象
当 include_serp_info=true 时返回;若平台无对应 SERP 数据,也可能为 null。
| 字段 | 类型 | 说明 |
|---|---|---|
se_type | string | 搜索引擎类型 |
check_url | string | 搜索结果检查链接 |
serp_item_types | array | SERP 中出现的结果类型 |
se_results_count | string | 搜索结果数量 |
last_updated_time | string | 最近一次 SERP 更新时间 |
previous_updated_time | string | 上一次 SERP 更新时间 |
支持识别的 serp_item_types括:
answer_box、app、carousel、multi_carousel、featured_snippet、google_flights、google_reviews、third_party_reviews、google_posts、images、jobs、knowledge_graph、local_pack、hotels_pack、map、organic、paid、people_also_ask、related_searches、people_also_search、shopping、top_stories、twitter、video、events、mention_carousel、recipes、top_sights、scholarly_articles、popular_products、podcasts、questions_and_answers、find_results_on、stocks_box、visual_stories、commercial_units、local_services、google_hotels、math_solver、currency_box、product_considerations、found_on_web、short_videos、refine_products、explore_brands、perspectives、discussions_and_forums、compare_sites、courses、ai_overview
注意:明细结果对
organic、paid、featured_snippet、local_pack返回。
avg_backlinks_info 对象
返回该在自然搜索前 10 页面中的平均外链画像。
| 字段 | 类型 | 说明 |
|---|---|---|
se_type | string | 搜索引擎类型 |
backlinks | float | 平均外链数 |
dofollow | float | 平均 dofollow 链接数 |
referring_pages | float | 平均引荐页面数 |
referring_domains | float | 平均引荐域名数 |
referring_main_domains | float | 平均主域名数 |
rank | float | 平均 Rank 值 |
main_domain_rank | float | 平均主域名 Rank 值 |
last_updated_time | string | 外链数据更新时间 |
search_intent_info 对象
返回搜索意图信息。
| 字段 | 类型 | 说明 |
|---|---|---|
se_type | string | 搜索引擎类型支持 google |
main_intent | string | 主搜索意图:informational、navigational、commercial、transactional |
foreign_intent | array | 补搜索意图,取值同上 |
last_updated_time | string | 搜索意图数据更新时间 |
keyword_info_normalized_with_bing 对象
返回使用 Bing 搜索量归一化后的数据。
| 字段 | 类型 | 说明 |
|---|---|---|
last_updated_time | string | 数据集更新时间 |
search_volume | integer | 当前搜索量 |
is_normalized | boolean | 是否已使用 Bing 数据归一化 |
monthly_searches | array | 月度搜索量数据 |
keyword_info_normalized_with_clickstream 对象
返回使用点击流数据归一化后的数据。
| 字段 | 类型 | 说明 |
|---|---|---|
last_updated_time | string | 数据集更新时间 |
search_volume | integer | 当前搜索量 |
is_normalized | boolean | 是否已使用点击流数据归一化 |
monthly_searches | array | 月度搜索量数据 |
响应示例
json
{
"version": "0.1.20240801",
"status_code": 20000,
"status_message": "Ok.",
"time": "0.1943 sec.",
"cost": 0.0103,
"tasks_count": 1,
"tasks_error": 0,
"tasks": [
{
"data": {
"api": "dataforseo_labs",
"function": "keywords_for_categories",
"se_type": "google",
"category_codes": [12191, 12193],
"language_name": "English",
"location_code": 2840,
"include_serp_info": true,
"limit": 3
},
"result": [
{
"location_code": 2840,
"language_code": "en",
"total_count": 11982,
"items_count": 3,
"offset": 0,
"offset_token": "eyJDdXJyZW50T2Zmc2V0IjozLCJSZXF1ZXN0RGF0YSI6eyJjYXRlZ29yaWVzIjpbMTIxOTEsMTIxOTNdLCJsb2NhdGlvbiI6Mjg0MCwibGFuZ3VhZ2UiOiJlbiIsImludGVyc2VjdCI6dHJ1ZSwibG9hZF9zZXJwX2luZm8iOnRydWUsInNlYXJjaF9hZnRlcl90b2tlbiI6bnVsbCwiaWdub3JlX3N5bm9ueW1zIjpmYWxzZSwic2VhcmNoX2VuZ2luZSI6Imdvb2dsZSIsInVzZV9uZXdfY2F0ZWdvcmllcyI6dHJ1ZSwib3JkZXJfYnkiOnsib3JkZXJfZmllbGQiOiJrZXl3b3JkX2luZm8uc2VhcmNoX3ZvbHVtZSIsIm9yZGVyX3R5cGUiOiJEZXNjIiwibmV4dCI6bnVsbH0sImxpbWl0IjozLCJvZmZzZXQiOjAsImFpZCI6MTUzNX0sIlJhd1F1ZXJ5IjpudWxsLCJJZCI6IjQwY2ViMTk5LTk3ZGYtNGRmZC04MzJhLThkMmI3NWNlZGZiYSIsIlNlYXJjaEFmdGVyRGF0YSI6WzE0ODAwLCI4YjA2NzljNy1lZWVhLTFjMmEtYWRlNi0wNDg5M2FlZTc1NGEiXX0=",
"items": [
{
"se_type": "google",
"keyword": "desktop dell optiplex",
"location_code": 2840,
"language_code": "en",
"keyword_info": {
"se_type": "google",
"last_updated_time": "2024-08-08 11:13:37 +00:00",
"competition": 0.07,
"competition_level": "LOW",
"cpc": 0.51,
"search_volume": 18100,
"monthly_searches": [],
"search_volume_trend": {
"monthly": 22,
"quarterly": 22,
"yearly": 0
}
},
"clickstream_keyword_info": null,
"keyword_properties": {
"se_type": "google",
"core_keyword": "dell optiplex desktop",
"synonym_clustering_algorithm": "text_processing",
"keyword_difficulty": 19,
"detected_language": "en",
"is_another_language": false,
"words_count": 3
},
"serp_info": {
"se_type": "google",
"check_url": "https://www.google.com/search?q=desktop%20dell%20optiplex&num=100&hl=en&gl=US&gws_rd=cr&ie=UTF-8&oe=UTF-8&glp=1&uule=w+CAIQIFISCQs2MuSEtepUEUK33kOSuTsc",
"serp_item_types": ["organic", "paid"],
"se_results_count": 22200000,
"last_updated_time": "2024-07-14 22:14:14 +00:00",
"previous_updated_time": "2022-07-15 11:54:47 +00:00"
}
}
]
}
]
}
]
}状态码与错误处理
- 顶层
status_code表示整次请求状态 tasks[].status_code表示单个任务状态- 建议同时检查:
- HTTP 状态码
- 顶层
status_code - 任务级
tasks[].status_code
常见成功状态:
20000:成功
错误码完整列表可参考 /v3/appendix/errors。 建议在生产环境中建立统一的异常处理和重试机制,以下:
- 参数缺失或格式错误
- 地区/语言/分类编码无效 -出并发或频率限制
- 翻页时
offset_token失效或使用方式错误
使用建议
类别组合策略 若希望保留同时属于多个分类的,使用
category_intersection=true;如需尽可能扩大候选词覆盖面,使用false。大结果集分页
10,000条优用offset-过10,000条建议改用offset_token
控制成本
include_clickstream_data=true会提高成本。在确需查看点击流维度、归一化搜索量或人群分布时开启。去重与聚类 如果只想保留核心词,减少相似词噪音,可将
ignore_synonyms设为true。
实用场景
- 挖掘类目池:按产品分类批量获取,快速建立电商站、品牌站或站的类目词库。
- 筛选高价值投放词:结合
search_volume、cpc、competition过滤,优定位有商业价值且可投放的词。 - 识别季节性需求变化:利用
monthly_searches与search_volume_trend判断热度走势,排期和广告预算调整。 - 分析 SERP 竞争环境:开启
include_serp_info后查看 SERP 特征和结果量,判断目标词更适合做自然排名还是付费流量。 - 构建类目页与专题页结构:基于分类词及核心词聚类结果,规划站点信息架构,提升类目页覆盖度与链组织质量。