---
title: "List the environments of a project"
method: GET
path: "/api/cli/environments"
tags: ["CI & Test Runs"]
---

# List the environments of a project

`GET /api/cli/environments`

## Request

- Base URL: `https://api.routebase.dev`
- URL: `https://api.routebase.dev/api/cli/environments`
- Auth: API key in header `X-API-Key`

Returns the environments of a project, so a pipeline can pick the one whose
variables the run should use. An environment marked `isReadOnly` rejects every
write request sent to it, and the test cases concerned are reported as blocked
rather than failed.

## Query parameters

- `ProjectIdQuery` string, uuid, required

## Headers

- `X-RB-Region` string

## Response `200`

The environments of the project.

- Environment[]
  - `id` string, uuid, required: Public id of the environment.
  - `name` string, required: Display name of the environment, such as Staging.
  - `type` 'development' | 'staging' | 'production' | 'custom', required: The stage an environment stands for.
  - `baseUrl` string, nullable: Base URL requests in this environment are sent to.
  - `createdAt` string, date-time, required: When the environment was created, in UTC.
  - `variableCount` integer, required: How many variables the environment defines for substitution.
  - `freezesVersion` boolean: A promotion into this environment makes the promoted version immutable.
  - `isDocsSource` boolean: What this environment pins is what the public documentation shows.
  - `isMockSource` boolean: What this environment pins is what the mock server serves.
  - `isReadOnly` boolean: Only GET, HEAD and OPTIONS may be sent here. Test cases that write are reported as blocked rather than run.

## Other responses

- `401`: The API key is missing, invalid, expired or revoked. A US organization calling without `X-RB-Region: us` also lands here, because the request reached the wrong region.
- `403`: The key is valid but lacks the permission or the project scope for this call. A scoped key is also refused on organization level operations by design.
- `404`: The resource does not exist, or it belongs to another organization or project. Both cases answer the same way on purpose, so the API cannot be used to probe for foreign identifiers.
- `429`: The rate limit was exceeded. The `Retry-After` header gives the seconds to wait.

---

[API](https://skmtc.dev/routebase/apis/routebase-public-api.md) · [All operations](https://skmtc.dev/routebase/apis/routebase-public-api/llms.txt) · [OpenAPI document](https://skmtc.dev/routebase/apis/routebase-public-api/revisions/7187df489f27?raw)
