Skip to content

Google Ads 搜索量实时查询

POST /v3/keywords_data/google_ads/search_volume/live

本接口使用 POST 方法,路径为:

/v3/keywords_data/google_ads/search_volume/live

用于实时获取最多 1000 个的搜索量、月度搜索趋势、竞争程度、首页顶部广告出价等数据。历史数据最长可查询 4 年。

> Google Ads Keywords Data API 基于新版 Google Ads API。
> 本接口每个请求只能 1 个任务;每分钟每个账户最多调用 12 次。单个请求中的 keywords 数组最多 1000 个,按请求计费,与数量无。

计费说明

每次请求均会产生费用。示例响应中的 cost 为原始接口返回的任务成本字段;扣费以响应头 X-SeerMarTech-Charge-CNY 为准。

参考价约 ¥0.54 / 次。同一请求提交 1 个或 1000 个,单次请求价格相同。

所有 POST 请求体使用 UTF-8 编码的 JSON 格式,并以 JSON 数组提交:

json
[
  {
    "keywords": ["buy laptop", "cheap laptops for sale"]
  }
]

请求参数

参数类型说明
keywordsarray要查询的数组。最多 1000 个;每个最多 80 个字符、10 个单词。系统会将转换为小写格式。
location_namestring搜索位置的完整名称。不指定时返回范围结果。使用此参数后,无需同时指定 location_codelocation_coordinate
location_codeinteger搜索位置代码。不指定位置时返回范围结果。使用此参数后,无需同时指定 location_namelocation_coordinate
location_coordinatestring位置的 GPS 坐标,格式为 纬度,经度。数据将按该坐标所属国家返回。使用此参数后,无需同时指定 location_namelocation_code
language_namestring搜索语言的完整名称,例如 English
language_codestring搜索语言代码,例如 en
search_partnersboolean是否 Google 搜索合作伙伴网络的数据。默认值为 false
date_fromstring数据起始日期,格式为 yyyy-mm-dd。默认查询过去 12 个月。最早可查询至当前日期前 4 年。
date_tostring数据结束日期,格式为 yyyy-mm-dd。默认使用昨天日期。不能上个月,因为 Google Ads 不提供当月完整数据。
include_adult_keywordsboolean是否在结果中成人。默认值为 false。即使设为 true,受 Google Ads 政策限制,部分仍可能没有数据。
sort_bystring结果排序字段,支持 relevancesearch_volumecompetition_indexlow_top_of_page_bidhigh_top_of_page_bid。按降序排列。默认值为 relevance
tagstring自定义任务标识,最多 255 个字符。该值会原样返回在响应任务的 data 字段中。

限制

  • Google Ads 可能不会为部分组合返回数据。
  • 对于相似,Google Ads 可能返回合并后的搜索量。
  • 如需分别获取相似的搜索量,建议将拆分到不同请求中。
  • 不支持部分特殊符号、Unicode 符号或表符号。
  • 可能会被自动纠正。若提交的存在拼写错误,结果中的 spell 字段会返回修正后的拼写。

位置参数示例

text
location_name: London,England,United Kingdom
location_code: 2840
location_coordinate: 52.6178549,-155.352142

位置列表接口:

/v3/keywords_data/google_ads/locations

语言参数示例

text
language_name: English
language_code: en

语言列表接口:

/v3/keywords_data/google_ads/languages

日期限制

  • date_from 不能晚于 date_to 或昨天。
  • 当状态接口的 actual_datafalse 时,date_from 最多可设置为上上个月及更早日期。
  • 当状态接口的 actual_datatrue 时,date_from 可设置为上个月及更早日期。
  • date_to 不能设置为当前月份。

状态查询接口:

/v3/keywords_data/google_ads/status

请求示例

cURL

bash
curl --location --request POST \
  "https://api.seermartech.cn/v3/keywords_data/google_ads/search_volume/live" \
  --header "Authorization: Bearer smt_live_YOUR_KEY" \
  --header "Content-Type: application/json" \
  --data-raw '[
    {
      "location_code": 2840,
      "keywords": [
        "buy laptop",
        "cheap laptops for sale",
        "purchase laptop"
      ],
      "date_from": "2021-08-01",
      "search_partners": true
    }
  ]'

TypeScript

typescript
import axios from "axios";

const postData = [
  {
    location_code: 2840,
    keywords: [
      "buy laptop",
      "cheap laptops for sale",
      "purchase laptop",
    ],
    date_from: "2021-08-01",
    search_partners: true,
  },
];

axios
  .post(
    "https://api.seermartech.cn/v3/keywords_data/google_ads/search_volume/live",
    postData,
    {
      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

url = "https://api.seermartech.cn/v3/keywords_data/google_ads/search_volume/live"

payload = [
    {
        "location_code": 2840,
        "keywords": [
            "buy laptop",
            "cheap laptops for sale",
            "purchase laptop",
        ],
        "date_from": "2021-08-01",
        "search_partners": True,
    }
]

headers = {
    "Authorization": "Bearer smt_live_YOUR_KEY",
    "Content-Type": "application/json",
}

response = requests.post(url, json=payload, headers=headers, timeout=60)
response.raise_for_status()

result = response.json()
if result.get("status_code") == 20000:
    print(result)
else:
    print(
        "请求失败,错误码:%s,错误信息:%s"
        % (result.get("status_code"), result.get("status_message"))
    )

响应结构

接口返回 JSON 对象 tasks 数组。每个任务对应请求体中的一个任务对象。

顶层字段

字段类型说明
versionstring当前 API 版本。
status_codeinteger请求级状态码。20000 表示成功。
status_messagestring请求级状态信息。
timestring请求执行耗时,单位为秒。
costfloat平台原始 USD 成本兼容字段;人民币实扣以 X-SeerMarTech-Charge-CNY 为准。
tasks_countintegertasks 数组中的任务总数。
tasks_errorinteger执行失败的任务数量。
tasksarray任务结果数组。

tasks 字段

字段类型说明
idstring任务唯一标识,UUID 格式。
status_codeinteger任务状态码,通常位于 1000060000 范围。
status_messagestring任务状态信息。
timestring任务执行耗时,单位为秒。
costfloat平台原始 USD 成本兼容字段;人民币实扣以 X-SeerMarTech-Charge-CNY 为准。
result_countintegerresult 数组中的结果数量。
patharray请求 URL 路径信息。
dataarray与 POST 请求中提交的参数基本一致。
resultarray搜索量结果数组。

result 字段

字段类型说明
keywordstring返回的。已对编码进行解码,+ 字符会被解码为空格。
spellstring | null的正确拼写。如果提交的存在拼写错误,可能返回修正后的拼写;否则通常为 null
location_codeinteger | null请求中的位置代码。无数据时为 null
language_codestring | null请求中的语言代码。无数据时为 null
search_partnersboolean是否搜索合作伙伴网络数据。
competitionstring | null付费搜索结果中的相对竞争程度,可能为 HIGHMEDIUMLOW。无数据时为 null
competition_indexinteger | null付费搜索结果中的竞争指数,范围为 0 至 100。无数据时为 null
search_volumeinteger | null月均搜索量,表示目标区域该的大致月搜索次数。无数据时为 null
low_top_of_page_bidfloat | null广告展示在第一页顶部所需的较低参考出价。通常高于约 20% 的最低有效出价,数值会因目标位置不同而变化。
high_top_of_page_bidfloat | null广告展示在第一页顶部所需的较高参考出价。通常高于约 80% 的最低有效出价,数值会因目标位置不同而变化。
cpcfloat | null单次点击费用参考值。
monthly_searchesarray | null按月拆分的搜索量数据,默认覆盖过去 12 个月。无数据时为 null

monthly_searches 字段

字段类型说明
yearinteger年份。
monthinteger月份,取值范围为 1 至 12。
search_volumeinteger该月份的搜索量。

响应示例

json
{
  "version": "0.1.20231117",
  "status_code": 20000,
  "status_message": "Ok.",
  "time": "1.9903 sec.",
  "cost": 0.075,
  "tasks_count": 1,
  "tasks_error": 0,
  "tasks": [
    {
      "id": "00000000-0000-0000-0000-000000000000",
      "status_code": 20000,
      "status_message": "Ok.",
      "time": "1.8500 sec.",
      "cost": 0.075,
      "result_count": 2,
      "path": [
        "v3",
        "keywords_data",
        "google_ads",
        "search_volume",
        "live"
      ],
      "data": {
        "api": "keywords_data",
        "function": "search_volume",
        "se": "google_ads",
        "language_code": "en",
        "location_code": 2840,
        "keywords": [
          "cheap laptops for sale",
          "purchase laptop"
        ],
        "date_from": "2021-08-01"
      },
      "result": [
        {
          "keyword": "cheap laptops for sale",
          "spell": null,
          "location_code": 2840,
          "language_code": "en",
          "search_partners": false,
          "competition": "HIGH",
          "competition_index": 100,
          "search_volume": 6600,
          "low_top_of_page_bid": 0.38,
          "high_top_of_page_bid": 2.78,
          "cpc": 1.25,
          "monthly_searches": [
            {
              "year": 2022,
              "month": 11,
              "search_volume": 6600
            }
          ]
        },
        {
          "keyword": "purchase laptop",
          "spell": null,
          "location_code": 2840,
          "language_code": "en",
          "search_partners": false,
          "competition": "HIGH",
          "competition_index": 99,
          "search_volume": 110,
          "low_top_of_page_bid": 2.07,
          "high_top_of_page_bid": 15.43,
          "cpc": 12.74,
          "monthly_searches": [
            {
              "year": 2022,
              "month": 11,
              "search_volume": 110
            }
          ]
        }
      ]
    }
  ]
}

状态码与错误处理

  • 顶层 status_code 用于判断整个请求是否成功。
  • 任务级 tasks[].status_code 用于判断任务是否成功。
  • 20000 表示成功。
  • 建议根据状态码和 status_message 实现异常处理、重试和日志记录。
  • 完整状态码列表请参考错误码文档。

实用场景

  • 批量评估搜索需求:一次提交最多 1000 个,快速建立 SEO 选词和规划所需的搜索量数据。
  • 比较不同地区的潜力:通过 location_codelocation_coordinate 获取指定市场数据,为区域化 SEO 和海外市场决策提供依据。
  • 分析商业竞争度:结合 competitioncompetition_indexcpc 和顶部广告出价,筛选流量和商业价值的。
  • 追踪季节性变化:利用 monthly_searches 观察过去 12 个月的月度趋势,识别季节性需求和发布窗口。
  • 校验拼写与搜索合作伙伴影响:结合 spellsearch_partners 字段,检查纠正,并比较 Google 主搜索与合作伙伴网络之间的搜索量差异。

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