> ## Documentation Index
> Fetch the complete documentation index at: https://docs.aibase.com/llms.txt
> Use this file to discover all available pages before exploring further.

# GEO 排名监测

> 对指定品牌关键词在多个大模型平台、多个监控问题下进行持续 GEO 排名与可见度监测。

GEO 排名监测用于对指定品牌关键词在多个大模型平台、多个监控问题（提示词）下进行持续的 GEO 排名和品牌可见度监测。提交任务后先返回任务标识，再通过任务查询接口轮询获取汇总统计、提示词维度分析、平台曝光明细及每期监控历史。

<Info>
  **执行模式：ASYNC · 异步。**
  本接口采用异步任务模式：向统一入口提交请求后，平台返回 `requestId` 和 `taskId`；随后使用 `taskId` 轮询 [异步任务查询接口](/api-reference/tasks)（建议每隔 10 秒查询一次）获取最终结果。
</Info>

## 接口速查

| 项目   | 当前接口约定                                   |
| ---- | ---------------------------------------- |
| 接口状态 | 已上线                                      |
| 请求方式 | `POST`                                   |
| 请求地址 | `https://api.aibase.cn/v1/openapi/tasks` |
| 业务标识 | `geo.rank_monitor`                       |
| 执行模式 | **ASYNC · 异步**（需轮询结果）                    |
| 身份认证 | Header `AIBase-API-Key`                  |
| 请求格式 | `application/json`                       |

## 请求头

<ParamField header="AIBase-API-Key" type="string" required>
  AIBase 开放平台 API Key，例如 `AIBase_xxx`。请仅在服务端保存和使用。
</ParamField>

<ParamField header="Content-Type" type="string" required>
  固定为 `application/json`。
</ParamField>

<ParamField header="AIBase-Request-Id" type="string">
  可选的客户端请求追踪标识。
</ParamField>

## 请求体

<ParamField body="apiCode" type="string" required>
  固定为 `geo.rank_monitor`。
</ParamField>

<ParamField body="data" type="object" required>
  当前业务接口的参数对象。
</ParamField>

<ParamField body="data.taskName" type="string" required>
  任务名称，不能为空，最长 200 个字符。
</ParamField>

<ParamField body="data.platforms" type="string[]" required>
  参与检测的大模型平台编码列表，至少 1 个（如 `["volcengine", "baidu", "deepseek"]`）。列表项不能为空字符串。
</ParamField>

<ParamField body="data.promptTexts" type="string[]" required>
  监控问题（提示词）列表，至少 1 条，每条文本不能为空。
</ParamField>

<ParamField body="data.repeatQueryTimes" type="integer">
  每轮重复查询次数，范围 1～3。不传时按默认规则处理。
</ParamField>

<ParamField body="data.brandKeywords" type="string[]" required>
  目标品牌关键词列表，至少 1 个。命中规则应用于上述全部监控问题。
</ParamField>

