---
title: "Create a group"
method: POST
path: "/groups"
tags: ["Mailbox access"]
---

# Create a group

`POST /groups`

## Request

- Base URL: `https://api.primitive.dev/v1`
- URL: `https://api.primitive.dev/v1/groups`
- Auth: HTTP bearer

Creates a group. Needs roles:assign. With an org-wide API key (acting for its person) or the person's own Primitive CLI the group must have no role: a group with a role is role assignment, done in a dashboard session or with a session step-up. Adding members to a group that holds mailbox access gives them that access, so each of its entries is checked as for a mailbox edit. A group whose role names a member's personal mailbox holds only that member: giving the role to, or adding, anyone else is refused with 403 `grant_forbidden` and `details.reason` `personal_mailbox_member_only`.

## Headers

- `Idempotency-Key` string

## Request body

- CreateGroupRequest
  - `name` string, required
  - `description` string, nullable
  - `role` string, nullable
  - `members` string[]

## Response `201`

Create a group

- object
  - `success` true, required
  - `data` CreateGroupResult, required
    - `id` string, required
    - `name` string, required
    - `description` string, nullable, required
    - `role_id` string, nullable, required
    - `members` string[], required

## Other responses

- `400`: Invalid request parameters
- `401`: Invalid or missing API key
- `403`: Authenticated caller lacks permission for the operation
- `404`: feature_disabled: the feature is not enabled for the organization; or not_found: the item the path names does not exist.
- `409`: conflict: the item changed while you edited it, or a member was removed and added back. Look again, then retry.
- `429`: Rate limit exceeded. The `ratelimit-*` headers describe the limiter that rejected this request, with its own limit and window, not the API budget that successful responses report. A limiter that reports only a wait sends `Retry-After` alone.

---

[API](https://skmtc.dev/primitive/apis/primitive-api.md) - [All operations](https://skmtc.dev/primitive/apis/primitive-api/llms.txt) - [OpenAPI document](https://skmtc.dev/primitive/apis/primitive-api/revisions/bce409c97acb?raw)
