> For the complete documentation index, see [llms.txt](https://dbd-ts.gitbook.io/dbdts/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://dbd-ts.gitbook.io/dbdts/functions/getserverinvite.md).

# $getServerInvite

Creates and returns a server's invite URL.

### Usage

```php
$getServerInvite[guildID]
```

This function has one param.

| Param   | Description                         | Type      | Required |
| ------- | ----------------------------------- | --------- | -------- |
| guildID | The server to create the invite in. | Snowflake | Yes      |

{% hint style="warning" %}
Your bot must have the `CREATE_INSTANT_INVITE` permission in the provided guild for this function to work.
{% endhint %}

### Example

```javascript
bot.commands.add({
    type: "basicCommand",
    name: "example",
    code: `$getServerInvite[$guildID]` //Returns the current server's invite
})
```
