Skip to content

Affiliate Endpoints

Affiliate OpenAPI endpoints use the /api/v1/agent prefix. All endpoints require a signed API Key and are available only to accounts with affiliate access.

  • All endpoints use GET, and business parameters are sent in the query string.
  • All endpoints require a signed request. For shared signing rules, see Basic Information.
  • All endpoints have a rate limit of 5 requests per second and a request weight of 1.
  • Unless otherwise specified, all time fields are millisecond UNIX timestamps.
  • For paginated endpoints, pageIndex defaults to 1, and pageSize defaults to 100 with a valid range of 100 to 200.

Common Signed Parameters

NameTypeMandatoryDescription
recvWindowLONGNORequest validity window in milliseconds. Defaults to 5000 if omitted
timestampLONGYESRequest timestamp in milliseconds
signatureSTRINGYESHMAC SHA256 signature generated with your API Secret

Common Response Format

Successful responses use the following wrapper:

json
{
  "code": 200,
  "msg": "success",
  "data": {}
}

For paginated endpoints, data is a page object:

FieldTypeDescription
pagesstringTotal pages
totalstringTotal records
listarrayCurrent page items

Common Error Codes

codemsgDescription
200successSuccess
-1001Internal error.Internal error or downstream service error
-1003Too many requests...Affiliate endpoint rate limit exceeded
-1020This operation is not supported.The current API Key does not support the operation, for example a read-only API Key applying for export
-1021Timestamp for this request is outside of the recvWindow.Timestamp is outside the valid request window
-1022Signature for this request is not valid.Invalid signature
-1115Invalid timeInForce.Invalid time range. Affiliate endpoints also use this code for time-window validation failures
-1130Data sent for paramter ... is not valid.Invalid parameter
-1153User not existUser does not exist

Query Invited Users

Query basic information about users directly or indirectly invited by the current affiliate. You can filter by registration time, UID, or referral code.

Request Weight

1

Request URL

GET /api/v1/agent/inviteUserList

Parameters

NameTypeMandatoryDefaultDescription
pageIndexINTEGERNO1Page number, starting from 1
pageSizeINTEGERNO100Page size, from 100 to 200
startTimeLONGNO0Registration start time. When used with endTime, the time span cannot exceed 30 days
endTimeLONGNO0Registration end time
uidLONGNO0Invited user UID
referralCodeSTRINGNO-Referral code

Response

data.list[] fields:

FieldTypeDescription
uidlongInvited user UID
ownInviteCodestringThe invited user's own invite code. Returned for affiliates and may be empty for regular users
inviteSidlongParent UID
invitationCodestringParent invite code used at registration
registerTimelongRegistration time in milliseconds
directInvitationbooleantrue direct invite, false indirect invite
depositbooleantrue deposited, false not deposited
balanceVolumestringNet asset value in USDT
tradebooleantrue traded, false not traded
kycResultbooleantrue KYC passed, false KYC not passed
levelintegerUser level
spotCommissionRatiostringSpot commission ratio
contractCommissionRatiostringFutures commission ratio

Query Commission Details

Query hourly commission details for invited users. Only data from the last 365 days is available, and each request can cover at most 30 days.

Request Weight

1

Request URL

GET /api/v1/agent/commissionDataList

Parameters

NameTypeMandatoryDefaultDescription
uidLONGNO0Invited user UID. Omit or send 0 to disable UID filtering
pageIndexINTEGERNO1Page number, starting from 1
pageSizeINTEGERNO100Page size, from 100 to 200
startTimeLONGYES-Statistics start time in milliseconds
endTimeLONGYES-Statistics end time in milliseconds

Response

data.list[] fields:

FieldTypeDescription
uidlongInvited user UID
commissionTimelongCommission distribution time
tradingVolumestringTotal spot and futures trading volume in USDT
commissionVolumestringTotal commission amount in USDT
spotTradingVolumestringSpot trading volume in USDT
swapTradingVolumestringFutures trading volume in USDT
spotCommissionVolumestringSpot commission amount in USDT
swapCommissionVolumestringFutures commission amount in USDT

Query Commission Summary

Query commission summary by invited user. Only data from the last 365 days is available, and each request can cover at most 30 days.

Request Weight

1

Request URL

GET /api/v1/agent/commissionDataInfo

Parameters

NameTypeMandatoryDefaultDescription
uidLONGNO0Invited user UID. Omit or send 0 to disable UID filtering
pageIndexINTEGERNO1Page number, starting from 1
pageSizeINTEGERNO100Page size, from 100 to 200
startTimeLONGYES-Statistics start time in milliseconds
endTimeLONGYES-Statistics end time in milliseconds
referralCodeSTRINGNO-Invite code of the invited user

Response

data.list[] fields:

FieldTypeDescription
uidlongInvited user UID
tradingVolumestringTotal spot and futures trading volume in USDT
commissionVolumestringTotal commission amount in USDT
spotTradingVolumestringSpot trading volume in USDT
swapTradingVolumestringFutures trading volume in USDT
spotCommissionVolumestringSpot commission amount in USDT
swapCommissionVolumestringFutures commission amount in USDT
feestringTotal fee
netFeestringNet fee
spotFeestringSpot fee
contractFeestringFutures fee
spotNetFeestringSpot net fee
contractNetFeestringFutures net fee

