Download repository as zip using repository access token

I want to switch from using app passwords to repository specific access tokens. However, I could not find a Bitbucket API which supports this.

The following fails:

curl --request GET --url '<user>/<repository>/get/' --header 'Authorization: Bearer <access token>'

{“type”: “error”, “error”: {“message”: “Token is invalid or not supported for this endpoint.”}}

I guess this endpoint does not support access tokens. Is there another API to do the same or will this be supported in future? Using app passwords is not granular enough and access tokens would be the ideal use case. I hope there is a way to use this.



In this context, it is not possible to use an access token and that this is not an officially supported REST API endpoint.

If you are still looking for an alternative, please have a look at these two answers:

Please also note that the --output parameter in the second link will “hide” the Token is invalid or not supported for this endpoint error when using it in the request.

(I know it’s been a while but I was looking into a similar topic and wanted to cross-post the answer here as well)


1 Like