REST endpoint to make repos public or private

Is there any REST endpoint to make repos and projects public or private?

Essentially looking for an automated way to accomplish this setting, and can't find it in REST API Docs.


3 answers

1 accepted

1 vote
Accepted answer

I found one api -


http://bitbucket.example/rest/api/latest/projects/{projectSlug}/repos/{repoSlug}  (PUT)

request payload- {public: true}.

It is documented here-

If you try to make an repository public  from bitbucket-server UI , then do inspect element, and see UI is also calling this API only/

Hi Ed,

We have a way to do that through a permissions update script using ScriptRunner for Bitbucket Server.

You can also set it for all future by extending the repository creation event using our event handler too.



He asked for REST endpoint, how this script gonna help ?

It's a viable answer while not directly answering the question we have scriptrunner installed and provides a method for accomplishing our larger task.


Thanks for the answers!!

Here's the catch if your project is public tweaking any repo to private will require the project to be private which in effect makes ALL repos private!

Another catch is if you tweak the project to private it has to stay private. Tweaking it back public after setting your repo private will reset the repo setting or make it public again.

Is there any way to differentiate this setting at the repo level.

Also what is the API endpoint for setting the project permission to private? It is not obvious from inspection as appears to use a class.



-Walt Shekrota

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Nov 06, 2018 in Bitbucket

Upgrade Best Practices

Hello! My name is Mark Askew and I am a Premier Support Engineer for products Bitbucket Server/Data Center, Fisheye & Crucible. Today, I want to bring the discussion that Jennifer, Matt, and ...

1,909 views 7 10
Read article

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you