Check Invite Relation

Check whether the specified UID has an invite relationship with the current affiliate, and return the user's affiliate-related profile.

Request Weight

1

Request URL

GET /api/v1/agent/inviteRelationCheck

Parameters

NameTypeMandatoryDefaultDescription
uidLONGYES-Invited user UID

Response

data fields:

FieldTypeDescription
uidlongInvited user UID
inviteSidlongParent UID
registerTimelongRegistration time in milliseconds
directInvitationbooleantrue direct invite, false indirect invite
depositbooleantrue deposited, false not deposited
kycResultbooleantrue KYC passed, false KYC not passed
balanceVolumestringNet asset value in USDT
tradebooleantrue traded, false not traded
levelintegerUser level
spotCommissionRatiostringSpot commission ratio
contractCommissionRatiostringFutures commission ratio

Query Deposit Details

Query deposit details for an invited user. Only data from the last 90 days is available, and each request can cover at most 30 days.

Request Weight

1

Request URL

GET /api/v1/agent/depositDetailList

Parameters

NameTypeMandatoryDefaultDescription
uidLONGYES-Invited user UID
pageIndexINTEGERNO1Page number, starting from 1
pageSizeINTEGERNO100Page size, from 100 to 200
startTimeLONGYES-Query start time in milliseconds
endTimeLONGYES-Query end time in milliseconds

Response

data.list[] fields:

FieldTypeDescription
uidlongInvited user UID
directInvitationbooleantrue direct invite, false indirect invite
bizTypeintegerBusiness type. 1 means deposit
bizTimelongDeposit time in milliseconds
tokenIdstringToken
quantitystringDeposit quantity

Query Sub-Affiliate Data

Query business metrics for sub-affiliates or invited users in the statistics window. If no time range is sent, the default window is the last 30 days. Only data from the last 90 days is available, and each request can cover at most 30 days.

Request Weight

1

Request URL

GET /api/v1/agent/querySubAgentData

Parameters

NameTypeMandatoryDefaultDescription
uidLONGNO0Sub-affiliate or invited user UID. Omit or send 0 to disable UID filtering
pageIndexINTEGERNO1Page number, starting from 1
pageSizeINTEGERNO100Page size, from 100 to 200
startTimeLONGNO0Query start time in milliseconds
endTimeLONGNO0Query end time in milliseconds

Response

data.list[] fields:

FieldTypeDescription
uidlongUser UID
emailstringMasked email
phonestringMasked phone number
directInvitationbooleantrue direct invite, false indirect invite
newRefereesintegerNew referrals in the query window
firstTradeintegerFirst-trade user count
branchDepositsstringSubtree deposit amount
branchTradingintegerSubtree trading user count
branchTradingVolstringSubtree trading volume
levelintegerRelative level
spotCommissionRatiostringSpot commission ratio
contractCommissionRatiostringFutures commission ratio
commissionAmountstringCommission amount

Query Spot Orders

Query spot orders for users in the affiliate hierarchy. If no time range is sent, the default window is the last 7 days. Only data from the last 180 days is available, and each request can cover at most 30 days.

Request Weight

1

Request URL

GET /api/v1/agent/spotOrdersList

Parameters

NameTypeMandatoryDefaultDescription
parentAccountIdLONGYES-Parent account ID. Send 0 when querying only by subAccountId
subAccountIdLONGYES-Sub-account ID. Send 0 when querying only by parentAccountId
fromIdLONGNO0Start cursor ID
endIdLONGNO0End cursor ID
startTimeLONGNO0Query start time in milliseconds
endTimeLONGNO0Query end time in milliseconds
limitINTEGERNO100Number of records to return, from 1 to 200

parentAccountId and subAccountId cannot both be 0.

Response

data is an array. Each item contains:

FieldTypeDescription
orderIdlongOrder ID
userIdlongUser ID
markstringMark field
symbolIdstringSymbol ID
sideintegerSide. 1 buy, 2 sell
timelongOrder time in milliseconds
orderTypeintegerOrder type. 0 limit, 2 market
origQtystringOriginal quantity
executedQtystringExecuted quantity
executedAmountstringExecuted amount in USDT
avgPricestringAverage execution price
deductedFeestringDeducted fee
isAgentbooleanWhether the user is an affiliate
childUserIdlongChild user ID

Query Futures Orders

Query futures orders for users in the affiliate hierarchy. If no time range is sent, the default window is the last 7 days. Only data from the last 180 days is available, and each request can cover at most 30 days.

Request Weight

1

Request URL

GET /api/v1/agent/futuresOrdersList

Parameters

