swagger: '2.0'
info:
title: Bitbucket Addon Repositories API
description: Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework.
version: '2.0'
termsOfService: https://www.atlassian.com/legal/customer-agreement
contact:
name: Bitbucket Support
url: https://support.atlassian.com/bitbucket-cloud/
email: support@bitbucket.org
host: api.bitbucket.org
basePath: /2.0
schemes:
- https
consumes:
- application/json
produces:
- application/json
tags:
- name: Repositories
description: 'A Git repository is a virtual storage of your project. It
allows you to save versions of your code, which you can access
when needed. The repo resource allows you to access public repos,
or repos that belong to a specific workspace.
'
paths:
/repositories:
parameters: []
get:
tags:
- Repositories
description: '**This endpoint is deprecated. Please use the
[workspace scoped alternative](/cloud/bitbucket/rest/api-group-repositories/#api-repositories-workspace-get).**
Returns a paginated list of all public repositories.
This endpoint also supports filtering and sorting of the results. See
[filtering and sorting](/cloud/bitbucket/rest/intro/#filtering) for more details.'
summary: List public repositories
responses:
'200':
description: All public repositories.
schema:
$ref: '#/definitions/paginated_repositories'
parameters:
- name: after
in: query
description: "Filter the results to include only repositories created on or\nafter this [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601)\n timestamp. Example: `YYYY-MM-DDTHH:mm:ss.sssZ`"
required: false
type: string
- name: role
in: query
description: 'Filters the result based on the authenticated user''s role on each repository.
* **member**: returns repositories to which the user has explicit read access
* **contributor**: returns repositories to which the user has explicit write access
* **admin**: returns repositories to which the user has explicit administrator access
* **owner**: returns all repositories owned by the current user
'
required: false
type: string
enum:
- admin
- contributor
- member
- owner
- name: q
in: query
description: 'Query string to narrow down the response as per [filtering and sorting](/cloud/bitbucket/rest/intro/#filtering).
`role` parameter must also be specified.
'
required: false
type: string
- name: sort
in: query
description: 'Field by which the results should be sorted as per [filtering and sorting](/cloud/bitbucket/rest/intro/#filtering).
'
required: false
type: string
security:
- oauth2:
- repository
- basic: []
- api_key: []
deprecated: true
x-atlassian-oauth2-scopes:
- state: Current
scheme: oauth2
scopes:
- read:repository:bitbucket
x-atlassian-auth-types:
- api-token
/repositories/{workspace}:
parameters:
- name: workspace
in: path
description: 'This can either be the workspace ID (slug) or the workspace UUID
surrounded by curly-braces, for example: `{workspace UUID}`.
'
required: true
type: string
get:
tags:
- Repositories
description: 'Returns a paginated list of all repositories owned by the specified
workspace.
The result can be narrowed down based on the authenticated user''s role.
E.g. with `?role=contributor`, only those repositories that the
authenticated user has write access to are returned (this includes any
repo the user is an admin on, as that implies write access).
This endpoint also supports filtering and sorting of the results. See
[filtering and sorting](/cloud/bitbucket/rest/intro/#filtering) for more details.'
summary: List repositories in a workspace
responses:
'200':
description: The repositories owned by the specified account.
schema:
$ref: '#/definitions/paginated_repositories'
'404':
description: If the specified account does not exist.
schema:
$ref: '#/definitions/error'
'410':
description: If the specified account marked as spam.
schema:
$ref: '#/definitions/error'
parameters:
- name: role
in: query
description: '
Filters the result based on the authenticated user''s role on each repository.
* **member**: returns repositories to which the user has explicit read access
* **contributor**: returns repositories to which the user has explicit write access
* **admin**: returns repositories to which the user has explicit administrator access
* **owner**: returns all repositories owned by the current user
'
required: false
type: string
enum:
- admin
- contributor
- member
- owner
- name: q
in: query
description: '
Query string to narrow down the response as per [filtering and sorting](/cloud/bitbucket/rest/intro/#filtering).
'
required: false
type: string
- name: sort
in: query
description: "\nField by which the results should be sorted as per [filtering and sorting](/cloud/bitbucket/rest/intro/#filtering).\n "
required: false
type: string
security:
- oauth2:
- repository
- basic: []
- api_key: []
x-atlassian-oauth2-scopes:
- state: Current
scheme: oauth2
scopes:
- read:repository:bitbucket
x-atlassian-auth-types:
- forge-oauth2
- api-token
/repositories/{workspace}/{repo_slug}:
parameters:
- name: repo_slug
in: path
description: 'This can either be the repository slug or the UUID of the repository,
surrounded by curly-braces, for example: `{repository UUID}`.
'
required: true
type: string
- name: workspace
in: path
description: 'This can either be the workspace ID (slug) or the workspace UUID
surrounded by curly-braces, for example: `{workspace UUID}`.
'
required: true
type: string
delete:
tags:
- Repositories
description: 'Deletes the repository. This is an irreversible operation.
This does not affect its forks.'
summary: Delete a repository
responses:
'204':
description: Indicates successful deletion.
'403':
description: If the caller either does not have admin access to the repository, or the repository is set to read-only.
schema:
$ref: '#/definitions/error'
'404':
description: If the repository does not exist.
schema:
$ref: '#/definitions/error'
parameters:
- name: redirect_to
in: query
description: 'If a repository has been moved to a new location, use this parameter to
show users a friendly message in the Bitbucket UI that the repository
has moved to a new location. However, a GET to this endpoint will still
return a 404.
'
required: false
type: string
security:
- oauth2:
- repository:delete
- basic: []
- api_key: []
x-atlassian-oauth2-scopes:
- state: Current
scheme: oauth2
scopes:
- delete:repository:bitbucket
x-atlassian-auth-types:
- forge-oauth2
- api-token
get:
tags:
- Repositories
description: Returns the object describing this repository.
summary: Get a repository
responses:
'200':
description: The repository object.
schema:
$ref: '#/definitions/repository'
'403':
description: If the repository is private and the authenticated user does not have access to it.
schema:
$ref: '#/definitions/error'
'404':
description: If no repository exists at this location.
schema:
$ref: '#/definitions/error'
parameters: []
security:
- oauth2:
- repository
- basic: []
- api_key: []
produces:
- application/json
x-atlassian-oauth2-scopes:
- state: Current
scheme: oauth2
scopes:
- read:repository:bitbucket
x-atlassian-auth-types:
- forge-oauth2
- api-token
post:
tags:
- Repositories
description: "Creates a new repository.\n\nNote: In order to set the project for the newly created repository,\npass in either the project key or the project UUID as part of the\nrequest body as shown in the examples below:\n\n```\n$ curl -X POST -H \"Content-Type: application/json\" -d '{\n \"scm\": \"git\",\n \"project\": {\n \"key\": \"MARS\"\n }\n}' https://api.bitbucket.org/2.0/repositories/teamsinspace/hablanding\n```\n\nor\n\n```\n$ curl -X POST -H \"Content-Type: application/json\" -d '{\n \"scm\": \"git\",\n \"project\": {\n \"key\": \"{ba516952-992a-4c2d-acbd-17d502922f96}\"\n }\n}' https://api.bitbucket.org/2.0/repositories/teamsinspace/hablanding\n```\n\nThe project must be assigned for all repositories. If the project is not provided,\nthe repository is automatically assigned to the oldest project in the workspace.\n\nNote: In the examples above, the workspace ID `teamsinspace`,\nand/or the repository name `hablanding` can be replaced by UUIDs."
summary: Create a repository
responses:
'200':
description: The newly created repository.
schema:
$ref: '#/definitions/repository'
'400':
description: If the input document was invalid, or if the caller lacks the privilege to create repositories under the targeted account.
schema:
$ref: '#/definitions/error'
'401':
description: If the request was not authenticated.
schema:
$ref: '#/definitions/error'
parameters:
- name: _body
in: body
description: The repository that is to be created. Note that most object elements are optional. Elements "owner" and "full_name" are ignored as the URL implies them.
required: false
schema:
$ref: '#/definitions/repository'
security:
- oauth2:
- repository:admin
- basic: []
- api_key: []
produces:
- application/json
x-atlassian-oauth2-scopes:
- state: Current
scheme: oauth2
scopes:
- admin:repository:bitbucket
x-atlassian-auth-types:
- forge-oauth2
- api-token
put:
tags:
- Repositories
description: 'Since this endpoint can be used to both update and to create a
repository, the request body depends on the intent.
#### Creation
See the POST documentation for the repository endpoint for an example
of the request body.
#### Update
Note: Changing the `name` of the repository will cause the location to
be changed. This is because the URL of the repo is derived from the
name (a process called slugification). In such a scenario, it is
possible for the request to fail if the newly created slug conflicts
with an existing repository''s slug. But if there is no conflict,
the new location will be returned in the `Location` header of the
response.'
summary: Update a repository
responses:
'200':
description: The existing repository has been updated
schema:
$ref: '#/definitions/repository'
headers:
Location:
type: string
description: 'The location of the repository. This header is only
provided when the repository''s name is changed.'
'201':
description: A new repository has been created
schema:
$ref: '#/definitions/repository'
headers:
Location:
type: string
description: The location of the newly created repository
'400':
description: If the input document was invalid, or if the caller lacks the privilege to create repositories under the targeted account.
schema:
$ref: '#/definitions/error'
'401':
description: If the request was not authenticated.
schema:
$ref: '#/definitions/error'
parameters:
- name: _body
in: body
description: 'The repository that is to be updated.
Note that the elements "owner" and "full_name" are ignored since the
URL implies them.
'
required: false
schema:
$ref: '#/definitions/repository'
security:
- oauth2:
- repository:admin
- basic: []
- api_key: []
produces:
- application/json
x-atlassian-oauth2-scopes:
- state: Current
scheme: oauth2
scopes:
- admin:repository:bitbucket
x-atlassian-auth-types:
- forge-oauth2
- api-token
/repositories/{workspace}/{repo_slug}/filehistory/{commit}/{path}:
parameters:
- name: commit
in: path
description: The commit's SHA1.
required: true
type: string
- name: path
in: path
description: Path to the file.
required: true
type: string
- name: repo_slug
in: path
description: 'This can either be the repository slug or the UUID of the repository,
surrounded by curly-braces, for example: `{repository UUID}`.
'
required: true
type: string
- name: workspace
in: path
description: 'This can either be the workspace ID (slug) or the workspace UUID
surrounded by curly-braces, for example: `{workspace UUID}`.
'
required: true
type: string
get:
tags:
- Repositories
description: "Returns a paginated list of commits that modified the specified file.\n\nCommits are returned in reverse chronological order. This is roughly\nequivalent to the following commands:\n\n $ git log --follow --date-order <sha> <path>\n\nBy default, Bitbucket will follow renames and the path name in the\nreturned entries reflects that. This can be turned off using the\n`?renames=false` query parameter.\n\nResults are returned in descending chronological order by default, and\nlike most endpoints you can\n[filter and sort](/cloud/bitbucket/rest/intro/#filtering) the response to\nonly provide exactly the data you want.\n\nThe example response returns commits made before 2011-05-18 against a file\nnamed `README.rst`. The results are filtered to only return the path and\ndate. This request can be made using:\n\n```\n$ curl 'https://api.bitbucket.org/2.0/repositories/evzijst/dogslow/filehistory/master/README.rst'\\\n '?fields=values.next,values.path,values.commit.date&q=commit.date<=2011-05-18'\n```\n\nIn the response you can see that the file was renamed to `README.rst`\nby the commit made on 2011-05-16, and was previously named `README.txt`."
summary: List commits that modified a file
responses:
'200':
description: A paginated list of commits that modified the specified file
schema:
$ref: '#/definitions/paginated_files'
examples:
application/json:
values:
- commit:
date: '2011-05-17T07:32:09+00:00'
path: README.rst
- commit:
date: '2011-05-16T06:33:28+00:00'
path: README.txt
- commit:
date: '2011-05-16T06:15:39+00:00'
path: README.txt
'404':
description: If the repository does not exist.
schema:
$ref: '#/definitions/error'
parameters:
- name: renames
in: query
description: '
When `true`, Bitbucket will follow the history of the file across
renames (this is the default behavior). This can be turned off by
specifying `false`.'
required: false
type: string
- name: q
in: query
description: '
Query string to narrow down the response as per
[filtering and sorting](/cloud/bitbucket/rest/intro/#filtering).'
required: false
type: string
- name: sort
in: query
description: '
Name of a response property sort the result by as per
[filtering and sorting](/cloud/bitbucket/rest/intro/#sorting-query-results).
'
required: false
type: string
security:
- oauth2:
- repository
- basic: []
- api_key: []
x-atlassian-oauth2-scopes:
- state: Current
scheme: oauth2
scopes:
- read:repository:bitbucket
x-atlassian-auth-types:
- forge-oauth2
- api-token
/repositories/{workspace}/{repo_slug}/forks:
parameters:
- name: repo_slug
in: path
description: 'This can either be the repository slug or the UUID of the repository,
surrounded by curly-braces, for example: `{repository UUID}`.
'
required: true
type: string
- name: workspace
in: path
description: 'This can either be the workspace ID (slug) or the workspace UUID
surrounded by curly-braces, for example: `{workspace UUID}`.
'
required: true
type: string
get:
tags:
- Repositories
description: 'Returns a paginated list of all the forks of the specified
repository.'
summary: List repository forks
responses:
'200':
description: All forks.
schema:
$ref: '#/definitions/paginated_repositories'
parameters:
- name: role
in: query
description: 'Filters the result based on the authenticated user''s role on each repository.
* **member**: returns repositories to which the user has explicit read access
* **contributor**: returns repositories to which the user has explicit write access
* **admin**: returns repositories to which the user has explicit administrator access
* **owner**: returns all repositories owned by the current user
'
required: false
type: string
enum:
- admin
- contributor
- member
- owner
- name: q
in: query
description: 'Query string to narrow down the response as per [filtering and sorting](/cloud/bitbucket/rest/intro/#filtering).
'
required: false
type: string
- name: sort
in: query
description: 'Field by which the results should be sorted as per [filtering and sorting](/cloud/bitbucket/rest/intro/#filtering).
'
required: false
type: string
security:
- oauth2:
- repository
- basic: []
- api_key: []
x-atlassian-oauth2-scopes:
- state: Current
scheme: oauth2
scopes:
- read:repository:bitbucket
x-atlassian-auth-types:
- forge-oauth2
- api-token
post:
tags:
- Repositories
description: "Creates a new fork of the specified repository.\n\n#### Forking a repository\n\nTo create a fork, specify the workspace explicitly as part of the\nrequest body:\n\n```\n$ curl -X POST -u jdoe https://api.bitbucket.org/2.0/repositories/atlassian/bbql/forks \\\n -H 'Content-Type: application/json' -d '{\n \"name\": \"bbql_fork\",\n \"workspace\": {\n \"slug\": \"atlassian\"\n }\n}'\n```\n\nTo fork a repository into the same workspace, also specify a new `name`.\n\nWhen you specify a value for `name`, it will also affect the `slug`.\nThe `slug` is reflected in the repository URL of the new fork. It is\nderived from `name` by substituting non-ASCII characters, removes\nwhitespace, and changes characters to lower case. For example,\n`My repo` would turn into `my_repo`.\n\nYou need contributor access to create new forks within a workspace.\n\n\n#### Change the properties of a new fork\n\nBy default the fork inherits most of its properties from the parent.\nHowever, since the optional POST body document follows the normal\n`repository` JSON schema and you can override the new fork's\nproperties.\n\nProperties that can be overridden include:\n\n* description\n* fork_policy\n* language\n* mainbranch\n* is_private (note that a private repo's fork_policy might prohibit\n the creation of public forks, in which `is_private=False` would fail)\n* has_issues (to initialize or disable the new repo's issue tracker --\n note that the actual contents of the parent repository's issue\n tracker are not copied during forking)\n* has_wiki (to initialize or disable the new repo's wiki --\n note that the actual contents of the parent repository's wiki are not\n copied during forking)\n* project (when forking into a private project, the fork's `is_private`\n must be `true`)\n\nProperties that cannot be modified include:\n\n* scm\n* parent\n* full_name"
summary: Fork a repository
responses:
'201':
description: The newly created fork.
schema:
$ref: '#/definitions/repository'
headers:
Location:
type: string
description: The URL of the newly created fork
parameters:
- name: _body
in: body
description: A repository object. This can be left blank.
required: false
schema:
$ref: '#/definitions/repository'
security:
- oauth2:
- repository:write
- basic: []
- api_key: []
x-atlassian-oauth2-scopes:
- state: Current
scheme: oauth2
scopes:
- read:repository:bitbucket
- write:repository:bitbucket
x-atlassian-auth-types:
- forge-oauth2
- api-token
/repositories/{workspace}/{repo_slug}/hooks:
parameters:
- name: repo_slug
in: path
description: 'This can either be the repository slug or the UUID of the repository,
surrounded by curly-braces, for example: `{repository UUID}`.
'
required: true
type: string
- name: workspace
in: path
description: 'This can either be the workspace ID (slug) or the workspace UUID
surrounded by curly-braces, for example: `{workspace UUID}`.
'
required: true
type: string
get:
tags:
- Repositories
description: Returns a paginated list of webhooks installed on this repository.
summary: List webhooks for a repository
responses:
'200':
description: The paginated list of installed webhooks.
schema:
$ref: '#/definitions/paginated_webhook_subscriptions'
'403':
description: If the authenticated user does not have permission to access the webhooks.
schema:
$ref: '#/definitions/error'
'404':
description: If the repository does not exist.
schema:
$ref: '#/definitions/error'
parameters: []
security:
- oauth2:
- webhook
- basic: []
- api_key: []
x-atlassian-oauth2-scopes:
- state: Current
scheme: oauth2
scopes:
- read:webhook:bitbucket
x-atlassian-auth-types:
- api-token
post:
tags:
- Repositories
description: "Creates a new webhook on the specified repository.\n\nExample:\n\n```\n$ curl -X POST -u credentials -H 'Content-Type: application/json'\n https://api.bitbucket.org/2.0/repositories/my-workspace/my-repo-slug/hooks\n -d '\n {\n \"description\": \"Webhook Description\",\n \"url\": \"https://example.com/\",\n \"active\": true,\n \"secret\": \"this is a really bad secret\",\n \"events\": [\n \"repo:push\",\n \"issue:created\",\n \"issue:updated\"\n ]\n }'\n```\n\nWhen the `secret` is provided it will be used as the key to generate a HMAC\ndigest value sent in the `X-Hub-Signature` header at delivery time. Passing\na `null` or empty `secret` or not passing a `secret` will leave the webhook's\nsecret unset. Bitbucket only generates the `X-Hub-Signature` when the webhook's\nsecret is set.\n\nNote that this call requires the webhook scope, as well as any scope\nthat applies to the events that the webhook subscribes to. In the\nexample above that means: `webhook`, `repository` and `issue`.\n\nAlso note that the `url` must properly resolve and cannot be an\ninternal, non-routed address."
summary: Create a webhook for a repository
responses:
'201':
description: If the webhook was registered successfully.
schema:
$ref: '#/definitions/webhook_subscription'
headers:
Location:
type: string
description: The URL of new newly created webhook.
'403':
description: If the authenticated user does not have permission to install webhooks on the specified repository.
schema:
$ref: '#/definitions/error'
'404':
description: If the repository does not exist.
schema:
$ref: '#/definitions/error'
parameters: []
security:
- oauth2:
- webhook
- basic: []
- api_key: []
x-atlassian-oauth2-scopes:
- state: Current
scheme: oauth2
scopes:
- read:webhook:bitbucket
- write:webhook:bitbucket
x-atlassian-auth-types:
- api-token
/repositories/{workspace}/{repo_slug}/hooks/{uid}:
parameters:
- name: repo_slug
in: path
description: 'This can either be the repository slug or the UUID of the repository,
surrounded by curly-braces, for example: `{repository UUID}`.
'
required: true
type: string
- name: uid
in: path
description: Installed webhook's ID
required: true
type: string
- name: workspace
in: path
description: 'This can either be the workspace ID (slug) or the workspace UUID
surrounded by curly-braces, for example: `{workspace UUID}`.
'
required: true
type: string
delete:
tags:
- Repositories
description: 'Deletes the specified webhook subscription from the given
repository.'
summary: Delete a webhook for a repository
responses:
'204':
description: When the webhook was deleted successfully
'403':
description: If the authenticated user does not have permission to delete the webhook.
schema:
$ref: '#/definitions/error'
'404':
description: If the webhook or repository does not exist.
schema:
$ref: '#/definitions/error'
parameters: []
security:
- oauth2:
- webhook
- basic: []
- api_key: []
x-atlassian-oauth2-scopes:
- state: Current
scheme: oauth2
scopes:
- delete:webhook:bitbucket
x-atlassian-auth-types:
- api-token
get:
tags:
- Repositories
description: 'Returns the webhook with the specified id installed on the specified
repository.'
summary: Get a webhook for a repository
responses:
'200':
description: The webhook subscription object.
schema:
$ref: '#/definitions/webhook_subscription'
'404':
description: If the webhook or repository does not exist.
schema:
$ref: '#/definitions/error'
parameters: []
security:
- oauth2:
- webhook
- basic: []
- api_key: []
x-atlassian-oauth2-scopes:
- state: Current
scheme: oauth2
scopes:
- read:webhook:bitbucket
x-atlassian-auth-types:
- api-token
put:
tags:
- Repositories
description: 'Updates the specified webhook subscription.
The following properties can be mutated:
* `description`
* `url`
* `secret`
* `active`
* `events`
The hook''s secret is used as a key to generate the HMAC hex digest sent in the
`X-Hub-Signature` header at delivery time. This signature is only generated
when the hook has a secret.
Set the hook''s secret by passing the new value in the `secret` field. Passing a
`null` value in the `secret` field will remove the secret from the hook. The
hook''s secret can be left unchanged by not passing the `secret` field in the
request.'
summary: Update a webhook for a repository
responses:
'200':
description: The webhook subscription object.
schema:
$ref: '#/definitions/webhook_subscription'
'403':
description: If the authenticated user does not have permission to update the webhook.
schema:
$ref: '#/definitions/error'
'404':
description: If the webhook or repository does not exist.
schema:
$ref: '#/definitions/error'
parameters: []
security:
- oauth2:
- webhook
- basic: []
- api_key: []
x-atlassian-oauth2-scopes:
- state: Current
scheme: oauth2
scopes:
- read:webhook:bitbucket
- write:webhook:bitbucket
x-atlassian-auth-types:
- api-token
/repositories/{workspace}/{repo_slug}/override-settings:
parameters:
- name: repo_slug
in: path
description: 'This can either be the repository slug or the UUID of the repository,
surrounded by curly-braces, for example: `{repository UUID}`.
'
required: true
type: string
- name: workspace
in: path
description: 'This can either be the workspace ID (slug) or the workspace UUID
surrounded by curly-braces, for example: `{workspace UUID}`.
'
required: true
type: string
get:
tags:
- Repositories
description: ''
summary: Retrieve the inheritance state for repository settings
responses:
'200':
description: The repository setting inheritance state
schema:
$ref: '#/definitions/repository_inheritance_state'
'404':
description: If no repository exists at this location
schema:
$ref: '#/definitions/error'
parameters: []
security:
- oauth2:
- repository:admin
- basic: []
- api_key: []
x-atlassian-oauth2-scopes:
- state: Current
scheme: oauth2
scopes:
- admin:repository:bitbucket
x-atlassian-auth-types:
- forge-oauth2
- api-token
put:
tags:
- Repositories
description: ''
summary: "Set the inheritance state for repository settings\n "
responses:
'204':
description: The repository setting inheritance state was set and no content returned
'404':
description: If no repository exists at this location
schema:
$ref: '#/definitions/error'
parameters: []
security:
- oauth2:
- repository:admin
- basic: []
- api_key: []
x-atlassian-oauth2-scopes:
- state: Current
scheme: oauth2
scopes:
- admin:repository:bitbucket
x-atlassian-auth-types:
- forge-oauth2
- api-token
/repositories/{workspace}/{repo_slug}/permissions-config/groups:
parameters:
- name: repo_slug
in: path
description: 'This can either be the repository slug or the UUID of the repository,
surrounded by curly-braces, for example: `{repository UUID}`.
'
# --- truncated at 32 KB (237 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/bitbucket/refs/heads/main/openapi/bitbucket-repositories-api-openapi.yml