How to get Available Environments via API?

In the GitLab UI under [project page] > Operations > Environments Environments are divided into Available and Stopped tabs. Under API there is no information about environment status, nor there is any filter that would allow me to select such subsets.

I am looking mainly for available environments, hence the question from the title: How to get Available Environments via API?

1 Like


Hi @rgembalik

You can get the Environment API from below location.


@kirangavali Please, read my question carefully. I specifically asked about the list of Available Environments.
By Available I mean the environments that are listed on the tab “Available” in GitLab:

Dear @rgembalik

I investigate this issue but “Available” list is not present in GitLab API.

curl http://hostname-xxxxx/api/v4/projects/4/environments?private_token=xxxxxxxx

because there is no any option for fetching the “Available” or “Stopped” Environment list.