---
url: >-
  https://game-engine-io.github.io/enginex-frontend-sdk/reference/api/@getenginex/sdk-igaming/interfaces/ReferralsApi.md
---
[Reference](../../../index.md) / [@getenginex/sdk-igaming](../index.md) / ReferralsApi

# ReferralsApi

The player's referrals. All three methods require login. Whoever is signing up passes the code in the core's
`auth.register({ referralCode })`; the `register` here is for someone who already has an account.

## Methods

### get()

> **get**(`params?`, `options?`): `Promise`<[`ReferralInfo`](ReferralInfo.md)>

The player's referral code, link and totals.

#### Parameters

##### params?

[`NoParams`](../../sdk/type-aliases/NoParams.md)

##### options?

[`CallOptions`](../../sdk/interfaces/CallOptions.md)

#### Returns

`Promise`<[`ReferralInfo`](ReferralInfo.md)>

#### Example

```ts
const referral = await igaming.referrals.get()
console.log(referral.code, referral.link, referral.totalEarned)
```

#### Throws

`UNAUTHENTICATED` without a session; `VALIDATION_ERROR` in `validation: 'strict'`
if a money value is not a finite number or if a counter is not an integer ≥ 0.

***

### listHistory()

> **listHistory**(`input?`, `options?`): `Promise`<[`ReferralHistory`](../type-aliases/ReferralHistory.md)>

Referral history, paginated. Pagination comes inside `data` (not in the envelope's `meta`):
the SDK builds the `Page` and computes `totalPages` (`0` without items); a page beyond the end returns
`items: []`.

#### Parameters

##### input?

[`ListReferralsInput`](ListReferralsInput.md)

##### options?

[`CallOptions`](../../sdk/interfaces/CallOptions.md)

#### Returns

`Promise`<[`ReferralHistory`](../type-aliases/ReferralHistory.md)>

#### Example

```ts
const { items, totalPages, completedCount } = await igaming.referrals.listHistory({ perPage: 20 })
items.forEach((r) => console.log(r.refereeEmailMasked, r.status))
```

#### Throws

`CONFIGURATION_ERROR` (without a request) for a `page` that is not an integer ≥ 1 or
a `perPage` outside 1–100 or not an integer; `UNAUTHENTICATED` without a session; `VALIDATION_ERROR` in
`validation: 'strict'` if the status is unknown or the money is not a finite number.

***

### register()

> **register**(`input`, `options?`): `Promise`<[`RegisteredReferral`](RegisteredReferral.md)>

Registers another player's referral code on the logged-in account (after signup). Answers
HTTP 201.

#### Parameters

##### input

[`RegisterReferralInput`](RegisterReferralInput.md)

##### options?

[`CallOptions`](../../sdk/interfaces/CallOptions.md)

#### Returns

`Promise`<[`RegisteredReferral`](RegisteredReferral.md)>

#### Example

```ts
const result = await igaming.referrals.register({ code: 'ANA123' })
console.log(result.status, result.refereeBonus)
```

#### Throws

`CONFIGURATION_ERROR` (without a request) if `code` is not non-empty text;
`UNAUTHENTICATED` without a session; the service refuses a nonexistent, already used or out-of-rule code:
decide by `error.code` (the contract does not list the codes).
