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!


Can't create repo in a bitbucket cloud with curl and access token

I am trying to create a repo in bitbucket cloud with:

curl --request GET \
  --url '{workspace}/{repo_slug}' \
  --header 'Authorization: Bearer <access_token>' \
  --header 'Accept: application/json'

The problem is with the "access_token".
I tried to put there my app password, ssh key, login password, but I always get back the same error:
{"type": "error", "error": {"message": "Access token expired."}}

I created a 
OAuth 2.0 key and secret, but can't extract a access token from them:

curl -X POST -u "key:secret" \ \
  -d grant_type=authorization_code -d code={code}

error: "Cannot use client_credentials with a consumer marked as \"public\". Calls for auto generated consumers should use urn:bitbucket:oauth2:jwt instead.", "error": "invalid_grant"}

1 answer

0 votes
Patrik S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
Nov 26, 2021
Hello Zalman,

Welcome to Atlassian Community!
I understand you’re trying to create a repository using Bitbucket API, so I would like to highlight a few points on why you are getting these errors :
  • HTTP Method : From the request you shared with us you’re using the GET method, which is used return an object describing a given repository. In order to create a new repository you should use the POST method instead.
  • Authentication Method: I’ve noticed you’re trying to use OAuth2 flow to authenticate your request, and this is usually used to integrate with other applications. In your case I would suggest using the Basic Authentication flow, providing your username and App Password.

That being said, in order to create a new repository using Basic Authentication your cUrl command would look like the following :

curl -u "<Bitbucket Username>:<AppPasswords>" -X POST -H "Content-Type: application/json" -d '{
"scm": "git",
"is_private": true,
"project": {
"key": "<your project key>"
If the project is not provided, the repository is automatically assigned to the oldest project in the workspace.
Please note that App Passwords are different from account passwords. If you haven’t created an AppPasswords yet, you can do so following these steps
Also, you can reference to the following documents for more details about the API call and authentication methods :


Hope that helps to address your questions, let me know if this works for you!

Thanks, Zalman!
Kinds regards,
Patrik S

Suggest an answer

Log in or Sign up to answer
AUG Leaders

Atlassian Community Events