# Get Server Invites

> Retrieve a list of invites for a server.

- ID: `get_guild_invites`
- Type: Loop
- Category: [Invites](https://inventor.bot/docs/reference/blocks/invites.md)

- Loop block: write `for item := range get_guild_invites(Args{...}) { ... }` and read the current item's outputs from `item`. See loops.

**Inputs**

| Name | Required | Description | Value |
| --- | --- | --- | --- |
| `server_id` | yes | ID of the server to retrieve invites for. |  |
| `body` |  | Blocks to run for each invite. | blocks: `func() { ... }` |

**Outputs**

| Name | Description | Value |
| --- | --- | --- |
| `iteration_number` | Current iteration (1-based). | e.g. `"1"` |
| `total_iterations` | Total number of iterations. | e.g. `"3"` |
| `invite_code` | Code for the invite. |  |
| `server_id` | ID of the server for the invite. |  |
| `channel_id` | ID of the channel for the invite. |  |
| `channel_name` | Name of the channel. |  |
| `invite_creator_user_id` | User ID of the invite creator. |  |
| `invite_creator_username` | Username of the invite creator. |  |
| `invite_uses` | Number of times the invite has been used. |  |
| `invite_max_uses` | Maximum number of times the invite can be used. |  |
| `invite_temporary` | Whether the invite is temporary. |  |
| `expires_at_unix` | Unix timestamp when the invite expires. |  |
| `invite_created_at_unix` | Unix timestamp when the invite was created. |  |

**Example**

```go
for guildInvite := range get_guild_invites(Args{server_id: trigger.server_id}) {
	send_text_message(Args{
		channel_id:      trigger.channel_id,
		message_content: "Invite Code: " + guildInvite.invite_code,
	})
}
```