curl --location 'https://geobaseapi.aibase.com/v1/openapi/execute' \
--header 'Content-Type: application/json' \
--header 'AIBase-API-Key: AIBase_xxxxxxxxxxxxxxxx' \
--header 'AIBase-Request-Id: req-20260924-001' \
--data '{"apiCode":"competitor.ranking","data":{"brandId":"brand-001","startDate":"2026-09-01","endDate":"2026-09-23","pageNo":1,"pageSize":50}}'
import os
import requests
api_key = os.environ["AIBASE_API_KEY"]
headers = {
"AIBase-API-Key": api_key,
"Content-Type": "application/json",
"AIBase-Request-Id": "req-20260924-001",
}
payload = {
"apiCode": "competitor.ranking",
"data": {
"brandId": "brand-001",
"startDate": "2026-09-01",
"endDate": "2026-09-23",
"pageNo": 1,
"pageSize": 50
}
}
res = requests.post(
"https://geobaseapi.aibase.com/v1/openapi/execute",
headers=headers,
json=payload,
timeout=60,
)
res.raise_for_status()
body = res.json()
if body["code"] == 200:
print(body["data"])
const payload = {
"apiCode": "competitor.ranking",
"data": {
"brandId": "brand-001",
"startDate": "2026-09-01",
"endDate": "2026-09-23",
"pageNo": 1,
"pageSize": 50
}
};
const res = await fetch("https://geobaseapi.aibase.com/v1/openapi/execute", {
method: "POST",
headers: {
"Content-Type": "application/json",
"AIBase-API-Key": process.env.AIBASE_API_KEY,
"AIBase-Request-Id": "req-20260924-001",
},
body: JSON.stringify(payload),
});
const body = await res.json();
if (body.code === 200) {
console.log(body.data);
}
String body = """
{
"apiCode": "competitor.ranking",
"data": {
"brandId": "brand-001",
"startDate": "2026-09-01",
"endDate": "2026-09-23",
"pageNo": 1,
"pageSize": 50
}
}
""";
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://geobaseapi.aibase.com/v1/openapi/execute"))
.header("Content-Type", "application/json")
.header("AIBase-API-Key", "AIBase_xxxxxxxxxxxxxxxx")
.header("AIBase-Request-Id", "req-20260924-001")
.POST(BodyPublishers.ofString(body))
.build();
HttpResponse<String> response = HttpClient.newHttpClient()
.send(request, BodyHandlers.ofString());
System.out.println(response.body());
{
"code": 200,
"msg": "成功",
"data": {
"records": [
{
"competitorName": "竞品A",
"brandRate": 25.6,
"top1Rate": 18.2,
"top3Rate": 42.5,
"top10Rate": 78.3,
"position": 2.4,
"logoUrl": "https://cdn.example.com/logo-a.png",
"queryDate": "2026-09-23",
"visibilityCount": 96,
"visibilityRatePercent": 62.5
},
{
"competitorName": "我方品牌",
"brandRate": 20.1,
"top1Rate": 12.4,
"top3Rate": 35.8,
"top10Rate": 70.2,
"position": 3.1,
"logoUrl": "https://cdn.example.com/logo-self.png",
"queryDate": "2026-09-23",
"visibilityCount": 80,
"visibilityRatePercent": 55.0
}
],
"total": 1,
"size": 50,
"current": 1,
"pages": 1
},
"timeStamp": 1788830174812
}
竞品整体对比
查询指定品牌在指定时间范围内与监测竞品的整体对比排名,返回各竞品与我方品牌的 AI 声量占比、Top1/Top3/Top10 占比、平均排名、曝光总次数与曝光率等核心指标,按分页返回。
POST
/
v1
/
openapi
/
execute
curl --location 'https://geobaseapi.aibase.com/v1/openapi/execute' \
--header 'Content-Type: application/json' \
--header 'AIBase-API-Key: AIBase_xxxxxxxxxxxxxxxx' \
--header 'AIBase-Request-Id: req-20260924-001' \
--data '{"apiCode":"competitor.ranking","data":{"brandId":"brand-001","startDate":"2026-09-01","endDate":"2026-09-23","pageNo":1,"pageSize":50}}'
import os
import requests
api_key = os.environ["AIBASE_API_KEY"]
headers = {
"AIBase-API-Key": api_key,
"Content-Type": "application/json",
"AIBase-Request-Id": "req-20260924-001",
}
payload = {
"apiCode": "competitor.ranking",
"data": {
"brandId": "brand-001",
"startDate": "2026-09-01",
"endDate": "2026-09-23",
"pageNo": 1,
"pageSize": 50
}
}
res = requests.post(
"https://geobaseapi.aibase.com/v1/openapi/execute",
headers=headers,
json=payload,
timeout=60,
)
res.raise_for_status()
body = res.json()
if body["code"] == 200:
print(body["data"])
const payload = {
"apiCode": "competitor.ranking",
"data": {
"brandId": "brand-001",
"startDate": "2026-09-01",
"endDate": "2026-09-23",
"pageNo": 1,
"pageSize": 50
}
};
const res = await fetch("https://geobaseapi.aibase.com/v1/openapi/execute", {
method: "POST",
headers: {
"Content-Type": "application/json",
"AIBase-API-Key": process.env.AIBASE_API_KEY,
"AIBase-Request-Id": "req-20260924-001",
},
body: JSON.stringify(payload),
});
const body = await res.json();
if (body.code === 200) {
console.log(body.data);
}
String body = """
{
"apiCode": "competitor.ranking",
"data": {
"brandId": "brand-001",
"startDate": "2026-09-01",
"endDate": "2026-09-23",
"pageNo": 1,
"pageSize": 50
}
}
""";
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://geobaseapi.aibase.com/v1/openapi/execute"))
.header("Content-Type", "application/json")
.header("AIBase-API-Key", "AIBase_xxxxxxxxxxxxxxxx")
.header("AIBase-Request-Id", "req-20260924-001")
.POST(BodyPublishers.ofString(body))
.build();
HttpResponse<String> response = HttpClient.newHttpClient()
.send(request, BodyHandlers.ofString());
System.out.println(response.body());
{
"code": 200,
"msg": "成功",
"data": {
"records": [
{
"competitorName": "竞品A",
"brandRate": 25.6,
"top1Rate": 18.2,
"top3Rate": 42.5,
"top10Rate": 78.3,
"position": 2.4,
"logoUrl": "https://cdn.example.com/logo-a.png",
"queryDate": "2026-09-23",
"visibilityCount": 96,
"visibilityRatePercent": 62.5
},
{
"competitorName": "我方品牌",
"brandRate": 20.1,
"top1Rate": 12.4,
"top3Rate": 35.8,
"top10Rate": 70.2,
"position": 3.1,
"logoUrl": "https://cdn.example.com/logo-self.png",
"queryDate": "2026-09-23",
"visibilityCount": 80,
"visibilityRatePercent": 55.0
}
],
"total": 1,
"size": 50,
"current": 1,
"pages": 1
},
"timeStamp": 1788830174812
}
查询指定品牌在指定时间范围内与监测竞品的整体对比排名,返回各竞品与我方品牌的 AI 声量占比、Top1/Top3/Top10 占比、平均排名、曝光总次数与曝光率等核心指标,按分页返回。
完整响应类型可表示为
可按以上 TypeScript 类型定义解析响应数据。
执行模式:SYNC · 实时请求。
请求发出后服务端同步执行业务,结果直接在当前响应的
data 中返回,不存在异步任务、无需轮询、无需二次查询。接口速查
| 项目 | 当前接口约定 |
|---|---|
| 接口状态 | 已上线 |
| 请求方式 | POST |
| 请求地址 | https://geobaseapi.aibase.com/v1/openapi/execute |
| 业务标识 | competitor.ranking |
| 执行模式 | SYNC · 实时请求(直接返回,无需轮询) |
| 身份认证 | Header AIBase-API-Key |
| 请求格式 | application/json |
| 返回结构 | 分页结构(records + total / size / current / pages) |
请求头
string
required
开发者 API Key,例如
AIBase_xxx。用于身份认证、有效期与调用权限校验,请仅在服务端保存和使用。string
required
固定为
application/json。string
开发者自定义请求 ID,用于请求追踪;不传时系统自动生成 UUID。
请求体
string
required
固定为
competitor.ranking。object
required
业务请求参数对象。
string
required
品牌 ID。所属品牌 ID,为空返回 4001
string
AI平台。按 AI 平台筛选,如 deepseek;不传返回全部平台
string
开始日期。格式 yyyy-MM-dd;默认最近 7 天
string
结束日期。格式 yyyy-MM-dd;默认今天,不能晚于今天
integer
页码。默认 1
integer
每页条数。默认 50,最大 100,超限自动截断为 100
时间范围规则:startDate/endDate 不传时默认查询最近 7 天;endDate 晚于今天会被自动截断为今天;起止时间跨度最大 6 个月;开始日期晚于结束日期将直接报错。
curl --location 'https://geobaseapi.aibase.com/v1/openapi/execute' \
--header 'Content-Type: application/json' \
--header 'AIBase-API-Key: AIBase_xxxxxxxxxxxxxxxx' \
--header 'AIBase-Request-Id: req-20260924-001' \
--data '{"apiCode":"competitor.ranking","data":{"brandId":"brand-001","startDate":"2026-09-01","endDate":"2026-09-23","pageNo":1,"pageSize":50}}'
import os
import requests
api_key = os.environ["AIBASE_API_KEY"]
headers = {
"AIBase-API-Key": api_key,
"Content-Type": "application/json",
"AIBase-Request-Id": "req-20260924-001",
}
payload = {
"apiCode": "competitor.ranking",
"data": {
"brandId": "brand-001",
"startDate": "2026-09-01",
"endDate": "2026-09-23",
"pageNo": 1,
"pageSize": 50
}
}
res = requests.post(
"https://geobaseapi.aibase.com/v1/openapi/execute",
headers=headers,
json=payload,
timeout=60,
)
res.raise_for_status()
body = res.json()
if body["code"] == 200:
print(body["data"])
const payload = {
"apiCode": "competitor.ranking",
"data": {
"brandId": "brand-001",
"startDate": "2026-09-01",
"endDate": "2026-09-23",
"pageNo": 1,
"pageSize": 50
}
};
const res = await fetch("https://geobaseapi.aibase.com/v1/openapi/execute", {
method: "POST",
headers: {
"Content-Type": "application/json",
"AIBase-API-Key": process.env.AIBASE_API_KEY,
"AIBase-Request-Id": "req-20260924-001",
},
body: JSON.stringify(payload),
});
const body = await res.json();
if (body.code === 200) {
console.log(body.data);
}
String body = """
{
"apiCode": "competitor.ranking",
"data": {
"brandId": "brand-001",
"startDate": "2026-09-01",
"endDate": "2026-09-23",
"pageNo": 1,
"pageSize": 50
}
}
""";
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://geobaseapi.aibase.com/v1/openapi/execute"))
.header("Content-Type", "application/json")
.header("AIBase-API-Key", "AIBase_xxxxxxxxxxxxxxxx")
.header("AIBase-Request-Id", "req-20260924-001")
.POST(BodyPublishers.ofString(body))
.build();
HttpResponse<String> response = HttpClient.newHttpClient()
.send(request, BodyHandlers.ofString());
System.out.println(response.body());
返回参数
业务结果位于 data,为分页结构,其中 records 为各竞品(含我方品牌)的整体对比指标列表。若时间范围内无任何曝光数据,data 为 null;有曝光数据但当前分页无记录时,data 为空数组 []。object[]
竞品整体对比列表。各竞品(含我方品牌)的整体对比指标。
string
竞品名称。品牌或竞品名称,包含我方品牌自身。
number
AI 声量占比。该品牌在监测范围内的 AI 声量占比(%)。
number
Top1 占比。该品牌的 Top1 占比(%)。
number
Top3 占比。该品牌的 Top3 占比(%)。
number
Top10 占比。该品牌的 Top10 占比(%)。
number
平均排名。该品牌的平均排名位次。
string
竞品图标。品牌或竞品图标 URL。
string
查询时间。格式 yyyy-MM-dd。
integer
曝光总次数。该品牌的曝光总次数。
number
曝光率。该品牌的曝光率(%)。
integer
required
记录总数。
integer
required
每页条数。
integer
required
当前页码。
integer
required
总页数。
{
"code": 200,
"msg": "成功",
"data": {
"records": [
{
"competitorName": "竞品A",
"brandRate": 25.6,
"top1Rate": 18.2,
"top3Rate": 42.5,
"top10Rate": 78.3,
"position": 2.4,
"logoUrl": "https://cdn.example.com/logo-a.png",
"queryDate": "2026-09-23",
"visibilityCount": 96,
"visibilityRatePercent": 62.5
},
{
"competitorName": "我方品牌",
"brandRate": 20.1,
"top1Rate": 12.4,
"top3Rate": 35.8,
"top10Rate": 70.2,
"position": 3.1,
"logoUrl": "https://cdn.example.com/logo-self.png",
"queryDate": "2026-09-23",
"visibilityCount": 80,
"visibilityRatePercent": 55.0
}
],
"total": 1,
"size": 50,
"current": 1,
"pages": 1
},
"timeStamp": 1788830174812
}
接入注意事项
- apiCode 必须固定为 competitor.ranking。
- brandId 为必填参数,为空返回 4001(所需参数不足)。
- startDate/endDate 格式必须为 yyyy-MM-dd,默认最近 7 天,最大查询跨度 6 个月。
- pageNo 默认 1;pageSize 默认 50,最大 100,超限自动截断为 100。
- 返回结构为分页对象;若时间范围内无任何曝光数据,data 为 null;有曝光数据但当前分页无记录时 data 为空数组 [],解析时做好空值兼容。
- records 中同时包含我方品牌与监测竞品的对比指标。
- 各占比字段(brandRate、top1Rate 等)为百分比数值。
Java 返回对象
Java 返回对象
public class CompetitorRanking {
private String competitorName;
private BigDecimal brandRate;
private BigDecimal top1Rate;
private BigDecimal top3Rate;
private BigDecimal top10Rate;
private BigDecimal position;
private String logoUrl;
private String queryDate;
private Integer visibilityCount;
private BigDecimal visibilityRatePercent;
}
ReturnResult<PageResult<CompetitorRanking>>(ReturnResult 定义见 6.2.5)。(PageResult 定义见 6.2.5)TypeScript 类型
TypeScript 类型
export interface CompetitorRanking {
competitorName: string | null;
brandRate: number | null;
top1Rate: number | null;
top3Rate: number | null;
top10Rate: number | null;
position: number | null;
logoUrl: string | null;
queryDate: string | null;
visibilityCount: number;
visibilityRatePercent: number | null;
}
本页的 cURL 与 Java 示例来自官方接口文档;Python 与 Node.js 示例为等价转写,未经服务端联调,请以实际返回结果为准。