• Addon
  • Branch restrictions
  • Branching model
  • Commit statuses
  • Commits
  • Deployments
  • Downloads
  • Issue tracker
  • Pipelines
  • Projects
  • Pullrequests
  • Refs
  • Reports
  • Repositories
  • Snippets
  • Source
  • Ssh
  • Users
  • Webhooks
  • Workspaces
  • Other operations
Cloud
Bitbucket Cloud / Reference / REST APIs

Other operations

Postman Collection
OpenAPI
GET

Get a commit application property

Retrieve an application property value stored against a commit.

Request

Path parameters

workspace

string

Required
repo_slug

string

Required
commit

string

Required
app_key

string

Required
property_name

string

Required

Responses

The value of the property.

application/json

Application Property

An application property. It is a caller defined JSON object that Bitbucket will store and return. The _attributes field at its top level can be used to control who is allowed to read and update the property. The keys of the JSON object must match an allowed pattern. For details, see Application properties.

GET/repositories/{workspace}/{repo_slug}/commit/{commit}/properties/{app_key}/{property_name}
1 2 3 4 curl --request GET \ --url 'https://api.bitbucket.org/2.0/repositories/{workspace}/{repo_slug}/commit/{commit}/properties/{app_key}/{property_name}' \ --header 'Authorization: Bearer <access_token>' \ --header 'Accept: application/json'
200Response
1 2 3 4 5 { "_attributes": [ "public" ] }
PUT

Update a commit application property

Update an application property value stored against a commit.

Request

Path parameters

workspace

string

Required
repo_slug

string

Required
commit

string

Required
app_key

string

Required
property_name

string

Required

Request bodyapplication/json

The application property to create or update.

_attributes

array<string>

Additional Properties

any

Responses

An empty response.

PUT/repositories/{workspace}/{repo_slug}/commit/{commit}/properties/{app_key}/{property_name}
1 2 3 4 5 6 7 8 9 curl --request PUT \ --url 'https://api.bitbucket.org/2.0/repositories/{workspace}/{repo_slug}/commit/{commit}/properties/{app_key}/{property_name}' \ --header 'Authorization: Bearer <access_token>' \ --header 'Content-Type: application/json' \ --data '{ "_attributes": [ "public" ] }'
DEL

Delete a commit application property

Delete an application property value stored against a commit.

Request

Path parameters

workspace

string

Required
repo_slug

string

Required
commit

string

Required
app_key

string

Required
property_name

string

Required

Responses

An empty response.

DEL/repositories/{workspace}/{repo_slug}/commit/{commit}/properties/{app_key}/{property_name}
1 2 3 curl --request DELETE \ --url 'https://api.bitbucket.org/2.0/repositories/{workspace}/{repo_slug}/commit/{commit}/properties/{app_key}/{property_name}' \ --header 'Authorization: Bearer <access_token>'
GET

Get a repository application property

Retrieve an application property value stored against a repository.

Request

Path parameters

workspace

string

Required
repo_slug

string

Required
app_key

string

Required
property_name

string

Required

Responses

The value of the property.

application/json

Application Property

An application property. It is a caller defined JSON object that Bitbucket will store and return. The _attributes field at its top level can be used to control who is allowed to read and update the property. The keys of the JSON object must match an allowed pattern. For details, see Application properties.

GET/repositories/{workspace}/{repo_slug}/properties/{app_key}/{property_name}
1 2 3 4 curl --request GET \ --url 'https://api.bitbucket.org/2.0/repositories/{workspace}/{repo_slug}/properties/{app_key}/{property_name}' \ --header 'Authorization: Bearer <access_token>' \ --header 'Accept: application/json'
200Response
1 2 3 4 5 { "_attributes": [ "public" ] }
PUT

Update a repository application property

Update an application property value stored against a repository.

Request

Path parameters

workspace

string

Required
repo_slug

string

Required
app_key

string

Required
property_name

string

Required

Request bodyapplication/json

The application property to create or update.

_attributes

array<string>

Additional Properties

any

Responses

An empty response.

PUT/repositories/{workspace}/{repo_slug}/properties/{app_key}/{property_name}
1 2 3 4 5 6 7 8 9 curl --request PUT \ --url 'https://api.bitbucket.org/2.0/repositories/{workspace}/{repo_slug}/properties/{app_key}/{property_name}' \ --header 'Authorization: Bearer <access_token>' \ --header 'Content-Type: application/json' \ --data '{ "_attributes": [ "public" ] }'
DEL

Delete a repository application property

Delete an application property value stored against a repository.

Request

Path parameters

workspace

string

Required
repo_slug

string

Required
app_key

string