NameTypeMandatoryDefaultDescription
parentAccountIdLONGYES-Parent account ID. Send 0 when querying only by subAccountId
subAccountIdLONGYES-Sub-account ID. Send 0 when querying only by parentAccountId
fromIdLONGNO0Start cursor ID
endIdLONGNO0End cursor ID
startTimeLONGNO0Query start time in milliseconds
endTimeLONGNO0Query end time in milliseconds
limitINTEGERNO100Number of records to return, from 1 to 200

parentAccountId and subAccountId cannot both be 0.

Response

data is an array. Each item contains:

FieldTypeDescription
orderIdlongOrder ID
userIdlongUser ID
vipLevelstringVIP level
markstringMark field
symbolIdstringFutures symbol ID
marginTypestringMargin mode
timelongOrder time in milliseconds
orderSidestringOrder side
pricestringOrder price
origQtystringOriginal quantity
executedQtystringExecuted quantity
avgPricestringAverage execution price
pnlstringProfit and loss
deductedFeestringDeducted fee
isAgentbooleanWhether the user is an affiliate
feeTokenIdstringFee token ID
childUserIdlongChild user ID

Query Futures Positions

Query futures positions for users in the affiliate hierarchy.

Request Weight

1

Request URL

GET /api/v1/agent/futuresPositionsList

Parameters

NameTypeMandatoryDefaultDescription
parentAccountIdLONGYES-Parent account ID. Send 0 when querying only by subAccountId
subAccountIdLONGYES-Sub-account ID. Send 0 when querying only by parentAccountId
fromIdLONGNO0Start cursor ID
endIdLONGNO0End cursor ID
limitINTEGERNO100Number of records to return, from 1 to 200

parentAccountId and subAccountId cannot both be 0.

Response

data is an array. Each item contains:

FieldTypeDescription
positionIdlongPosition ID
userIdlongUser ID
vipLevelstringVIP level
markstringMark field
symbolIdstringFutures symbol ID
marginTypestringMargin mode
leveragestringLeverage
isLongintegerPosition direction. 1 long, 0 short
totalstringTotal position size
avgPricestringAverage entry price
marginstringMargin
riskRatestringRisk rate
unrealisedPnlstringUnrealized PnL
profitRatestringProfit rate
liquidationPricestringLiquidation price
childUserIdlongChild user ID

Query Invite Commission Detail

Query commission relationship and accumulated commission information for a specified invited user.

Request Weight

1

Request URL

GET /api/v1/agent/invite-commission-detail

Parameters

NameTypeMandatoryDefaultDescription
uidLONGYES-Invited user UID
startTimeLONGNO0Query start time in milliseconds
endTimeLONGNO0Query end time in milliseconds

Response

data fields:

FieldTypeDescription
uidlongInvited user UID
joinTimestringCommission relationship start time as a millisecond timestamp string
inviteeRebateRatestringCommission rate generated by this user, in decimal form. For example, 0.01 means 1%
totalCommissionstringAccumulated commission amount. May contain multiple tokens
firstTradeTimestringFirst trade time as a millisecond timestamp string. Empty string if the user has not traded
levelstringUser level, for example Lv1
volMonthstringCurrent-month trading volume in USDT
accFeestringAccumulated trading fee
regionstringCountry or region code
affiliateCodestringInvite code

Apply for Trade Detail Export

Create an export task for affiliate trade details. This endpoint creates a task and does not support read-only API Keys. By default it exports the last 7 days of data. The maximum query window is 180 days, and up to 10,000 records can be exported.

Request Weight

1

Request URL

GET /api/v1/agent/user/export

Parameters

NameTypeMandatoryDefaultDescription
beginTimeSTRINGNOStart date of the last 7 daysStart date in YYYYMMdd format, for example 20210623
endTimeSTRINGNOCurrent dateEnd date in YYYYMMdd format
uidLONGNO0Trading user UID

Response

FieldTypeDescription
databooleantrue export task submitted, false export failed

Query Export Tasks

Query trade detail export tasks that have already been requested. Download tasks are usually valid for 7 days.

Request Weight

1

Request URL

GET /api/v1/agent/export-list

Parameters

NameTypeMandatoryDefaultDescription
limitINTEGERNO50Number of records to return, from 1 to 200
fromIdLONGNO0Start cursor ID
endIdLONGNO0End cursor ID
typeINTEGERNO0Export type. 0 means trade details

Response

data is an array. Each item contains:

FieldTypeDescription
downTokenstringUnique download task token
applyTimelongApply time in milliseconds
filterStartTimelongExport filter start time
filterEndTimelongExport filter end time
statusintegerTask status. 0 applying, 1 completed, 2 canceled
typeintegerExport type. 0 means trade details

Get Export Download URL

Get the download URL for a completed export task. The download URL is valid for 60 seconds. Call this endpoint again after expiration to get a fresh URL.

Request Weight

1

Request URL

GET /api/v1/agent/export-url

Parameters

NameTypeMandatoryDefaultDescription
downTokenSTRINGNO-Unique download task token. Recommended parameter
tokenSTRINGNO-Compatibility parameter. Used when downToken is omitted

At least one of downToken and token must be sent.

Response

FieldTypeDescription
datastringDownload URL

Released under the MIT License.