> For the complete documentation index, see [llms.txt](https://docs.iynxdev.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.iynxdev.com/configuration-files/invites.md).

# Invites

## <mark style="color:blue;">Introduction</mark>

The Invites configuration file (`invites.json`) controls the invite tracking system and role rewards for users who invite members to your server.

***

## <mark style="color:blue;">Role Rewards</mark>

Automatically assign roles to users based on how many members they've successfully invited to the server.

### <mark style="color:yellow;">enabled</mark>

**Type:** Boolean

Enables or disables invite role rewards.

```json
role_rewards: {
    enabled: false,
}
```

**When `true`:** Users receive roles when they reach invite milestones\
**When `false`:** Invite tracking still works, but no roles are automatically assigned

***

### <mark style="color:yellow;">keep\_all\_roles</mark>

**Type:** Boolean

Determines whether users keep all earned invite roles or only the highest one.

```json
keep_all_roles: true
```

**When `true`:**

* User with 5 invites gets the 5-invite role
* When they reach 10 invites, they keep the 5-invite role AND get the 10-invite role
* Users accumulate all milestone roles

**When `false`:**

* User with 5 invites gets the 5-invite role
* When they reach 10 invites, the 5-invite role is removed and replaced with the 10-invite role
* Users only have their highest milestone role

***

### <mark style="color:yellow;">roles</mark>

**Type:** Array of Objects

Define which roles are awarded at which invite counts.

```json
roles: [
    {
        invites: 5,
        role_id: "804354034135597066",
    },
    {
        invites: 10,
        role_id: "804354033338286130",
    },
    {
        invites: 25,
        role_id: "123456789012345678",
    },
    {
        invites: 50,
        role_id: "234567890123456789",
    },
]
```

**invites** - Number of successful invites required to earn the role\
**role\_id** - Discord role ID to assign

{% hint style="info" %}
**Note:** Only successful invites count - if an invited member leaves the server, the invite count may be adjusted based on your server's invite tracking settings.
{% endhint %}

***

## <mark style="color:blue;">Complete Configuration Example</mark>

Here's a complete invite rewards configuration:

```json
{
    config: {
        role_rewards: {
            enabled: true,
            keep_all_roles: true,
            roles: [
                {
                    invites: 5,
                    role_id: "804354034135597066",
                },
                {
                    invites: 10,
                    role_id: "804354033338286130",
                },
                {
                    invites: 25,
                    role_id: "123456789012345678",
                },
                {
                    invites: 50,
                    role_id: "234567890123456789",
                },
                {
                    invites: 100,
                    role_id: "345678901234567890",
                },
            ]
        }
    },
}
```