Required
property_name

string

Required

Responses

An empty response.

DEL/repositories/{workspace}/{repo_slug}/properties/{app_key}/{property_name}
1 2 3 curl --request DELETE \ --url 'https://api.bitbucket.org/2.0/repositories/{workspace}/{repo_slug}/properties/{app_key}/{property_name}' \ --header 'Authorization: Bearer <access_token>'
GET

Get a pull request application property

Retrieve an application property value stored against a pull request.

Request

Path parameters

workspace

string

Required
repo_slug

string

Required
pullrequest_id

string

Required
app_key

string

Required
property_name

string

Required

Responses

The value of the property.

application/json

Application Property

An application property. It is a caller defined JSON object that Bitbucket will store and return. The _attributes field at its top level can be used to control who is allowed to read and update the property. The keys of the JSON object must match an allowed pattern. For details, see Application properties.

GET/repositories/{workspace}/{repo_slug}/pullrequests/{pullrequest_id}/properties/{app_key}/{property_name}
1 2 3 4 curl --request GET \ --url 'https://api.bitbucket.org/2.0/repositories/{workspace}/{repo_slug}/pullrequests/{pullrequest_id}/properties/{app_key}/{property_name}' \ --header 'Authorization: Bearer <access_token>' \ --header 'Accept: application/json'
200Response
1 2 3 4 5 { "_attributes": [ "public" ] }
PUT

Update a pull request application property

Update an application property value stored against a pull request.

Request

Path parameters

workspace

string

Required
repo_slug

string

Required
pullrequest_id

string

Required
app_key

string

Required
property_name

string

Required

Request bodyapplication/json

The application property to create or update.

_attributes

array<string>

Additional Properties

any

Responses

An empty response.

PUT/repositories/{workspace}/{repo_slug}/pullrequests/{pullrequest_id}/properties/{app_key}/{property_name}
1 2 3 4 5 6 7 8 9 curl --request PUT \ --url 'https://api.bitbucket.org/2.0/repositories/{workspace}/{repo_slug}/pullrequests/{pullrequest_id}/properties/{app_key}/{property_name}' \ --header 'Authorization: Bearer <access_token>' \ --header 'Content-Type: application/json' \ --data '{ "_attributes": [ "public" ] }'
DEL

Delete a pull request application property

Delete an application property value stored against a pull request.

Request

Path parameters

workspace

string

Required
repo_slug

string

Required
pullrequest_id

string

Required
app_key

string

Required
property_name

string

Required

Responses

An empty response.

DEL/repositories/{workspace}/{repo_slug}/pullrequests/{pullrequest_id}/properties/{app_key}/{property_name}
1 2 3 curl --request DELETE \ --url 'https://api.bitbucket.org/2.0/repositories/{workspace}/{repo_slug}/pullrequests/{pullrequest_id}/properties/{app_key}/{property_name}' \ --header 'Authorization: Bearer <access_token>'
GET

Search for code in a team's repositories

Search for code in the repositories of the specified team.

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 +).

Try fields=%2Bvalues.*.*.*.* to get an idea what's possible.

repository

Request

Path parameters

username

string

Required

Query parameters

search_query

string

Required
page

integer

pagelen

integer

Responses

Successful search

application/json

search_result_page
GET/teams/{username}/search/code
1 2 3 4 curl --request GET \ --url 'https://api.bitbucket.org/2.0/teams/{username}/search/code?search_query={search_query}' \ --header 'Authorization: Bearer <access_token>' \ --header 'Accept: application/json'
200Response
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 { "size": 1, "page": 1, "pagelen": 10, "query_substituted": false, "values": [ { "type": "code_search_result", "content_match_count": 2, "content_matches": [ { "lines": [ { "line": 2, "segments": [] }, { "line": 3, "segments": [ { "text": "def " }, { "text": "foo", "match": true }, { "text": "():" } ] }, { "line": 4, "segments": [ { "text": " print(\"snek\")" } ] }, { "line": 5, "segments": [] } ] } ], "path_matches": [ { "text": "src/" }, { "text": "foo", "match": true }, { "text": ".py" } ], "file": { "path": "src/foo.py", "type": "commit_file", "links": { "self": { "href": "https://api.bitbucket.org/2.0/repositories/my-workspace/demo/src/ad6964b5fe2880dbd9ddcad1c89000f1dbcbc24b/src/foo.py" } } } } ] }
GET

Get a user application property

Retrieve an application property value stored against a user.

Request

Path parameters

selected_user

string

Required
app_key

string

Required
property_name

string

Required

Responses

The value of the property.

application/json

Application Property

