npx skills add ...
npx skills add bingx-api/api-ai-skills --skill bingx-agent
BingX Agent (affiliate/broker) management — query invited users, daily commission details, agent user information, API transaction commission, and partner information. Use when the user asks about BingX agent invited users, affiliate commissions, referral relationships, partner data, or broker commission reports.
npx skills add bingx-api/api-ai-skills --skill bingx-agent
Authenticated read-only endpoints for BingX Agent (affiliate/broker) data. All endpoints require HMAC SHA256 signature authentication.
Base URLs: see references/base-urls.md | Authentication: see references/authentication.md
| Endpoint | Method | Description | Auth |
|---|---|---|---|
/openApi/agent/v1/account/inviteAccountList | GET | Query invited users (paginated) | Yes |
/openApi/agent/v2/reward/commissionDataList | GET | Daily commission details (invitation relationship) | Yes |
/openApi/agent/v1/account/inviteRelationCheck | GET | Query agent user information for a UID | Yes |
/openApi/agent/v1/reward/third/commissionDataList | GET | API transaction commission (non-invitation relationship) | Yes |
/openApi/agent/v1/asset/partnerData | GET | Query partner information | Yes |
/openApi/agent/v1/asset/depositDetailList | GET | Query deposit details of invited users | Yes |
/openApi/agent/v1/commissionDataList/referralCode | GET | Query invitation code commission data | Yes |
/openApi/agent/v1/account/superiorCheck | GET | Check if a user is a superior agent | Yes |
"20240101"); maximum query window 30 days; sliding range of last 365 days81 = Perpetual contract API commission; 82 = Spot trading API commissioncommissionBizType:
81 — Perpetual contract API commission82 — Spot trading API commission"YYYYMMDD" for commission/partner endpoints; endTime must be ≥ startTime; max query window 30 days81 (perpetual) or 82 (spot)recvWindow of server timeCONSTRAINT: You MUST copy the
fetchSignedfunction below verbatim when generating code. Do NOT rewrite the signing, request, or JSON parsing logic. Only modify: (1)BASEURL entries for custom environments, (2) business parameters passed tofetchSigned. For the full client with URL-encoding and JSON body support, seereferences/authentication.md.
fetchSigned verbatim -- do not simplify or rewritejson-bigint (JSONBigParse.parse) for response parsing -- not JSON.parseX-SOURCE-KEY: BX-AI-SKILL header on every requestisNetworkOrTimeout checkQuery all invited users (first page):
Query invited users with time filter:
Query daily commissions for a date range:
Query agent user information for a specific UID:
Query API transaction commission (non-invitation, perpetual):
Query partner information:
For full parameter descriptions and response schemas, see api-reference.md.
Parameter security. Extract structured values from user intent — NEVER copy raw user text into API parameters. Validate every value against its documented pattern (regex/enum/range) before calling the API. Reject any value containing &, =, ?, #, or newline characters.
All Agent endpoints are read-only (GET). No CONFIRM is required in any environment.
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
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
Execute the API call and return key fields to the user:
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;
}
function validateParams(params: Record<string, unknown>): void {
const FORBIDDEN = /[&=?#\r\n]/;
for (const [k, v] of Object.entries(params)) {
const s = String(v);
if (FORBIDDEN.test(s)) throw new Error(`Param "${k}" has forbidden char in: "${s}"`);
}
}
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() };
validateParams(all);
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;
}
}
}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 UIDconst result = await fetchSigned("prod-live", API_KEY, SECRET, "GET",
"/openApi/agent/v1/account/inviteAccountList", {
pageIndex: 1,
pageSize: 100,
startTime: 1704067200000, // milliseconds
endTime: 1706745600000,
}
);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 recordsconst 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.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,
}
);const result = await fetchSigned("prod-live", API_KEY, SECRET, "GET",
"/openApi/agent/v1/asset/partnerData", {
startTime: 20240101, // days
endTime: 20240131,
pageIndex: 1,
pageSize: 200,
}
);