Are you in the loop? Keep up with the latest by making sure you're subscribed to Community Announcements. Just click Watch and select Articles.

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!


How do i create a bitbucket repo using REST API in our company bitbucket

We have a company wide bitbucket and I have an account and have an existing project.  Could someone please help me how to create a repo using REST API call. I can access bitbucket using  the "bitbucket.<company_name>.com" and create a repo manually.

Thanks in advance for the help.

2 answers

3 votes
Alexey Matveev
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
Nov 10, 2018

Hi Alex, thank you so much for your help, I think I'm in  the right direction now, I followed the link that you mentioned above and created my json and ran the curl command as mentioned below for creating a repo in a project, i got the response as :
           "Repository abc/test does not exist."

and when i created the same repo manually and run the same below command it says:          
           "This repository URL is already taken by 'test'  in 'ABC'".

and when i don't mention reponame in the url ( just https://bitbucket.<mycompany>.com/rest/api/1.0/projects/abc/repos" and it says:

             "A repository name must be provided to create a repository."

Here is my command: 

curl -u <username>:<password>  -X POST -H "Content-Type: application/json" -d '{

   "slug": "test",

   "forkable": false,

   "project": {

        "key": "ABC"


}' https://bitbucket.<mycompany>.com/rest/api/1.0/projects/abc/repos/test

In the above command, 'abc' is my project, 'ABC' is my project key and 'test' is the repo that I'm trying to create.

Could you please check if I'm doing anything wrong? Thank you so much for your help.


Like # people like this

Hey @Alexey Matveev 

Do you know to create a new repo from existing repo but of a specific branch only currently if I apply @Srini 's solution the new repo, I create has all the branch from the parent repo, do you what else we need to add in the body of request so that the new forked repo consist only the branch that I want to create from parent repo

I couldn't find that in docs.

I tried giving the id of the branch in the Json body but didn't work.

Best Regards,

1 vote
Daniel Eads
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
Nov 20, 2018

Hey Srini,

From the create repo endpoint, it looks like the wrong URL might be called in your curl command. The endpoint you'll want to hit is:

(swapping out yourcompany and ABC with the correct values)

The slug doesn't need to contain the project - just the repo name and scmId:

    "name": "My repo",
    "scmId": "git",
    "forkable": true

Hope that helps!


Hi@Eaniel Deads, can we create multiple repos at the same time using the above method?



Daniel Eads
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
Feb 11, 2019

Hi Bney,

The endpoint only accepts one project at a time. If you need to create multiple projects, I'd suggest using a loop in your code to iterate over the list of projects you need to create and submit a new API request for each one.


Suggest an answer

Log in or Sign up to answer
AUG Leaders

Atlassian Community Events