---
title: "Get an environment"
method: GET
path: "/repos/{owner}/{repo}/environments/{environment_name}"
tags: ["repos"]
---

# Get an environment

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

> [!NOTE]
> To get information about name patterns that branches must match in order to deploy to this environment, see "[Get a deployment branch policy](/rest/deployments/branch-policies#get-a-deployment-branch-policy)."

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
- `environment_name` string, required

## Response `200`

Response

- Environment — Details of a deployment 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
            - SimpleUser — A GitHub user.
              - …
            - Team — Groups of organization members that gives permissions on specified repositories.
              - …
      - 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/github-v3-rest-api-2.md) · [All operations](https://skmtc.net/github/apis/github-v3-rest-api-2/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/github/github-v3-rest-api-2/versions/8ae6d0c8716e/schema)
