---
title: "Add a Group"
method: POST
path: "/api/group"
tags: ["group"]
---

# Add a Group

`POST /api/group`

This function is an API endpoint that allows an authenticated admin to add a new group. It is tagged with "group" for OpenAPI documentation..<br> Todo allow to use different team

## Parameters

- `request`: The request data, which includes the details of the group to be added.  <br>

## Returns

If successful, this function returns a `Json<UsersResponse>` object, which includes a success message, the total number of groups, and the list of groups.  <br> If the admin is not authorized, this function returns a `status::Unauthorized` error.  <br>

## Errors

This function will return an error if the system is in maintenance mode, or if the admin is not authorized.

# Example

POST /api/group {"name":"new group","password":"string","confirm-password":"string","email":"string","is_admin":false,"group_name":"string"}

## Request body

- AddGoupRequest
  - `name` string, required
  - `note` string, required
  - `allowed_outgoings` string[], required
  - `allowed_incomings` string[], required

## Response `200`

- UsersResponse
  - `msg` string, required
  - `total` integer, required
  - `data` string, required

## Other responses

- `401`

## Changes

- **2024-06-12** `a4a2ca9fb3af` — 3 breaking, 5 warning
  - added the new required request property `allowed_incomings`
  - added the new required request property `allowed_outgoings`
  - added the new required request property `note`
  - removed the request property `confirm-password`
  - …4 more
- **2024-05-21** `1b51dd9ab58f` — 2 info
  - api tag `group` added
  - api tag `todo` removed
- **2024-05-19** `fafd43b82c78` — 5 breaking, 3 warning, 2 info
  - added the new required request property `confirm-password`
  - added the new required request property `email`
  - added the new required request property `group_name`
  - added the new required request property `is_admin`
  - …6 more

[Change history](https://skmtc.dev/nesaku/apis/sctgdesk-api-server/changes/api/group/post.md)

---

[API](https://skmtc.dev/nesaku/apis/sctgdesk-api-server.md) · [All operations](https://skmtc.dev/nesaku/apis/sctgdesk-api-server/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/nesaku/sctgdesk-api-server/revisions/b1c0e7a4434f/schema)
