---
title: "Create or update a Group from an automation GroupSpec"
method: PUT
path: "/organizations/{orgId}/environments/{envId}/groups"
tags: ["Groups"]
---

# Create or update a Group from an automation GroupSpec

`PUT /organizations/{orgId}/environments/{envId}/groups`

Create/update a Group from an automation Group Spec

## Path parameters

- `orgId` string, required
- `envId` string, required

## Query parameters

- `dryRun` boolean
- `hridContainsUUID` boolean

## Request body

- GroupSpec — Defines the desired state of a Group. Groups allow organizing users and managing their access to APIs and applications collectively.
  - `hrid` string, required — A unique human readable id identifying this resource
  - `name` string, required — Group's name.
  - `members` GroupMember[] — Members of this group with their IDP source and role assignments. Members that do not already exist in the IDP will be ignored.
    - `source` string, required — The identity provider source of the member.
    - `sourceId` string, required — The member's identifier within the identity provider.
    - `roles` object — Map of scopes to role name defining what the member can do.
  - `notifyMembers` boolean — If true, members will be notified when the group is synced with APIM.

## Response `200`

State of the successfully created/updated Group

- GroupState — Base status properties common to all resources.
  - `hrid` string, required — A unique human readable id identifying this resource
  - `name` string, required — Group's name.
  - `members` GroupMember[] — Members of this group with their IDP source and role assignments. Members that do not already exist in the IDP will be ignored.
    - `source` string, required — The identity provider source of the member.
    - `sourceId` string, required — The member's identifier within the identity provider.
    - `roles` object — Map of scopes to role name defining what the member can do.
  - `notifyMembers` boolean — If true, members will be notified when the group is synced with APIM.
  - `id` string — Resource UUID.
  - `environmentId` string — The environment ID.
  - `organizationId` string — The organization ID.
  - `errors` Errors — When a resource has been created regardless of errors, this field is used to persist the error message encountered during validation
    - `severe` string[] — Severe errors do not pass validation and will block creation/update/delete hence, this field should always be populated during the validation phase and is very unlikely to be persisted client side.
    - `warning` string[] — Warning errors do not block object creation/update/delete, most of the time because the value is ignored or defaulted.
  - `memberCount` integer — Number of members in the group.

## Other responses

- `400` — Request is invalid
- `401` — Unauthenticated
- `403` — Unauthorized
- `default` — Default error

---

[API](https://skmtc.net/gravitee-io/apis/gravitee-io-automation-api.md) · [All operations](https://skmtc.net/gravitee-io/apis/gravitee-io-automation-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/gravitee-io/gravitee-io-automation-api/revisions/ecefec7d65f9/schema)
