Search

Search for code in a user's repositories

Changed on

This API will be deprecated on November 1, 2026.

Search for code in the repositories of the specified user.

Note that searches can match in the file's text (content_matches), the path (path_matches), or both.

You can use the same syntax for the search query as in the UI. E.g. to search for "foo" only within the repository "demo", use the query parameter search_query=foo+repo:demo.

Similar to other APIs, you can request more fields using a fields query parameter. E.g. to get some more information about the repository of matched files, use the query parameter search_query=foo&fields=%2Bvalues.file.commit.repository (the %2B is a URL-encoded +).

get/users/{selected_user}/search/code

Request

  • Base URL
    https://api.bitbucket.org/2.0
  • URL
    https://api.bitbucket.org/2.0/users/{selected_user}/search/code
  • Auth
    • OAuth 2
      Authorization code: https://bitbucket.org/site/oauth2/authorize
      Token URL: https://bitbucket.org/site/oauth2/access_token scopes: repository
    • or HTTP basic
    • or API key in header Authorization

Path parameters

selected_userstring required

Either the UUID of the account surrounded by curly-braces, for example {account UUID}, OR an Atlassian Account ID.

Query parameters

search_querystring required

The search query

pageinteger

Which page of the search results to retrieve

pageleninteger

How many search results to retrieve per page

Response

Successful search

sizeinteger
pageinteger
pageleninteger
query_substitutedboolean
nextstring uri
previousstring uri

Changes

    • warning

      removed the optional property ///////////// from the response with the status

    • warning

      removed the optional property ////////// from the response with the status

    • info

      endpoint deprecated

    • info

      added the optional property ///////// to the response with the status