How do I retrieve allowed deployment branches in Bitbucket from my Forge app?

Hi everyone,

I’m working on a Forge app that needs to read the list of branches allowed to deploy to a given environment (like “production” or “staging”) in a Bitbucket repository. When I look at the Bitbucket repository settings, I see a UI control (“Branches allowed to deploy to production: main”) that restricts which branches can deploy.

I want to retrieve this data using Bitbucket’s API, but I’m having trouble figuring out which endpoint (or combination of endpoints) to call, especially from within a Forge app. Has anyone done this before or knows which Bitbucket Cloud or Server REST API endpoints expose environment deployment settings?

I was able to retrieve all other information , but this.

  • Is there a documented or stable REST endpoint for fetching the environment’s allowed branches for deployment?