Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

Bitbucket Cloud Rest API - Deployments & Environments

I am trying to filter & sort the deployments & environments rest api for bitbucket cloud but I am getting a 404 error below are the details.


This works

fetch('{workspace}/{repo_slug}/environments/', {method:'GET', 
headers: {'Authorization': 'Basic ' + btoa('username:password')}})
.then(response => response.json())
.then(json => console.log(json));

 This gives 404. The only difference is the querystring. I have tried various combinations of

  • encoding the string
  • ending with / or ? or both
fetch('{workspace}/{repo_slug}/environments?q=slug%3D%22canary-amr-qat-hardees%22', {method:'GET', 
headers: {'Authorization': 'Basic ' + btoa('username:password')}})
.then(response => response.json())
.then(json => console.log(json));


Is filtering & sorting not supported on these endpoints?

1 answer

0 votes
Patrik S Atlassian Team Jun 21, 2022

Hello @Muffadal Hamid ,

Welcome to Atlassian Community!

I'm afraid that sorting and filtering are not supported for the environments endpoint.

However, we already have a feature request to implement that functionality, which you can check at the following link: 

I would suggest you to add your vote there, since this helps both developers and product managers to understand the interest. Also, make sure you add yourself as a watcher in case you want to receive first-hand updates from that ticket. Please note that all features are implemented with this policy in mind.

While this feature is not implemented, you have the option to retrieve all environments via the API and then use another tool to filter JSON data, like jq, in order to filter the results.

Thank you, @Muffadal Hamid .

Kind regards,

Patrik S

Thanks, @Patrik S for your response. The link you have posted talks only about the "environments" endpoint.  However, I am facing the exact same issue with the "deployments" endpoint below{workspace}/{repo_slug}/deployments?"COMPLETED"
Patrik S Atlassian Team Jun 24, 2022

Hey @Muffadal Hamid ,

Actually, the feature request BCLOUD-18729 covers both the /deployments and /environment endpoints. 

You can check that the feature name is regarding the /deployments endpoint, and I have added a comment in the feature description to also mention the /environments endpoint that is having the same behavior and currently not allowing filtering and sorting.

Thank you, @Muffadal Hamid .

Kind regards,

Patrik S

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Bitbucket

Git push size limits are coming to Bitbucket Cloud starting April 4th, 2022

Beginning on April 4th, we will be implementing push limits. This means that your push cannot be completed if it is over 3.5 GB. If you do attempt to complete a push that is over 3.5 GB, it will fail...

2,224 views 2 9
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you