Skip to content

为网站生成任务接口

POST /v3/keywords_data/google/keywords_for_site/task_post

接口说明

POST /v3/keywords_data/google/keywords_for_site/task_post

该接口用于为指定域名创建“网站”采集任务。任务完成后,可获得与目标网站的一组,以及这些的核心投放与搜索数据:

  • 所属分类
  • 上月搜索量
  • 近 12 个月搜索量趋势
  • 当前平均点击成本(CPC)
  • 付费搜索竞争度

这是标准任务模式:创建任务,再系统异步处理,随后通过结果接口、pingback_urlpostback_url 获取结果。若不要求实时返回,这是更适合批量采集和成本控制的方式。

说明:该能力属于较早版本的数据接口,现有体系中已逐步由新版 Google Ads 能力替代;如你正在使用旧版容链路,建议结合新版能力规划迁移。

请求地址

text
POST https://api.seermartech.cn/v3/keywords_data/google/keywords_for_site/task_post

计费说明

  • 成功创建任务时计费
  • 单次请求最多返回约 700 个建议及核心数据
  • 无论最终返回 1 个还是 700 个,该次请求费用相同
  • 参考价约 ¥0.8000 / 次
  • 实扣费以响应头 X-SeerMarTech-Charge-CNY 为准

使用规则

  • 请求体为 JSON UTF-8
  • POST 请求体格式为 JSON 数组[{ ... }]
  • 单次 POST 最多可提交 100 个任务
  • 接口频率上限为 2000 次 API 调用/分钟
  • 如果单次 POST 中任务数 100,出部分将返回错误 40006

结果获取方式

任务提交后,可通过以下方式获取结果:

  1. 使用任务唯一标识 id 查询已完成任务结果
  2. 创建任务时设置 postback_url,任务完成后由本平台向该地址发送 POST 回调,数据为 gzip 压缩
  3. 创建任务时设置 pingback_url,任务完成后由本平台向该地址发送 GET 通知

注意:如果你的服务器在 10 秒未响应回调,请求会因时中止,任务会转对应的 tasks_ready 列表,后续可再主动获取结果。


请求参数

以下字段用于创建任务。

字段名类型说明
targetstring。目标网站的域名。示例:example.com
location_namestring可选。搜索引擎地区完整名称。使用该字段时,无需再传 location_codelocation_coordinate。可通过 /v3/keywords_data/google/locations 获取可用地区列表。忽略该字段则返回结果。示例:London,England,United Kingdom
location_codeinteger可选。搜索引擎地区编码。使用该字段时,无需再传 location_namelocation_coordinate。可通过 /v3/keywords_data/google/locations 获取可用地区编码。忽略该字段则返回结果。示例:2840
location_coordinatestring可选。地理坐标,格式为 "latitude,longitude"。使用该字段时,无需再传 location_namelocation_code。返回数据将对应到该坐标所属国家。忽略该字段则返回结果。示例:52.6178549,-155.352142
language_namestring可选。搜索引擎语言完整名称。使用该字段时,无需再传 language_code。可通过 /v3/keywords_data/google/languages 获取可用语言列表。忽略该字段则返回所有可用语言结果。示例:English
language_codestring可选。搜索引擎语言编码。使用该字段时,无需再传 language_name。可通过 /v3/keywords_data/google/languages 获取可用语言编码。忽略该字段则返回所有可用语言结果。示例:en
sort_bystring可选。结果排序方式,支持按 search_volumerelevance 降序排序。默认值:search_volume
keywords_negativearray可选。排除数组。结果中会忽略这些词;最多可指定 200 个词条;系统会自动转为小写
postback_urlstring可选。结果回传地址。任务完成后,本平台会向该地址发送 POST 请求,并附带 gzip 压缩结果。可使用 $id 作为任务 id 变量,$tag 作为经过 URL 编码的 tag 变量。示例:http://your-server.com/postbackscript?id=$id
pingback_urlstring可选。完成通知地址。任务完成后,本平台会向该地址发送 GET 请求。可使用 $id 作为任务 id 变量,$tag 作为经过 URL 编码的 tag 变量。示例:http://your-server.com/pingscript?id=$id&tag=$tag
tagstring可选。用户自定义任务标识,最长 255 个字符。可用于将任务与业务记录;响应中的 data 对象会返回该值

回调 URL 注意事项

  • postback_urlpingback_url 中的特殊字符会被 URL 编码
  • 例如 # 会编码为 %23

响应结构

接口返回 JSON 数据,顶层 tasks 数组。

顶层字段

字段名类型说明
versionstring当前 API 版本
status_codeinteger通用状态码
status_messagestring通用状态信息
timestring执行耗时,单位:秒
costfloat本次所有任务总费用,单位:USD
tasks_countintegertasks 数组中的任务数量
tasks_errorinteger返回错误的任务数量
tasksarray任务数组

tasks[] 字段

字段名类型说明
idstring任务唯一标识,UUID 格式
status_codeinteger任务状态码,范围通常为 10000-60000
status_messagestring任务状态信息
timestring当前任务处理耗时,单位:秒
costfloat当前任务费用,单位:USD
result_countintegerresult 数组数量
patharray请求路径
dataobject回显你在 POST 请求中提交的参数
resultarray | null结果数组。对于任务创建接口,此处通常为 null

建议在接时对 status_codetasks[].status_code 建立完善的异常处理机制。


请求示例

cURL

