> For the complete documentation index, see [llms.txt](https://api-docs.flipster.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://api-docs.flipster.io/api-reference/affiliate/download-referee-history.md).

# Download Referee History

Downloads a detailed history of referee trading activity, individual performance, and commission rewards in a CSV format.

{% hint style="warning" %}
This API is restricted to Flipster Affiliates only. If you are not an affiliate, requests to these endpoints will return a `400 Bad Request` with the error type `UserNotKol`.
{% endhint %}

This endpoint allows affiliates to export comprehensive historical data regarding their referral network, including active referee counts, total trading volumes, and specific commission distributions. The data provided through this API is identical to the information available in the "Referee history" section at the bottom of the Flipster support page (<https://flipster.io/support/affiliate>).

It supports granular filtering by date range, `username`, and `userId`. It also lets partners view data for their sub-affiliates with a referral code. The generated CSV file includes detailed identity and performance data, such as `uid`, `userId`, taker fee rates, effective commission rates, and trading activity, making it useful for reporting and audits.

#### CSV Data Columns

The exported CSV file contains the following fields:

<table data-header-hidden><thead><tr><th width="247.6875">Column</th><th>Description</th></tr></thead><tbody><tr><td>date</td><td>Date and time of the record (Format: YYYYMMDDTHH)</td></tr><tr><td>totalRewards</td><td>Total rewards for the specified day (USDT)</td></tr><tr><td>activeReferees</td><td>Number of active referees for the day</td></tr><tr><td>totalTradingVolume</td><td>Total trading volume including bonus (USDT)</td></tr><tr><td>totalEligibleTradingVolume</td><td>Total eligible trading volume excluding bonus (USDT)</td></tr><tr><td>totalTradingFee</td><td>Total trading fee including bonus (USDT)</td></tr><tr><td>totalEligibleTradingFee</td><td>Total eligible trading fee excluding bonus (USDT)</td></tr><tr><td>referrerUid</td><td>Referrer's UID</td></tr><tr><td>signUpTime</td><td>Referee's sign-up time</td></tr><tr><td>kycStatusOfReferee</td><td>KYC status of the referee</td></tr><tr><td>firstDepositTime</td><td>Referee's first deposit time</td></tr><tr><td>totalAssetsUsdt</td><td>Referee's total assets (USDT)</td></tr><tr><td>userId</td><td>Referee's user identifier</td></tr><tr><td>username</td><td>Referee's username</td></tr><tr><td>uid</td><td>Referee's legacy unique identifier (UID)</td></tr><tr><td>referralType</td><td>Referral type (e.g., AFFILIATE or REFERRAL)</td></tr><tr><td>vipTier</td><td>VIP tier of the referee</td></tr><tr><td>takerFee</td><td>Taker fee rate applied to the referee</td></tr><tr><td>reward</td><td>Individual reward generated from the referee (USDT)</td></tr><tr><td>tradingVolume</td><td>Individual trading volume including bonus (USDT)</td></tr><tr><td>eligibleTradingVolume</td><td>Individual eligible trading volume excluding bonus (USDT)</td></tr><tr><td>tradingFee</td><td>Individual trading fee including bonus (USDT)</td></tr><tr><td>eligibleTradingFee</td><td>Individual eligible trading fee excluding bonus (USDT)</td></tr><tr><td>effectiveCommissionRate</td><td>The effective commission rate applied</td></tr></tbody></table>

## Download Referee History

> Returns CSV file containing data for the \`Referee history\` section in affiliate dashboard overview tab

```json
{"openapi":"3.0.0","info":{"title":"Prex Trading API","version":"1.0.0"},"tags":[],"servers":[{"url":"https://trading-api.flipster.io","description":"Production"}],"security":[{"thirdPartyApiKeyAuth":["read"]}],"components":{"securitySchemes":{"thirdPartyApiKeyAuth":{"description":"For third party retail API users","in":"header","name":"api-key","type":"apiKey"}},"schemas":{"Date":{"description":"DATE-ONLY representation of YYYY-MM-DD","type":"string"},"ErrorResponse":{"type":"object","properties":{"error":{"type":"object","properties":{"type":{"type":"string","description":"Error type"},"message":{"type":"string","description":"Error message"},"code":{"type":"integer","description":"Error code"}},"required":["type"]}},"required":["error"]}}},"paths":{"/api/v1/affiliate/overview-referral-history-csv":{"get":{"tags":["affiliate"],"summary":"Download Referee History","description":"Returns CSV file containing data for the `Referee history` section in affiliate dashboard overview tab","parameters":[{"in":"query","name":"startDate","description":"start date in YYYY-MM-DD, inclusive. omit for all period.","schema":{"$ref":"#/components/schemas/Date"}},{"in":"query","name":"endDate","description":"end date in YYYY-MM-DD, inclusive. omit for all period.","schema":{"$ref":"#/components/schemas/Date"}},{"in":"query","name":"username","description":"username filter","schema":{"type":"string"}},{"in":"query","name":"referralCode","description":"Optional: referral code of a sub-affiliate to view their data","schema":{"type":"string"}}],"responses":{"200":{"description":"Returns affiliate_child_daily_record table data in CSV format.\n\nCSV Columns:\n- date: Date (YYYYMMDDTHH)\n- totalRewards: Total rewards for the day (USDT)\n- activeReferees: Number of active referees for the day\n- totalTradingVolume: Total trading volume including bonus (USDT)\n- totalEligibleTradingVolume: Total eligible trading volume excluding bonus (USDT)\n- totalTradingFee: Total trading fee including bonus (USDT)\n- totalEligibleTradingFee: Total eligible trading fee excluding bonus (USDT)\n- referrerUid: Referrer UID\n- signUpTime: Referee sign-up time\n- kycStatusOfReferee: KYC status of the referee\n- firstDepositTime: Referee first deposit time\n- totalAssetsUsdt: Referee total assets (USDT)\n- userId: Referee user ID\n- username: Referee username\n- uid: Referee UID\n- referralType: Referral type (AFFILIATE or REFERRAL)\n- vipTier: VIP tier of the referee\n- takerFee: Taker fee rate\n- reward: Individual reward for the referee (USDT)\n- tradingVolume: Individual trading volume including bonus (USDT)\n- eligibleTradingVolume: Individual eligible trading volume excluding bonus (USDT)\n- tradingFee: Individual trading fee including bonus (USDT)\n- eligibleTradingFee: Individual eligible trading fee excluding bonus (USDT)\n- effectiveCommissionRate: Effective commission rate","content":{"text/csv":{"schema":{"type":"string"}}}},"400":{"description":"Bad Request\n* invalidDateAffiliateOverview (api.affiliateOverview.invalidDate): Invalid date range\n* UserNotKol (api.user.notKol): Caller or the target user (if provided via `referralCode` parameter) is not an affiliate\n* InvalidParameter (api.invalidParameter): Invalid referral code","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Unauthorized\n* Unauthorized (api.unauthorized)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden\n* Forbidden (api.forbidden): Referral code is not a sub-affiliate of the caller","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}}}
```