<RequestExample>
  ```bash cURL (第一步：提交任务) theme={null}
  curl --request POST \
    --url https://api.aibase.cn/v1/openapi/tasks \
    --header "AIBase-API-Key: ${AIBASE_API_KEY}" \
    --header 'Content-Type: application/json' \
    --data '{
      "apiCode": "geo.rank_monitor",
      "data": {
        "taskName": "小米品牌可见度监控",
        "platforms": ["volcengine", "baidu", "deepseek"],
        "promptTexts": [
          "国产手机哪家性价比高",
          "小米手机怎么样",
          "智能家居品牌推荐"
        ],
        "repeatQueryTimes": 1,
        "brandKeywords": ["小米", "Xiaomi"]
      }
    }'
  ```

  ```python Python (提交并轮询) theme={null}
  import os
  import time
  import requests

  api_key = os.environ["AIBASE_API_KEY"]
  headers = {
      "AIBase-API-Key": api_key,
      "Content-Type": "application/json",
  }

  # 1. 提交任务
  res = requests.post(
      "https://api.aibase.cn/v1/openapi/tasks",
      headers=headers,
      json={
          "apiCode": "geo.rank_monitor",
          "data": {
              "taskName": "小米品牌可见度监控",
              "platforms": ["volcengine", "baidu", "deepseek"],
              "promptTexts": [
                  "国产手机哪家性价比高",
                  "小米手机怎么样",
                  "智能家居品牌推荐",
              ],
              "repeatQueryTimes": 1,
              "brandKeywords": ["小米", "Xiaomi"],
          },
      },
      timeout=30,
  )
  res.raise_for_status()
  task_id = res.json()["data"]["taskId"]
  print("任务已提交，taskId:", task_id)

  # 2. 轮询结果（10 秒间隔）
  while True:
      time.sleep(10)
      query_res = requests.get(
          f"https://api.aibase.cn/v1/openapi/tasks/{task_id}",
          headers={"AIBase-API-Key": api_key},
          timeout=30,
      )
      payload = query_res.json()
      status = payload["data"]["status"]
      if status == 2:
          print("检测完成，结果如下:")
          print(payload["data"]["result"])
          break
      elif status != 1:
          raise RuntimeError(f"任务异常，status: {status}")
  ```

  ```javascript Node.js theme={null}
  import { setTimeout } from "node:timers/promises";

  const apiKey = process.env.AIBASE_API_KEY;
  const headers = {
    "AIBase-API-Key": apiKey,
    "Content-Type": "application/json",
  };

  const res = await fetch("https://api.aibase.cn/v1/openapi/tasks", {
    method: "POST",
    headers,
    body: JSON.stringify({
      apiCode: "geo.rank_monitor",
      data: {
        taskName: "小米品牌可见度监控",
        platforms: ["volcengine", "baidu", "deepseek"],
        promptTexts: ["小米手机怎么样", "智能家居推荐"],
        brandKeywords: ["小米"],
      },
    }),
  });
  const { data: { taskId } } = await res.json();

  while (true) {
    await setTimeout(10000);
    const check = await fetch(`https://api.aibase.cn/v1/openapi/tasks/${taskId}`, {
      headers: { "AIBase-API-Key": apiKey },
    });
    const json = await check.json();
    if (json.data?.status === 2) {
      console.log("检测结果:", json.data.result);
      break;
    }
  }
  ```
</RequestExample>

## 第一步：提交任务响应

提交后平台先返回异步任务标识：

<ResponseExample>
  ```json 200 (提交任务响应) theme={null}
  {
    "code": 200,
    "msg": "成功",
    "data": {
      "requestId": "599b2f8f39078d",
      "taskId": "task_d77143abc87642d4842ff588197faa89"
    },
    "timeStamp": 1789550182642
  }
  ```
</ResponseExample>

## 第二步：最终结果字段说明（GET 查询返回）

轮询任务查询接口，当 `status = 2` 时，`data.result` 返回完整的检测结果结构：

<ResponseField name="lastMonitorTime" type="string" required>
  最近一次检测时间，格式为 `yyyy-MM-dd HH:mm:ss`。
</ResponseField>

<ResponseField name="latestStatistics" type="object">
  任务汇总统计对象。无统计时可能为 `null`。
</ResponseField>

<ResponseField name="latestStatistics.totalPrompt" type="integer" required>
  该任务下的监控提示词（问题）总数。
</ResponseField>

<ResponseField name="latestStatistics.totalMonitor" type="integer" required>
  累计监控总次数。
</ResponseField>

<ResponseField name="latestStatistics.totalMentioned" type="integer" required>
  目标品牌被提及的总次数合计。
</ResponseField>

<ResponseField name="latestStatistics.totalExposureCountSum" type="integer" required>
  全部已完成分析记录的曝光次数累计。
</ResponseField>

<ResponseField name="latestStatistics.avgExposure" type="number" required>
  平均曝光率（百分比数值）。
</ResponseField>

<ResponseField name="prompts" type="object[]" required>
  提示词维度列表，每个提示词包含历史曝光数据和各期监控明细。
</ResponseField>

<ResponseField name="prompts[].promptId" type="string" required>
  提示词 ID。
</ResponseField>

<ResponseField name="prompts[].promptText" type="string" required>
  提示词（问题）内容。
</ResponseField>

<ResponseField name="prompts[].promptOrder" type="integer" required>
  排序序号。
</ResponseField>

<ResponseField name="prompts[].lastMonitorTime" type="string" required>
  该提示词最后一次监控时间。
</ResponseField>

<ResponseField name="prompts[].lastDetected" type="string" required>
  最近一次检测时间。
</ResponseField>

<ResponseField name="prompts[].monitorCount" type="integer" required>
  该提示词累计监控次数。
</ResponseField>

<ResponseField name="prompts[].mentionRate" type="number" required>
  品牌提及率（百分比数值）。
</ResponseField>

<ResponseField name="prompts[].totalExposureCountSum" type="integer" required>
  该提示词下的曝光次数累计。
</ResponseField>

<ResponseField name="prompts[].platformExposures" type="object[]" required>
  该提示词在各大模型平台上的曝光数据列表。
</ResponseField>

<ResponseField name="prompts[].platformExposures[].platform" type="string" required>
  大模型平台编码。
</ResponseField>

<ResponseField name="prompts[].platformExposures[].totalExposure" type="integer" required>
  该提示词在该平台上的品牌曝光次数。
</ResponseField>

<ResponseField name="prompts[].platformExposures[].totalMentions" type="integer" required>
  该提示词在该平台上的品牌提及次数。
</ResponseField>

<ResponseField name="prompts[].platformExposures[].avgMentioned" type="number" required>
  平均提及率（百分比数值）。
</ResponseField>

<ResponseField name="prompts[].platformExposures[].monitorCount" type="integer" required>
  该平台累计检测次数。
</ResponseField>

<ResponseField name="prompts[].runs" type="object[]" required>
  单期监控历史执行列表。
</ResponseField>

<ResponseField name="prompts[].runs[].runId" type="string" required>
  本期执行记录 ID。
</ResponseField>

<ResponseField name="prompts[].runs[].runTime" type="string" required>
  本期执行时间。
</ResponseField>

<ResponseField name="prompts[].runs[].recommendedCount" type="integer" required>
  本期被推荐次数。
</ResponseField>

<ResponseField name="prompts[].runs[].totalDetected" type="integer" required>
  本期总检测次数。
</ResponseField>

<ResponseField name="prompts[].runs[].totalExposure" type="integer" required>
  本期总曝光次数。
</ResponseField>

<ResponseField name="prompts[].runs[].visibilityPercent" type="integer" required>
  本期可见度（百分比数值）。
</ResponseField>

<ResponseField name="prompts[].runs[].platformDetails" type="object[]" required>
  本期各平台的详细分析记录。
</ResponseField>

<ResponseField name="prompts[].runs[].platformDetails[].analysisId" type="string" required>
  监控分析记录 ID。
</ResponseField>

<ResponseField name="prompts[].runs[].platformDetails[].platform" type="string" required>
  大模型平台编码。
</ResponseField>

<ResponseField name="prompts[].runs[].platformDetails[].promptText" type="string" required>
  该分析记录使用的提示词。
</ResponseField>

<ResponseField name="prompts[].runs[].platformDetails[].status" type="string" required>
  监控状态（如 `success`）。
</ResponseField>

<ResponseField name="prompts[].runs[].platformDetails[].isRecommended" type="integer" required>
  是否推荐：`1` 已推荐，`0` 未推荐。
</ResponseField>

<ResponseField name="prompts[].runs[].platformDetails[].exposureCount" type="integer" required>
  品牌曝光次数。
</ResponseField>

<ResponseField name="prompts[].runs[].platformDetails[].position" type="integer" required>
  品牌排名位置。
</ResponseField>

<ResponseField name="prompts[].runs[].platformDetails[].citationSourceCount" type="integer" required>
  引用来源条数。
</ResponseField>

<ResponseField name="prompts[].runs[].platformDetails[].brandCount" type="integer" required>
  回答涉及的品牌总数。
</ResponseField>

<ResponseField name="prompts[].runs[].platformDetails[].brandRecords" type="object[]" required>
  回答提及的品牌明细列表（包含 `brandName`、`exposureCount`、`rankingPosition`）。
</ResponseField>

<ResponseField name="prompts[].runs[].platformDetails[].sourceRecords" type="object[]" required>
  回答引用的来源列表（包含 `platformName`、`citationUrl`、`citationCount`、`citationTitle`、`domain`）。
</ResponseField>

<ResponseExample>
  ```json 200 (最终成功 result 结构) theme={null}
  {
    "lastMonitorTime": "2026-09-15 10:30:00",
    "latestStatistics": {
      "totalPrompt": 5,
      "totalMonitor": 20,
      "totalMentioned": 16,
      "totalExposureCountSum": 80,
      "avgExposure": 18.50
    },
    "prompts": [
      {
        "promptId": "111",
        "promptText": "小米手机怎么样",
        "promptOrder": 1,
        "lastMonitorTime": "2026-09-15 10:30:00",
        "lastDetected": "2026-09-15 10:30:00",
        "monitorCount": 4,
        "mentionRate": 80.00,
        "totalExposureCountSum": 20,
        "platformExposures": [
          {
            "platform": "deepseek",
            "totalExposure": 8,
            "totalMentions": 6,
            "avgMentioned": 75.00,
            "monitorCount": 4
          }
        ],
        "runs": [
          {
            "runId": "222",
            "runTime": "2026-09-15 10:30:00",
            "recommendedCount": 1,
            "totalDetected": 3,
            "totalExposure": 5,
            "visibilityPercent": 80,
            "platformDetails": [
              {
                "analysisId": "333",
                "platform": "deepseek",
                "promptText": "小米手机怎么样",
                "status": "success",
                "isRecommended": 1,
                "exposureCount": 5,
                "position": 2,
                "citationSourceCount": 2,
                "brandCount": 3,
                "brandRecords": [
                  {
                    "brandName": "小米",
                    "exposureCount": 5,
                    "rankingPosition": 1
                  }
                ],
                "sourceRecords": [
                  {
                    "platformName": "官网",
                    "citationUrl": "https://www.mi.com",
                    "citationCount": 2,
                    "citationTitle": "小米官网",
                    "domain": "mi.com"
                  }
                ]
              }
            ]
          }
        ]
      }
    ]
  }
  ```
</ResponseExample>

## 接入注意事项

1. **固定业务标识**：`apiCode` 必须固定为 `geo.rank_monitor`。
2. **校验限制**：`taskName` 不能为空且最长 200；`platforms` 至少包含 1 个模型平台编码；`promptTexts` 至少包含 1 条提示词。
3. **两阶段调用**：提交端点仅返回任务 `taskId`，请按照每隔 10 秒的频率调用任务查询端点，待 `status = 2` 时从 `data.result` 获取完整树状结果。
4. **层级结构解析**：结果中包含 `prompts`（提示词）→ `runs`（执行期次）→ `platformDetails`（各平台明细）的三层下钻结构，客户端解析时需做好多层嵌套与空列表的兼容。
