---
title: "Create or update Shared Policy Group from SharedPolicyGroupSpec"
method: PUT
path: "/organizations/{orgId}/environments/{envId}/shared-policy-groups"
tags: ["Shared Policy Group"]
---

# Create or update Shared Policy Group from SharedPolicyGroupSpec

`PUT /organizations/{orgId}/environments/{envId}/shared-policy-groups`

Create/update Shared Policy Group from Shared Policy Group Spec

## Path parameters

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

## Query parameters

- `dryRun` boolean

## Request body

- SharedPolicyGroupSpec — Shared Policy Group Spec
  - `hrid` string, required — A unique human readable id identifying this resource
  - `apiType` 'PROXY' | 'MESSAGE', required — API type compatible with a shared policy group.
  - `description` string — The description of the shared policy group
  - `prerequisiteMessage` string — The prerequisite message of the shared policy group. This message is displayed to the user to help understand the prerequisite to use the shared policy group.
  - `name` string, required — The name of the shared policy group
  - `phase` 'REQUEST' | 'RESPONSE' | 'PUBLISH' | 'SUBSCRIBE', required — The execution phase of a shared policy group policy. Only phases compatible with PROXY and MESSAGE API types are supported.
  - `steps` StepV4[] — SharedPolicyGroup Steps
    - `name` string — The name of the step
    - `description` string — A description for the step
    - `enabled` boolean, required — To enable the step globally.
    - `policy` string, required — The policy of the step (plugin ID)
    - `configuration` object — JSON Object configuration of the policy used.
    - `condition` string — The EL condition return a boolean to execute this step at runtime. Empty expression implies it is enabled.
    - `messageCondition` string — The message condition of the step (for message API)

## Response `200`

State of the successfully created / updated Shared Policy Group

- SharedPolicyGroupState — Base status properties common to all resources.
  - `hrid` string, required — A unique human readable id identifying this resource
  - `apiType` 'PROXY' | 'MESSAGE', required — API type compatible with a shared policy group.
  - `description` string — The description of the shared policy group
  - `prerequisiteMessage` string — The prerequisite message of the shared policy group. This message is displayed to the user to help understand the prerequisite to use the shared policy group.
  - `name` string, required — The name of the shared policy group
  - `phase` 'REQUEST' | 'RESPONSE' | 'PUBLISH' | 'SUBSCRIBE', required — The execution phase of a shared policy group policy. Only phases compatible with PROXY and MESSAGE API types are supported.
  - `steps` StepV4[] — SharedPolicyGroup Steps
    - `name` string — The name of the step
    - `description` string — A description for the step
    - `enabled` boolean, required — To enable the step globally.
    - `policy` string, required — The policy of the step (plugin ID)
    - `configuration` object — JSON Object configuration of the policy used.
    - `condition` string — The EL condition return a boolean to execute this step at runtime. Empty expression implies it is enabled.
    - `messageCondition` string — The message condition of the step (for message API)
  - `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.
  - `crossId` string — Identifier used to track this resource across environment promotions.

## Other responses

- `400` — Request is invalid
- `401` — Unauthenticated
- `403` — Unauthorized
- `404` — Resource not found
- `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/versions/ecefec7d65f9/schema)
