# Referrals

4 operations on the Logion v1 API.

- [List referral attributions](#list-referral-attributions) — `GET /v1/referrals/attributions`
- [Get referral code](#get-referral-code) — `GET /v1/referrals/code`
- [Get referral link](#get-referral-link) — `GET /v1/referrals/link`
- [Get referral statistics](#get-referral-statistics) — `GET /v1/referrals/stats`

## List referral attributions

```http
GET /v1/referrals/attributions
```

Operation id: `list_referral_attributions`

Takes an [`Authorization`](/docs/api/overview#authentication) header.

**Responses**

| Status | Meaning | Schema |
| --- | --- | --- |
| `200` | Successful response | — |
| `401` | Unauthorized | `ErrorResponse` |
| `422` | Validation Error | `HTTPValidationError` |

Returns `ListReferralAttributionsResponse[]`.

## Get referral code

```http
GET /v1/referrals/code
```

Operation id: `get_referral_code`

Takes an [`Authorization`](/docs/api/overview#authentication) header.

**Responses**

| Status | Meaning | Schema |
| --- | --- | --- |
| `200` | Successful response | `GetReferralCodeResponse` |
| `401` | Unauthorized | `ErrorResponse` |
| `422` | Validation Error | `HTTPValidationError` |

Returns `GetReferralCodeResponse`:

| Field | Type | Required | Notes |
| --- | --- | --- | --- |
| `code` | string | yes |  |
| `is_default` | boolean | yes |  |
| `label` | string, optional | no |  |
| `status` | string | yes |  |

## Get referral link

```http
GET /v1/referrals/link
```

Operation id: `get_referral_link`

Takes an [`Authorization`](/docs/api/overview#authentication) header.

**Parameters**

| Name | In | Type | Required |
| --- | --- | --- | --- |
| `course_id` | query | string(uuid), optional | no |

**Responses**

| Status | Meaning | Schema |
| --- | --- | --- |
| `200` | Successful response | `GetReferralLinkResponse` |
| `401` | Unauthorized | `ErrorResponse` |
| `422` | Validation Error | `HTTPValidationError` |

Returns `GetReferralLinkResponse`:

| Field | Type | Required | Notes |
| --- | --- | --- | --- |
| `course_id` | string(uuid), optional | no |  |
| `link` | string | yes |  |
| `referral_code` | string | yes |  |

## Get referral statistics

```http
GET /v1/referrals/stats
```

Operation id: `get_referral_stats`

Takes an [`Authorization`](/docs/api/overview#authentication) header.

**Responses**

| Status | Meaning | Schema |
| --- | --- | --- |
| `200` | Successful response | `GetReferralStatsResponse` |
| `401` | Unauthorized | `ErrorResponse` |
| `422` | Validation Error | `HTTPValidationError` |

Returns `GetReferralStatsResponse`:

| Field | Type | Required | Notes |
| --- | --- | --- | --- |
| `active_attributions` | integer | yes |  |
| `pending_rewards_cents` | integer | yes |  |
| `total_attributions` | integer | yes |  |
| `total_rewards_credited_cents` | integer | yes |  |
