-
Bug
-
Resolution: Unresolved
-
Medium
-
9
-
Severity 3 - Minor
-
1,395
-
Issue Summary
Cannot create a repo via /2.0/repositories/{workspace}/{repo_slug} with project access token (PAT)
Steps to Reproduce
- create a PAT from project settings with scope repository:admin
- try creating a repository using create repository API endpoint
Expected Results
The repository should be created
Actual Results
The below error is thrown in the API response:
{
"type": "error",
"error": {
"message": "You do not have access to view this workspace."
}
}
Workaround
- API Token: You can use an API Token as a workaround. This approach should work smoothly as long as the user has the necessary permissions to create a repository.
- Workspace Access Tokens: Another option is to use a Workspace Access Token. This functions similarly to a Project Access Token but offers permissions across the entire workspace, providing more extensive access.
Example using API Token:
curl --request POST \
--url 'https://api.bitbucket.org/2.0/repositories/{workspace}/{repo_slug}' \
--user '{user_email_address}:{api_token}' \
--header 'Content-Type: application/json' \
--data '{
"is_private": "true",
"scm": "git",
"project": {
"key": "TEST"
}
}'