Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Search API for bitbucket

Sabyasachi Purkayastha
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!
May 15, 2025

Hello. I am looking for an API to search for a string across my bitbucket repo. Basically when we want to search a string in bitbucket, we would use the search box on the top right corner and input the string. This would return us the files (and its contents) and which have that string. 

I am able to get a list of all my files, under a certain repo using the API mentioned at the bottom. The project key is the parent repo. repo_slug is the child repo. 

The baseURL is 

https://bitbucketdc.{company-name}.net

It uses bearer token as an authentication. Is there any API that takes in the string and returns the specific file containing the string?

 

BASE_URL + "/rest/api/1.0/projects/" + PROJECT_KEY + "/repos/" + REPO_SLUG + "/files"

2 answers

0 votes
Aman Shrivastava
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 24, 2025

Hi @Sabyasachi Purkayastha 

Currently, Bitbucket DC does not provide a search API that can search a string in a given project/repository. Instead, it communicates with the Search server by constructing a query based on parameters entered by the user in the UI search box and sending it to the Search server, which then provides the results to be displayed in the UI. Since the data resides on the Search server, you could potentially retrieve it directly, though this falls outside our support scope. Both ElasticSearch and OpenSearch offer search APIs you can utilize. You can refer to the ElasticSearch documentation or the OpenSearch documentation for examples on executing searches via API.

Regards,
Aman

0 votes
Sabyasachi Purkayastha
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!
May 15, 2025

Kindly assist @Theodora Boudale and others. Thanks

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events