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 'https://bitbucket.org/<user>/<repository>/get/master.zip' --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.

Thanks,
Christoph

Hi,

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 repo.zip 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)

Cheers,
Caterina

1 Like