# Organization API: Organization deployments: Variables

> The 3 Organization API operations for variables.

Source: https://www.coritan.com/docs/api/reference/organizations/organization-deployments/env-groups-variables/

Part of [Organization deployments](/docs/api/reference/organizations/organization-deployments/).

## Operations

| Method | Path | Summary |
| --- | --- | --- |
| PUT | [`/api/v1/orgs/{org_slug}/env-groups/{group_uuid}/variables`](#op-put-api-v1-orgs-org-slug-env-groups-group-uuid-variables) | Set or replace a group's variables |
| PUT | [`/api/v1/orgs/{org_slug}/env-groups/{group_uuid}/variables/{key}`](#op-put-api-v1-orgs-org-slug-env-groups-group-uuid-variables-key) | Set a group variable |
| DELETE | [`/api/v1/orgs/{org_slug}/env-groups/{group_uuid}/variables/{key}`](#op-delete-api-v1-orgs-org-slug-env-groups-group-uuid-variables-key) | Delete one variable of one environment of a group; 404 when it has none |

### Set or replace a group's variables {#op-put-api-v1-orgs-org-slug-env-groups-group-uuid-variables}

`PUT /api/v1/orgs/{org_slug}/env-groups/{group_uuid}/variables`

Set many variables in one environment of a group, as on a deployment.

#### Parameters

| Name | In | Type | Required |
| --- | --- | --- | --- |
| `group_uuid` | path | string (uuid) | yes |
| `org_slug` | path | string | yes |

#### Request body

`application/json` (required)

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `environment` | string | no |  |
| `vars` | array of VariableIn | yes |  |
| `vars[].key` | string | yes |  |
| `vars[].value` | string or null | no | Left out: the saved value is kept |
| `vars[].secret` | boolean or null | no | Withheld from exports and redacted from build logs; new variables default to true |
| `vars[].target` | string or null | no |  |
| `replace` | boolean | no | Delete every variable of this environment not in vars |

#### Responses

| Status | Meaning |
| --- | --- |
| `200` | Success. |
| `422` | The request is not valid. `detail` lists each problem. |

### Set a group variable {#op-put-api-v1-orgs-org-slug-env-groups-group-uuid-variables-key}

`PUT /api/v1/orgs/{org_slug}/env-groups/{group_uuid}/variables/{key}`

Set one variable in one environment of a group.

#### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `group_uuid` | path | string (uuid) | yes |  |
| `key` | path | string | yes |  |
| `org_slug` | path | string | yes |  |
| `environment` | query | string | no | The environment it is set in: all, production, preview or development Default: `all`. |

#### Request body

`application/json` (required)

| Field | Type | Required |
| --- | --- | --- |
| `value` | string or null | no |
| `secret` | boolean or null | no |
| `target` | string or null | no |

#### Responses

| Status | Meaning |
| --- | --- |
| `200` | Success. |
| `422` | The request is not valid. `detail` lists each problem. |

### Delete one variable of one environment of a group; 404 when it has none {#op-delete-api-v1-orgs-org-slug-env-groups-group-uuid-variables-key}

`DELETE /api/v1/orgs/{org_slug}/env-groups/{group_uuid}/variables/{key}`

Delete one variable of one environment of a group; 404 when it has none.

#### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `group_uuid` | path | string (uuid) | yes |  |
| `key` | path | string | yes |  |
| `org_slug` | path | string | yes |  |
| `environment` | query | string | no | The environment it is deleted from: all, production, preview or development Default: `all`. |

#### Responses

| Status | Meaning |
| --- | --- |
| `200` | Success. |
| `422` | The request is not valid. `detail` lists each problem. |
