---
title: Update Environments
description: Reference for the POST /console/v1/environments API endpoint.
product: general
token_estimate: 1535
---
# Update Environments

> For AI agents: a documentation index is available at [/llms.txt](/llms.txt). Append `.md` to any page URL for markdown, or send `Accept: text/markdown`.

## Update Environments

**POST** `/console/v1/environments`

Full URL: `https://statsigapi.net/console/v1/environments`

Update Environments

## Authorizations

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| STATSIG-API-KEY | string | Yes | — | apiKey (header) |

## Body (application/json)

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| environments | object[] | Yes | — | — |
| environments.name | string | Yes | — | The name of the environment. |
| environments.id | string | No | — | A unique identifier for the environment. If not provided, the associated environment will be treated as a newly created environment. |
| environments.isProduction | boolean | Yes | — | Whether the environment is production. |
| environments.requiresReview | boolean | Yes | — | Whether the environment requires review. |
| environments.requiredReviewGroupID | string | No | — | The ID of the review group that the environment requires review from. |
| environments.requiresReleasePipeline | boolean | Yes | — | Whether the environment requires a release pipeline. |

## Response (application/json)

**200** — Update Environments Response

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| message | string | Yes | — | A simple string explaining the result of the operation. |
| data | object | Yes | — | — |
| data.environments | object[] | Yes | — | — |
| data.environments.name | string | Yes | — | The name of the environment. |
| data.environments.id | string | Yes | — | A unique identifier for the environment. |
| data.environments.isProduction | boolean | Yes | — | Whether the environment is production. |
| data.environments.requiresReview | boolean | Yes | — | Whether the environment requires review. |
| data.environments.requiredReviewGroupID | string | No | — | The ID of the review group that the environment requires review from. |
| data.environments.requiresReleasePipeline | boolean | Yes | — | Whether the environment requires a release pipeline. |

```json
{
  "message": "Environments updated successfully.",
  "data": {
    "environments": [
      {
        "name": "development",
        "id": "0.35629335902367476",
        "isProduction": false,
        "requiresReview": false,
        "requiresReleasePipeline": true
      },
      {
        "name": "latest",
        "id": "0.08933465966698129",
        "isProduction": false,
        "requiresReview": false,
        "requiresReleasePipeline": true
      },
      {
        "name": "staging",
        "id": "0.015089163460661137",
        "isProduction": false,
        "requiresReview": false,
        "requiresReleasePipeline": true
      },
      {
        "name": "production",
        "id": "0.4067426155658289",
        "isProduction": true,
        "requiresReview": true,
        "requiresReleasePipeline": true
      }
    ]
  }
}
```

**400** — Invalid request. Please check the request input and try again.

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| status | integer | Yes | — | Allowed values: 400 |
| message | string | Yes | — | — |

```json
{
  "status": 400,
  "message": "Invalid request. Please check the request input and try again."
}
```

**401** — This endpoint only accepts an active CONSOLE key, but an invalid key was sent. Key: console-xxxXXXxxxXXXxxx

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| status | integer | Yes | — | Allowed values: 401 |
| message | string | Yes | — | — |

```json
{
  "status": 401,
  "message": "This endpoint only accepts an active CONSOLE key, but an invalid key was sent. Key: console-xxxXXXxxxXXXxxx"
}
```

## Code samples

### cURL

```bash
curl -X POST "https://statsigapi.net/console/v1/environments" \
  -H "Content-Type: application/json" \
  -H "STATSIG-API-KEY: YOUR_API_KEY"
```

### Python

```python
import requests

response = requests.post(
    "https://statsigapi.net/console/v1/environments",
    headers={
        "Content-Type": "application/json",
        "STATSIG-API-KEY": "YOUR_API_KEY"
    }
)
data = response.json()
```

### JavaScript

```javascript
const response = await fetch("https://statsigapi.net/console/v1/environments", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "STATSIG-API-KEY": "YOUR_API_KEY"
  }
});
const data = await response.json();
```

### PHP

```php
<?php
$ch = curl_init("https://statsigapi.net/console/v1/environments");
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    "Content-Type: application/json",
    "STATSIG-API-KEY: YOUR_API_KEY"
]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
```

### Go

```go
package main

import (
  "bytes"
  "net/http"
)

func main() {
req, _ := http.NewRequest("POST", "https://statsigapi.net/console/v1/environments", nil)
req.Header.Set("Content-Type", "application/json")
req.Header.Set("STATSIG-API-KEY", "YOUR_API_KEY")
  client := &http.Client{}
  resp, _ := client.Do(req)
  defer resp.Body.Close()
}
```

### Java

```java
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
      .uri(URI.create("https://statsigapi.net/console/v1/environments"))
      .method("POST", HttpRequest.BodyPublishers.noBody())
.header("Content-Type", "application/json")
      .header("STATSIG-API-KEY", "YOUR_API_KEY")
      .build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
```

### Ruby

```ruby
require "net/http"
require "json"

uri = URI("https://statsigapi.net/console/v1/environments")
request = Net::HTTP::Post.new(uri)
request["Content-Type"] = "application/json"
request["STATSIG-API-KEY"] = "YOUR_API_KEY"
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: uri.scheme == "https") do |http|
  http.request(request)
end
```

