# Create Server Invite

<figure><img src="/files/aC8bpm6pCR3K7pUYpAWS" alt=""><figcaption></figcaption></figure>

The Create Server Invite block is self explanatory and creates a server invite for a specific server.

## Channel

<figure><img src="/files/D0hgoxhXUFzJlEqe05z0" alt=""><figcaption></figcaption></figure>

This dropdown menu is the channel target for the server invite. You will have the three standard options to choose from.

{% tabs %}
{% tab title="Channel the command was run in" %}
If this type is selected, the server invite will be targeted towards the channel the command / event was run in.
{% endtab %}

{% tab title="Channel Option" %}
Selecting "channel option" will have the server invite target the channel a user selected inside the command from the [channel option](/custom-commands-and-events/options/channel-option.md).

### Channel Option

You must have a channel option added in the command in order for this field to work.\
Only [channel options](/custom-commands-and-events/options/channel-option.md) may be used in this field, IDs and [variables](/custom-commands-and-events/variables.md) can be used in [#channel-id](#channel-id "mention")

<figure><img src="/files/8GXGVdZeUdxD46yHqxUJ" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/5snBrLWwVNCMSMyOuFmV" alt=""><figcaption></figcaption></figure>
{% endtab %}

{% tab title="Channel ID" %}
This type selected from the dropdown will have the server invite target a specific channel ID or [variable ](/custom-commands-and-events/variables.md)that contains a channel ID.

### Channel ID

This field accepts any plain channel ID with no extra symbols or spaces. The ID can be in the form of a [variable ](/custom-commands-and-events/variables.md)as well.

<figure><img src="/files/M9lMdqhwFHo6Ujlb1sTb" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/R0CmvR4iVbMhdQ4lszam" alt=""><figcaption></figcaption></figure>
{% endtab %}
{% endtabs %}

## Invite Duration

This field is modifies how long the server invite will be valid (in seconds) for until expiration. The field only accepts integers, 0 being the duration is infinite. [Variables](/custom-commands-and-events/variables.md) can be used.

<figure><img src="/files/Ixdjc3A3WrSXdIYvi3l4" alt=""><figcaption></figcaption></figure>

## Max Uses

Similar to the duration field, this field is the number of uses the invite can have until it is unusable. Likewise, it only accepts integers and [variables](/custom-commands-and-events/variables.md). Having it set to 0 will make the amount of uses infinite.

<figure><img src="/files/tByGWt48bXRi4RICVE2K" alt=""><figcaption></figcaption></figure>

## Temporary

This dropdown menu represents a temporary kick system. If the user doesn't receive a role in 24 hours upon them joining off the invite created, they will be kicked. You can enable to disable this by making them temporary or not.

<figure><img src="/files/P41P02XgVBi0C4q9JjC9" alt=""><figcaption></figcaption></figure>

## Unique Invite

This dropdown menu represents whether the invite is unique or is based off another invite. If the "user a existing invite" is selected, then the bot will create the invite with similar settings based off other invites in that server.

<figure><img src="/files/0rVP8hY1famU7tGtHUiI" alt=""><figcaption></figcaption></figure>

## Optional Server ID

This field is where you input a plain server ID to for the server invite to target the channel in. This field can be left blank to target the server of wherever the command / event was triggered in or where a user clicked a [button](/custom-commands-and-events/actions/legacy-reply-actions/send-a-message-with-attached-buttons/buttons.md) / [menu option](/custom-commands-and-events/actions/legacy-reply-actions/send-a-message-with-a-select-menu/menu-option.md).  A [variable](/custom-commands-and-events/variables.md) containing a plain server ID that has no spaces or extra symbols can be used as well.

<figure><img src="/files/UY298dRaTRfDVABcYJ7z" alt=""><figcaption></figcaption></figure>

## Invite Variable

This field is however the variable that returns the server invite URL will be returned. This is similar to the [set a unique variable](/custom-commands-and-events/actions/other-actions/set-a-unique-variable.md) block, so you can name your variable whatever you wish inside {}. You can then use this invite variable in later actions.

<figure><img src="/files/txwIPDjdoo8iJCLKJS9x" alt=""><figcaption></figcaption></figure>

## Enable Success/Error Handles

Enable Success / Error Handles to detect success and errors inside of the action block. This allows you to run different actions if something goes wrong with your action. Inside of the handle, there are 2 different paths which are used to detect the outcome of the action. The green path on the bottom left side of the block indicates success, while the red path on the bottom right side of the block indicates error. You may attach action blocks to each side of the handle to get the outcome of your action block.

<figure><img src="/files/pYtBPljHi13YFv89blSF" alt=""><figcaption></figcaption></figure>

The Success/Error Handles feature includes 3 different error variables you can use to get information on why the action block encountered an error. Check them out [here](/custom-commands-and-events/variables.md#error-variables).

<figure><img src="/files/i83ylvvBSlx8LDGrXqlJ" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://documentation.botghost.com/custom-commands-and-events/actions/server-actions/create-server-invite.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