An application property. It is a caller defined JSON object that Bitbucket will store and return. The _attributes field at its top level can be used to control who is allowed to read and update the property. The keys of the JSON object must match an allowed pattern. For details, see Application properties.

GET/users/{selected_user}/properties/{app_key}/{property_name}
1 2 3 4 curl --request GET \ --url 'https://api.bitbucket.org/2.0/users/{selected_user}/properties/{app_key}/{property_name}' \ --header 'Authorization: Bearer <access_token>' \ --header 'Accept: application/json'
200Response
1 2 3 4 5 { "_attributes": [ "public" ] }
PUT

Update a user application property

Update an application property value stored against a user.

Request

Path parameters

selected_user

string

Required
app_key

string

Required
property_name

string

Required

Request bodyapplication/json

The application property to create or update.

_attributes

array<string>

Additional Properties

any

Responses

An empty response.

PUT/users/{selected_user}/properties/{app_key}/{property_name}
1 2 3 4 5 6 7 8 9 curl --request PUT \ --url 'https://api.bitbucket.org/2.0/users/{selected_user}/properties/{app_key}/{property_name}' \ --header 'Authorization: Bearer <access_token>' \ --header 'Content-Type: application/json' \ --data '{ "_attributes": [ "public" ] }'
DEL

Delete a user application property

Delete an application property value stored against a user.

Request

Path parameters

selected_user

string

Required
app_key

string

Required
property_name

string

Required

Responses

An empty response.

DEL/users/{selected_user}/properties/{app_key}/{property_name}
1 2 3 curl --request DELETE \ --url 'https://api.bitbucket.org/2.0/users/{selected_user}/properties/{app_key}/{property_name}' \ --header 'Authorization: Bearer <access_token>'
GET

Search for code in a user's repositories

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 +).

repository

Request

Path parameters

selected_user

string

Required

Query parameters

search_query

string

Required
page

integer

pagelen

integer

Responses

Successful search

application/json

search_result_page
GET/users/{selected_user}/search/code
1 2 3 4 curl --request GET \ --url 'https://api.bitbucket.org/2.0/users/{selected_user}/search/code?search_query={search_query}' \ --header 'Authorization: Bearer <access_token>' \ --header 'Accept: application/json'
200Response
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 { "size": 1, "page": 1, "pagelen": 10, "query_substituted": false, "values": [ { "type": "code_search_result", "content_match_count": 2, "content_matches": [ { "lines": [ { "line": 2, "segments": [] }, { "line": 3, "segments": [ { "text": "def " }, { "text": "foo", "match": true }, { "text": "():" } ] }, { "line": 4, "segments": [ { "text": " print(\"snek\")" } ] }, { "line": 5, "segments": [] } ] } ], "path_matches": [ { "text": "src/" }, { "text": "foo", "match": true }, { "text": ".py" } ], "file": { "path": "src/foo.py", "type": "commit_file", "links": { "self": { "href": "https://api.bitbucket.org/2.0/repositories/my-workspace/demo/src/ad6964b5fe2880dbd9ddcad1c89000f1dbcbc24b/src/foo.py" } } } } ] }
GET

Search for code in a workspace

Search for code in the repositories of the specified workspace.

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 +).

Try fields=%2Bvalues.*.*.*.* to get an idea what's possible.

Scopes
repository
read:repository:bitbucket

Request

Path parameters

workspace

string

Required

Query parameters

search_query

string

Required
page

integer

pagelen

integer

Responses

Successful search

application/json

search_result_page
GET/workspaces/{workspace}/search/code
1 2 3 4 curl --request GET \ --url 'https://api.bitbucket.org/2.0/workspaces/{workspace}/search/code?search_query={search_query}' \ --header 'Authorization: Bearer <access_token>' \ --header 'Accept: application/json'
200Response
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 { "size": 1, "page": 1, "pagelen": 10, "query_substituted": false, "values": [ { "type": "code_search_result", "content_match_count": 2, "content_matches": [ { "lines": [ { "line": 2, "segments": [] }, { "line": 3, "segments": [ { "text": "def " }, { "text": "foo", "match": true }, { "text": "():" } ] }, { "line": 4, "segments": [ { "text": " print(\"snek\")" } ] }, { "line": 5, "segments": [] } ] } ], "path_matches": [ { "text": "src/" }, { "text": "foo", "match": true }, { "text": ".py" } ], "file": { "path": "src/foo.py", "type": "commit_file", "links": { "self": { "href": "https://api.bitbucket.org/2.0/repositories/my-workspace/demo/src/ad6964b5fe2880dbd9ddcad1c89000f1dbcbc24b/src/foo.py" } } } } ] }

Rate this page: