Skip to content

本平台 Labs 类别列表

GET /v3/dataforseo_labs/categories

接口说明

GET https://api.seermartech.cn/v3/dataforseo_labs/categories

本接口返回 本平台 Labs 容接口支持的完整 Google 产品与服务类别列表。接口不收取调用费用。

类别数据类别编码、类别名称及父级类别编码,可用于构建类别筛选、行业分类和分析条件。

接口返回 JSON 格式数据 tasks 数组。

请求方式

  • HTTP 方法GET
  • 请求路径/v3/dataforseo_labs/categories
  • 请求体:无
  • 认证方式:Bearer Token

请求头

http
Authorization: Bearer smt_live_YOUR_KEY
Content-Type: application/json

计费说明

本接口调用,响应中的 cost 通常为 0

如平台后续对接口产生计费,扣费以响应头 X-SeerMarTech-Charge-CNY 为准。

响应字段

顶层字段

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

tasks 对象字段

字段类型说明
idstring任务唯一标识,采用 UUID 格式
status_codeinteger任务状态码,通常在 1000060000 范围
status_messagestring任务状态说明
timestring任务执行耗时,单位为秒
costfloat平台原始 USD 成本兼容字段;人民币实扣以 X-SeerMarTech-Charge-CNY 为准。
result_countintegerresult 数组中的数量
patharray当前请求的 URL 路径
dataobjectGET 请求中使用的接口参数信息
resultarray类别结果数组

data 对象字段

字段类型说明
apistringAPI 模块名称,值为 dataforseo_labs
functionstring接口名称,值为 categories

result 类别字段

字段类型说明
category_codeinteger类别编码
category_namestring类别完整名称
category_code_parentinteger / null父级类别编码;顶级类别为 null

例如:

json
{
  "category_code": 10178,
  "category_name": "Apparel Accessories",
  "category_code_parent": 10021
}

category_code_parent10021 的类别对应:

json
{
  "category_code": 10021,
  "category_name": "Apparel"
}

顶级类别的 category_code_parentnull

请求示例

cURL

bash
curl --location --request GET \
  "https://api.seermartech.cn/v3/dataforseo_labs/categories" \
  --header "Authorization: Bearer smt_live_YOUR_KEY" \
  --header "Content-Type: application/json"

Python

python
import requests

url = "https://api.seermartech.cn/v3/dataforseo_labs/categories"

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

response = requests.get(url, headers=headers)
result = response.json()

if result.get("status_code") == 20000:
    print(result)
else:
    print(
        "请求失败,状态码:{},消息:{}".format(
            result.get("status_code"),
            result.get("status_message"),
        )
    )

TypeScript

typescript
import axios from "axios";

axios
  .get("https://api.seermartech.cn/v3/dataforseo_labs/categories", {
    headers: {
      Authorization: "Bearer smt_live_YOUR_KEY",
      "Content-Type": "application/json",
    },
  })
  .then((response) => {
    const result = response.data;

    if (result.status_code === 20000) {
      console.log(result);
    } else {
      console.error(
        `请求失败,状态码:${result.status_code},消息:${result.status_message}`
      );
    }
  })
  .catch((error) => {
    console.error("网络请求失败:", error.message);
  });

响应示例

json
{
  "version": "0.1.20200305",
  "status_code": 20000,
  "status_message": "Ok.",
  "time": "0.0594 sec.",
  "cost": 0,
  "tasks_count": 1,
  "tasks_error": 0,
  "tasks": [
    {
      "id": "8e1c5f7e-7c9d-4e6e-9f9a-123456789abc",
      "status_code": 20000,
      "status_message": "Ok.",
      "time": "0.0594 sec.",
      "cost": 0,
      "result_count": 2,
      "path": [
        "v3",
        "dataforseo_labs",
        "categories"
      ],
      "data": {
        "api": "dataforseo_labs",
        "function": "categories"
      },
      "result": [
        {
          "category_code": 10021,
          "category_name": "Apparel",
          "category_code_parent": null
        },
        {
          "category_code": 10178,
          "category_name": "Apparel Accessories",
          "category_code_parent": 10021
        }
      ]
    }
  ]
}

状态码

  • 20000:请求成功。
  • 状态码:请求或任务执行失败,错误信息以 status_message 为准。

实用场景

  • 获取完整类别树:同步所有可用类别及父子层级,构建行业分类导航和筛选器。
  • 映射行业:将分析结果到标准类别编码,支持按行业统计搜索需求。
  • 生成类别选择器:在 SEO 工或运营后台中展示可选类别,减少人工维护分类数据的成本。
  • 校验类别参数:在调用类别接口前验证类别编码是否有效,降低请求失败率。
  • 构建竞品分类报表:按类别聚合网站、或市场数据,识别不同细分行业的搜索机会。

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