主题
设置 Google 拓展实时任务
本接口使用 POST 方法,路径为:
/v3/keywords_data/google/keywords_for_keywords/live
> 说明:Google AdWords 数据接口已属于旧版能力,建议迁移至 Google Ads API。本文档保留原容路径,便于现有系统继续使用。
本接口可根据指定获取建议。单个任务最多提交 200 个,并实时返回搜索结果。
由于 Google API 的结果会受到广告账户历史、账户已有广告素材及因素影响,接口返回的数据可能与规划中的估算值不同。若业务要求即时获得结果,建议使用本实时接口。与标准任务接口相比,本接口无需提交任务、再单独查询结果,但实时接口的计费方式可能不同。
如无需实时返回结果,也可以使用标准任务接口,通过分别调用任务提交和结果查询接口获取数据。搜索量的更新状态可通过以下接口查询:
/v3/keywords_data/google/adwords_status
请求信息
- 请求方法:
POST - 请求地址:
text
https://api.seermartech.cn/v3/keywords_data/google/keywords_for_keywords/live- Content-Type:
application/json - 请求体格式: JSON 数组,UTF-8 编码 平台限流以认证说明中的 30/60/120 次/分钟规则为准
- 计费方式: 按请求计费。扣费以响应头
X-SeerMarTech-Charge-CNY为准。
请求参数
请求体是数组,每个数组代表一个任务。
| 参数 | 类型 | 填 | 说明 |
|---|---|---|---|
keywords | array | 是 | 用于获取的列表。最多 200 个。会被转换为小写,结果将在单独的结果数组中返回。 |
location_name | string | 否 | 搜索引擎地区的完整名称。使用此参数时,无需同时指定 location_code 或 location_coordinate。可通过 /v3/keywords_data/google/locations 获取可用地区列表。忽略此参数时返回结果。示例:London,England,United Kingdom |
location_code | integer | 否 | 搜索引擎地区代码。使用此参数时,无需同时指定 location_name 或 location_coordinate。可通过 /v3/keywords_data/google/locations 获取地区代码。忽略此参数时返回结果。示例:2840 |
location_coordinate | string | 否 | 地区 GPS 坐标,格式为 纬度,经度。数据将该坐标所属国家返回。使用此参数时,无需同时指定 location_name 或 location_code。忽略此参数时返回结果。示例:52.6178549,-155.352142 |
language_name | string | 否 | 搜索引擎语言的完整名称。使用此参数时,无需同时指定 language_code。可通过 /v3/keywords_data/google/languages 获取可用语言列表。忽略此参数时返回所有可用语言的结果。示例:English |
language_code | string | 否 | 搜索引擎语言代码。使用此参数时,无需同时指定 language_name。可通过 /v3/keywords_data/google/languages 获取语言代码。忽略此参数时返回所有可用语言的结果。示例:en |
search_partners | boolean | 否 | 是否 Google 搜索合作伙伴网络的数据。true 表示同时返回 Google 及搜索合作伙伴的数据。默认值:false。 |
sort_by | string | 否 | 结果排序字段。支持 search_volume(搜索量)或 relevance(性),按降序排列。默认值:search_volume。 |
keywords_negative | array | 否 | 需要从结果中排除的列表。最多 200 个,会被转换为小写。 |
closely_variants | boolean | 否 | 是否返回与高度的结果。默认值:false。当设置为 true 时,keywords_negative 中的不能与的 keywords 相同。 |
tag | string | 否 | 用户自定义任务标识,最长 255 个字符。可用于任务与结果。提交的值会在响应的 data 对象中返回。 |
location_name、location_code 和 location_coordinate 三只能选择一;language_name 和 language_code 只能选择一。
请求示例
curl
bash
curl --location --request POST \
"https://api.seermartech.cn/v3/keywords_data/google/keywords_for_keywords/live" \
--header "Authorization: Bearer smt_live_YOUR_KEY" \
--header "Content-Type: application/json" \
--data-raw '[
{
"location_name": "United States",
"language_name": "English",
"keywords": [
"average page rpm adsense",
"adsense blank ads how long",
"leads and prospects"
],
"tag": "tag1"
}
]'Python
python
import requests
url = "https://api.seermartech.cn/v3/keywords_data/google/keywords_for_keywords/live"
payload = [
{
"location_name": "United States",
"language_name": "English",
"keywords": [
"average page rpm adsense",
"adsense blank ads how long",
"leads and prospects"
],
"tag": "tag1"
}
]
headers = {
"Authorization": "Bearer smt_live_YOUR_KEY",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
result = response.json()
if result.get("status_code") == 20000:
print(result)
else:
print(
f"请求失败,状态码:{result.get('status_code')},"
f"消息:{result.get('status_message')}"
)TypeScript
typescript
import axios from "axios";
const response = await axios.post(
"https://api.seermartech.cn/v3/keywords_data/google/keywords_for_keywords/live",
[
{
location_name: "United States",
language_name: "English",
keywords: [
"average page rpm adsense",
"adsense blank ads how long",
"leads and prospects"
],
tag: "tag1"
}
],
{
headers: {
Authorization: "Bearer smt_live_YOUR_KEY",
"Content-Type": "application/json"
}
}
);
if (response.data.status_code === 20000) {
console.log(response.data);
} else {
console.error(
`请求失败,状态码:${response.data.status_code},` +
`消息:${response.data.status_message}`
);
}PHP
php
<?php
$url = 'https://api.seermartech.cn/v3/keywords_data/google/keywords_for_keywords/live';
$payload = [
[
'location_name' => 'United States',
'language_name' => 'English',
'keywords' => [
'average page rpm adsense',
'adsense blank ads how long',
'leads and prospects'
],
'tag' => 'tag1'
]
];
$ch = curl_init($url);
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer smt_live_YOUR_KEY',
'Content-Type: application/json'
],
CURLOPT_POSTFIELDS => json_encode($payload, JSON_UNESCAPED_UNICODE)
]);
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
if ($response === false) {
echo '请求失败:' . curl_error($ch);
} else {
echo "HTTP 状态码:{$httpCode}\n";
echo $response;
}
curl_close($ch);响应结构
接口返回 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 | 结果数组。 |
result 结果字段
| 字段 | 类型 | 说明 |
|---|---|---|
keyword | string | 返回的。 |
location_code | integer | null | 地区代码。无数据时为 null。 |
language_code | string | null | 语言代码。无数据时为 null。 |
search_partners | boolean | 是否搜索合作伙伴网络的数据。 |
competition | float | null | 付费搜索结果页中的相对竞争程度,取值范围为 0 到 1,边界值。无数据时为 null。 |
cpc | float | null | 历史平均每次点击费用。原始数据以口径提供;如需人民币计费信息,请以响应头 X-SeerMarTech-Charge-CNY 为准。无数据时为 null。 |
search_volume | integer | null | 月均搜索量,表示目标地区 Google 或 Google 及合作伙伴上的近似月搜索次数。无数据时为 null。 |
categories | array | null | 产品和服务类别。无数据时为 null。 |
monthly_searches | array | null | 最近 12 个月的月度搜索量,指定地理位置统计。无数据时为 null。 |
monthly_searches 字段
| 字段 | 类型 | 说明 |
|---|---|---|
year | integer | 年份。 |
month | integer | 月份。 |
search_volume | integer | 对应月份的近似搜索量。 |
响应示例
json
{
"version": "0.1.20200130",
"status_code": 20000,
"status_message": "Ok.",
"time": "0 sec.",
"cost": 0,
"tasks_count": 1,
"tasks_error": 0,
"tasks": [
{
"id": "060815ต1-0001-0000-0000-000000000000",
"status_code": 20000,
"status_message": "Ok.",
"time": "0 sec.",
"cost": 0,
"result_count": 4,
"path": [
"v3",
"keywords_data",
"google",
"keywords_for_keywords",
"live"
],
"data": {
"api": "keywords_data",
"function": "keywords_for_keywords",
"se": "google",
"location_name": "United States",
"language_name": "English",
"keywords": [
"average page rpm adsense",
"adsense blank ads how long",
"leads and prospects"
],
"tag": "tag1"
},
"result": [
{
"keyword": "google adsense",
"location_code": 2840,
"language_code": "en",
"search_partners": false,
"competition": 0.1818930929281237,
"cpc": 1.858456,
"search_volume": 110000,
"categories": [],
"monthly_searches": [
{
"year": 2024,
"month": 1,
"search_volume": 110000
}
]
},
{
"keyword": "adsense",
"location_code": 2840,
"language_code": "en",
"search_partners": false,
"competition": 0.10024431527022201,
"cpc": 1.427514,
"search_volume": 110000,
"categories": [],
"monthly_searches": [
{
"year": 2024,
"month": 1,
"search_volume": 110000
}
]
},
{
"keyword": "prospect",
"location_code": 2840,
"language_code": "en",
"search_partners": false,
"competition": 0.0032797439370289166,
"cpc": 4.623882,
"search_volume": 90500,
"categories": [],
"monthly_searches": [
{
"year": 2024,
"month": 1,
"search_volume": 90500
}
]
},
{
"keyword": "mlm",
"location_code": 2840,
"language_code": "en",
"search_partners": false,
"competition": 0.04609994966369266,
"cpc": 5.00388,
"search_volume": 90500,
"categories": [],
"monthly_searches": [
{
"year": 2024,
"month": 1,
"search_volume": 90500
}
]
}
]
}
]
}状态码与异常处理
20000表示请求成功。- 请求级错误可通过顶层
status_code和status_message判断。 - 单个任务的执行结果应通过
tasks[].status_code和tasks[].status_message判断。 - 建议客户端同时处理 HTTP 错误、请求级错误、任务级错误及结果为空等。
- 完整错误码列表请参考本平台错误码文档。
实用场景
- 拓展种子:根据一组核心词获取,扩大 SEO规划和覆盖范围。
- 筛选高潜力:结合搜索量、竞争程度和每次点击费用,优选择流量与商业价值的词。
- 生成地区化单:按国家、城市或坐标查询数据,支持本地 SEO 和区域广告投放。
- 分析趋势:读取最近 12 个月的月度搜索量,识别季节性需求并安排发布时间。
- 排除无词并聚焦近似变体:使用
keywords_negative和closely_variants控制结果范围,提高聚类和广告组构建效率。