主题
按任务 ID 获取 Google 搜索量结果
本接口使用 GET /v3/keywords_data/google/search_volume/task_get/$id,根据任务 ID 获取 Google 搜索量数据。接口返回最近一个月的搜索量、过去 12 个月的搜索趋势、平均每次点击费用(CPC)以及付费搜索竞争度等信息。
> 注意:Google AdWords Keywords Data API 已属于旧版接口,建议逐步迁移至 Google Ads API。
请求信息
- 请求方法:
GET - 请求路径:
/v3/keywords_data/google/search_volume/task_get/$id - 完整 URL:
https://api.seermartech.cn/v3/keywords_data/google/search_volume/task_get/$id - 请求体:无
路径参数
| 参数 | 类型 | 说明 |
|---|---|---|
id | string | 任务唯一标识,UUID 格式。任务提交成功后,可在 30 天使用该 ID 查询结果。 |
计费说明
任务结果查询在任务提交后的 30 天不额外收费。扣费以响应头 X-SeerMarTech-Charge-CNY 为准。
响应结构
接口返回 JSON 数据 tasks 数组。
顶层字段
| 字段 | 类型 | 说明 |
|---|---|---|
version | string | 当前 API 版本。 |
status_code | integer | 通用状态码。完整状态码请参考错误码文档。建议对异常及错误状态进行统一处理。 |
status_message | string | 通用状态说明。 |
time | string | 接口执行耗时,单位为秒。 |
cost | float | 平台原始 USD 成本兼容字段;人民币实扣以 X-SeerMarTech-Charge-CNY 为准。 |
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 成本兼容字段;人民币实扣以 X-SeerMarTech-Charge-CNY 为准。 |
result_count | integer | result 数组中的结果数量。 |
path | array | 请求路径信息。 |
data | object | 创建任务时提交的参数。 |
result | array | 搜索量结果数组。 |
data 字段
data 中创建任务时提交的参数,例如、地区、语言和标签等:
| 字段 | 类型 | 说明 |
|---|---|---|
api | string | API 名称,例如 keywords_data。 |
function | string | 接口功能名称,例如 search_volume。 |
se | string | 搜索引擎名称,例如 google。 |
location_name | string | 地区名称。 |
keywords | array | 请求中的列表。 |
tag | string | 用户自定义任务标签。 |
result 数组字段
| 字段 | 类型 | 说明 |
|---|---|---|
keyword | string | 请求中的。 |
location_code | integer | 请求中的地区代码。无数据时返回 null。 |
language_code | string | 请求中的语言代码。无数据时返回 null。 |
search_partners | boolean | 是否搜索合作伙伴网络的数据。 |
competition | float | 付费搜索竞争度,取值范围为 0 至 1,边界值。该值基于 Google Ads 数据表示付费搜索结果中的相对竞争程度。无数据时返回 null。 |
cpc | float | 平均每次点击费用,表示该历史平均 CPC。无数据时返回 null。 |
search_volume | integer | 月均搜索量,表示指定定位条件下该在 Google 或 Google 及合作伙伴网络中的近似月均搜索次数。无数据时返回 null。 |
categories | array | 产品和服务分类。无数据时返回 null。 |
monthly_searches | array | 过去 12 个月的月度搜索量数据。无数据时返回 null。 |
monthly_searches 数组字段
| 字段 | 类型 | 说明 |
|---|---|---|
year | integer | 年份。 |
month | integer | 月份。 |
search_volume | integer | 当月近似搜索量。 |
请求示例
cURL
bash
TASK_ID="02031608-0696-0110-0000-a81d0414edbe"
curl --location --request GET \
"https://api.seermartech.cn/v3/keywords_data/google/search_volume/task_get/${TASK_ID}" \
--header "Authorization: Bearer smt_live_YOUR_KEY" \
--header "Content-Type: application/json"TypeScript
typescript
import axios from "axios";
const taskId = "02231934-2604-0066-2000-570459f04879";
axios
.get(
`https://api.seermartech.cn/v3/keywords_data/google/search_volume/task_get/${taskId}`,
{
headers: {
Authorization: "Bearer smt_live_YOUR_KEY",
"Content-Type": "application/json",
},
}
)
.then((response) => {
// 处理任务结果
console.log(response.data);
})
.catch((error) => {
// 处理请求错误
console.error(error.response?.data || error.message);
});Python
python
import requests
task_id = "02031608-0696-0110-0000-a81d0414edbe"
url = (
"https://api.seermartech.cn/v3/keywords_data/google/"
f"search_volume/task_get/{task_id}"
)
response = requests.get(
url,
headers={
"Authorization": "Bearer smt_live_YOUR_KEY",
"Content-Type": "application/json",
},
)
if response.ok:
result = response.json()
print(result)
else:
print(f"请求失败:HTTP {response.status_code}")
print(response.text)PHP
php
<?php
$taskId = '02031608-0696-0110-0000-a81d0414edbe';
$url = 'https://api.seermartech.cn/v3/keywords_data/google/'
. 'search_volume/task_get/' . $taskId;
$ch = curl_init($url);
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer smt_live_YOUR_KEY',
'Content-Type: application/json',
],
]);
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
if ($response === false) {
echo '请求失败:' . curl_error($ch);
} else {
echo "HTTP 状态码:{$httpCode}\n";
print_r(json_decode($response, true));
}
curl_close($ch);C#
csharp
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading.Tasks;
public class SearchVolumeExample
{
public static async Task GetTaskResultAsync()
{
var taskId = "02031608-0696-0110-0000-a81d0414edbe";
using var httpClient = new HttpClient();
httpClient.DefaultRequestHeaders.Authorization =
new AuthenticationHeaderValue(
"Bearer",
"smt_live_YOUR_KEY"
);
var url =
"https://api.seermartech.cn/v3/keywords_data/google/" +
$"search_volume/task_get/{taskId}";
var response = await httpClient.GetAsync(url);
var content = await response.Content.ReadAsStringAsync();
if (response.IsSuccessStatusCode)
{
Console.WriteLine(content);
}
else
{
Console.WriteLine(
$"请求失败:HTTP {(int)response.StatusCode} {content}"
);
}
}
}响应示例
json
{
"version": "0.1.20200130",
"status_code": 20000,
"status_message": "Ok.",
"time": "0 sec.",
"cost": 0,
"tasks_count": 1,
"tasks_error": 0,
"tasks": [
{
"id": "02031608-0696-0110-0000-a81d0414edbe",
"status_code": 20000,
"status_message": "Ok.",
"time": "0 sec.",
"cost": 0,
"result_count": 1,
"path": [
"v3",
"keywords_data",
"google",
"search_volume",
"task_get",
"02031608-0696-0110-0000-a81d0414edbe"
],
"data": {
"api": "keywords_data",
"function": "search_volume",
"se": "google",
"location_name": "London,England,United Kingdom",
"keywords": [
"seo tools"
],
"tag": "tag1"
},
"result": [
{
"keyword": "seo tools",
"location_code": 1006886,
"language_code": "en",
"search_partners": false,
"competition": 0.85,
"cpc": 12.45,
"search_volume": 18100,
"categories": [
10001
],
"monthly_searches": [
{
"year": 2024,
"month": 1,
"search_volume": 18100
},
{
"year": 2023,
"month": 12,
"search_volume": 16500
}
]
}
]
}
]
}错误处理
建议同时检查以下状态字段:
- 顶层
status_code - 任务级
tasks[].status_code - 顶层及任务级
status_message tasks_errorresult是否为空或为null
当任务状态码表示错误,或任务尚未生成结果时,应根据 status_message 记录日志并执行重试或异常处理。完整错误码请参考本平台错误码文档。
实用场景
- 评估商业价值:结合
search_volume、cpc和competition筛选高需求、高商业意图,优化 SEO 与付费广告预算分。 - 分析季节性趋势:读取
monthly_searches对比过去 12 个月的搜索量,制定季度计划和促销节奏。 - 对比不同地区的搜索需求:使用不同
location_code查询同一,发现区域市场差异,支持本地化 SEO 和市场决策。 - 构建优级模型:将搜索量、竞争度、CPC 和业务分类结合起来,为库自动评分并生成优化排序。
- 监控合作伙伴网络影响:通过
search_partners区分 Google 搜索与合作伙伴网络数据,评估数据口径差异对投放和分析的影响。