Skip to main content

KOL Endpoints

Endpoints available to any registered KOL (wallet JWT required). The caller must already be an active broker; otherwise 404 not a broker is returned.


Create Invite Code

Create a direct or sub_kol invite code.

  • direct: For end-user downlines. Requires customer_rebate_ratio.
  • sub_kol: For recruiting sub-KOLs. Requires sub_kol_rebate_rate. Only available to KOLs (not Sub-KOLs). Auto-expires after 7 days.
POST /api/v1/broker/invite-code
Authorization: Bearer <wallet_jwt>
Content-Type: application/json

Request Body

Direct code:

{
"code_type": "direct",
"share_ratio": "0.10",
"customer_rebate_ratio": "0.20",
"note": "Main invite link"
}

Sub-KOL code:

{
"code_type": "sub_kol",
"share_ratio": "0.15",
"sub_kol_rebate_rate": "0.55",
"note": "Recruit sub-KOLs"
}
FieldTypeRequiredDescription
code_typestringYes"direct" or "sub_kol"
share_ratiodecimal (0–1)YesPortion of this KOL's rebate shared upward to their parent KOL
customer_rebate_ratiodecimal (0–1)direct onlyRebate fraction returned to the downline user. Cannot exceed the KOL's own rebate_rate.
sub_kol_rebate_ratedecimal (0–1)sub_kol onlyrebate_rate assigned to the sub-KOL when they bind via the code
notestringNoOptional label

Response

{
"id": 42,
"code": "A1B2C3D4",
"code_type": "direct",
"share_ratio": "0.10",
"rebate_rate": "0.20",
"note": "Main invite link",
"cached_used_count": 0,
"status": "active",
"expire_at": null,
"bound_broker": null
}
FieldTypeDescription
idint
codestring
code_typestring"direct" or "sub_kol"
share_ratiostring (decimal)
rebate_ratestring (decimal)For direct: the customer_rebate_ratio. For sub_kol: the sub_kol_rebate_rate.
notestring | null
cached_used_countint
statusstring
expire_atstring | nullISO 8601. sub_kol codes auto-expire after 7 days. direct codes have no expiry.
bound_brokerobject | nullOnly for sub_kol codes that have been bound. See Bound Broker Info.

Errors

HTTPDescription
400share_ratio or customer_rebate_ratio out of range [0, 1]
400customer_rebate_ratio exceeds caller's rebate_rate
400Sub-KOL attempting to create a sub_kol code
400Missing required type-specific field

List Invite Codes

GET /api/v1/broker/invite-codes[?code_type=sub_kol]
Authorization: Bearer <wallet_jwt>

Query Parameters

ParameterTypeRequiredDescription
code_typestringNoFilter: "all" (default), "sub_kol", or "direct"

Response

Array of invite code objects (same schema as Create Invite Code response), ordered by created_at DESC.

For sub_kol codes, bound_broker is populated when a downline has bound via the code:

Bound Broker Info

{
"wallet_address": "0xabc...",
"nickname": "Bob",
"bind_time": "2026-06-04T10:00:00Z",
"total_fee": "500.00",
"total_commission": "350.00",
"total_volume": "0",
"status": "active"
}
FieldTypeDescription
wallet_addressstringBound downline's wallet
nicknamestring | null
bind_timestring (ISO 8601)When they bound
total_feestring (decimal)Sum of trading fees from this broker
total_commissionstring (decimal)Sum of kol_net_rebate earned
total_volumestringPlaceholder — always "0"
statusstringBroker status

List Downlines

List all downlines with their referral info and rebate summary. Supports type filtering.

GET /api/v1/broker/downlines[?type=direct|sub_kol]
Authorization: Bearer <wallet_jwt>

Query Parameters

ParameterTypeRequiredDescription
typestringNoFilter: "direct" (直客 only), "sub_kol" (SubKOL only). Omit for all.

Response

[
{
"wallet_address": "0xabc...",
"bind_time": "2026-05-28T12:00:00Z",
"code_type": "direct",
"rebate_rate": "0.1000",
"share_ratio": "0",
"customer_rebate_ratio": "0.1000",
"status": "active",
"total_fee": "500.00",
"total_customer_rebate": "50.00",
"total_nominal_rebate": "400.00",
"total_kol_net_rebate": "350.00"
}
]
FieldTypeDescription
wallet_addressstringDownline user's wallet
bind_timestring (ISO 8601)When they bound
code_typestring"direct" (直客), "sub_kol" (SubKOL), or "bd" (KOL self via BD code)
rebate_ratestring (decimal)下级自己的返佣费率:直客用 customer_rebate_ratio,SubKOL/KOL 用 broker.rebate_rate
share_ratiostring (decimal)Share ratio from the invite code used
customer_rebate_ratiostring | nullCustomer rebate ratio from the invite code used
statusstringAlways "active"
total_feestring (decimal)Sum of trading fees generated by this downline
total_customer_rebatestring (decimal)Rebate returned to the downline (自返佣)
total_nominal_rebatestring (decimal)Gross rebate (cake = fee × KOL rebate rate)
total_kol_net_rebatestring (decimal)KOL's net earnings from this downline

Overview

KOL recommendation center overview with aggregated stats.

GET /api/v1/broker/overview
Authorization: Bearer <wallet_jwt>

Response

