Is it possible to use the API search endpoint with a workspace access token?

Olivier
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
January 9, 2025

Hello,

I've been trying to use the API workspace search [1] endpoint to query our workspace.

This works fine when I use my username and an app password but won't work when using a workspace access token [2].

Are there known restrictions applying here?

I've tried it with a `repository` only scoped token as well as with a `account`, `project` and `repository` scoped token but neither would return any results.

I'd be grateful for any help.

Thank you

Olivier

 

1: https://developer.atlassian.com/cloud/bitbucket/rest/api-group-other-operations/#api-workspaces-workspace-search-code-get

2: https://support.atlassian.com/bitbucket-cloud/docs/workspace-access-token-permissions/

2 answers

1 accepted

2 votes
Answer accepted
Syahrul
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 12, 2025

G'day, @Olivier 

Welcome to the community!

We currently don't support WAT for code search. We. have an existing feature request that I highly suggest you Vote on and Watch to keep an eye out for any updates at

https://jira.atlassian.com/browse/BCLOUD-22586

Unfortunately, the workaround is to use App password or OAuth access token as your authentication method.

Regards,
Syahrul

Olivier
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
January 12, 2025

Hello Syahrul,

Thank you for confirming that this isn't an issue on my side. I have upvoted the issue.

Maybe the docs could also mention this? It's currently not clear as it only mentions the `repository` scope as necessary for the search.

Cheers,

Olivier

Syahrul
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 13, 2025

Hey @Olivier 

Thanks for the update. I've raised an internal request to get the documentation updated.

Cheers,
Syahrul

Like Olivier likes this
0 votes
Sahir Maharaj
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.
January 12, 2025

Hello @Olivier

Workspace access tokens in Bitbucket are scoped for specific operations, and it seems the API search endpoint may require additional permissions not granted by these tokens.

I would recommend to ensure your token includes all necessary scopes (repository, project, and account) and matches the endpoint's requirements.

If the issue persists despite proper token configuration, it might be a limitation of the current API functionality.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
PERMISSIONS LEVEL
Product Admin Site Admin
TAGS
AUG Leaders

Atlassian Community Events