## GET /v1/environments

List saved environments.

Required permissions: read:environments.
API key: Supported.
CLI user token: Supported.
Session token: Requires the ellipsis:api scope, and the session's permissions.ellipsis rules must allow the operation.
Higher permission levels include lower levels: read < write < delete.

### Response

```text
{
  "environments": [
    {
      "created_at": str,
      "edited_by": {
        "avatar_url": str,
        "id": int,
        "login": str,
        "name": str,
        "type": str
      },
      "environment": {
        "compute": {
          "cpu": int,
          "idle": str,
          "memory": { # str | null
            "gb": int,
            "mb": int
          },
          "timeout": str
        },
        "ellipsis": {
          "description": str,
          "kind": "environment",
          "metadata": {
            "annotations": {
              "[str]": str
            },
            "labels": [
              str
            ]
          },
          "name": str
        },
        "hooks": {
          "after_checkout": { # str | null
            "run": str
          },
          "before_start": { # str | null
            "run": str
          },
          "build_base": { # str | null
            "inputs": [
              str
            ],
            "run": str
          },
          "post_clone": str,
          "post_start": str,
          "validate": { # str | null
            "run": str
          }
        },
        "mcp": [ # list[str | McpServerRef | McpRemoteServer | McpCommandServer]
          {
            "args": [
              str
            ],
            "command": str,
            "env": {
              "[str]": str
            },
            "name": str
          }
        ],
        "repositories": [
          {
            "name": str,
            "owner": str,
            "ref": str
          }
        ],
        "variables": [
          {
            "name": str,
            "value": str
          }
        ]
      },
      "id": str,
      "last_sync_error": str,
      "last_synced_commit_sha": str,
      "managed_by": str,
      "name": str,
      "pending_pull_request_url": str,
      "raw_yaml": str,
      "sha": str,
      "source_details": {
        "branch": str,
        "path": str,
        "repo_id": int
      },
      "updated_at": str,
      "url": str
    }
  ]
}
```

### Python

```python
import os

from ellipsis import Ellipsis

client = Ellipsis(api_key=os.environ["ELLIPSIS_API_TOKEN"])

result = client.environments.list()
print(result)
```

### TypeScript

```typescript
import { Ellipsis } from '@ellipsis-dev/sdk';

const client = new Ellipsis({
  apiKey: process.env.ELLIPSIS_API_TOKEN!,
});

const result = await client.environments.list();
console.log(result);
```

### cURL

```bash
curl "https://api.ellipsis.dev/v1/environments" \
  -H "Authorization: Bearer $ELLIPSIS_API_TOKEN"
```

### Response schema

```json
{
  "properties": {
    "environments": {
      "items": {
        "properties": {
          "created_at": {
            "format": "date-time",
            "type": "string"
          },
          "edited_by": {
            "anyOf": [
              {
                "properties": {
                  "avatar_url": {
                    "type": "string"
                  },
                  "id": {
                    "type": "integer"
                  },
                  "login": {
                    "type": "string"
                  },
                  "name": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "type": {
                    "enum": [
                      "User",
                      "Organization",
                      "Bot",
                      "Mannequin"
                    ],
                    "type": "string"
                  }
                },
                "required": [
                  "avatar_url",
                  "id",
                  "login",
                  "name",
                  "type"
                ],
                "type": "object"
              },
              {
                "type": "null"
              }
            ]
          },
          "environment": {
            "additionalProperties": false,
            "properties": {
              "compute": {
                "additionalProperties": false,
                "properties": {
                  "cpu": {
                    "anyOf": [
                      {
                        "type": "integer"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "idle": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "memory": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "object"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "timeout": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "cpu",
                  "idle",
                  "memory",
                  "timeout"
                ],
                "type": "object",
                "x-ellipsis-returned-form-of": "ComputeConfig"
              },
              "ellipsis": {
                "additionalProperties": false,
                "properties": {
                  "description": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "kind": {
                    "const": "environment",
                    "type": "string"
                  },
                  "metadata": {
                    "additionalProperties": false,
                    "properties": {
                      "annotations": {
                        "type": "object"
                      },
                      "labels": {
                        "type": "array"
                      }
                    },
                    "required": [
                      "annotations",
                      "labels"
                    ],
                    "type": "object",
                    "x-ellipsis-returned-form-of": "ConfigMetadata"
                  },
                  "name": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "kind"
                ],
                "type": "object",
                "x-ellipsis-returned-form-of": "EnvironmentIdentity"
              },
              "hooks": {
                "additionalProperties": false,
                "properties": {
                  "after_checkout": {
                    "anyOf": [
                      {
                        "type": "object"
                      },
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "before_start": {
                    "anyOf": [
                      {
                        "type": "object"
                      },
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "build_base": {
                    "anyOf": [
                      {
                        "type": "object"
                      },
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "post_clone": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "post_start": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "validate": {
                    "anyOf": [
                      {
                        "type": "object"
                      },
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "after_checkout",
                  "before_start",
                  "build_base",
                  "post_clone",
                  "post_start",
                  "validate"
                ],
                "type": "object",
                "x-ellipsis-returned-form-of": "EnvironmentHooks"
              },
              "mcp": {
                "default": [],
                "items": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "object"
                    },
                    {
                      "type": "object"
                    },
                    {
                      "type": "object"
                    }
                  ]
                },
                "type": "array"
              },
              "repositories": {
                "default": [],
                "items": {
                  "additionalProperties": false,
                  "properties": {
                    "name": {
                      "type": "string"
                    },
                    "owner": {
                      "type": "object"
                    },
                    "ref": {
                      "type": "object"
                    }
                  },
                  "required": [
                    "name",
                    "owner",
                    "ref"
                  ],
                  "type": "object",
                  "x-ellipsis-returned-form-of": "RepositoryRef"
                },
                "type": "array"
              },
              "variables": {
                "default": [],
                "items": {
                  "additionalProperties": false,
                  "properties": {
                    "name": {
                      "type": "string"
                    },
                    "value": {
                      "type": "object"
                    }
                  },
                  "required": [
                    "name",
                    "value"
                  ],
                  "type": "object",
                  "x-ellipsis-returned-form-of": "EnvironmentVariable"
                },
                "type": "array"
              }
            },
            "required": [
              "ellipsis"
            ],
            "type": "object",
            "x-ellipsis-returned-form-of": "EnvironmentDocument"
          },
          "id": {
            "type": "string"
          },
          "last_sync_error": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "last_synced_commit_sha": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "managed_by": {
            "enum": [
              "github",
              "api",
              "ellipsis"
            ],
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "pending_pull_request_url": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "raw_yaml": {
            "type": "string"
          },
          "sha": {
            "type": "string"
          },
          "source_details": {
            "anyOf": [
              {
                "properties": {
                  "branch": {
                    "type": "string"
                  },
                  "path": {
                    "type": "string"
                  },
                  "repo_id": {
                    "type": "integer"
                  }
                },
                "required": [
                  "repo_id",
                  "path",
                  "branch"
                ],
                "type": "object"
              },
              {
                "type": "null"
              }
            ]
          },
          "updated_at": {
            "format": "date-time",
            "type": "string"
          },
          "url": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "url",
          "name",
          "sha",
          "created_at",
          "updated_at",
          "managed_by",
          "environment",
          "raw_yaml"
        ],
        "type": "object"
      },
      "type": "array"
    }
  },
  "required": [
    "environments"
  ],
  "type": "object"
}
```