{
"broker_id": "550e8400-e29b-41d4-a716-446655440000",
"wallet_address": "0xabc...",
"nickname": "Alice",
"level": 1,
"rebate_rate": "0.70",
"parent_broker": null,
"total_invited": 42,
"total_volume": "0",
"total_fee": "1500.00",
"total_rebate": "1050.00",
"current_level_label": "Silver",
"next_level_label": "Gold"
}
FieldTypeDescription
broker_idstring (UUID)
wallet_addressstring
nicknamestring | null
levelint | nullCurrent tier level. null for sub-KOLs.
rebate_ratestring (decimal)Current rebate rate
parent_brokerstring | nullParent KOL's wallet address (only for sub-KOLs)
total_invitedintNumber of bound downlines
total_volumestringPlaceholder — always "0" currently
total_feestring (decimal)Sum of downline fees handled
total_rebatestring (decimal)Sum of kol_net_rebate earned
current_level_labelstringTier label from config (e.g. "Silver")
next_level_labelstring | nullNext tier label, or null if at max

Referral Info

GET /api/v1/broker/referral-info
Authorization: Bearer <wallet_jwt>

Response

{
"referral_code": "A1B2C3D4",
"invite_codes": [
{
"id": 42,
"code": "A1B2C3D4",
"code_type": "direct",
"share_ratio": "0.10",
"rebate_rate": "0.20",
"note": null,
"cached_used_count": 5,
"status": "active",
"expire_at": null,
"bound_broker": null
}
]
}

referral_code is the code value of the most recently created active invite code (empty string if none exist).

Each invite code follows the same schema as Create Invite Code response. For sub_kol codes, bound_broker is populated when a downline has bound (see Bound Broker Info).


Rebate Records

GET /api/v1/broker/rebate-records[?period=YYYY-MM-DD]
Authorization: Bearer <wallet_jwt>

Query Parameters

ParameterTypeRequiredDescription
periodstringNoFilter by settlement date (YYYY-MM-DD). Returns all records if omitted.

Response

Array of rebate record objects, up to 100 most recent:

[
{
"id": "550e8400-...",
"downline_wallet": "0xabc...",
"period": "2026-05-28",
"fee_amount": "10.00",
"customer_rebate": "2.00",
"nominal_rebate": "7.00",
"share_amount": "0.70",
"kol_net_rebate": "4.30",
"payment_status": "pending"
}
]
FieldTypeDescription
idstring (UUID)Record ID
downline_walletstringDownline user wallet
periodstringSettlement date
fee_amountstring (decimal)Trading fee generated by this downline
customer_rebatestring (decimal)Portion returned to the customer
nominal_rebatestring (decimal)Gross rebate before share deduction
share_amountstring (decimal)Portion shared to parent KOL
kol_net_rebatestring (decimal)Net rebate credited to this KOL
payment_statusstring"pending" or "paid"

已移除: GET /api/v1/broker/sub-kol-stats 已废弃删除,请使用 GET /api/v1/broker/downlines?type=sub_kol 替代。

Leaderboard

Rebate leaderboard for all brokers.

GET /api/v1/broker/leaderboard[?limit=20&offset=0]
Authorization: Bearer <wallet_jwt>

Query Parameters

ParameterTypeRequiredDescription
limitintNoPage size (default 20, max 100)
offsetintNoPagination offset (default 0)

Response

{
"total": 100,
"leaderboard": [
{
"rank": 1,
"broker_id": "550e8400-...",
"wallet_address": "0xabc...",
"nickname": "Alice",
"level": 3,
"rebate_rate": "0.80",
"total_fee": "5000.00",
"total_nominal_rebate": "4000.00",
"total_kol_net_rebate": "3500.00",
"downline_count": 10
}
]
}
FieldTypeDescription
totalintTotal number of brokers with rebate data
leaderboard[].rankintRanking (1-based)
leaderboard[].broker_idstring (UUID)
leaderboard[].wallet_addressstring
leaderboard[].nicknamestring | null
leaderboard[].levelintTier level
leaderboard[].rebate_ratestring (decimal)
leaderboard[].total_feestring (decimal)Sum of trading fees generated
leaderboard[].total_nominal_rebatestring (decimal)Gross rebate before share deduction
leaderboard[].total_kol_net_rebatestring (decimal)Net rebate earned by the KOL
leaderboard[].downline_countintNumber of bound downlines

Rebate Trend

Last 30 days daily commission trend for the current broker.

GET /api/v1/broker/rebate-trend
Authorization: Bearer <wallet_jwt>

Response

[
{
"date": "2026-06-01",
"total_fee": "100.00",
"total_nominal_rebate": "70.00",
"total_kol_net_rebate": "55.00"
}
]
FieldTypeDescription
datestringSettlement date (YYYY-MM-DD)
total_feestring (decimal)Sum of trading fees for this day
total_nominal_rebatestring (decimal)Gross rebate for this day
total_kol_net_rebatestring (decimal)Net rebate earned for this day

My Rebate (直客自返佣查询)

Direct users (non-brokers) can query their own rebate records. No broker status required.

GET /api/v1/broker/my-rebate[?period=YYYY-MM-DD]
Authorization: Bearer <wallet_jwt>

Query Parameters

ParameterTypeRequiredDescription
periodstringNoFilter by settlement date (YYYY-MM-DD). Returns all records if omitted.

Response

Same schema as Rebate Records. Returns up to 100 most recent records.


返佣公式 (Rebate Formula)

所有返佣从 KOL 的返佣池(cake = fee × KOL rebate rate)中分配。封顶规则:下级比例不得超过链路最低费率。

场景customer_rebatekol_net说明
直客交易fee × customer_rebate_rationominal - customer_rebate直客返佣给自己(手续费折扣)
KOL 自交易fee × kol_rebate_rate0全部返给自己
Sub-KOL 自交易fee × min(own_rate, effective_cap)nominal - customer_rebate倒挂时封顶
倒挂封顶effective_cap = min(own_rate, parent_rate, ...)取链路最低费率