Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root


1 badge earned


Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!


Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.


Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!


Branch restriction - custom settings changes via API


Dear Bitbucket Community, 


I have a question regarding branch restrictions - I created new branch restriction via the API. The group which I white listed for push has also rights to delete or rewrite the branch. If the restriction is created via the interface, those settings are not marked by default and I would want to disable them via the API. I looked for flags, related with the custom settings, where they appear when are in use, but I did not find anything. This is the payload which I use with POST request to create the branch restriction:


"type": "branch",
"branch_match_kind": "glob",

"users": [],
"groups": [
"slug": "my-team",
"type": "group"

"kind": "push",
"pattern": "elena-branch",

Even with default_permission and account_privilege flag, the permissions for delete and rewrite branch histrory are still active:

"branch_match_kind": "glob",
"groups": [{
"default_permission": "read",
"account_privilege": "read",
"name": "my-team",
"slug": "my-team",
"type": "group"
"kind": "push",
"pattern": "elena-branch"


1 answer

1 accepted

0 votes
Answer accepted
Mark C
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
Sep 24, 2023

Hi @Elena Dzhordzhilova,

Thank you for reaching out to the community.

I understand that you'd like to uncheck the two branch restriction settings below via API:

  • "Allow rewriting branch history"
  • "Allow deleting this branch"

If that's correct, you can uncheck those settings by running two POST commands specifically changing the parameter "kind":

To uncheck "Allow rewriting branch history", you can use the CURL command below:

curl -u bb_username:app_password -X POST -k -H 'Content-Type: application/json; charset=utf-8' --data '{"kind": "force", "branch_match_kind": "glob", "pattern": "elena-branch"}'

To uncheck "Allow deleting this branch", you can use the CURL command below:

curl -u bb_username:app_password -X POST -k -H 'Content-Type: application/json; charset=utf-8' --data '{"kind": "delete", "branch_match_kind": "glob", "pattern": "elena-branch"}'

I hope it helps and let me know how it goes.

Mark C

Hello @Mark C !


Thank you a lot for the help!

Both POST commands worked as expected and the functionalities are disabled for the desired branch! 


Best Regards, 


Suggest an answer

Log in or Sign up to answer
AUG Leaders

Atlassian Community Events