Every API here is available over the APIs.io API and to AI agents over MCP.
MCP server
One button, every client — Claude, Cursor, VS Code and the rest.
https://apis.io/mcp
Tools for apis
7 MCP tools reach this
find_apisBrowse and filter every API in the catalog.
get_api_artifactsOne API's artifacts, grouped by type.
get_openapiThe primary OpenAPI for this API.
find_similar_apisAPIs that look like this one.
apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
resolveTurn a domain, URL or GitHub org into the provider it belongs to.
find_cohortsEvery scored population of providers in the catalog.
All 92 tools →
Call it yourself
curl for this page
This API
curl "https://apis.io/api/v1/apis/gitlab:gitlab-protected-environments-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"
Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.
Get an API key
Free tier, no form to fill in. Signing in shares your email address with us — we
store it to create your key and to recognise you if you sign in with another
provider. See our Privacy Policy and
Terms.
A second provider on the same verified email joins the account you already have.
openapi: 3.2.0
info:
title: GitLab REST Protected environments API
description: GitLab REST API used to interact with a GitLab installation.
termsOfService: https://handbook.gitlab.com/handbook/legal/api-terms/
version: '19.6'
license:
name: CC BY-SA 4.0
url: https://gitlab.com/gitlab-org/gitlab/-/blob/master/LICENSE
x-gitlab-description: The license applies to the OpenAPI specification document itself. For terms governing use of the GitLab API, see the termsOfService field.
servers:
- url: https://{hostname}
description: GitLab REST API
variables:
hostname:
default: gitlab.com
description: Your GitLab instance hostname
security:
- http: []
- oauth2: []
- apiKey: []
tags:
- name: Protected environments
description: 'Use this API to manage protected environments
for a project, and protected environments for a group
for a group.
> [!note]
> The project endpoints require CI/CD to be turned on for the project. If
> CI/CD is turned off,
> requests return `403 Forbidden`, even for users who otherwise have permission to manage protected
> environments.'
x-displayName: Protected environments
externalDocs:
url: https://docs.gitlab.com/api/protected_environments/
paths:
/api/v4/projects/{id}/protected_environments:
get:
operationId: getApiV4ProjectsIdProtectedEnvironments
summary: List all protected environments for a project
description: Lists all protected environments for a specified project.
tags:
- Protected environments
responses:
'200':
description: OK
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/APIEntitiesProtectedEnvironment'
'404':
description: Not found
'400':
description: Bad Request
parameters:
- name: id
required: true
description: ID or URL-encoded path of the project.
schema:
oneOf:
- type: string
- type: integer
in: path
- name: page
required: false
description: Page number of results to retrieve.
schema:
type: integer
default: 1
in: query
example: 1
- name: per_page
required: false
description: Number of items to list per page.
schema:
type: integer
default: 20
in: query
example: 20
x-gitlab-tier: premium
post:
operationId: postApiV4ProjectsIdProtectedEnvironments
summary: Protect an environment for a project
description: Protects a specified environment for a project.
tags:
- Protected environments
responses:
'201':
description: Created
content:
application/json:
schema:
$ref: '#/components/schemas/APIEntitiesProtectedEnvironment'
'409':
description: Conflict
'404':
description: Not found
'422':
description: Unprocessable entity
'400':
description: Bad Request
parameters:
- name: id
required: true
description: ID or URL-encoded path of the project.
schema:
oneOf:
- type: string
- type: integer
in: path
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/postApiV4ProjectsIdProtectedEnvironmentsRequest'
x-gitlab-tier: premium
/api/v4/projects/{id}/protected_environments/{name}:
get:
operationId: getApiV4ProjectsIdProtectedEnvironmentsName
summary: Retrieve a protected environment for a project
description: Retrieves a specified protected environment for a project.
tags:
- Protected environments
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/APIEntitiesProtectedEnvironment'
'404':
description: Not found
'400':
description: Bad Request
parameters:
- name: id
required: true
description: ID or URL-encoded path of the project.
schema:
oneOf:
- type: string
- type: integer
in: path
- name: name
required: true
description: Name of the protected environment.
schema:
type: string
in: path
x-gitlab-tier: premium
put:
operationId: putApiV4ProjectsIdProtectedEnvironmentsName
summary: Update a protected environment for a project
description: Updates a specified protected environment for a project.
tags:
- Protected environments
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/APIEntitiesProtectedEnvironment'
'404':
description: Not found
'422':
description: Unprocessable entity
'400':
description: Bad Request
parameters:
- name: id
required: true
description: ID or URL-encoded path of the project.
schema:
oneOf:
- type: string
- type: integer
in: path
- name: name
required: true
description: Name of the environment.
schema:
type: string
in: path
requestBody:
required: false
content:
application/json:
schema:
$ref: '#/components/schemas/putApiV4ProjectsIdProtectedEnvironmentsNameRequest'
x-gitlab-tier: premium
delete:
operationId: deleteApiV4ProjectsIdProtectedEnvironmentsName
summary: Unprotect a protected environment for a project
description: Unprotects a specified protected environment for a project.
tags:
- Protected environments
responses:
'204':
description: Resource deleted
'404':
description: Not Found
'400':
description: Bad Request
parameters:
- name: id
required: true
description: ID or URL-encoded path of the project.
schema:
oneOf:
- type: string
- type: integer
in: path
- name: name
required: true
description: Name of the protected environment.
schema:
type: string
in: path
x-gitlab-tier: premium
/api/v4/groups/{id}/protected_environments:
get:
operationId: getApiV4GroupsIdProtectedEnvironments
summary: List all protected environments for a group
description: Lists all protected environments for a specified group.
tags:
- Protected environments
responses:
'200':
description: OK
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/APIEntitiesProtectedEnvironment'
'404':
description: Not found
'400':
description: Bad Request
parameters:
- name: id
required: true
description: ID or URL-encoded path of the group.
schema:
oneOf:
- type: string
- type: integer
in: path
- name: page
required: false
description: Page number of results to retrieve.
schema:
type: integer
default: 1
in: query
example: 1
- name: per_page
required: false
description: Number of items to list per page.
schema:
type: integer
default: 20
in: query
example: 20
x-gitlab-tier: premium
post:
operationId: postApiV4GroupsIdProtectedEnvironments
summary: Protect an environment for a group
description: Protects a specified environment for a group.
tags:
- Protected environments
responses:
'201':
description: Created
content:
application/json:
schema:
$ref: '#/components/schemas/APIEntitiesProtectedEnvironment'
'400':
description: Bad request
'409':
description: Conflict
'404':
description: Not found
'422':
description: Unprocessable entity
parameters:
- name: id
required: true
description: ID or URL-encoded path of the group.
schema:
oneOf:
- type: string
- type: integer
in: path
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/postApiV4GroupsIdProtectedEnvironmentsRequest'
x-gitlab-tier: premium
/api/v4/groups/{id}/protected_environments/{name}:
get:
operationId: getApiV4GroupsIdProtectedEnvironmentsName
summary: Retrieve a protected environment for a group
description: Retrieves a specified protected environment for a group.
tags:
- Protected environments
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/APIEntitiesProtectedEnvironment'
'400':
description: Bad request
'404':
description: Not found
parameters:
- name: id
required: true
description: ID or URL-encoded path of the group.
schema:
oneOf:
- type: string
- type: integer
in: path
- name: name
required: true
description: The deployment tier of the protected environment.
schema:
type: string
enum:
- production
- staging
- testing
- development
- other
minLength: 1
in: path
x-gitlab-tier: premium
put:
operationId: putApiV4GroupsIdProtectedEnvironmentsName
summary: Update a protected environment for a group
description: Updates a specified protected environment for a group.
tags:
- Protected environments
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/APIEntitiesProtectedEnvironment'
'400':
description: Bad request
'404':
description: Not found
'422':
description: Unprocessable entity
parameters:
- name: id
required: true
description: ID or URL-encoded path of the group.
schema:
oneOf:
- type: string
- type: integer
in: path
- name: name
required: true
description: The deployment tier of the protected environment.
schema:
type: string
enum:
- production
- staging
- testing
- development
- other
minLength: 1
in: path
requestBody:
required: false
content:
application/json:
schema:
$ref: '#/components/schemas/putApiV4GroupsIdProtectedEnvironmentsNameRequest'
x-gitlab-tier: premium
delete:
operationId: deleteApiV4GroupsIdProtectedEnvironmentsName
summary: Unprotect a group environment
description: Unprotects a specified protected environment for a group.
tags:
- Protected environments
responses:
'204':
description: Resource deleted
'404':
description: Not Found
'400':
description: Bad Request
parameters:
- name: id
required: true
description: ID or URL-encoded path of the group.
schema:
oneOf:
- type: string
- type: integer
in: path
- name: name
required: true
description: '[Deployment tier](https://docs.gitlab.com/ci/environments/#deployment-tier-of-environments) of the protected environment. Possible values are `production`, `staging`, `testing`, `development`, and `other`.'
schema:
type: string
in: path
x-gitlab-tier: premium
components:
schemas:
APIEntitiesProtectedEnvironmentsApprovalRule:
type: object
properties:
id:
type: integer
format: int64
user_id:
type: integer
format: int64
group_id:
type: integer
format: int64
access_level:
type: integer
access_level_description:
type: string
required_approvals:
type: integer
group_inheritance_type:
type: integer
APIEntitiesProtectedEnvironmentsDeployAccessLevel:
type: object
properties:
id:
type: integer
format: int64
example: 1
access_level:
type: integer
example: 40
access_level_description:
type: string
example: Maintainers
deploy_key_id:
type: integer
format: int64
example: 1
user_id:
type: integer
format: int64
example: 1
group_id:
type: integer
format: int64
example: 1
member_role_id:
type: integer
format: int64
example: 42
member_role_name:
type: string
example: Lead Developer
group_inheritance_type:
type: integer
example: 0
APIEntitiesProtectedEnvironment:
type: object
properties:
name:
type: string
example: production
deploy_access_levels:
$ref: '#/components/schemas/APIEntitiesProtectedEnvironmentsDeployAccessLevel'
required_approval_count:
type: integer
example: 2
approval_rules:
$ref: '#/components/schemas/APIEntitiesProtectedEnvironmentsApprovalRule'
putApiV4GroupsIdProtectedEnvironmentsNameRequest:
type: object
properties:
required_approval_count:
type: integer
description: Number of approvals required to deploy to the environment. Values greater than `0` are rejected. Deprecated. Use `approval_rules` instead.
default: 0
deploy_access_levels:
type:
- array
- 'null'
description: Array of access levels allowed to deploy to the environment, with each entry specifying a user, group, or access level.
items:
type: object
properties:
user_id:
type:
- integer
- 'null'
description: ID of the user to grant access to.
group_id:
type:
- integer
- 'null'
description: ID of the group to grant access to.
group_inheritance_type:
type:
- integer
- 'null'
enum:
- 0
- 1
- null
description: Whether to include inherited group membership. Use `0` for direct group membership only, or `1` to include inherited groups. Defaults to `0`.
id:
type:
- integer
- 'null'
description: ID of an existing entry to update.
_destroy:
type:
- boolean
- 'null'
description: If `true`, deletes the object.
access_level:
type:
- integer
- 'null'
enum:
- 40
- 30
- 20
- 60
- null
description: Access level allowed to deploy to the environment.
approval_rules:
type:
- array
- 'null'
description: Array of access levels allowed to approve deployments to the environment, with each entry specifying a user, group, or access level. Use `required_approvals` to set the number of approvals required from each entry.
items:
type: object
properties:
user_id:
type:
- integer
- 'null'
description: ID of the user to grant access to.
group_id:
type:
- integer
- 'null'
description: ID of the group to grant access to.
group_inheritance_type:
type:
- integer
- 'null'
enum:
- 0
- 1
- null
description: Whether to include inherited group membership. Use `0` for direct group membership only, or `1` to include inherited groups. Defaults to `0`.
id:
type:
- integer
- 'null'
description: ID of an existing entry to update.
_destroy:
type:
- boolean
- 'null'
description: If `true`, deletes the object.
access_level:
type:
- integer
- 'null'
enum:
- 40
- 30
- 20
- 60
- null
description: Access level allowed to approve deployments to the environment.
required_approvals:
type: integer
description: Number of approvals required for this rule.
default: 1
postApiV4ProjectsIdProtectedEnvironmentsRequest:
type: object
properties:
name:
type:
- string
- 'null'
description: Name of the environment.
required_approval_count:
type: integer
description: Number of approvals required to deploy to the environment. Values greater than `0` are rejected. Deprecated. Use `approval_rules` instead.
default: 0
deploy_access_levels:
type:
- array
- 'null'
description: Array of access levels allowed to deploy to the environment, with each entry specifying a user, group, or access level.
items:
type: object
properties:
user_id:
type:
- integer
- 'null'
description: ID of the user to grant access to.
group_id:
type:
- integer
- 'null'
description: ID of the group to grant access to.
group_inheritance_type:
type:
- integer
- 'null'
enum:
- 0
- 1
- null
description: Whether to include inherited group membership. Use `0` for direct group membership only, or `1` to include inherited groups. Defaults to `0`.
access_level:
type:
- integer
- 'null'
enum:
- 40
- 30
- 20
- 60
- null
description: Access level allowed to deploy to the environment.
approval_rules:
type:
- array
- 'null'
description: Array of access levels allowed to approve deployments to the environment, with each entry specifying a user, group, or access level. Use `required_approvals` to set the number of approvals required from each entry.
items:
type: object
properties:
user_id:
type:
- integer
- 'null'
description: ID of the user to grant access to.
group_id:
type:
- integer
- 'null'
description: ID of the group to grant access to.
group_inheritance_type:
type:
- integer
- 'null'
enum:
- 0
- 1
- null
description: Whether to include inherited group membership. Use `0` for direct group membership only, or `1` to include inherited groups. Defaults to `0`.
id:
type:
- integer
- 'null'
description: ID of an existing entry to update.
_destroy:
type:
- boolean
- 'null'
description: If `true`, deletes the object.
access_level:
type:
- integer
- 'null'
enum:
- 40
- 30
- 20
- 60
- null
description: Access level allowed to approve deployments to the environment.
required_approvals:
type: integer
description: Number of approvals required for this rule.
default: 1
required:
- name
- deploy_access_levels
putApiV4ProjectsIdProtectedEnvironmentsNameRequest:
type: object
properties:
required_approval_count:
type:
- integer
- 'null'
description: Number of approvals required to deploy to the environment. Values greater than `0` are rejected. Deprecated. Use `approval_rules` instead.
deploy_access_levels:
type:
- array
- 'null'
description: Array of access levels allowed to deploy to the environment, with each entry specifying a user, group, or access level.
items:
type: object
properties:
user_id:
type:
- integer
- 'null'
description: ID of the user to grant access to.
group_id:
type:
- integer
- 'null'
description: ID of the group to grant access to.
group_inheritance_type:
type:
- integer
- 'null'
enum:
- 0
- 1
- null
description: Whether to include inherited group membership. Use `0` for direct group membership only, or `1` to include inherited groups. Defaults to `0`.
id:
type:
- integer
- 'null'
description: ID of an existing entry to update.
_destroy:
type:
- boolean
- 'null'
description: If `true`, deletes the object.
access_level:
type:
- integer
- 'null'
enum:
- 40
- 30
- 20
- 60
- null
description: Access level allowed to deploy to the environment.
approval_rules:
type:
- array
- 'null'
description: Array of access levels allowed to approve deployments to the environment, with each entry specifying a user, group, or access level. Use `required_approvals` to set the number of approvals required from each entry.
items:
type: object
properties:
user_id:
type:
- integer
- 'null'
description: ID of the user to grant access to.
group_id:
type:
- integer
- 'null'
description: ID of the group to grant access to.
group_inheritance_type:
type:
- integer
- 'null'
enum:
- 0
- 1
- null
description: Whether to include inherited group membership. Use `0` for direct group membership only, or `1` to include inherited groups. Defaults to `0`.
id:
type:
- integer
- 'null'
description: ID of an existing entry to update.
_destroy:
type:
- boolean
- 'null'
description: If `true`, deletes the object.
access_level:
type:
- integer
- 'null'
enum:
- 40
- 30
- 20
- 60
- null
description: Access level allowed to approve deployments to the environment.
required_approvals:
type: integer
description: Number of approvals required for this rule.
default: 1
postApiV4GroupsIdProtectedEnvironmentsRequest:
type: object
properties:
name:
type: string
enum:
- production
- staging
- testing
- development
- other
description: The deployment tier of the protected environment.
minLength: 1
required_approval_count:
type: integer
description: Number of approvals required to deploy to the environment. Values greater than `0` are rejected. Deprecated. Use `approval_rules` instead.
default: 0
deploy_access_levels:
type:
- array
- 'null'
description: Array of access levels allowed to deploy to the environment, with each entry specifying a user, group, or access level.
items:
type: object
properties:
user_id:
type:
- integer
- 'null'
description: ID of the user to grant access to.
group_id:
type:
- integer
- 'null'
description: ID of the group to grant access to.
group_inheritance_type:
type:
- integer
- 'null'
enum:
- 0
- 1
- null
description: Whether to include inherited group membership. Use `0` for direct group membership only, or `1` to include inherited groups. Defaults to `0`.
access_level:
type:
- integer
- 'null'
enum:
- 40
- 30
- 20
- 60
- null
description: Access level allowed to deploy to the environment.
approval_rules:
type:
- array
- 'null'
description: Array of access levels allowed to approve deployments to the environment, with each entry specifying a user, group, or access level. Use `required_approvals` to set the number of approvals required from each entry.
items:
type: object
properties:
user_id:
type:
- integer
- 'null'
description: ID of the user to grant access to.
group_id:
type:
- integer
- 'null'
description: ID of the group to grant access to.
group_inheritance_type:
type:
- integer
- 'null'
enum:
- 0
- 1
- null
description: Whether to include inherited group membership. Use `0` for direct group membership only, or `1` to include inherited groups. Defaults to `0`.
id:
type:
- integer
- 'null'
description: ID of an existing entry to update.
_destroy:
type:
- boolean
- 'null'
description: If `true`, deletes the object.
access_level:
type:
- integer
- 'null'
enum:
- 40
- 30
- 20
- 60
- null
description: Access level allowed to approve deployments to the environment.
required_approvals:
type: integer
description: Number of approvals required for this rule.
default: 1
required:
- name
- deploy_access_levels
securitySchemes:
http:
type: http
scheme: bearer
oauth2:
type: oauth2
flows:
authorizationCode:
authorizationUrl: https://gitlab.com/oauth/authorize
tokenUrl: https://gitlab.com/oauth/token
refreshUrl: https://gitlab.com/oauth/token
scopes:
api: Grants complete read/write access to the API, including all groups and projects, the container registry, the dependency proxy, and the package registry.
read_api: Grants read access to the API, including all groups and projects, the container registry, and the package registry.
read_user: Grants read-only access to your profile through the /user API endpoint, which includes username, public email, and full name. Also grants access to read-only API endpoints under /users.
create_runner: Grants create access to the runners.
manage_runner: Grants access to manage the runners.
k8s_proxy: Grants permission to perform Kubernetes API calls using the agent for Kubernetes.
self_rotate: Grants permission for token to rotate itself.
mcp: Grants read-write access to remote Model Context Protocol (MCP) server for tools execution.
mcp_orbit: Grants access to the Orbit Knowledge Graph MCP server for graph queries and schema retrieval.
apiKey:
type: apiKey
name: PRIVATE-TOKEN
in: header