# Group voice ## `POST /api/guilds/{guild_id}/groups` **Create a group session** Records a group voice channel the bot just created. Returns 404 for any guild_id other than the SideQuest server. Returns 409 if the channel already has a session. **Parameters** | Name | In | Type | Required | Description | |---|---|---|---|---| | `guild_id` | path | integer | yes | The Discord server ID. Only the SideQuest server works. | **Request body** Model: {ref}`GroupSessionCreate ` | Field | Type | Required | Description | |---|---|---|---| | `discord_channel_id` | string | yes | | | `channel_name` | string | yes | | | `kind` | {ref}`EventKind ` | yes | | | `creator_discord_id` | string | yes | | | `name` | string \| null | no | | | `note` | string \| null | no | | | `needs` | array of {ref}`SignupRole ` | no | | | `cap` | integer \| null | no | | | `event_id` | string (uuid) \| null | no | | | `card_message_id` | string \| null | no | | | `pug_role_id` | string \| null | no | | **Response `201` — The created group session.** Model: {ref}`GroupSessionSchema ` | Field | Type | Required | Description | |---|---|---|---| | `id` | string (uuid) | yes | | | `discord_channel_id` | string | yes | | | `channel_name` | string | yes | | | `kind` | {ref}`EventKind ` | yes | | | `name` | string \| null | yes | | | `note` | string \| null | yes | | | `needs` | array of {ref}`SignupRole ` | yes | | | `cap` | integer \| null | yes | | | `creator_discord_id` | string | yes | | | `owner_discord_id` | string | yes | | | `event_id` | string (uuid) \| null | yes | | | `card_message_id` | string \| null | yes | | | `pug_role_id` | string \| null | no | | | `started_at` | string (date-time) | yes | | | `ended_at` | string (date-time) \| null | yes | | | `end_reason` | {ref}`GroupEndReason ` \| null | yes | | | `peak_size` | integer | yes | | | `grouped_minutes` | integer | yes | | | `pug_minutes` | integer | no | | | `members` | array of {ref}`GroupMemberMinutes ` | yes | | | `pairs` | array of {ref}`GroupPairMinutes ` | yes | | ## `GET /api/guilds/{guild_id}/groups/open` **List open group sessions** Returns every session that hasn't ended, oldest first, with presence so far, so a restarted bot can resume counting. Returns 404 for any guild_id other than the SideQuest server. **Parameters** | Name | In | Type | Required | Description | |---|---|---|---|---| | `guild_id` | path | integer | yes | The Discord server ID. Only the SideQuest server works. | **Response `200` — The open group sessions.** Model: array of {ref}`GroupSessionSchema ` Type: array of {ref}`GroupSessionSchema ` ## `POST /api/guilds/{guild_id}/groups/purge` **Purge expired group transcripts** Deletes transcripts of sessions that ended more than the retention window ago. Returns 404 for any guild_id other than the SideQuest server. **Parameters** | Name | In | Type | Required | Description | |---|---|---|---|---| | `guild_id` | path | integer | yes | The Discord server ID. Only the SideQuest server works. | **Response `200` — How many transcripts were deleted.** Model: {ref}`GroupTranscriptPurge ` | Field | Type | Required | Description | |---|---|---|---| | `deleted` | integer | yes | | ## `GET /api/guilds/{guild_id}/groups/{session_id}` **Get a group session** Returns one group session's settings and presence so far. Returns 404 for any guild_id other than the SideQuest server, or an unknown session. **Parameters** | Name | In | Type | Required | Description | |---|---|---|---|---| | `guild_id` | path | integer | yes | The Discord server ID. Only the SideQuest server works. | | `session_id` | path | string (uuid) | yes | The session's ID. | **Response `200` — The group session.** Model: {ref}`GroupSessionSchema ` | Field | Type | Required | Description | |---|---|---|---| | `id` | string (uuid) | yes | | | `discord_channel_id` | string | yes | | | `channel_name` | string | yes | | | `kind` | {ref}`EventKind ` | yes | | | `name` | string \| null | yes | | | `note` | string \| null | yes | | | `needs` | array of {ref}`SignupRole ` | yes | | | `cap` | integer \| null | yes | | | `creator_discord_id` | string | yes | | | `owner_discord_id` | string | yes | | | `event_id` | string (uuid) \| null | yes | | | `card_message_id` | string \| null | yes | | | `pug_role_id` | string \| null | no | | | `started_at` | string (date-time) | yes | | | `ended_at` | string (date-time) \| null | yes | | | `end_reason` | {ref}`GroupEndReason ` \| null | yes | | | `peak_size` | integer | yes | | | `grouped_minutes` | integer | yes | | | `pug_minutes` | integer | no | | | `members` | array of {ref}`GroupMemberMinutes ` | yes | | | `pairs` | array of {ref}`GroupPairMinutes ` | yes | | ## `PATCH /api/guilds/{guild_id}/groups/{session_id}` **Update a group session** Changes only the fields present in the request body; `channel_name: null` is ignored (it is never cleared). Returns 404 for any guild_id other than the SideQuest server, or an unknown session. **Parameters** | Name | In | Type | Required | Description | |---|---|---|---|---| | `guild_id` | path | integer | yes | The Discord server ID. Only the SideQuest server works. | | `session_id` | path | string (uuid) | yes | The session's ID. | **Request body** Model: {ref}`GroupSessionUpdate ` | Field | Type | Required | Description | |---|---|---|---| | `channel_name` | string \| null | no | | | `name` | string \| null | no | | | `note` | string \| null | no | | | `needs` | array of {ref}`SignupRole ` \| null | no | | | `cap` | integer \| null | no | | | `owner_discord_id` | string \| null | no | | | `card_message_id` | string \| null | no | | **Response `200` — The updated group session.** Model: {ref}`GroupSessionSchema ` | Field | Type | Required | Description | |---|---|---|---| | `id` | string (uuid) | yes | | | `discord_channel_id` | string | yes | | | `channel_name` | string | yes | | | `kind` | {ref}`EventKind ` | yes | | | `name` | string \| null | yes | | | `note` | string \| null | yes | | | `needs` | array of {ref}`SignupRole ` | yes | | | `cap` | integer \| null | yes | | | `creator_discord_id` | string | yes | | | `owner_discord_id` | string | yes | | | `event_id` | string (uuid) \| null | yes | | | `card_message_id` | string \| null | yes | | | `pug_role_id` | string \| null | no | | | `started_at` | string (date-time) | yes | | | `ended_at` | string (date-time) \| null | yes | | | `end_reason` | {ref}`GroupEndReason ` \| null | yes | | | `peak_size` | integer | yes | | | `grouped_minutes` | integer | yes | | | `pug_minutes` | integer | no | | | `members` | array of {ref}`GroupMemberMinutes ` | yes | | | `pairs` | array of {ref}`GroupPairMinutes ` | yes | | ## `POST /api/guilds/{guild_id}/groups/{session_id}/close` **Close a group session** Ends a session: sets `ended_at`, `end_reason`, merges final presence, and stores the transcript if non-empty. Idempotent: closing an already-closed session only merges presence (keeps the first `ended_at`/`end_reason`/transcript). Also purges any transcripts past the retention window. Returns 404 for any guild_id other than the SideQuest server, or an unknown session. **Parameters** | Name | In | Type | Required | Description | |---|---|---|---|---| | `guild_id` | path | integer | yes | The Discord server ID. Only the SideQuest server works. | | `session_id` | path | string (uuid) | yes | The session's ID. | **Request body** Model: {ref}`GroupSessionClose ` | Field | Type | Required | Description | |---|---|---|---| | `end_reason` | {ref}`GroupEndReason ` | yes | | | `presence` | {ref}`GroupPresenceReport ` | yes | | | `transcript` | array of {ref}`GroupTranscriptMessage ` | no | | **Response `204`** — The session was closed. ## `PUT /api/guilds/{guild_id}/groups/{session_id}/presence` **Report group presence** Raises the session's stored peak size, grouped minutes, and per-member/pair minutes to the reported max. Never lowers a stored total. Returns 404 for any guild_id other than the SideQuest server, or an unknown session. **Parameters** | Name | In | Type | Required | Description | |---|---|---|---|---| | `guild_id` | path | integer | yes | The Discord server ID. Only the SideQuest server works. | | `session_id` | path | string (uuid) | yes | The session's ID. | **Request body** Model: {ref}`GroupPresenceReport ` | Field | Type | Required | Description | |---|---|---|---| | `peak_size` | integer | yes | | | `grouped_minutes` | integer | yes | | | `pug_minutes` | integer | no | | | `members` | array of {ref}`GroupMemberMinutes ` | no | | | `pairs` | array of {ref}`GroupPairMinutes ` | no | | **Response `204`** — The presence report was applied.