bingx-agent
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseBingX Agent
BingX Agent
Authenticated read-only endpoints for BingX Agent (affiliate/broker) data. All endpoints require HMAC SHA256 signature authentication.
Base URLs: see | Authentication: see
references/base-urls.mdreferences/authentication.md用于获取BingX Agent(联盟/经纪人)数据的已认证只读接口,所有接口都需要HMAC SHA256签名认证。
基础URL: 查看 | 认证方式: 查看
references/base-urls.mdreferences/authentication.mdQuick Reference
快速参考
| Endpoint | Method | Description | Auth |
|---|---|---|---|
| GET | Query invited users (paginated) | Yes |
| GET | Daily commission details (invitation relationship) | Yes |
| GET | Query agent user information for a UID | Yes |
| GET | API transaction commission (non-invitation relationship) | Yes |
| GET | Query partner information | Yes |
| GET | Query deposit details of invited users | Yes |
| GET | Query invitation code commission data | Yes |
| GET | Check if a user is a superior agent | Yes |
| 接口 | 请求方法 | 描述 | 认证要求 |
|---|---|---|---|
| GET | 查询受邀用户(分页) | 是 |
| GET | 每日佣金明细(邀请关系绑定) | 是 |
| GET | 查询指定UID的代理人用户信息 | 是 |
| GET | API交易佣金(非邀请关系绑定) | 是 |
| GET | 查询合作伙伴信息 | 是 |
| GET | 查询受邀用户的入金明细 | 是 |
| GET | 查询邀请码佣金数据 | 是 |
| GET | 检查用户是否为上级代理 | 是 |
Parameters
参数说明
Pagination Parameters
分页参数
- pageIndex: Page number — must be greater than 0
- pageSize: Page size — must be greater than 0; maximum value varies by endpoint (100 or 200)
- pageIndex: 页码——必须大于0
- pageSize: 每页数量——必须大于0;最大值根据不同接口为100或200
Invited Users Parameters
受邀用户查询参数
- startTime: Start timestamp in milliseconds; maximum query window is 30 days; omit for all-time query
- endTime: End timestamp in milliseconds; maximum query window is 30 days; omit for all-time query
- lastUid: Required when queried data exceeds 10,000 records — pass the last UID of the current page on each subsequent request
- recvWindow: Request validity window in milliseconds (default 5 seconds)
- startTime: 起始时间戳,单位为毫秒;最大查询时间范围为30天;留空则查询全量数据
- endTime: 结束时间戳,单位为毫秒;最大查询时间范围为30天;留空则查询全量数据
- lastUid: 当查询数据超过10000条时必填——后续请求需要传入当前页的最后一个UID
- recvWindow: 请求有效期窗口,单位为毫秒(默认5秒)
Commission Parameters
佣金查询参数
- startTime: Start timestamp in days (date string, e.g. ); maximum query window 30 days; sliding range of last 365 days
"20240101" - endTime: End timestamp in days (date string); maximum query window 30 days
- uid: Optional — filter by a specific invited user UID
- recvWindow: Request validity window in milliseconds
- startTime: 起始日期,格式为日期字符串,例如 ;最大查询时间范围为30天,支持查询最近365天内的数据
"20240101" - endTime: 结束日期,格式为日期字符串;最大查询时间范围为30天
- uid: 可选——按指定受邀用户UID筛选
- recvWindow: 请求有效期窗口,单位为毫秒
API Commission (Non-Invitation) Parameters
API佣金(非邀请关系)查询参数
- commissionBizType: = Perpetual contract API commission;
81= Spot trading API commission82 - startTime: Start timestamp in days; supports data after December 1, 2023
- endTime: End timestamp in days; supports data after December 1, 2023
- uid: Optional — UID of the trading user (non-invitation relationship)
- commissionBizType: = 永续合约API佣金;
81= 现货交易API佣金82 - startTime: 起始日期;仅支持2023年12月1日之后的数据
- endTime: 结束日期;仅支持2023年12月1日之后的数据
- uid: 可选——交易用户UID(非邀请关系绑定)
Partner Information Parameters
合作伙伴信息查询参数
- startTime: Start timestamp in days; supports last 3 months only
- endTime: End timestamp in days; supports last 3 months only
- uid: Optional — filter by a specific partner UID
- pageSize: Maximum value 200 for this endpoint
- startTime: 起始日期;仅支持最近3个月内的数据
- endTime: 结束日期;仅支持最近3个月内的数据
- uid: 可选——按指定合作伙伴UID筛选
- pageSize: 该接口最大每页数量为200
Enums
枚举值
commissionBizType:
- — Perpetual contract API commission
81 - — Spot trading API commission
82
commissionBizType:
- — 永续合约API佣金
81 - — 现货交易API佣金
82
Parameter Validation Rules
参数校验规则
- pageIndex: Positive integer, must be > 0
- pageSize: Positive integer, must be > 0; max 100 or 200 depending on endpoint
- startTime / endTime: Format varies — milliseconds for invited users, date string for commission/partner endpoints;
"YYYYMMDD"must be ≥endTime; max query window 30 daysstartTime - uid: When provided, must be a positive integer
- commissionBizType: Must be (perpetual) or
81(spot)82 - lastUid: When paginating > 10,000 records, pass the last UID from the previous page
- recvWindow: Integer, 1–5000 ms (see Replay Protection)
- timestamp: Unix time in milliseconds; must be within of server time
recvWindow
- pageIndex: 正整数,必须大于0
- pageSize: 正整数,必须大于0;根据不同接口最大为100或200
- startTime / endTime: 格式根据接口不同有差异——受邀用户接口为毫秒级时间戳,佣金/合作伙伴接口为格式的日期字符串;
"YYYYMMDD"必须大于等于endTime;最大查询时间范围为30天startTime - uid: 传入时必须为正整数
- commissionBizType: 必须为(永续合约)或
81(现货)82 - lastUid: 当分页查询超过10000条数据时,需要传入上一页的最后一个UID
- recvWindow: 整数,取值范围1-5000毫秒(参考重放保护)
- timestamp: Unix时间戳,单位为毫秒;必须在服务器时间的范围内
recvWindow
Quick Start
快速开始
CONSTRAINT: You MUST copy thefunction below verbatim when generating code. Do NOT rewrite the signing, request, or JSON parsing logic. Only modify: (1)fetchSignedURL entries for custom environments, (2) business parameters passed toBASE. For the full client with URL-encoding and JSON body support, seefetchSigned.references/authentication.md
typescript
import * as crypto from "crypto";
import JSONBig from "json-bigint";
const JSONBigParse = JSONBig({ storeAsString: true });
// Full signing details & edge cases → references/authentication.md
// Domain priority: .com is mandatory primary; .pro is fallback for network/timeout errors ONLY.
const BASE = {
"prod-live": ["https://open-api.bingx.com", "https://open-api.bingx.pro"],
"prod-vst": ["https://open-api-vst.bingx.com", "https://open-api-vst.bingx.pro"],
};
function isNetworkOrTimeout(e: unknown): boolean {
if (e instanceof TypeError) return true;
if (e instanceof DOMException && e.name === "AbortError") return true;
if (e instanceof Error && e.name === "TimeoutError") return true;
return false;
}
async function fetchSigned(env: string, apiKey: string, secretKey: string,
method: "GET" | "POST" | "DELETE", path: string, params: Record<string, unknown> = {}
) {
const urls = BASE[env] ?? BASE["prod-live"];
const all = { ...params, timestamp: Date.now() };
const qs = Object.keys(all).sort().map(k => `${k}=${all[k]}`).join("&");
const sig = crypto.createHmac("sha256", secretKey).update(qs).digest("hex");
const signed = `${qs}&signature=${sig}`;
for (const base of urls) {
try {
const url = method === "POST" ? `${base}${path}` : `${base}${path}?${signed}`;
const res = await fetch(url, {
method,
headers: { "X-BX-APIKEY": apiKey, "X-SOURCE-KEY": "BX-AI-SKILL",
...(method === "POST" ? { "Content-Type": "application/x-www-form-urlencoded" } : {}) },
body: method === "POST" ? signed : undefined,
signal: AbortSignal.timeout(10000),
});
const json = JSONBigParse.parse(await res.text());
if (json.code !== 0) throw new Error(`BingX error ${json.code}: ${json.msg}`);
return json.data;
} catch (e) {
if (!isNetworkOrTimeout(e) || base === urls[urls.length - 1]) throw e;
}
}
}约束: 生成代码时你必须逐字复制下方的函数,请勿重写签名、请求或JSON解析逻辑。仅允许修改:(1) 自定义环境对应的fetchSignedURL条目,(2) 传入BASE的业务参数。如需支持URL编码和JSON请求体的完整客户端,请参考fetchSigned。references/authentication.md
typescript
import * as crypto from "crypto";
import JSONBig from "json-bigint";
const JSONBigParse = JSONBig({ storeAsString: true });
// Full signing details & edge cases → references/authentication.md
// Domain priority: .com is mandatory primary; .pro is fallback for network/timeout errors ONLY.
const BASE = {
"prod-live": ["https://open-api.bingx.com", "https://open-api.bingx.pro"],
"prod-vst": ["https://open-api-vst.bingx.com", "https://open-api-vst.bingx.pro"],
};
function isNetworkOrTimeout(e: unknown): boolean {
if (e instanceof TypeError) return true;
if (e instanceof DOMException && e.name === "AbortError") return true;
if (e instanceof Error && e.name === "TimeoutError") return true;
return false;
}
async function fetchSigned(env: string, apiKey: string, secretKey: string,
method: "GET" | "POST" | "DELETE", path: string, params: Record<string, unknown> = {}
) {
const urls = BASE[env] ?? BASE["prod-live"];
const all = { ...params, timestamp: Date.now() };
const qs = Object.keys(all).sort().map(k => `${k}=${all[k]}`).join("&");
const sig = crypto.createHmac("sha256", secretKey).update(qs).digest("hex");
const signed = `${qs}&signature=${sig}`;
for (const base of urls) {
try {
const url = method === "POST" ? `${base}${path}` : `${base}${path}?${signed}`;
const res = await fetch(url, {
method,
headers: { "X-BX-APIKEY": apiKey, "X-SOURCE-KEY": "BX-AI-SKILL",
...(method === "POST" ? { "Content-Type": "application/x-www-form-urlencoded" } : {}) },
body: method === "POST" ? signed : undefined,
signal: AbortSignal.timeout(10000),
});
const json = JSONBigParse.parse(await res.text());
if (json.code !== 0) throw new Error(`BingX error ${json.code}: ${json.msg}`);
return json.data;
} catch (e) {
if (!isNetworkOrTimeout(e) || base === urls[urls.length - 1]) throw e;
}
}
}Code Usage Rules
代码使用规则
- MUST copy verbatim -- do not simplify or rewrite
fetchSigned - MUST use (
json-bigint) for response parsing -- notJSONBigParse.parseJSON.parse - MUST include header on every request
X-SOURCE-KEY: BX-AI-SKILL - MUST NOT remove the domain fallback loop or check
isNetworkOrTimeout
- 必须逐字复制——请勿简化或重写
fetchSigned - 必须使用(
json-bigint)解析响应——不能使用JSONBigParse.parseJSON.parse - 必须在每个请求头中携带
X-SOURCE-KEY: BX-AI-SKILL - 禁止移除域名降级循环或校验
isNetworkOrTimeout
Common Calls
常用调用示例
Query all invited users (first page):
typescript
const result = await fetchSigned("prod-live", API_KEY, SECRET, "GET",
"/openApi/agent/v1/account/inviteAccountList", {
pageIndex: 1,
pageSize: 100,
}
);
// result.list — array of invited users
// result.total — total count
// result.currentAgentUid — current agent UIDQuery invited users with time filter:
typescript
const result = await fetchSigned("prod-live", API_KEY, SECRET, "GET",
"/openApi/agent/v1/account/inviteAccountList", {
pageIndex: 1,
pageSize: 100,
startTime: 1704067200000, // milliseconds
endTime: 1706745600000,
}
);Query daily commissions for a date range:
typescript
const result = await fetchSigned("prod-live", API_KEY, SECRET, "GET",
"/openApi/agent/v2/reward/commissionDataList", {
startTime: "20240101",
endTime: "20240131",
pageIndex: 1,
pageSize: 100,
}
);
// result.list — array of CommissionData per user per day
// result.total — total recordsQuery agent user information for a specific UID:
typescript
const result = await fetchSigned("prod-live", API_KEY, SECRET, "GET",
"/openApi/agent/v1/account/inviteRelationCheck", {
uid: 123456789,
}
);
// result.uid, result.inviteResult, result.deposit, result.trade, etc.Query API transaction commission (non-invitation, perpetual):
typescript
const result = await fetchSigned("prod-live", API_KEY, SECRET, "GET",
"/openApi/agent/v1/reward/third/commissionDataList", {
commissionBizType: 81, // 81=perpetual, 82=spot
startTime: "20240101",
endTime: "20240131",
pageIndex: 1,
pageSize: 100,
}
);Query partner information:
typescript
const result = await fetchSigned("prod-live", API_KEY, SECRET, "GET",
"/openApi/agent/v1/asset/partnerData", {
startTime: 20240101, // days
endTime: 20240131,
pageIndex: 1,
pageSize: 200,
}
);查询所有受邀用户(第一页):
typescript
const result = await fetchSigned("prod-live", API_KEY, SECRET, "GET",
"/openApi/agent/v1/account/inviteAccountList", {
pageIndex: 1,
pageSize: 100,
}
);
// result.list — 受邀用户数组
// result.total — 总数量
// result.currentAgentUid — 当前代理UID按时间筛选查询受邀用户:
typescript
const result = await fetchSigned("prod-live", API_KEY, SECRET, "GET",
"/openApi/agent/v1/account/inviteAccountList", {
pageIndex: 1,
pageSize: 100,
startTime: 1704067200000, // milliseconds
endTime: 1706745600000,
}
);查询指定日期范围的每日佣金:
typescript
const result = await fetchSigned("prod-live", API_KEY, SECRET, "GET",
"/openApi/agent/v2/reward/commissionDataList", {
startTime: "20240101",
endTime: "20240131",
pageIndex: 1,
pageSize: 100,
}
);
// result.list — 每个用户每日的佣金数据数组
// result.total — 总记录数查询指定UID的代理人用户信息:
typescript
const result = await fetchSigned("prod-live", API_KEY, SECRET, "GET",
"/openApi/agent/v1/account/inviteRelationCheck", {
uid: 123456789,
}
);
// result.uid, result.inviteResult, result.deposit, result.trade, etc.查询API交易佣金(非邀请关系,永续合约):
typescript
const result = await fetchSigned("prod-live", API_KEY, SECRET, "GET",
"/openApi/agent/v1/reward/third/commissionDataList", {
commissionBizType: 81, // 81=perpetual, 82=spot
startTime: "20240101",
endTime: "20240131",
pageIndex: 1,
pageSize: 100,
}
);查询合作伙伴信息:
typescript
const result = await fetchSigned("prod-live", API_KEY, SECRET, "GET",
"/openApi/agent/v1/asset/partnerData", {
startTime: 20240101, // days
endTime: 20240131,
pageIndex: 1,
pageSize: 200,
}
);Additional Resources
额外资源
For full parameter descriptions and response schemas, see api-reference.md.
如需完整的参数说明和响应结构,请参考api-reference.md。
Agent Interaction Rules
Agent交互规则
All Agent endpoints are read-only (GET). No is required in any environment.
CONFIRM- prod-live: No CONFIRM needed (read-only). Proceed directly.
- prod-vst: No CONFIRM required. Inform user: "You are operating in the Production Simulated (VST) environment."
所有Agent接口均为只读(GET),任何环境下都不需要确认。
CONFIRM- prod-live: 无需确认(只读),可直接执行。
- prod-vst: 无需确认,需要告知用户:"你当前正在生产模拟(VST)环境中操作。"
Step 1 — Identify the Operation
步骤1——识别操作类型
If the user's intent is unclear, present options:
What would you like to do?
- Query my invited/referred users list
- Query daily commission details (invitation relationship)
- Look up agent relationship info for a specific user UID
- Query API transaction commission (non-invitation relationship)
- Query partner information
如果用户意图不明确,可提供选项供选择:
你需要执行什么操作?
- 查询我的受邀/推荐用户列表
- 查询每日佣金明细(邀请关系绑定)
- 查询指定用户UID的代理关系信息
- 查询API交易佣金(非邀请关系绑定)
- 查询合作伙伴信息
Step 2 — Collect Time Range (if applicable)
步骤2——收集时间范围(如适用)
For commission and partner endpoints:
Please specify a date range (max 30 days window):
- Start date (e.g., 20240101)
- End date (e.g., 20240131)
For invited users list, timestamps are in milliseconds:
Please specify a time range (optional, max 30-day window):
- Start time (Unix ms) or leave blank for all-time
对于佣金和合作伙伴接口:
请指定日期范围(最大30天窗口):
- 起始日期(例如20240101)
- 结束日期(例如20240131)
对于受邀用户列表,时间戳为毫秒级:
请指定时间范围(可选,最大30天窗口):
- 起始时间(Unix毫秒)或留空查询全量
Step 3 — Collect Optional Filters
步骤3——收集可选筛选条件
- For commission queries: optionally filter by a specific invited user UID
- For API commission queries: ask for commissionBizType (81=perpetual, 82=spot)
- For large datasets (>10,000 records): use lastUid cursor for pagination
- 佣金查询:可选择按指定受邀用户UID筛选
- API佣金查询:询问用户需要的commissionBizType(81=永续合约,82=现货)
- 大数据集查询(>10000条记录):使用lastUid游标进行分页
Step 4 — Execute and Report
步骤4——执行并返回结果
Execute the API call and return key fields to the user:
- For invited users: total count, current page, and a summary of user details
- For commission data: total records, current agent UID, and aggregated commission amounts
- For user info: invitation relationship, KYC status, deposit/trade status, and welfare info
执行API调用并向用户返回关键字段:
- 受邀用户查询:总数量、当前页、用户详情摘要
- 佣金数据查询:总记录数、当前代理UID、佣金总额汇总
- 用户信息查询:邀请关系、KYC状态、入金/交易状态、福利信息