# list_environments

`tools/call` · `POST /agent/v1/environments:list`

List the workspace's environments, sorted by name. Returns environments, each with the deployments of products that are not archived. Archived environments are left out unless archived says otherwise. Needs read access.

- Area: Catalog
- Needs the read grant. Read-only. Idempotent.

## Inputs

- `archived` (string, one of: `exclude`, `include`, `only`): Which environments to list: exclude (the default) leaves archived ones out, include adds them, only lists just them.

## Request

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "list_environments",
    "arguments": {
      "archived": "exclude"
    }
  }
}
```

## HTTP request

The same call over the agent HTTP API, with an agent OAuth access token:

```bash
curl -X POST https://api.qa.clankership.net/agent/v1/environments:list \
  -H "Authorization: Bearer $CLANKER_AGENT_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "archived": "exclude"
  }'
```