bash
curl --location --request POST "https://api.seermartech.cn/v3/keywords_data/google/keywords_for_site/task_post" \
--header "Authorization: Bearer smt_live_YOUR_KEY" \
--header "Content-Type: application/json" \
--data-raw '[
 {
 "location_name": "United States",
 "target": "example.com"
 },
 {
 "language_code": "en",
 "location_code": 2840,
 "target": "example.com",
 "tag": "some_string_123",
 "pingback_url": "https://your-server.com/pingscript?id=$id&tag=$tag"
 },
 {
 "location_name": "United States",
 "language_name": "English",
 "target": "example.com",
 "postback_url": "https://your-server.com/postbackscript"
 }
]'

Python

python
import requests

url = "https://api.seermartech.cn/v3/keywords_data/google/keywords_for_site/task_post"
headers = {
 "Authorization": "Bearer smt_live_YOUR_KEY",
 "Content-Type": "application/json"
}

data = [
 {
 "location_name": "United States",
 "target": "example.com"
 },
 {
 "language_code": "en",
 "location_code": 2840,
 "target": "example.com",
 "tag": "some_string_123",
 "pingback_url": "https://your-server.com/pingscript?id=$id&tag=$tag"
 },
 {
 "location_name": "United States",
 "language_name": "English",
 "target": "example.com",
 "postback_url": "https://your-server.com/postbackscript"
 }
]

resp = requests.post(url, headers=headers, json=data)
print(resp.json)

TypeScript

typescript
import axios from "axios";

const postData = [
 {
 location_name: "United States",
 target: "example.com",
 },
 {
 language_code: "en",
 location_code: 2840,
 target: "example.com",
 tag: "some_string_123",
 pingback_url: "https://your-server.com/pingscript?id=$id&tag=$tag",
 },
 {
 location_name: "United States",
 language_name: "English",
 target: "example.com",
 postback_url: "https://your-server.com/postbackscript",
 },
];

axios({
 method: "post",
 url: "https://api.seermartech.cn/v3/keywords_data/google/keywords_for_site/task_post",
 headers: {
 Authorization: "Bearer smt_live_YOUR_KEY",
 "Content-Type": "application/json",
 },
 data: postData,
})
 .then((response) => {
 console.log(response.data);
 })
 .catch((error) => {
 console.error(error);
 });

响应示例

json
{
 "version": "0.1.20200130",
 "status_code": 20000,
 "status_message": "Ok.",
 "time": "0.1108 sec.",
 "cost": 0.15,
 "tasks_count": 3,
 "tasks_error": 0,
 "tasks": [
 {
 "id": "01301901-1535-0108-0000-f7f0d3d1a111",
 "status_code": 20100,
 "status_message": "Task Created.",
 "time": "0.0020 sec.",
 "cost": 0.05,
 "result_count": 0,
 "path": [
 "v3",
 "keywords_data",
 "google",
 "keywords_for_site",
 "task_post"
 ],
 "data": {
 "api": "keywords_data",
 "function": "keywords_for_site",
 "se": "google",
 "location_name": "United States",
 "target": "example.com"
 },
 "result": null
 },
 {
 "id": "01301901-1535-0108-0000-daf9eadecca9",
 "status_code": 20100,
 "status_message": "Task Created.",
 "time": "0.0019 sec.",
 "cost": 0.05,
 "result_count": 0,
 "path": [
 "v3",
 "keywords_data",
 "google",
 "keywords_for_site",
 "task_post"
 ],
 "data": {
 "api": "keywords_data",
 "function": "keywords_for_site",
 "se": "google",
 "language_code": "en",
 "location_code": 2840,
 "target": "example.com",
 "pingback_url": "https://your-server.com/pingscript?id=$id&tag=$tag",
 "tag": "some_string_123"
 },
 "result": null
 },
 {
 "id": "01301901-1535-0108-0000-d86ef6dbd3a8",
 "status_code": 20100,
 "status_message": "Task Created.",
 "time": "0.0018 sec.",
 "cost": 0.05,
 "result_count": 0,
 "path": [
 "v3",
 "keywords_data",
 "google",
 "keywords_for_site",
 "task_post"
 ],
 "data": {
 "api": "keywords_data",
 "function": "keywords_for_site",
 "se": "google",
 "location_name": "United States",
 "language_name": "English",
 "target": "example.com",
 "postback_url": "https://your-server.com/postbackscript"
 },
 "result": null
 }
 ]
}

状态码说明

以下是本接口中最常见的状态码:

状态码含义
20000请求成功
20100任务已创建
40006单次 POST 中提交的任务数出上限( 100)

更多错误码与状态信息请参考 /v3/appendix/errors

补说明

  • 若未指定 location_namelocation_codelocation_coordinate,则返回范围的数据
  • 若未指定 language_namelanguage_code,则返回所有可用语言的数据
  • keywords_negative 最多支持排除 200 个词
  • 如果你的业务需要即时结果,可改用对应的 实时(Live)接口;Live 模式无需拆分 POST/GET 两步

实用场景

  • 挖掘网站主题词:竞争对手域名,快速获取集合,用于建立行业词库和选题池。
  • 评估自然流量机会:结合返回的搜索量与趋势数据,筛选高增长,帮助判断值得的 SEO 方向。
  • 投放选词:利用 CPC 和竞争度字段识别商业价值较高的词,支持搜索广告拓展。
  • 排除无流量词:合 keywords_negative 过滤品牌无、低或不希望覆盖的词,提升结果可用性。
  • 构建竞品监控任务:批量提交多个域名任务,定期分析竞品网站覆盖的范围,发现新增主题与市场变化。

统一入口:官网 · LLM API · 控制台