GitLab CI/CD · Capability
GitLab API — environments
GitLab API — environments. 8 operations. Lead operation: List environments. Self-contained Naftiko capability covering one Gitlab Ci business surface.
What You Can Do
GET
Getapiv4projectsidenvironments
— List environments
/v1/api/v4/projects/{id}/environments
POST
Postapiv4projectsidenvironments
— Create a new environment
/v1/api/v4/projects/{id}/environments
DELETE
Deleteapiv4projectsidenvironmentsreviewapps
— Delete multiple stopped review apps
/v1/api/v4/projects/{id}/environments/review-apps
POST
Postapiv4projectsidenvironmentsstopstale
— Stop stale environments
/v1/api/v4/projects/{id}/environments/stop-stale
PUT
Putapiv4projectsidenvironmentsenvironmentid
— Update an existing environment
/v1/api/v4/projects/{id}/environments/{environment-id}
DELETE
Deleteapiv4projectsidenvironmentsenvironmentid
— Delete an environment
/v1/api/v4/projects/{id}/environments/{environment-id}
GET
Getapiv4projectsidenvironmentsenvironmentid
— Get a specific environment
/v1/api/v4/projects/{id}/environments/{environment-id}
POST
Postapiv4projectsidenvironmentsenvironmentidstop
— Stop an environment
/v1/api/v4/projects/{id}/environments/{environment-id}/stop
MCP Tools
list-environments
List environments
read-only
idempotent
create-new-environment
Create a new environment
delete-multiple-stopped-review-apps
Delete multiple stopped review apps
idempotent
stop-stale-environments
Stop stale environments
update-existing-environment
Update an existing environment
idempotent
delete-environment
Delete an environment
idempotent
get-specific-environment
Get a specific environment
read-only
idempotent
stop-environment
Stop an environment
Capability Spec
naftiko: 1.0.0-alpha2
info:
label: GitLab API — environments
description: 'GitLab API — environments. 8 operations. Lead operation: List environments. Self-contained Naftiko capability
covering one Gitlab Ci business surface.'
tags:
- Gitlab Ci
- environments
created: '2026-05-19'
modified: '2026-05-19'
binds:
- namespace: env
keys:
GITLAB_CI_API_KEY: GITLAB_CI_API_KEY
capability:
consumes:
- type: http
namespace: gitlab-ci-environments
baseUri: https://gitlab.com
description: GitLab API — environments business capability. Self-contained, no shared references.
resources:
- name: api-v4-projects-id-environments
path: /api/v4/projects/{id}/environments
operations:
- name: getapiv4projectsidenvironments
method: GET
description: List environments
outputRawFormat: json
outputParameters:
- name: result
type: object
value: $.
inputParameters:
- name: id
in: path
type: string
description: The ID or URL-encoded path of the project owned by the authenticated user
required: true
- name: page
in: query
type: integer
description: Current page number
- name: per_page
in: query
type: integer
description: Number of items per page
- name: name
in: query
type: string
description: Return the environment with this name. Mutually exclusive with search
- name: search
in: query
type: string
description: Return list of environments matching the search criteria. Mutually exclusive with name. Must be at
least 3 characters.
- name: states
in: query
type: string
description: 'List all environments that match a specific state. Accepted values: `available`, `stopping`, or `stopped`.
If no state value given, returns all environments'
- name: postapiv4projectsidenvironments
method: POST
description: Create a new environment
outputRawFormat: json
outputParameters:
- name: result
type: object
value: $.
inputParameters:
- name: id
in: path
type: string
description: The ID or URL-encoded path of the project owned by the authenticated user
required: true
- name: postApiV4ProjectsIdEnvironments
in: body
type: string
required: true
- name: api-v4-projects-id-environments-review_apps
path: /api/v4/projects/{id}/environments/review_apps
operations:
- name: deleteapiv4projectsidenvironmentsreviewapps
method: DELETE
description: Delete multiple stopped review apps
outputRawFormat: json
outputParameters:
- name: result
type: object
value: $.
inputParameters:
- name: id
in: path
type: string
description: The ID or URL-encoded path of the project owned by the authenticated user
required: true
- name: before
in: query
type: string
description: The date before which environments can be deleted. Defaults to 30 days ago. Expected in ISO 8601 format
(`YYYY-MM-DDTHH:MM:SSZ`)
- name: limit
in: query
type: integer
description: Maximum number of environments to delete. Defaults to 100
- name: dry_run
in: query
type: boolean
description: Defaults to true for safety reasons. It performs a dry run where no actual deletion will be performed.
Set to false to actually delete the environment
- name: api-v4-projects-id-environments-stop_stale
path: /api/v4/projects/{id}/environments/stop_stale
operations:
- name: postapiv4projectsidenvironmentsstopstale
method: POST
description: Stop stale environments
outputRawFormat: json
outputParameters:
- name: result
type: object
value: $.
inputParameters:
- name: id
in: path
type: string
description: The ID or URL-encoded path of the project owned by the authenticated user
required: true
- name: postApiV4ProjectsIdEnvironmentsStopStale
in: body
type: string
required: true
- name: api-v4-projects-id-environments-environment_id
path: /api/v4/projects/{id}/environments/{environment_id}
operations:
- name: putapiv4projectsidenvironmentsenvironmentid
method: PUT
description: Update an existing environment
outputRawFormat: json
outputParameters:
- name: result
type: object
value: $.
inputParameters:
- name: id
in: path
type: string
description: The ID or URL-encoded path of the project owned by the authenticated user
required: true
- name: environment_id
in: path
type: integer
description: The ID of the environment
required: true
- name: putApiV4ProjectsIdEnvironmentsEnvironmentId
in: body
type: string
required: true
- name: deleteapiv4projectsidenvironmentsenvironmentid
method: DELETE
description: Delete an environment
outputRawFormat: json
outputParameters:
- name: result
type: object
value: $.
inputParameters:
- name: id
in: path
type: string
description: The ID or URL-encoded path of the project owned by the authenticated user
required: true
- name: environment_id
in: path
type: integer
description: The ID of the environment
required: true
- name: getapiv4projectsidenvironmentsenvironmentid
method: GET
description: Get a specific environment
outputRawFormat: json
outputParameters:
- name: result
type: object
value: $.
inputParameters:
- name: id
in: path
type: string
description: The ID or URL-encoded path of the project owned by the authenticated user
required: true
- name: environment_id
in: path
type: integer
description: The ID of the environment
required: true
- name: api-v4-projects-id-environments-environment_id-stop
path: /api/v4/projects/{id}/environments/{environment_id}/stop
operations:
- name: postapiv4projectsidenvironmentsenvironmentidstop
method: POST
description: Stop an environment
outputRawFormat: json
outputParameters:
- name: result
type: object
value: $.
inputParameters:
- name: id
in: path
type: string
description: The ID or URL-encoded path of the project owned by the authenticated user
required: true
- name: environment_id
in: path
type: integer
description: The ID of the environment
required: true
- name: postApiV4ProjectsIdEnvironmentsEnvironmentIdStop
in: body
type: string
required: true
exposes:
- type: rest
namespace: gitlab-ci-environments-rest
port: 8080
description: REST adapter for GitLab API — environments. One Spectral-compliant resource per consumed operation, prefixed
with /v1.
resources:
- path: /v1/api/v4/projects/{id}/environments
name: api-v4-projects-id-environments
description: REST surface for api-v4-projects-id-environments.
operations:
- method: GET
name: getapiv4projectsidenvironments
description: List environments
call: gitlab-ci-environments.getapiv4projectsidenvironments
with:
id: rest.id
page: rest.page
per_page: rest.per_page
name: rest.name
search: rest.search
states: rest.states
outputParameters:
- type: object
mapping: $.
- method: POST
name: postapiv4projectsidenvironments
description: Create a new environment
call: gitlab-ci-environments.postapiv4projectsidenvironments
with:
id: rest.id
postApiV4ProjectsIdEnvironments: rest.postApiV4ProjectsIdEnvironments
outputParameters:
- type: object
mapping: $.
- path: /v1/api/v4/projects/{id}/environments/review-apps
name: api-v4-projects-id-environments-review-apps
description: REST surface for api-v4-projects-id-environments-review_apps.
operations:
- method: DELETE
name: deleteapiv4projectsidenvironmentsreviewapps
description: Delete multiple stopped review apps
call: gitlab-ci-environments.deleteapiv4projectsidenvironmentsreviewapps
with:
id: rest.id
before: rest.before
limit: rest.limit
dry_run: rest.dry_run
outputParameters:
- type: object
mapping: $.
- path: /v1/api/v4/projects/{id}/environments/stop-stale
name: api-v4-projects-id-environments-stop-stale
description: REST surface for api-v4-projects-id-environments-stop_stale.
operations:
- method: POST
name: postapiv4projectsidenvironmentsstopstale
description: Stop stale environments
call: gitlab-ci-environments.postapiv4projectsidenvironmentsstopstale
with:
id: rest.id
postApiV4ProjectsIdEnvironmentsStopStale: rest.postApiV4ProjectsIdEnvironmentsStopStale
outputParameters:
- type: object
mapping: $.
- path: /v1/api/v4/projects/{id}/environments/{environment-id}
name: api-v4-projects-id-environments-environment-id
description: REST surface for api-v4-projects-id-environments-environment_id.
operations:
- method: PUT
name: putapiv4projectsidenvironmentsenvironmentid
description: Update an existing environment
call: gitlab-ci-environments.putapiv4projectsidenvironmentsenvironmentid
with:
id: rest.id
environment_id: rest.environment_id
putApiV4ProjectsIdEnvironmentsEnvironmentId: rest.putApiV4ProjectsIdEnvironmentsEnvironmentId
outputParameters:
- type: object
mapping: $.
- method: DELETE
name: deleteapiv4projectsidenvironmentsenvironmentid
description: Delete an environment
call: gitlab-ci-environments.deleteapiv4projectsidenvironmentsenvironmentid
with:
id: rest.id
environment_id: rest.environment_id
outputParameters:
- type: object
mapping: $.
- method: GET
name: getapiv4projectsidenvironmentsenvironmentid
description: Get a specific environment
call: gitlab-ci-environments.getapiv4projectsidenvironmentsenvironmentid
with:
id: rest.id
environment_id: rest.environment_id
outputParameters:
- type: object
mapping: $.
- path: /v1/api/v4/projects/{id}/environments/{environment-id}/stop
name: api-v4-projects-id-environments-environment-id-stop
description: REST surface for api-v4-projects-id-environments-environment_id-stop.
operations:
- method: POST
name: postapiv4projectsidenvironmentsenvironmentidstop
description: Stop an environment
call: gitlab-ci-environments.postapiv4projectsidenvironmentsenvironmentidstop
with:
id: rest.id
environment_id: rest.environment_id
postApiV4ProjectsIdEnvironmentsEnvironmentIdStop: rest.postApiV4ProjectsIdEnvironmentsEnvironmentIdStop
outputParameters:
- type: object
mapping: $.
- type: mcp
namespace: gitlab-ci-environments-mcp
port: 9090
transport: http
description: MCP adapter for GitLab API — environments. One tool per consumed operation, routed inline through this capability's
consumes block.
tools:
- name: list-environments
description: List environments
hints:
readOnly: true
destructive: false
idempotent: true
call: gitlab-ci-environments.getapiv4projectsidenvironments
with:
id: tools.id
page: tools.page
per_page: tools.per_page
name: tools.name
search: tools.search
states: tools.states
outputParameters:
- type: object
mapping: $.
- name: create-new-environment
description: Create a new environment
hints:
readOnly: false
destructive: false
idempotent: false
call: gitlab-ci-environments.postapiv4projectsidenvironments
with:
id: tools.id
postApiV4ProjectsIdEnvironments: tools.postApiV4ProjectsIdEnvironments
outputParameters:
- type: object
mapping: $.
- name: delete-multiple-stopped-review-apps
description: Delete multiple stopped review apps
hints:
readOnly: false
destructive: true
idempotent: true
call: gitlab-ci-environments.deleteapiv4projectsidenvironmentsreviewapps
with:
id: tools.id
before: tools.before
limit: tools.limit
dry_run: tools.dry_run
outputParameters:
- type: object
mapping: $.
- name: stop-stale-environments
description: Stop stale environments
hints:
readOnly: false
destructive: false
idempotent: false
call: gitlab-ci-environments.postapiv4projectsidenvironmentsstopstale
with:
id: tools.id
postApiV4ProjectsIdEnvironmentsStopStale: tools.postApiV4ProjectsIdEnvironmentsStopStale
outputParameters:
- type: object
mapping: $.
- name: update-existing-environment
description: Update an existing environment
hints:
readOnly: false
destructive: false
idempotent: true
call: gitlab-ci-environments.putapiv4projectsidenvironmentsenvironmentid
with:
id: tools.id
environment_id: tools.environment_id
putApiV4ProjectsIdEnvironmentsEnvironmentId: tools.putApiV4ProjectsIdEnvironmentsEnvironmentId
outputParameters:
- type: object
mapping: $.
- name: delete-environment
description: Delete an environment
hints:
readOnly: false
destructive: true
idempotent: true
call: gitlab-ci-environments.deleteapiv4projectsidenvironmentsenvironmentid
with:
id: tools.id
environment_id: tools.environment_id
outputParameters:
- type: object
mapping: $.
- name: get-specific-environment
description: Get a specific environment
hints:
readOnly: true
destructive: false
idempotent: true
call: gitlab-ci-environments.getapiv4projectsidenvironmentsenvironmentid
with:
id: tools.id
environment_id: tools.environment_id
outputParameters:
- type: object
mapping: $.
- name: stop-environment
description: Stop an environment
hints:
readOnly: false
destructive: false
idempotent: false
call: gitlab-ci-environments.postapiv4projectsidenvironmentsenvironmentidstop
with:
id: tools.id
environment_id: tools.environment_id
postApiV4ProjectsIdEnvironmentsEnvironmentIdStop: tools.postApiV4ProjectsIdEnvironmentsEnvironmentIdStop
outputParameters:
- type: object
mapping: $.