---
title: "List environments"
method: GET
path: "/repos/{owner}/{repo}/environments"
tags: ["repos"]
---

# List environments

`GET /repos/{owner}/{repo}/environments`

Lists the environments for a repository.

Anyone with read access to the repository can use this endpoint.

OAuth app tokens and personal access tokens (classic) need the `repo` scope to use this endpoint with a private repository.

## Path parameters

- `owner` string, required
- `repo` string, required

## Query parameters

- `per_page` integer
- `page` integer

## Response `200`

Response

- object
  - `total_count` integer — The number of environments in this repository
  - `environments` Environment[]
    - `id` integer, required — The id of the environment.
    - `node_id` string, required
    - `name` string, required — The name of the environment.
    - `url` string, required
    - `html_url` string, required
    - `created_at` string, date-time, required — The time that the environment was created, in ISO 8601 format.
    - `updated_at` string, date-time, required — The time that the environment was last updated, in ISO 8601 format.
    - `protection_rules` union[] — Built-in deployment protection rules for the environment.
      - union
        - object
          - `id` integer, required
          - `node_id` string, required
          - `type` string, required
          - `wait_timer` integer — The amount of time to delay a job after the job is initially triggered. The time (in minutes) must be an integer between 0 and 43,200 (30 days).
        - object
          - `id` integer, required
          - `node_id` string, required
          - `prevent_self_review` boolean — Whether deployments to this environment can be approved by the user who created the deployment.
          - `type` string, required
          - `reviewers` object[] — The people or teams that may approve jobs that reference the environment. You can list up to six users or teams as reviewers. The reviewers must have at least read access to the repository. Only one of the required reviewers needs to approve the job for it to proceed.
            - `type` 'User' | 'Team' — The type of reviewer.
            - `reviewer` union
              - …
        - object
          - `id` integer, required
          - `node_id` string, required
          - `type` string, required
    - `deployment_branch_policy` DeploymentBranchPolicySettings, nullable — The type of deployment branch policy for this environment. To allow all branches to deploy, set to `null`.
      - `protected_branches` boolean, required — Whether only branches with branch protection rules can deploy to this environment. If `protected_branches` is `true`, `custom_branch_policies` must be `false`; if `protected_branches` is `false`, `custom_branch_policies` must be `true`.
      - `custom_branch_policies` boolean, required — Whether only branches that match the specified name patterns can deploy to this environment. If `custom_branch_policies` is `true`, `protected_branches` must be `false`; if `custom_branch_policies` is `false`, `protected_branches` must be `true`.

---

[API](https://skmtc.net/github/apis/rest-api.md) · [All operations](https://skmtc.net/github/apis/rest-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/github/rest-api/versions/80850db290cd/schema)
