> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://ref.scoutos.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://ref.scoutos.com/_mcp/server.

# List workflow environments

GET https://api.scoutos.com/v2/workflows/{workflow_id}/environments

List all environments for a workflow in the organization

Reference: https://ref.scoutos.com/api-sdk/endpoints/environments/list

## Authentication

- `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer <token>`, where token is your auth token.

## Request

### Path parameters

- `workflow_id` (string, required)

## Response

### 200

Successful Response

- `data` (list of Environment, required)

## Errors

### 422 Unprocessable Entity Error

Validation Error

- `detail` (list of ValidationError, optional)

## Types

### Environment

- `environment_id` (string, required)
- `environment_config` (EnvironmentConfig, required)
- `created_at` (datetime, required)
- `created_by` (Identity, required)
- `last_updated_at` (datetime, required)
- `last_updated_by` (Identity, required)
- `deployments` (list of EnvironmentDeploymentDocument, required)

### ValidationError

- `loc` (list of ValidationErrorLocItems, required)
- `msg` (string, required)
- `type` (string, required)

### EnvironmentConfig

- `name` (string, required)
- `description` (string, required)

### Identity

- `type` (enum, required)
  - Allowed values: `user`, `api_key`, `system`
- `details` (IdentityDetails, required)

### EnvironmentDeploymentDocument

- `deployment_id` (string, required)
- `environment_id` (string, required)
- `deployment_config` (EnvironmentDeploymentConfig, required)
- `created_at` (datetime, required)
- `created_by` (Identity, required)

### ValidationErrorLocItems

- string
- integer

### IdentityDetails

- UserIdentity: UserIdentity
- ApiKeyIdentity: ApiKeyIdentity

### EnvironmentDeploymentConfig

- `revision_lookup` (enum, required)
  - Allowed values: `latest`, `revision_id`
- `revision_id` (string, optional, nullable) — Revision ID to direct traffic to
- `traffic` (integer, optional, default: 100)

### UserIdentity

- `user_id` (string, required)
- `org_id` (string, required)
- `scout_organization_id` (string, required)
- `email` (UserIdentityEmail, required)

### ApiKeyIdentity

- `api_key` (ApiKeyIdentityApiKey, optional)

### UserIdentityEmail

### ApiKeyIdentityApiKey

## Examples

**Response**

```json
{
  "data": [
    {
      "environment_id": "env-7f3a2b9c",
      "environment_config": {
        "name": "Production",
        "description": "Primary production environment serving live traffic"
      },
      "created_at": "2023-11-20T14:22:00Z",
      "created_by": {
        "type": "user",
        "details": {
          "user_id": "user-1234abcd",
          "org_id": "org-5678efgh",
          "scout_organization_id": "scout-org-9012ijkl",
          "email": {
            "address": "jane.doe@example.com",
            "verified": true
          }
        }
      },
      "last_updated_at": "2024-04-10T08:45:00Z",
      "last_updated_by": {
        "type": "user",
        "details": {
          "user_id": "user-9876wxyz",
          "org_id": "org-5678efgh",
          "scout_organization_id": "scout-org-9012ijkl",
          "email": {
            "address": "john.smith@example.com",
            "verified": true
          }
        }
      },
      "deployments": [
        {
          "deployment_id": "deploy-3a9f7c2e",
          "environment_id": "env-7f3a2b9c",
          "deployment_config": {
            "revision_lookup": "revision_id",
            "revision_id": "rev-20240410a",
            "traffic": 100
          },
          "created_at": "2024-04-10T08:30:00Z",
          "created_by": {
            "type": "user",
            "details": {
              "user_id": "user-9876wxyz",
              "org_id": "org-5678efgh",
              "scout_organization_id": "scout-org-9012ijkl",
              "email": {
                "address": "john.smith@example.com",
                "verified": true
              }
            }
          }
        }
      ]
    }
  ]
}
```

**SDK Code**

```python
import requests

url = "https://api.scoutos.com/v2/workflows/workflow_id/environments"

headers = {"Authorization": "Bearer <token>"}

response = requests.get(url, headers=headers)

print(response.json())
```

```typescript
import { ScoutClient } from "scoutos";

const client = new ScoutClient({ apiKey: "YOUR_API_KEY" });
await client.environments.list("workflow_id");

```

```go
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://api.scoutos.com/v2/workflows/workflow_id/environments"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("Authorization", "Bearer <token>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.scoutos.com/v2/workflows/workflow_id/environments")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://api.scoutos.com/v2/workflows/workflow_id/environments")
  .header("Authorization", "Bearer <token>")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.scoutos.com/v2/workflows/workflow_id/environments', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.scoutos.com/v2/workflows/workflow_id/environments");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Bearer <token>");
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = ["Authorization": "Bearer <token>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.scoutos.com/v2/workflows/workflow_id/environments")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```