---
title: "Referrals"
description: "Read your referral data from code: epochs, points, per-referral volume, fees and earnings, daily breakdowns, and referrals of your referrals."
order: 34
llms: account
---

Use these calls to build reports for the people you referred to Grvt: their trading volume and fees, what you
earned from them, and your points. They read data only.

The calls are on the edge host and have no SDK methods yet. Send them over HTTP.

| Call | Returns |
|---|---|
| `GET /api/v1/referral/epochs` | the reward epochs so far |
| `GET /api/v1/referral/points` | your points |
| `GET /api/v1/referral/data` | your direct referrals, with totals per referral |
| `POST /api/v1/referral/daily_data` | one direct referral, day by day |
| `GET /api/v1/referral/indirect_data` | referrals of your referrals |

## Before you call

- **Authenticate** with your API key in an `X-API-Key` header, or with the session cookie from a login
  ([Authentication](authentication.md#by-hand)). The data is for the account the key or session belongs to.
  Without either, calls fail with HTTP 401.
- **Account IDs** in these calls are off-chain account IDs, such as `"ACC:..."`, not `0x` addresses. Each
  referral also has its `funding_account_address`, its main account ID.
- **Numbers** in responses are JSON numbers, not decimal strings, rounded to 4 decimals. `total` is a string.
- **Errors** come back as `{"code": "err_...", "message": "...", "params": {...}}` with an HTTP status.

```sh
export GRVT_DOMAIN=testnet.grvt.io
curl -sS "https://edge.$GRVT_DOMAIN/api/v1/referral/epochs" -H "X-API-Key: $GRVT_API_KEY"
```

```json nocheck
{"epochs": [{"epoch": 1, "start_time": "<RFC 3339 time>", "end_time": "<RFC 3339 time>"}]}
```

Epochs that have started are listed, oldest first. Use their numbers as `from_epoch` and `to_epoch` below.

## Your points

`GET /api/v1/referral/points?from_epoch=10&to_epoch=12` returns
`{"total_points": 1520.5, "community_referral_points": 230.25}`. Leave out an epoch bound (or send `0`) for no
limit on that side.

## Your direct referrals

**When:** you want totals per referral over a range of epochs or days.

```sh
curl -sS "https://edge.$GRVT_DOMAIN/api/v1/referral/data?from_date=2026-11-01&to_date=2026-11-07&page_size=50" \
  -H "X-API-Key: $GRVT_API_KEY"
```

Query parameters, all optional:

| Parameter | Meaning |
|---|---|
| `from_epoch`, `to_epoch` | Epoch range. `0` or left out means no limit. |
| `from_date`, `to_date` | Day range, `YYYY-MM-DD` in UTC, both days included. Don't combine with epochs. |
| `account_id` | Only this referral. |
| `page_number`, `page_size` | Paging. Pages start at 1; the default size is 100. |
| `include_all_referrals` | `true` also lists referrals with no activity in the range, with zeros. Default `false`. |

The response has `referrals`, `total` (how many referrals match), `page_number`, `page_size` and
`total_trading_volume`, your own trading volume over the same range. Each referral has:

| Field | Meaning |
|---|---|
| `account_id`, `username`, `funding_account_address` | Who they are |
| `referral_join_time` | When they last became your referral |
| `trade_type` | Always `"Perpetual"`: the program pays on perpetuals |
| `total_trading_volume`, `total_trading_fee` | Their volume and the fees they paid |
| `total_eligible_trading_fee` | The part of their fees your earnings are based on |
| `earning_from_referral` | What you earned from them |
| `cashback_earning` | The cashback they earned |

**Watch out:** with dates, only completed UTC days are served. `to_date` defaults to yesterday, and
`from_date` to the first day with daily data. A range outside that fails with `err_referral_date_out_of_range`,
whose `params` give `earliest_date` and `latest_date`.

## One referral, day by day

```sh
curl -sS "https://edge.$GRVT_DOMAIN/api/v1/referral/daily_data" \
  -H "X-API-Key: $GRVT_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{"account_id": "ACC:...", "from_date": "2026-10-01", "to_date": "2026-10-31"}'
```

- `account_id` is required and must be your direct referral; otherwise the call fails with
  `err_referral_account_not_found` (HTTP 404).
- `to_date` defaults to yesterday and `from_date` to 89 days before it (90 days in all), but no earlier than
  the first day with data. The range can be at most 300 days (`err_referral_date_range_too_large`).

The response repeats the referral's `account_id`, `username`, `funding_account_address`, `referral_join_time`
and the resolved `from_date` and `to_date`. `days` has one entry per day with activity: `date`, `trade_type`,
`total_trading_volume`, `total_trading_fee`, `total_eligible_trading_fee`, `earning_from_referral` and
`cashback_earning`.

## Referrals of your referrals

`GET /api/v1/referral/indirect_data` takes `from_epoch`, `to_epoch`, `page_number`, `page_size` and
`include_all_referrals`, as above (no dates). Each entry has `account_id`, `username`,
`funding_account_address`, `total_trading_volume`, `total_trading_fee`, `total_eligible_trading_fee` and
`earning_from_referral`; the response adds `total`, `page_number` and `page_size`.

<details>
<summary>Errors</summary>

| Status | Code | Cause |
|---|---|---|
| 400 | `err_invalid_query_params` | A bad query parameter, or `to_epoch` below `from_epoch`. `params.reason` says which. |
| 400 | `err_referral_date_with_epoch` | Dates and epochs in one request. |
| 400 | `err_validation_invalid_date_format` | A date that isn't `YYYY-MM-DD`. |
| 400 | `err_referral_date_out_of_range` | Outside `params.earliest_date` to `params.latest_date`, or `to_date` before `from_date`. |
| 400 | `err_referral_daily_data_unavailable` | No daily data yet. |
| 400 | `err_referral_date_range_too_large` | More than `params.max_days` days. |
| 400 | `err_invalid_request_body` / `err_missing_required_fields` | `daily_data` body is not valid JSON, or has no `account_id`. |
| 404 | `err_referral_account_not_found` | `account_id` is not your direct referral. |

</details>
