Git code hosting and collaboration
developer.atlassian.com/cloud/bitbucket/rest ↗Query structured spec data via REST or MCP. Get exactly what your agent needs.
https://api.bitbucket.org/2.0
/addon/linkers/{linker_key}/values
Creates a linker value for the specified
linker of authenticated application.
A linker value lets applications supply values to modify its regular expression.
The base regular expression must use a Bitbucket-specific match group (?K)
which will be translated to ([\w\-]+). A value must match this pattern.
| Name | In | Required | Type | Description |
|---|---|---|---|---|
| linker_key | path | required | string | The unique key of a linker module |
Successfully created the linker value.
Authentication must use app JWT
The linker does not exist.
The linker already has the value being added.
POST /addon/linkers/{linker_key}/values
/repositories/{workspace}/{repo_slug}/branch-restrictions
Creates a new branch restriction rule for a repository.
kind describes what will be restricted. Allowed values include:
push, force, delete, restrict_merges, require_tasks_to_be_completed,
require_approvals_to_merge, require_default_reviewer_approvals_to_merge,
require_no_changes_requested, require_passing_builds_to_merge, require_commits_behind,
reset_pullrequest_approvals_on_change, smart_reset_pullrequest_approvals,
reset_pullrequest_changes_requested_on_change, require_all_dependencies_merged,
enforce_merge_checks, and allow_auto_merge_when_builds_pass.
Different kinds of branch restrictions have different requirements:
push and restrict_merges require users and groups to beThe restriction applies to all branches that match. There are
two ways to match a branch. It is configured in branch_match_kind:
glob: Matches a branch against the pattern. A '*' inpattern will expand to match zero or more characters, and every'foo*' will match'foo' and 'foobar', but not 'barfoo'. '*' will match allbranching_model: Matches a branch against the repository’sbranch_type controls the type of branchproduction, development,bugfix, release, feature and hotfix.The combination of kind and match must be unique. This means that
two glob restrictions in a repository cannot have the same kind and
pattern. Additionally, two branching_model restrictions in a
repository cannot have the same kind and branch_type.
users and groups are lists of users and groups that are except from
the restriction. They can only be configured in push and
restrict_merges restrictions. The push restriction stops a user
pushing to matching branches unless that user is in users or is a
member of a group in groups. The restrict_merges stops a user
merging pull requests to matching branches unless that user is in
users or is a member of a group in groups. Adding new users or
groups to an existing restriction should be done via PUT.
Note that branch restrictions with overlapping matchers is allowed,
but the resulting behavior may be surprising.
| Name | In | Required | Type | Description |
|---|---|---|---|---|
| repo_slug | path | required | string | This can either be the repository slug or the UUID of the repository, |
| workspace | path | required | string | This can either be the workspace ID (slug) or the workspace UUID |
The new rule
application/json
branchrestriction
| Property | Type | Required |
|---|---|---|
| type | string | required |
| users | array | optional |
| └ type | string | required |
| └ uuid | string | optional |
| └ links | object | optional |
| └ avatar | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| └ username | string | optional |
| └ created_on | string | optional |
| └ display_name | string | optional |
| groups | array | optional |
| └ type | string | required |
| └ name | string | optional |
| └ slug | string | optional |
| └ links | object | optional |
| └ html | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| └ self | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| └ owner | object | optional |
| └ type | string | required |
| └ uuid | string | optional |
| └ links | object | optional |
| └ avatar | object | optional |
| └ username | string | optional |
| └ created_on | string | optional |
| └ display_name | string | optional |
| └ full_slug | string | optional |
| └ workspace | object | optional |
| └ type | string | required |
| └ name | string | optional |
| └ slug | string | optional |
| └ uuid | string | optional |
| └ links | object | optional |
| └ html | object | optional |
| └ self | object | optional |
| └ avatar | object | optional |
| └ owners | object | optional |
| └ members | object | optional |
| └ projects | object | optional |
| └ snippets | object | optional |
| └ repositories | object | optional |
| └ created_on | string | optional |
| └ is_private | boolean | optional |
| └ updated_on | string | optional |
A paginated list of branch restrictions
If the request was not authenticated
If the authenticated user does not have admin access to the repository
If the repository does not exist
POST /repositories/{workspace}/{repo_slug}/branch-restrictions
/repositories/{workspace}/{repo_slug}/commit/{commit}/statuses/build
Creates a new build status against the specified commit.
If the specified key already exists, the existing status object will
be overwritten.
Example:
curl https://api.bitbucket.org/2.0/repositories/my-workspace/my-repo/commit/e10dae226959c2194f2b07b077c07762d93821cf/statuses/build/ -X POST -u jdoe -H 'Content-Type: application/json' -d '{
"key": "MY-BUILD",
"state": "SUCCESSFUL",
"description": "42 tests passed",
"url": "https://www.example.org/my-build-result"
}'
When creating a new commit status, you can use a URI template for the URL.
Templates are URLs that contain variable names that Bitbucket will
evaluate at runtime whenever the URL is displayed anywhere similar to
parameter substitution in
Bitbucket Connect.
For example, one could use https://foo.com/builds/{repository.full_name}
which Bitbucket will turn into https://foo.com/builds/foo/bar at render time.
The context variables available are repository and commit.
| Name | In | Required | Type | Description |
|---|---|---|---|---|
| commit | path | required | string | The commit’s SHA1. |
| repo_slug | path | required | string | This can either be the repository slug or the UUID of the repository, |
| workspace | path | required | string | This can either be the workspace ID (slug) or the workspace UUID |
The new commit status object.
application/json
commitstatus
| Property | Type | Required |
|---|---|---|
| type | string | required |
| key | string | optional |
| url | string | optional |
| name | string | optional |
| uuid | string | optional |
| links | object | optional |
| └ self | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| └ commit | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| state | string | optional |
| refname | string | optional |
| created_on | string | optional |
| updated_on | string | optional |
| description | string | optional |
The newly created build status object.
If the repository is private and the request was not authenticated.
If the repository, commit, or build status key does not exist
POST /repositories/{workspace}/{repo_slug}/commit/{commit}/statuses/build
/repositories/{workspace}/{repo_slug}/commit/{commit}/approve
Approve the specified commit as the authenticated user.
This operation is only available to users that have explicit access to
the repository. In contrast, just the fact that a repository is
publicly accessible to users does not give them the ability to approve
commits.
| Name | In | Required | Type | Description |
|---|---|---|---|---|
| commit | path | required | string | The commit’s SHA1. |
| repo_slug | path | required | string | This can either be the repository slug or the UUID of the repository, |
| workspace | path | required | string | This can either be the workspace ID (slug) or the workspace UUID |
The participant object recording that the authenticated user approved the commit.
If the specified commit, or the repository does not exist.
POST /repositories/{workspace}/{repo_slug}/commit/{commit}/approve
/repositories/{workspace}/{repo_slug}/commit/{commit}/comments
Creates new comment on the specified commit.
To post a reply to an existing comment, include the parent.id field:
$ curl https://api.bitbucket.org/2.0/repositories/atlassian/prlinks/commit/db9ba1e031d07a02603eae0e559a7adc010257fc/comments/ \
-X POST -u evzijst \
-H 'Content-Type: application/json' \
-d '{"content": {"raw": "One more thing!"},
"parent": {"id": 5728901}}'
| Name | In | Required | Type | Description |
|---|---|---|---|---|
| commit | path | required | string | The commit’s SHA1. |
| repo_slug | path | required | string | This can either be the repository slug or the UUID of the repository, |
| workspace | path | required | string | This can either be the workspace ID (slug) or the workspace UUID |
The specified comment.
application/json
commit_comment
| Property | Type | Required |
|---|---|---|
| type | string | required |
| id | integer | optional |
| user | object | optional |
| └ type | string | required |
| └ uuid | string | optional |
| └ links | object | optional |
| └ avatar | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| └ username | string | optional |
| └ created_on | string | optional |
| └ display_name | string | optional |
| links | object | optional |
| └ code | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| └ html | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| └ self | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| inline | object | optional |
| └ to | integer | optional |
| └ from | integer | optional |
| └ path | string | required |
| parent | object | optional |
| content | object | optional |
| └ raw | string | optional |
| └ html | string | optional |
| └ markup | string | optional |
| deleted | boolean | optional |
| created_on | string | optional |
| updated_on | string | optional |
| commit | object | optional |
| └ type | string | required |
| └ date | string | optional |
| └ hash | string | optional |
| └ author | object | optional |
| └ type | string | required |
| └ raw | string | optional |
| └ user | object | optional |
| └ type | string | required |
| └ uuid | string | optional |
| └ links | object | optional |
| └ username | string | optional |
| └ created_on | string | optional |
| └ display_name | string | optional |
| └ message | string | optional |
| └ parents | array | optional |
| └ summary | object | optional |
| └ raw | string | optional |
| └ html | string | optional |
| └ markup | string | optional |
| └ repository | object | optional |
| └ type | string | required |
| └ scm | string | optional |
| └ name | string | optional |
| └ size | integer | optional |
| └ uuid | string | optional |
| └ links | object | optional |
| └ html | object | optional |
| └ self | object | optional |
| └ clone | array | optional |
| └ forks | object | optional |
| └ hooks | object | optional |
| └ avatar | object | optional |
| └ commits | object | optional |
| └ watchers | object | optional |
| └ downloads | object | optional |
| └ pullrequests | object | optional |
| └ owner | object | optional |
| └ type | string | required |
| └ uuid | string | optional |
| └ links | object | optional |
| └ username | string | optional |
| └ created_on | string | optional |
| └ display_name | string | optional |
| └ parent | object | optional |
| └ project | object | optional |
| └ type | string | required |
| └ key | string | optional |
| └ name | string | optional |
| └ uuid | string | optional |
| └ links | object | optional |
| └ owner | object | optional |
| └ created_on | string | optional |
| └ is_private | boolean | optional |
| └ updated_on | string | optional |
| └ description | string | optional |
| └ has_publicly_visible_repos | boolean | optional |
| └ has_wiki | boolean | optional |
| └ language | string | optional |
| └ full_name | string | optional |
| └ created_on | string | optional |
| └ has_issues | boolean | optional |
| └ is_private | boolean | optional |
| └ mainbranch | object | optional |
| └ name | string | optional |
| └ type | string | required |
| └ links | object | optional |
| └ target | object | optional |
| └ merge_strategies | array | optional |
| └ default_merge_strategy | string | optional |
| └ updated_on | string | optional |
| └ description | string | optional |
| └ fork_policy | string | optional |
| └ participants | array | optional |
| └ type | string | required |
| └ role | string | optional |
| └ user | object | optional |
| └ type | string | required |
| └ uuid | string | optional |
| └ links | object | optional |
| └ username | string | optional |
| └ created_on | string | optional |
| └ display_name | string | optional |
| └ state | string | optional |
| └ approved | boolean | optional |
| └ participated_on | string | optional |
The newly created comment.
If the comment was detected as spam, or if the parent comment is not attached to the same node as the new comment
If a parent ID was passed in that cannot be found
POST /repositories/{workspace}/{repo_slug}/commit/{commit}/comments
/repositories/{workspace}/{repo_slug}/commits
Identical to GET /repositories/{workspace}/{repo_slug}/commits,
except that POST allows clients to place the include and exclude
parameters in the request body to avoid URL length issues.
Note that this resource does NOT support new commit creation.
| Name | In | Required | Type | Description |
|---|---|---|---|---|
| repo_slug | path | required | string | This can either be the repository slug or the UUID of the repository, |
| workspace | path | required | string | This can either be the workspace ID (slug) or the workspace UUID |
A paginated list of commits
If the specified repository does not exist.
POST /repositories/{workspace}/{repo_slug}/commits
/repositories/{workspace}/{repo_slug}/commits/{revision}
Identical to GET /repositories/{workspace}/{repo_slug}/commits/{revision},
except that POST allows clients to place the include and exclude
parameters in the request body to avoid URL length issues.
Note that this resource does NOT support new commit creation.
| Name | In | Required | Type | Description |
|---|---|---|---|---|
| repo_slug | path | required | string | This can either be the repository slug or the UUID of the repository, |
| revision | path | required | string | A commit SHA1 or ref name. |
| workspace | path | required | string | This can either be the workspace ID (slug) or the workspace UUID |
A paginated list of commits
If the specified revision does not exist.
POST /repositories/{workspace}/{repo_slug}/commits/{revision}
/repositories/{workspace}/{repo_slug}/deploy-keys
Create a new deploy key in a repository. Note: If authenticating a deploy key
with an OAuth consumer, any changes to the OAuth consumer will subsequently
invalidate the deploy key.
Example:
$ curl -X POST \
-H "Authorization <auth header>" \
-H "Content-type: application/json" \
https://api.bitbucket.org/2.0/repositories/mleu/test/deploy-keys -d \
'{
"key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDAK/b1cHHDr/TEV1JGQl+WjCwStKG6Bhrv0rFpEsYlyTBm1fzN0VOJJYn4ZOPCPJwqse6fGbXntEs+BbXiptR+++HycVgl65TMR0b5ul5AgwrVdZdT7qjCOCgaSV74/9xlHDK8oqgGnfA7ZoBBU+qpVyaloSjBdJfLtPY/xqj4yHnXKYzrtn/uFc4Kp9Tb7PUg9Io3qohSTGJGVHnsVblq/rToJG7L5xIo0OxK0SJSQ5vuId93ZuFZrCNMXj8JDHZeSEtjJzpRCBEXHxpOPhAcbm4MzULgkFHhAVgp4JbkrT99/wpvZ7r9AdkTg7HGqL3rlaDrEcWfL7Lu6TnhBdq5 mleu@C02W454JHTD8",
"label": "mydeploykey"
}'
| Name | In | Required | Type | Description |
|---|---|---|---|---|
| repo_slug | path | required | string | This can either be the repository slug or the UUID of the repository, |
| workspace | path | required | string | This can either be the workspace ID (slug) or the workspace UUID |
The deploy key that was created
Invalid deploy key inputs
If the specified user or repository is not accessible to the current user
If the specified user or repository does not exist
POST /repositories/{workspace}/{repo_slug}/deploy-keys
/repositories/{workspace}/{repo_slug}/environments
Create an environment.
| Name | In | Required | Type | Description |
|---|---|---|---|---|
| workspace | path | required | string | This can either be the workspace ID (slug) or the workspace UUID surrounded by curly-braces, for example |
| repo_slug | path | required | string | The repository. |
The environment to create.
application/json
deployment_environment
| Property | Type | Required |
|---|---|---|
| type | string | required |
| name | string | optional |
| uuid | string | optional |
The environment was created.
The account or repository does not exist.
An environment host with the provided name already exists.
POST /repositories/{workspace}/{repo_slug}/environments
/repositories/{workspace}/{repo_slug}/environments/{environment_uuid}/changes
Update an environment
| Name | In | Required | Type | Description |
|---|---|---|---|---|
| workspace | path | required | string | This can either be the workspace ID (slug) or the workspace UUID surrounded by curly-braces, for example |
| repo_slug | path | required | string | The repository. |
| environment_uuid | path | required | string | The environment UUID. |
The environment update request was accepted.
No account, repository or environment with the UUID provided exists.
POST /repositories/{workspace}/{repo_slug}/environments/{environment_uuid}/changes
/workspaces/{workspace}/projects/{project_key}/deploy-keys
Create a new deploy key in a project.
Example:
$ curl -X POST \
-H "Authorization <auth header>" \
-H "Content-type: application/json" \
https://api.bitbucket.org/2.0/workspaces/standard/projects/TEST_PROJECT/deploy-keys/ -d \
'{
"key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDAK/b1cHHDr/TEV1JGQl+WjCwStKG6Bhrv0rFpEsYlyTBm1fzN0VOJJYn4ZOPCPJwqse6fGbXntEs+BbXiptR+++HycVgl65TMR0b5ul5AgwrVdZdT7qjCOCgaSV74/9xlHDK8oqgGnfA7ZoBBU+qpVyaloSjBdJfLtPY/xqj4yHnXKYzrtn/uFc4Kp9Tb7PUg9Io3qohSTGJGVHnsVblq/rToJG7L5xIo0OxK0SJSQ5vuId93ZuFZrCNMXj8JDHZeSEtjJzpRCBEXHxpOPhAcbm4MzULgkFHhAVgp4JbkrT99/wpvZ7r9AdkTg7HGqL3rlaDrEcWfL7Lu6TnhBdq5 mleu@C02W454JHTD8",
"label": "mydeploykey"
}'
| Name | In | Required | Type | Description |
|---|---|---|---|---|
| project_key | path | required | string | The project in question. This is the actual |
| workspace | path | required | string | This can either be the workspace ID (slug) or the workspace UUID |
The project deploy key that was created
Invalid deploy key inputs
If the specified workspace or project is not accessible to the current user
If the specified workspace or project does not exist
POST /workspaces/{workspace}/projects/{project_key}/deploy-keys
/repositories/{workspace}/{repo_slug}/downloads
Upload new download artifacts.
To upload files, perform a multipart/form-data POST containing one
or more files fields:
$ echo Hello World > hello.txt
$ curl -s -u evzijst -X POST https://api.bitbucket.org/2.0/repositories/evzijst/git-tests/downloads -F files=@hello.txt
When a file is uploaded with the same name as an existing artifact,
then the existing file will be replaced.
| Name | In | Required | Type | Description |
|---|---|---|---|---|
| repo_slug | path | required | string | This can either be the repository slug or the UUID of the repository, |
| workspace | path | required | string | This can either be the workspace ID (slug) or the workspace UUID |
The artifact was uploaded sucessfully.
Bad Request.
User is not authorized to write to the repository.
Unsupported Content-Type. Use multiplart/form-data.
POST /repositories/{workspace}/{repo_slug}/downloads
/repositories/{workspace}/{repo_slug}/issues
Creates a new issue.
This call requires authentication. Private repositories or private
issue trackers require the caller to authenticate with an account that
has appropriate authorization.
The authenticated user is used for the issue’s reporter field.
| Name | In | Required | Type | Description |
|---|---|---|---|---|
| repo_slug | path | required | string | This can either be the repository slug or the UUID of the repository, |
| workspace | path | required | string | This can either be the workspace ID (slug) or the workspace UUID |
The new issue. The only required element is title. All other elements can be omitted from the body.
application/json
issue
| Property | Type | Required |
|---|---|---|
| type | string | required |
| id | integer | optional |
| kind | string | optional |
| links | object | optional |
| └ html | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| └ self | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| └ vote | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| └ watch | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| └ comments | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| └ attachments | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| state | string | optional |
| title | string | optional |
| votes | integer | optional |
| content | object | optional |
| └ raw | string | optional |
| └ html | string | optional |
| └ markup | string | optional |
| version | object | optional |
| └ type | string | required |
| └ id | integer | optional |
| └ name | string | optional |
| └ links | object | optional |
| └ self | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| assignee | object | optional |
| └ type | string | required |
| └ uuid | string | optional |
| └ links | object | optional |
| └ avatar | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| └ username | string | optional |
| └ created_on | string | optional |
| └ display_name | string | optional |
| priority | string | optional |
| reporter | object | optional |
| └ type | string | required |
| └ uuid | string | optional |
| └ links | object | optional |
| └ avatar | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| └ username | string | optional |
| └ created_on | string | optional |
| └ display_name | string | optional |
| component | object | optional |
| └ type | string | required |
| └ id | integer | optional |
| └ name | string | optional |
| └ links | object | optional |
| └ self | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| edited_on | string | optional |
| milestone | object | optional |
| └ type | string | required |
| └ id | integer | optional |
| └ name | string | optional |
| └ links | object | optional |
| └ self | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| created_on | string | optional |
| repository | object | optional |
| └ type | string | required |
| └ scm | string | optional |
| └ name | string | optional |
| └ size | integer | optional |
| └ uuid | string | optional |
| └ links | object | optional |
| └ html | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| └ self | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| └ clone | array | optional |
| └ href | string | optional |
| └ name | string | optional |
| └ forks | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| └ hooks | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| └ avatar | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| └ commits | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| └ watchers | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| └ downloads | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| └ pullrequests | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| └ owner | object | optional |
| └ type | string | required |
| └ uuid | string | optional |
| └ links | object | optional |
| └ avatar | object | optional |
| └ username | string | optional |
| └ created_on | string | optional |
| └ display_name | string | optional |
| └ parent | object | optional |
| └ project | object | optional |
| └ type | string | required |
| └ key | string | optional |
| └ name | string | optional |
| └ uuid | string | optional |
| └ links | object | optional |
| └ html | object | optional |
| └ avatar | object | optional |
| └ owner | object | optional |
| └ type | string | required |
| └ uuid | string | optional |
| └ links | object | optional |
| └ username | string | optional |
| └ created_on | string | optional |
| └ display_name | string | optional |
| └ created_on | string | optional |
| └ is_private | boolean | optional |
| └ updated_on | string | optional |
| └ description | string | optional |
| └ has_publicly_visible_repos | boolean | optional |
| └ has_wiki | boolean | optional |
| └ language | string | optional |
| └ full_name | string | optional |
| └ created_on | string | optional |
| └ has_issues | boolean | optional |
| └ is_private | boolean | optional |
| └ mainbranch | object | optional |
| └ name | string | optional |
| └ type | string | required |
| └ links | object | optional |
| └ html | object | optional |
| └ self | object | optional |
| └ commits | object | optional |
| └ target | object | optional |
| └ type | string | required |
| └ date | string | optional |
| └ hash | string | optional |
| └ author | object | optional |
| └ message | string | optional |
| └ parents | array | optional |
| └ summary | object | optional |
| └ repository | object | optional |
| └ participants | array | optional |
| └ merge_strategies | array | optional |
| └ default_merge_strategy | string | optional |
| └ updated_on | string | optional |
| └ description | string | optional |
| └ fork_policy | string | optional |
| updated_on | string | optional |
The newly created issue.
When the request wasn’t authenticated.
When the authenticated user isn’t authorized to create the issue.
The specified repository does not exist or does not have the issue tracker enabled.
POST /repositories/{workspace}/{repo_slug}/issues
/repositories/{workspace}/{repo_slug}/issues/export
A POST request to this endpoint initiates a new background celery task that archives the repo’s issues.
When the job has been accepted, it will return a 202 (Accepted) along with a unique url to this job in the
‘Location’ response header. This url is the endpoint for where the user can obtain their zip files.”
| Name | In | Required | Type | Description |
|---|---|---|---|---|
| repo_slug | path | required | string | This can either be the repository slug or the UUID of the repository, |
| workspace | path | required | string | This can either be the workspace ID (slug) or the workspace UUID |
The options to apply to the export. Available options include project_key and project_name which, if specified, are used as the project key and name in the exported Jira json format. Option send_email specifies whether an email should be sent upon export result. Option include_attachments specifies whether attachments are included in the export.
application/json
export_options
| Property | Type | Required |
|---|---|---|
| type | string | required |
| send_email | boolean | optional |
| project_key | string | optional |
| project_name | string | optional |
| include_attachments | boolean | optional |
The export job has been accepted
The request wasn’t authenticated properly
When the authenticated user does not have admin permission on the repo
The repo does not exist or does not have an issue tracker
POST /repositories/{workspace}/{repo_slug}/issues/export
/repositories/{workspace}/{repo_slug}/issues/import
A POST request to this endpoint will import the zip file given by the archive parameter into the repository. All
existing issues will be deleted and replaced by the contents of the imported zip file.
Imports are done through a multipart/form-data POST. There is one valid and required form field, with the name
“archive,” which needs to be a file field:
$ curl -u <username> -X POST -F archive=@/path/to/file.zip https://api.bitbucket.org/2.0/repositories/<owner_username>/<repo_slug>/issues/import
| Name | In | Required | Type | Description |
|---|---|---|---|---|
| repo_slug | path | required | string | This can either be the repository slug or the UUID of the repository, |
| workspace | path | required | string | This can either be the workspace ID (slug) or the workspace UUID |
Import job accepted
The request wasn’t authenticated properly
When the authenticated user does not have admin permission on the repo
No export job has begun
Import already running
POST /repositories/{workspace}/{repo_slug}/issues/import
/repositories/{workspace}/{repo_slug}/issues/{issue_id}/attachments
Upload new issue attachments.
To upload files, perform a multipart/form-data POST containing one
or more file fields.
When a file is uploaded with the same name as an existing attachment,
then the existing file will be replaced.
| Name | In | Required | Type | Description |
|---|---|---|---|---|
| issue_id | path | required | string | The issue id |
| repo_slug | path | required | string | This can either be the repository slug or the UUID of the repository, |
| workspace | path | required | string | This can either be the workspace ID (slug) or the workspace UUID |
An empty response document.
If no files were uploaded, or if the wrong Content-Type was used.
If the issue tracker is private and the request was not authenticated.
The specified repository or issue does not exist or does not have the issue tracker enabled.
POST /repositories/{workspace}/{repo_slug}/issues/{issue_id}/attachments
/repositories/{workspace}/{repo_slug}/issues/{issue_id}/changes
Makes a change to the specified issue.
For example, to change an issue’s state and assignee, create a new
change object that modifies these fields:
curl https://api.bitbucket.org/2.0/site/master/issues/1234/changes \
-s -u evzijst -X POST -H "Content-Type: application/json" \
-d '{
"changes": {
"assignee_account_id": {
"new": "557058:c0b72ad0-1cb5-4018-9cdc-0cde8492c443"
},
"state": {
"new": 'resolved"
}
}
"message": {
"raw": "This is now resolved."
}
}'
The above example also includes a custom comment to go alongside the
change. This comment will also be visible on the issue page in the UI.
The fields of the changes object are strings, not objects. This
allows for immutable change log records, even after user accounts,
milestones, or other objects recorded in a change entry, get renamed or
deleted.
The assignee_account_id field stores the account id. When POSTing a
new change and changing the assignee, the client should therefore use
the user’s account_id in the changes.assignee_account_id.new field.
This call requires authentication. Private repositories or private
issue trackers require the caller to authenticate with an account that
has appropriate authorization.
| Name | In | Required | Type | Description |
|---|---|---|---|---|
| issue_id | path | required | string | The issue id |
| repo_slug | path | required | string | This can either be the repository slug or the UUID of the repository, |
| workspace | path | required | string | This can either be the workspace ID (slug) or the workspace UUID |
The new issue state change. The only required elements are changes.[].new. All other elements can be omitted from the body.
application/json
issue_change
| Property | Type | Required |
|---|---|---|
| name | string | optional |
| type | string | required |
| user | object | optional |
| └ type | string | required |
| └ uuid | string | optional |
| └ links | object | optional |
| └ avatar | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| └ username | string | optional |
| └ created_on | string | optional |
| └ display_name | string | optional |
| issue | object | optional |
| └ type | string | required |
| └ id | integer | optional |
| └ kind | string | optional |
| └ links | object | optional |
| └ html | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| └ self | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| └ vote | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| └ watch | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| └ comments | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| └ attachments | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| └ state | string | optional |
| └ title | string | optional |
| └ votes | integer | optional |
| └ content | object | optional |
| └ raw | string | optional |
| └ html | string | optional |
| └ markup | string | optional |
| └ version | object | optional |
| └ type | string | required |
| └ id | integer | optional |
| └ name | string | optional |
| └ links | object | optional |
| └ self | object | optional |
| └ assignee | object | optional |
| └ type | string | required |
| └ uuid | string | optional |
| └ links | object | optional |
| └ avatar | object | optional |
| └ username | string | optional |
| └ created_on | string | optional |
| └ display_name | string | optional |
| └ priority | string | optional |
| └ reporter | object | optional |
| └ type | string | required |
| └ uuid | string | optional |
| └ links | object | optional |
| └ avatar | object | optional |
| └ username | string | optional |
| └ created_on | string | optional |
| └ display_name | string | optional |
| └ component | object | optional |
| └ type | string | required |
| └ id | integer | optional |
| └ name | string | optional |
| └ links | object | optional |
| └ self | object | optional |
| └ edited_on | string | optional |
| └ milestone | object | optional |
| └ type | string | required |
| └ id | integer | optional |
| └ name | string | optional |
| └ links | object | optional |
| └ self | object | optional |
| └ created_on | string | optional |
| └ repository | object | optional |
| └ type | string | required |
| └ scm | string | optional |
| └ name | string | optional |
| └ size | integer | optional |
| └ uuid | string | optional |
| └ links | object | optional |
| └ html | object | optional |
| └ self | object | optional |
| └ clone | array | optional |
| └ forks | object | optional |
| └ hooks | object | optional |
| └ avatar | object | optional |
| └ commits | object | optional |
| └ watchers | object | optional |
| └ downloads | object | optional |
| └ pullrequests | object | optional |
| └ owner | object | optional |
| └ type | string | required |
| └ uuid | string | optional |
| └ links | object | optional |
| └ username | string | optional |
| └ created_on | string | optional |
| └ display_name | string | optional |
| └ parent | object | optional |
| └ project | object | optional |
| └ type | string | required |
| └ key | string | optional |
| └ name | string | optional |
| └ uuid | string | optional |
| └ links | object | optional |
| └ owner | object | optional |
| └ created_on | string | optional |
| └ is_private | boolean | optional |
| └ updated_on | string | optional |
| └ description | string | optional |
| └ has_publicly_visible_repos | boolean | optional |
| └ has_wiki | boolean | optional |
| └ language | string | optional |
| └ full_name | string | optional |
| └ created_on | string | optional |
| └ has_issues | boolean | optional |
| └ is_private | boolean | optional |
| └ mainbranch | object | optional |
| └ name | string | optional |
| └ type | string | required |
| └ links | object | optional |
| └ target | object | optional |
| └ merge_strategies | array | optional |
| └ default_merge_strategy | string | optional |
| └ updated_on | string | optional |
| └ description | string | optional |
| └ fork_policy | string | optional |
| └ updated_on | string | optional |
| links | object | optional |
| └ self | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| └ issue | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| changes | object | optional |
| └ kind | object | optional |
| └ new | string | optional |
| └ old | string | optional |
| └ state | object | optional |
| └ new | string | optional |
| └ old | string | optional |
| └ title | object | optional |
| └ new | string | optional |
| └ old | string | optional |
| └ content | object | optional |
| └ new | string | optional |
| └ old | string | optional |
| └ version | object | optional |
| └ new | string | optional |
| └ old | string | optional |
| └ assignee | object | optional |
| └ new | string | optional |
| └ old | string | optional |
| └ priority | object | optional |
| └ new | string | optional |
| └ old | string | optional |
| └ component | object | optional |
| └ new | string | optional |
| └ old | string | optional |
| └ milestone | object | optional |
| └ new | string | optional |
| └ old | string | optional |
| message | object | optional |
| └ raw | string | optional |
| └ html | string | optional |
| └ markup | string | optional |
| created_on | string | optional |
The newly created issue change.
When the request wasn’t authenticated.
When the authenticated user isn’t authorized to modify the issue.
The specified repository or issue does not exist or does not have the issue tracker enabled.
POST /repositories/{workspace}/{repo_slug}/issues/{issue_id}/changes
/repositories/{workspace}/{repo_slug}/issues/{issue_id}/comments
Creates a new issue comment.
$ curl https://api.bitbucket.org/2.0/repositories/atlassian/prlinks/issues/42/comments/ \
-X POST -u evzijst \
-H 'Content-Type: application/json' \
-d '{"content": {"raw": "Lorem ipsum."}}'
| Name | In | Required | Type | Description |
|---|---|---|---|---|
| issue_id | path | required | string | The issue id |
| repo_slug | path | required | string | This can either be the repository slug or the UUID of the repository, |
| workspace | path | required | string | This can either be the workspace ID (slug) or the workspace UUID |
The new issue comment object.
application/json
issue_comment
| Property | Type | Required |
|---|---|---|
| type | string | required |
| id | integer | optional |
| user | object | optional |
| └ type | string | required |
| └ uuid | string | optional |
| └ links | object | optional |
| └ avatar | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| └ username | string | optional |
| └ created_on | string | optional |
| └ display_name | string | optional |
| links | object | optional |
| └ code | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| └ html | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| └ self | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| inline | object | optional |
| └ to | integer | optional |
| └ from | integer | optional |
| └ path | string | required |
| parent | object | optional |
| content | object | optional |
| └ raw | string | optional |
| └ html | string | optional |
| └ markup | string | optional |
| deleted | boolean | optional |
| created_on | string | optional |
| updated_on | string | optional |
| issue | object | optional |
| └ type | string | required |
| └ id | integer | optional |
| └ kind | string | optional |
| └ links | object | optional |
| └ html | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| └ self | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| └ vote | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| └ watch | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| └ comments | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| └ attachments | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| └ state | string | optional |
| └ title | string | optional |
| └ votes | integer | optional |
| └ content | object | optional |
| └ raw | string | optional |
| └ html | string | optional |
| └ markup | string | optional |
| └ version | object | optional |
| └ type | string | required |
| └ id | integer | optional |
| └ name | string | optional |
| └ links | object | optional |
| └ self | object | optional |
| └ assignee | object | optional |
| └ type | string | required |
| └ uuid | string | optional |
| └ links | object | optional |
| └ avatar | object | optional |
| └ username | string | optional |
| └ created_on | string | optional |
| └ display_name | string | optional |
| └ priority | string | optional |
| └ reporter | object | optional |
| └ type | string | required |
| └ uuid | string | optional |
| └ links | object | optional |
| └ avatar | object | optional |
| └ username | string | optional |
| └ created_on | string | optional |
| └ display_name | string | optional |
| └ component | object | optional |
| └ type | string | required |
| └ id | integer | optional |
| └ name | string | optional |
| └ links | object | optional |
| └ self | object | optional |
| └ edited_on | string | optional |
| └ milestone | object | optional |
| └ type | string | required |
| └ id | integer | optional |
| └ name | string | optional |
| └ links | object | optional |
| └ self | object | optional |
| └ created_on | string | optional |
| └ repository | object | optional |
| └ type | string | required |
| └ scm | string | optional |
| └ name | string | optional |
| └ size | integer | optional |
| └ uuid | string | optional |
| └ links | object | optional |
| └ html | object | optional |
| └ self | object | optional |
| └ clone | array | optional |
| └ forks | object | optional |
| └ hooks | object | optional |
| └ avatar | object | optional |
| └ commits | object | optional |
| └ watchers | object | optional |
| └ downloads | object | optional |
| └ pullrequests | object | optional |
| └ owner | object | optional |
| └ type | string | required |
| └ uuid | string | optional |
| └ links | object | optional |
| └ username | string | optional |
| └ created_on | string | optional |
| └ display_name | string | optional |
| └ parent | object | optional |
| └ project | object | optional |
| └ type | string | required |
| └ key | string | optional |
| └ name | string | optional |
| └ uuid | string | optional |
| └ links | object | optional |
| └ owner | object | optional |
| └ created_on | string | optional |
| └ is_private | boolean | optional |
| └ updated_on | string | optional |
| └ description | string | optional |
| └ has_publicly_visible_repos | boolean | optional |
| └ has_wiki | boolean | optional |
| └ language | string | optional |
| └ full_name | string | optional |
| └ created_on | string | optional |
| └ has_issues | boolean | optional |
| └ is_private | boolean | optional |
| └ mainbranch | object | optional |
| └ name | string | optional |
| └ type | string | required |
| └ links | object | optional |
| └ target | object | optional |
| └ merge_strategies | array | optional |
| └ default_merge_strategy | string | optional |
| └ updated_on | string | optional |
| └ description | string | optional |
| └ fork_policy | string | optional |
| └ updated_on | string | optional |
The newly created comment.
If the input was invalid, or if the comment being created is detected as spam
POST /repositories/{workspace}/{repo_slug}/issues/{issue_id}/comments
/repositories/{workspace}/{repo_slug}/deployments_config/environments/{environment_uuid}/variables
Create a deployment environment level variable.
| Name | In | Required | Type | Description |
|---|---|---|---|---|
| workspace | path | required | string | This can either be the workspace ID (slug) or the workspace UUID surrounded by curly-braces, for example |
| repo_slug | path | required | string | The repository. |
| environment_uuid | path | required | string | The environment. |
The variable to create
application/json
deployment_variable
| Property | Type | Required |
|---|---|---|
| type | string | required |
| key | string | optional |
| uuid | string | optional |
| value | string | optional |
| secured | boolean | optional |
The variable was created.
The account, repository, environment or variable with the given UUID was not found.
A variable with the provided key already exists.
POST /repositories/{workspace}/{repo_slug}/deployments_config/environments/{environment_uuid}/variables
/repositories/{workspace}/{repo_slug}/pipelines
Endpoint to create and initiate a pipeline.
There are a couple of different options to initiate a pipeline, where the payload of the request will determine which type of pipeline will be instantiated.
One way to trigger pipelines is by specifying the branch for which you want to trigger a pipeline.
The specified branch will be used to determine which pipeline definition from the bitbucket-pipelines.yml file will be applied to initiate the pipeline. The pipeline will then do a clone of the repository and checkout the latest revision of the specified branch.
$ curl -X POST -is -u username:password \
-H 'Content-Type: application/json' \
https://api.bitbucket.org/2.0/repositories/jeroendr/meat-demo2/pipelines/ \
-d '
{
"target": {
"ref_type": "branch",
"type": "pipeline_ref_target",
"ref_name": "master"
}
}'
You can initiate a pipeline for a specific commit and in the context of a specified reference (e.g. a branch, tag or bookmark).
The specified reference will be used to determine which pipeline definition from the bitbucket-pipelines.yml file will be applied to initiate the pipeline. The pipeline will clone the repository and then do a checkout the specified reference.
The following reference types are supported:
branchnamed_branchbookmarktag$ curl -X POST -is -u username:password \
-H 'Content-Type: application/json' \
https://api.bitbucket.org/2.0/repositories/jeroendr/meat-demo2/pipelines/ \
-d '
{
"target": {
"commit": {
"type": "commit",
"hash": "ce5b7431602f7cbba007062eeb55225c6e18e956"
},
"ref_type": "branch",
"type": "pipeline_ref_target",
"ref_name": "master"
}
}'
You can trigger a specific pipeline that is defined in your bitbucket-pipelines.yml file for a specific commit.
In addition to the commit revision, you specify the type and pattern of the selector that identifies the pipeline definition. The resulting pipeline will then clone the repository and checkout the specified revision.
$ curl -X POST -is -u username:password \
-H 'Content-Type: application/json' \
https://api.bitbucket.org/2.0/repositories/jeroendr/meat-demo2/pipelines/ \
-d '
{
"target": {
"commit": {
"hash":"a3c4e02c9a3755eccdc3764e6ea13facdf30f923",
"type":"commit"
},
"selector": {
"type":"custom",
"pattern":"Deploy to production"
},
"type":"pipeline_commit_target"
}
}'
You can trigger a specific pipeline that is defined in your bitbucket-pipelines.yml file for a specific commit in the context of a specified reference.
In addition to the commit revision, you specify the type and pattern of the selector that identifies the pipeline definition, as well as the reference information. The resulting pipeline will then clone the repository a checkout the specified reference.
$ curl -X POST -is -u username:password \
-H 'Content-Type: application/json' \
https://api.bitbucket.org/2.0/repositories/jeroendr/meat-demo2/pipelines/ \
-d '
{
"target": {
"commit": {
"hash":"a3c4e02c9a3755eccdc3764e6ea13facdf30f923",
"type":"commit"
},
"selector": {
"type": "custom",
"pattern": "Deploy to production"
},
"type": "pipeline_ref_target",
"ref_name": "master",
"ref_type": "branch"
}
}'
In addition to triggering a custom pipeline that is defined in your bitbucket-pipelines.yml file as shown in the examples above, you can specify variables that will be available for your build. In the request, provide a list of variables, specifying the following for each variable: key, value, and whether it should be secured or not (this field is optional and defaults to not secured).
$ curl -X POST -is -u username:password \
-H 'Content-Type: application/json' \
https://api.bitbucket.org/2.0/repositories/{workspace}/{repo_slug}/pipelines/ \
-d '
{
"target": {
"type": "pipeline_ref_target",
"ref_type": "branch",
"ref_name": "master",
"selector": {
"type": "custom",
"pattern": "Deploy to production"
}
},
"variables": [
{
"key": "var1key",
"value": "var1value",
"secured": true
},
{
"key": "var2key",
"value": "var2value"
}
]
}'
You can also initiate a pipeline for a specific pull request.
$ curl -X POST -is -u username:password \
-H 'Content-Type: application/json' \
https://api.bitbucket.org/2.0/repositories/{workspace}/{repo_slug}/pipelines/ \
-d '
{
"target": {
"type": "pipeline_pullrequest_target",
"source": "pull-request-branch",
"destination": "master",
"destination_commit": {
"hash": "9f848b7"
},
"commit": {
"hash": "1a372fc"
},
"pullrequest": {
"id": "3"
},
"selector": {
"type": "pull-requests",
"pattern": "**"
}
}
}'
| Name | In | Required | Type | Description |
|---|---|---|---|---|
| workspace | path | required | string | This can either be the workspace ID (slug) or the workspace UUID surrounded by curly-braces, for example |
| repo_slug | path | required | string | The repository. |
The pipeline to initiate.
application/json
pipeline
| Property | Type | Required |
|---|---|---|
| type | string | required |
| uuid | string | optional |
| state | object | optional |
| └ type | string | required |
| target | object | optional |
| └ type | string | required |
| creator | object | optional |
| └ type | string | required |
| └ uuid | string | optional |
| └ links | object | optional |
| └ avatar | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| └ username | string | optional |
| └ created_on | string | optional |
| └ display_name | string | optional |
| trigger | object | optional |
| └ type | string | required |
| variables | array | optional |
| └ type | string | required |
| └ key | string | optional |
| └ uuid | string | optional |
| └ value | string | optional |
| └ secured | boolean | optional |
| created_on | string | optional |
| repository | object | optional |
| └ type | string | required |
| └ scm | string | optional |
| └ name | string | optional |
| └ size | integer | optional |
| └ uuid | string | optional |
| └ links | object | optional |
| └ html | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| └ self | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| └ clone | array | optional |
| └ href | string | optional |
| └ name | string | optional |
| └ forks | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| └ hooks | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| └ avatar | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| └ commits | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| └ watchers | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| └ downloads | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| └ pullrequests | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| └ owner | object | optional |
| └ type | string | required |
| └ uuid | string | optional |
| └ links | object | optional |
| └ avatar | object | optional |
| └ username | string | optional |
| └ created_on | string | optional |
| └ display_name | string | optional |
| └ parent | object | optional |
| └ project | object | optional |
| └ type | string | required |
| └ key | string | optional |
| └ name | string | optional |
| └ uuid | string | optional |
| └ links | object | optional |
| └ html | object | optional |
| └ avatar | object | optional |
| └ owner | object | optional |
| └ type | string | required |
| └ uuid | string | optional |
| └ links | object | optional |
| └ username | string | optional |
| └ created_on | string | optional |
| └ display_name | string | optional |
| └ created_on | string | optional |
| └ is_private | boolean | optional |
| └ updated_on | string | optional |
| └ description | string | optional |
| └ has_publicly_visible_repos | boolean | optional |
| └ has_wiki | boolean | optional |
| └ language | string | optional |
| └ full_name | string | optional |
| └ created_on | string | optional |
| └ has_issues | boolean | optional |
| └ is_private | boolean | optional |
| └ mainbranch | object | optional |
| └ name | string | optional |
| └ type | string | required |
| └ links | object | optional |
| └ html | object | optional |
| └ self | object | optional |
| └ commits | object | optional |
| └ target | object | optional |
| └ type | string | required |
| └ date | string | optional |
| └ hash | string | optional |
| └ author | object | optional |
| └ message | string | optional |
| └ parents | array | optional |
| └ summary | object | optional |
| └ repository | object | optional |
| └ participants | array | optional |
| └ merge_strategies | array | optional |
| └ default_merge_strategy | string | optional |
| └ updated_on | string | optional |
| └ description | string | optional |
| └ fork_policy | string | optional |
| build_number | integer | optional |
| completed_on | string | optional |
| build_seconds_used | integer | optional |
| configuration_sources | array | optional |
| └ uri | string | required |
| └ source | string | required |
The initiated pipeline.
The account or repository is not enabled, the yml file does not exist in the repository for the given revision, or the request body contained invalid properties.
The account or repository was not found.
POST /repositories/{workspace}/{repo_slug}/pipelines
/repositories/{workspace}/{repo_slug}/pipelines/{pipeline_uuid}/stopPipeline
Signal the stop of a pipeline and all of its steps that not have completed yet.
| Name | In | Required | Type | Description |
|---|---|---|---|---|
| workspace | path | required | string | This can either be the workspace ID (slug) or the workspace UUID surrounded by curly-braces, for example |
| repo_slug | path | required | string | The repository. |
| pipeline_uuid | path | required | string | The UUID of the pipeline. |
The pipeline has been signaled to stop.
The specified pipeline has already completed.
Either the account, repository or pipeline with the given UUID does not exist.
POST /repositories/{workspace}/{repo_slug}/pipelines/{pipeline_uuid}/stopPipeline
/repositories/{workspace}/{repo_slug}/pipelines_config/schedules
Create a schedule for the given repository.
| Name | In | Required | Type | Description |
|---|---|---|---|---|
| workspace | path | required | string | This can either be the workspace ID (slug) or the workspace UUID surrounded by curly-braces, for example |
| repo_slug | path | required | string | The repository. |
The schedule to create.
application/json
pipeline_schedule_post_request_body
| Property | Type | Required |
|---|---|---|
| type | string | required |
| target | object | required |
| └ ref_name | string | required |
| └ ref_type | string | required |
| └ selector | object | required |
| └ type | string | required |
| └ pattern | string | optional |
| enabled | boolean | optional |
| cron_pattern | string | required |
The created schedule.
There were errors validating the request.
The maximum limit of schedules for this repository was reached.
The account or repository was not found.
POST /repositories/{workspace}/{repo_slug}/pipelines_config/schedules
/repositories/{workspace}/{repo_slug}/pipelines_config/ssh/known_hosts
Create a repository level known host.
| Name | In | Required | Type | Description |
|---|---|---|---|---|
| workspace | path | required | string | This can either be the workspace ID (slug) or the workspace UUID surrounded by curly-braces, for example |
| repo_slug | path | required | string | The repository. |
The known host to create.
application/json
pipeline_known_host
| Property | Type | Required |
|---|---|---|
| type | string | required |
| uuid | string | optional |
| hostname | string | optional |
| public_key | object | optional |
| └ type | string | required |
| └ key | string | optional |
| └ key_type | string | optional |
| └ md5_fingerprint | string | optional |
| └ sha256_fingerprint | string | optional |
The known host was created.
The account or repository does not exist.
A known host with the provided hostname already exists.
POST /repositories/{workspace}/{repo_slug}/pipelines_config/ssh/known_hosts
/repositories/{workspace}/{repo_slug}/pipelines_config/variables
Create a repository level variable.
| Name | In | Required | Type | Description |
|---|---|---|---|---|
| workspace | path | required | string | This can either be the workspace ID (slug) or the workspace UUID surrounded by curly-braces, for example |
| repo_slug | path | required | string | The repository. |
The variable to create.
application/json
pipeline_variable
| Property | Type | Required |
|---|---|---|
| type | string | required |
| key | string | optional |
| uuid | string | optional |
| value | string | optional |
| secured | boolean | optional |
The variable was created.
The account or repository does not exist.
A variable with the provided key already exists.
POST /repositories/{workspace}/{repo_slug}/pipelines_config/variables
/workspaces/{workspace}/pipelines-config/variables
Create a workspace level variable.
| Name | In | Required | Type | Description |
|---|---|---|---|---|
| workspace | path | required | string | This can either be the workspace ID (slug) or the workspace UUID surrounded by curly-braces, for example |
The variable to create.
application/json
pipeline_variable
| Property | Type | Required |
|---|---|---|
| type | string | required |
| key | string | optional |
| uuid | string | optional |
| value | string | optional |
| secured | boolean | optional |
The created variable.
The workspace does not exist.
A variable with the provided key already exists.
POST /workspaces/{workspace}/pipelines-config/variables
/workspaces/{workspace}/projects
Creates a new project.
Note that the avatar has to be embedded as either a data-url
or a URL to an external image as shown in the examples below:
$ body=$(cat << EOF
{
"name": "Mars Project",
"key": "MARS",
"description": "Software for colonizing mars.",
"links": {
"avatar": {
"href": "data:image/gif;base64,R0lGODlhEAAQAMQAAORHHOVSKudfOulrSOp3WOyDZu6QdvCchPGolfO0o/..."
}
},
"is_private": false
}
EOF
)
$ curl -H "Content-Type: application/json" \
-X POST \
-d "$body" \
https://api.bitbucket.org/2.0/workspaces/teams-in-space/projects/ | jq .
{
// Serialized project document
}
or even:
$ body=$(cat << EOF
{
"name": "Mars Project",
"key": "MARS",
"description": "Software for colonizing mars.",
"links": {
"avatar": {
"href": "http://i.imgur.com/72tRx4w.gif"
}
},
"is_private": false
}
EOF
)
$ curl -H "Content-Type: application/json" \
-X POST \
-d "$body" \
https://api.bitbucket.org/2.0/workspaces/teams-in-space/projects/ | jq .
{
// Serialized project document
}
| Name | In | Required | Type | Description |
|---|---|---|---|---|
| workspace | path | required | string | This can either be the workspace ID (slug) or the workspace UUID |
application/json
project
| Property | Type | Required |
|---|---|---|
| type | string | required |
| key | string | optional |
| name | string | optional |
| uuid | string | optional |
| links | object | optional |
| └ html | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| └ avatar | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| owner | object | optional |
| └ type | string | required |
| └ uuid | string | optional |
| └ links | object | optional |
| └ avatar | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| └ html | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| └ self | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| └ members | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| └ projects | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| └ repositories | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| └ username | string | optional |
| └ created_on | string | optional |
| └ display_name | string | optional |
| created_on | string | optional |
| is_private | boolean | optional |
| updated_on | string | optional |
| description | string | optional |
| has_publicly_visible_repos | boolean | optional |
A new project has been created.
The requesting user isn’t authorized to create the project.
A workspace doesn’t exist at this location.
POST /workspaces/{workspace}/projects
/repositories/{workspace}/{repo_slug}/pullrequests
Creates a new pull request where the destination repository is
this repository and the author is the authenticated user.
The minimum required fields to create a pull request are title and
source, specified by a branch name.
curl https://api.bitbucket.org/2.0/repositories/my-workspace/my-repository/pullrequests \
-u my-username:my-password \
--request POST \
--header 'Content-Type: application/json' \
--data '{
"title": "My Title",
"source": {
"branch": {
"name": "staging"
}
}
}'
If the pull request’s destination is not specified, it will default
to the repository.mainbranch. To open a pull request to a
different branch, say from a feature branch to a staging branch,
specify a destination (same format as the source):
{
"title": "My Title",
"source": {
"branch": {
"name": "my-feature-branch"
}
},
"destination": {
"branch": {
"name": "staging"
}
}
}
Reviewers can be specified by adding an array of user objects as the
reviewers property.
{
"title": "My Title",
"source": {
"branch": {
"name": "my-feature-branch"
}
},
"reviewers": [
{
"uuid": "{504c3b62-8120-4f0c-a7bc-87800b9d6f70}"
}
]
}
Other fields:
description - a stringclose_source_branch - boolean that specifies if the source branch should be closed upon merging| Name | In | Required | Type | Description |
|---|---|---|---|---|
| repo_slug | path | required | string | This can either be the repository slug or the UUID of the repository, |
| workspace | path | required | string | This can either be the workspace ID (slug) or the workspace UUID |
The new pull request.
The request URL you POST to becomes the destination repository URL. For this reason, you must specify an explicit source repository in the request object if you want to pull from a different repository (fork).
Since not all elements are required or even mutable, you only need to include the elements you want to initialize, such as the source branch and the title.
application/json
pullrequest
| Property | Type | Required |
|---|---|---|
| type | string | required |
| id | integer | optional |
| links | object | optional |
| └ diff | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| └ html | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| └ self | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| └ merge | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| └ approve | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| └ commits | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| └ decline | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| └ activity | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| └ comments | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| └ diffstat | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| state | string | optional |
| title | string | optional |
| author | object | optional |
| └ type | string | required |
| └ uuid | string | optional |
| └ links | object | optional |
| └ avatar | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| └ username | string | optional |
| └ created_on | string | optional |
| └ display_name | string | optional |
| reason | string | optional |
| source | object | optional |
| └ branch | object | optional |
| └ name | string | optional |
| └ merge_strategies | array | optional |
| └ default_merge_strategy | string | optional |
| └ commit | object | optional |
| └ hash | string | optional |
| └ repository | object | optional |
| └ type | string | required |
| └ scm | string | optional |
| └ name | string | optional |
| └ size | integer | optional |
| └ uuid | string | optional |
| └ links | object | optional |
| └ html | object | optional |
| └ self | object | optional |
| └ clone | array | optional |
| └ forks | object | optional |
| └ hooks | object | optional |
| └ avatar | object | optional |
| └ commits | object | optional |
| └ watchers | object | optional |
| └ downloads | object | optional |
| └ pullrequests | object | optional |
| └ owner | object | optional |
| └ type | string | required |
| └ uuid | string | optional |
| └ links | object | optional |
| └ username | string | optional |
| └ created_on | string | optional |
| └ display_name | string | optional |
| └ parent | object | optional |
| └ project | object | optional |
| └ type | string | required |
| └ key | string | optional |
| └ name | string | optional |
| └ uuid | string | optional |
| └ links | object | optional |
| └ owner | object | optional |
| └ created_on | string | optional |
| └ is_private | boolean | optional |
| └ updated_on | string | optional |
| └ description | string | optional |
| └ has_publicly_visible_repos | boolean | optional |
| └ has_wiki | boolean | optional |
| └ language | string | optional |
| └ full_name | string | optional |
| └ created_on | string | optional |
| └ has_issues | boolean | optional |
| └ is_private | boolean | optional |
| └ mainbranch | object | optional |
| └ name | string | optional |
| └ type | string | required |
| └ links | object | optional |
| └ target | object | optional |
| └ merge_strategies | array | optional |
| └ default_merge_strategy | string | optional |
| └ updated_on | string | optional |
| └ description | string | optional |
| └ fork_policy | string | optional |
| summary | object | optional |
| └ raw | string | optional |
| └ html | string | optional |
| └ markup | string | optional |
| rendered | object | optional |
| └ title | object | optional |
| └ raw | string | optional |
| └ html | string | optional |
| └ markup | string | optional |
| └ reason | object | optional |
| └ raw | string | optional |
| └ html | string | optional |
| └ markup | string | optional |
| └ description | object | optional |
| └ raw | string | optional |
| └ html | string | optional |
| └ markup | string | optional |
| closed_by | object | optional |
| └ type | string | required |
| └ uuid | string | optional |
| └ links | object | optional |
| └ avatar | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| └ username | string | optional |
| └ created_on | string | optional |
| └ display_name | string | optional |
| reviewers | array | optional |
| └ type | string | required |
| └ uuid | string | optional |
| └ links | object | optional |
| └ avatar | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| └ username | string | optional |
| └ created_on | string | optional |
| └ display_name | string | optional |
| created_on | string | optional |
| task_count | integer | optional |
| updated_on | string | optional |
| destination | object | optional |
| └ branch | object | optional |
| └ name | string | optional |
| └ merge_strategies | array | optional |
| └ default_merge_strategy | string | optional |
| └ commit | object | optional |
| └ hash | string | optional |
| └ repository | object | optional |
| └ type | string | required |
| └ scm | string | optional |
| └ name | string | optional |
| └ size | integer | optional |
| └ uuid | string | optional |
| └ links | object | optional |
| └ html | object | optional |
| └ self | object | optional |
| └ clone | array | optional |
| └ forks | object | optional |
| └ hooks | object | optional |
| └ avatar | object | optional |
| └ commits | object | optional |
| └ watchers | object | optional |
| └ downloads | object | optional |
| └ pullrequests | object | optional |
| └ owner | object | optional |
| └ type | string | required |
| └ uuid | string | optional |
| └ links | object | optional |
| └ username | string | optional |
| └ created_on | string | optional |
| └ display_name | string | optional |
| └ parent | object | optional |
| └ project | object | optional |
| └ type | string | required |
| └ key | string | optional |
| └ name | string | optional |
| └ uuid | string | optional |
| └ links | object | optional |
| └ owner | object | optional |
| └ created_on | string | optional |
| └ is_private | boolean | optional |
| └ updated_on | string | optional |
| └ description | string | optional |
| └ has_publicly_visible_repos | boolean | optional |
| └ has_wiki | boolean | optional |
| └ language | string | optional |
| └ full_name | string | optional |
| └ created_on | string | optional |
| └ has_issues | boolean | optional |
| └ is_private | boolean | optional |
| └ mainbranch | object | optional |
| └ name | string | optional |
| └ type | string | required |
| └ links | object | optional |
| └ target | object | optional |
| └ merge_strategies | array | optional |
| └ default_merge_strategy | string | optional |
| └ updated_on | string | optional |
| └ description | string | optional |
| └ fork_policy | string | optional |
| merge_commit | object | optional |
| └ hash | string | optional |
| participants | array | optional |
| └ type | string | required |
| └ role | string | optional |
| └ user | object | optional |
| └ type | string | required |
| └ uuid | string | optional |
| └ links | object | optional |
| └ avatar | object | optional |
| └ username | string | optional |
| └ created_on | string | optional |
| └ display_name | string | optional |
| └ state | string | optional |
| └ approved | boolean | optional |
| └ participated_on | string | optional |
| comment_count | integer | optional |
| close_source_branch | boolean | optional |
The newly created pull request.
If the input document was invalid, or if the caller lacks the privilege to create repositories under the targeted account.
If the request was not authenticated.
POST /repositories/{workspace}/{repo_slug}/pullrequests
/repositories/{workspace}/{repo_slug}/pullrequests/{pull_request_id}/approve
Approve the specified pull request as the authenticated user.
| Name | In | Required | Type | Description |
|---|---|---|---|---|
| pull_request_id | path | required | integer | The id of the pull request. |
| repo_slug | path | required | string | This can either be the repository slug or the UUID of the repository, |
| workspace | path | required | string | This can either be the workspace ID (slug) or the workspace UUID |
The participant object recording that the authenticated user approved the pull request.
The request wasn’t authenticated.
The specified pull request or the repository does not exist.
POST /repositories/{workspace}/{repo_slug}/pullrequests/{pull_request_id}/approve
/repositories/{workspace}/{repo_slug}/pullrequests/{pull_request_id}/comments
Creates a new pull request comment.
Returns the newly created pull request comment.
| Name | In | Required | Type | Description |
|---|---|---|---|---|
| pull_request_id | path | required | integer | The id of the pull request. |
| repo_slug | path | required | string | This can either be the repository slug or the UUID of the repository, |
| workspace | path | required | string | This can either be the workspace ID (slug) or the workspace UUID |
The comment object.
application/json
pullrequest_comment
| Property | Type | Required |
|---|---|---|
| type | string | required |
| id | integer | optional |
| user | object | optional |
| └ type | string | required |
| └ uuid | string | optional |
| └ links | object | optional |
| └ avatar | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| └ username | string | optional |
| └ created_on | string | optional |
| └ display_name | string | optional |
| links | object | optional |
| └ code | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| └ html | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| └ self | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| inline | object | optional |
| └ to | integer | optional |
| └ from | integer | optional |
| └ path | string | required |
| parent | object | optional |
| content | object | optional |
| └ raw | string | optional |
| └ html | string | optional |
| └ markup | string | optional |
| deleted | boolean | optional |
| created_on | string | optional |
| updated_on | string | optional |
| pending | boolean | optional |
| resolution | object | optional |
| └ type | string | required |
| └ user | object | optional |
| └ type | string | required |
| └ uuid | string | optional |
| └ links | object | optional |
| └ avatar | object | optional |
| └ username | string | optional |
| └ created_on | string | optional |
| └ display_name | string | optional |
| └ created_on | string | optional |
| pullrequest | object | optional |
| └ type | string | required |
| └ id | integer | optional |
| └ links | object | optional |
| └ diff | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| └ html | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| └ self | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| └ merge | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| └ approve | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| └ commits | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| └ decline | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| └ activity | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| └ comments | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| └ diffstat | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| └ state | string | optional |
| └ title | string | optional |
| └ author | object | optional |
| └ type | string | required |
| └ uuid | string | optional |
| └ links | object | optional |
| └ avatar | object | optional |
| └ username | string | optional |
| └ created_on | string | optional |
| └ display_name | string | optional |
| └ reason | string | optional |
| └ source | object | optional |
| └ branch | object | optional |
| └ name | string | optional |
| └ merge_strategies | array | optional |
| └ default_merge_strategy | string | optional |
| └ commit | object | optional |
| └ hash | string | optional |
| └ repository | object | optional |
| └ type | string | required |
| └ scm | string | optional |
| └ name | string | optional |
| └ size | integer | optional |
| └ uuid | string | optional |
| └ links | object | optional |
| └ owner | object | optional |
| └ parent | object | optional |
| └ project | object | optional |
| └ has_wiki | boolean | optional |
| └ language | string | optional |
| └ full_name | string | optional |
| └ created_on | string | optional |
| └ has_issues | boolean | optional |
| └ is_private | boolean | optional |
| └ mainbranch | object | optional |
| └ updated_on | string | optional |
| └ description | string | optional |
| └ fork_policy | string | optional |
| └ summary | object | optional |
| └ raw | string | optional |
| └ html | string | optional |
| └ markup | string | optional |
| └ rendered | object | optional |
| └ title | object | optional |
| └ raw | string | optional |
| └ html | string | optional |
| └ markup | string | optional |
| └ reason | object | optional |
| └ raw | string | optional |
| └ html | string | optional |
| └ markup | string | optional |
| └ description | object | optional |
| └ raw | string | optional |
| └ html | string | optional |
| └ markup | string | optional |
| └ closed_by | object | optional |
| └ type | string | required |
| └ uuid | string | optional |
| └ links | object | optional |
| └ avatar | object | optional |
| └ username | string | optional |
| └ created_on | string | optional |
| └ display_name | string | optional |
| └ reviewers | array | optional |
| └ type | string | required |
| └ uuid | string | optional |
| └ links | object | optional |
| └ avatar | object | optional |
| └ username | string | optional |
| └ created_on | string | optional |
| └ display_name | string | optional |
| └ created_on | string | optional |
| └ task_count | integer | optional |
| └ updated_on | string | optional |
| └ destination | object | optional |
| └ branch | object | optional |
| └ name | string | optional |
| └ merge_strategies | array | optional |
| └ default_merge_strategy | string | optional |
| └ commit | object | optional |
| └ hash | string | optional |
| └ repository | object | optional |
| └ type | string | required |
| └ scm | string | optional |
| └ name | string | optional |
| └ size | integer | optional |
| └ uuid | string | optional |
| └ links | object | optional |
| └ owner | object | optional |
| └ parent | object | optional |
| └ project | object | optional |
| └ has_wiki | boolean | optional |
| └ language | string | optional |
| └ full_name | string | optional |
| └ created_on | string | optional |
| └ has_issues | boolean | optional |
| └ is_private | boolean | optional |
| └ mainbranch | object | optional |
| └ updated_on | string | optional |
| └ description | string | optional |
| └ fork_policy | string | optional |
| └ merge_commit | object | optional |
| └ hash | string | optional |
| └ participants | array | optional |
| └ type | string | required |
| └ role | string | optional |
| └ user | object | optional |
| └ type | string | required |
| └ uuid | string | optional |
| └ links | object | optional |
| └ username | string | optional |
| └ created_on | string | optional |
| └ display_name | string | optional |
| └ state | string | optional |
| └ approved | boolean | optional |
| └ participated_on | string | optional |
| └ comment_count | integer | optional |
| └ close_source_branch | boolean | optional |
The newly created comment.
If the authenticated user does not have access to the pull request.
If the pull request does not exist.
POST /repositories/{workspace}/{repo_slug}/pullrequests/{pull_request_id}/comments
/repositories/{workspace}/{repo_slug}/pullrequests/{pull_request_id}/comments/{comment_id}/resolve
| Name | In | Required | Type | Description |
|---|---|---|---|---|
| comment_id | path | required | integer | The id of the comment. |
| pull_request_id | path | required | integer | The id of the pull request. |
| repo_slug | path | required | string | This can either be the repository slug or the UUID of the repository, |
| workspace | path | required | string | This can either be the workspace ID (slug) or the workspace UUID |
The comment resolution details.
If the authenticated user does not have access to the pull request,
if the provided comment is not a top-level comment,
or if the comment is not on the diff.
If the comment does not exist.
If the comment has already been resolved.
POST /repositories/{workspace}/{repo_slug}/pullrequests/{pull_request_id}/comments/{comment_id}/resolve
/repositories/{workspace}/{repo_slug}/pullrequests/{pull_request_id}/decline
Declines the pull request.
| Name | In | Required | Type | Description |
|---|---|---|---|---|
| pull_request_id | path | required | integer | The id of the pull request. |
| repo_slug | path | required | string | This can either be the repository slug or the UUID of the repository, |
| workspace | path | required | string | This can either be the workspace ID (slug) or the workspace UUID |
The pull request was successfully declined.
If the decline took too long and timed out.
In this case the caller should retry the request later.
POST /repositories/{workspace}/{repo_slug}/pullrequests/{pull_request_id}/decline
/repositories/{workspace}/{repo_slug}/pullrequests/{pull_request_id}/merge
Merges the pull request.
| Name | In | Required | Type | Description |
|---|---|---|---|---|
| pull_request_id | path | required | integer | The id of the pull request. |
| repo_slug | path | required | string | This can either be the repository slug or the UUID of the repository, |
| workspace | path | required | string | This can either be the workspace ID (slug) or the workspace UUID |
| async | query | optional | boolean | Default value is false. When set to true, runs merge asynchronously and When set to false, runs merge and waits for it to |
application/json
pullrequest_merge_parameters
| Property | Type | Required |
|---|---|---|
| type | string | required |
| message | string | optional |
| merge_strategy | string | optional |
| close_source_branch | boolean | optional |
The pull request object.
In the Location header, the URL to poll for the pull request merge status
If the merge took too long and timed out.
In this case the caller should retry the request later
POST /repositories/{workspace}/{repo_slug}/pullrequests/{pull_request_id}/merge
/repositories/{workspace}/{repo_slug}/pullrequests/{pull_request_id}/request-changes
| Name | In | Required | Type | Description |
|---|---|---|---|---|
| pull_request_id | path | required | integer | The id of the pull request. |
| repo_slug | path | required | string | This can either be the repository slug or the UUID of the repository, |
| workspace | path | required | string | This can either be the workspace ID (slug) or the workspace UUID |
The participant object recording that the authenticated user requested changes on the pull request.
Pull request changes cannot be requested because the pull request has already been merged.
The request wasn’t authenticated.
The specified pull request or the repository does not exist.
POST /repositories/{workspace}/{repo_slug}/pullrequests/{pull_request_id}/request-changes
/repositories/{workspace}/{repo_slug}/pullrequests/{pull_request_id}/tasks
Creates a new pull request task.
Returns the newly created pull request task.
Tasks can optionally be created in relation to a comment specified by the comment’s ID which
will cause the task to appear below the comment on a pull request when viewed in Bitbucket.
| Name | In | Required | Type | Description |
|---|---|---|---|---|
| pull_request_id | path | required | integer | The id of the pull request. |
| repo_slug | path | required | string | This can either be the repository slug or the UUID of the repository, |
| workspace | path | required | string | This can either be the workspace ID (slug) or the workspace UUID |
The contents of the task
application/json
A_pullrequest_task_create
| Property | Type | Required |
|---|---|---|
| comment | object | optional |
| └ type | string | required |
| └ id | integer | optional |
| └ user | object | optional |
| └ type | string | required |
| └ uuid | string | optional |
| └ links | object | optional |
| └ avatar | object | optional |
| └ username | string | optional |
| └ created_on | string | optional |
| └ display_name | string | optional |
| └ links | object | optional |
| └ code | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| └ html | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| └ self | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| └ inline | object | optional |
| └ to | integer | optional |
| └ from | integer | optional |
| └ path | string | required |
| └ parent | object | optional |
| └ content | object | optional |
| └ raw | string | optional |
| └ html | string | optional |
| └ markup | string | optional |
| └ deleted | boolean | optional |
| └ created_on | string | optional |
| └ updated_on | string | optional |
| content | object | required |
| └ raw | string | required |
| pending | boolean | optional |
The newly created task.
There is a missing required field in the request or the task content is blank.
If the authenticated user does not have access to the pull request.
If the pull request does not exist.
POST /repositories/{workspace}/{repo_slug}/pullrequests/{pull_request_id}/tasks
/repositories/{workspace}/{repo_slug}/refs/branches
Creates a new branch in the specified repository.
The payload of the POST should consist of a JSON document that
contains the name of the tag and the target hash.
curl https://api.bitbucket.org/2.0/repositories/seanfarley/hg/refs/branches \
-s -u seanfarley -X POST -H "Content-Type: application/json" \
-d '{
"name" : "smf/create-feature",
"target" : {
"hash" : "default",
}
}'
This call requires authentication. Private repositories require the
caller to authenticate with an account that has appropriate
authorization.
The branch name should not include any prefixes (e.g.
refs/heads). This endpoint does support using short hash prefixes for
the commit hash, but it may return a 400 response if the provided
prefix is ambiguous. Using a full commit hash is the preferred
approach.
| Name | In | Required | Type | Description |
|---|---|---|---|---|
| repo_slug | path | required | string | This can either be the repository slug or the UUID of the repository, |
| workspace | path | required | string | This can either be the workspace ID (slug) or the workspace UUID |
The newly created branch object.
If the repository is private and the authenticated user does not have
access to it.
The specified repository or branch does not exist.
POST /repositories/{workspace}/{repo_slug}/refs/branches
/repositories/{workspace}/{repo_slug}/refs/tags
Creates a new tag in the specified repository.
The payload of the POST should consist of a JSON document that
contains the name of the tag and the target hash.
curl https://api.bitbucket.org/2.0/repositories/jdoe/myrepo/refs/tags \
-s -u jdoe -X POST -H "Content-Type: application/json" \
-d '{
"name" : "new-tag-name",
"target" : {
"hash" : "a1b2c3d4e5f6",
}
}'
This endpoint does support using short hash prefixes for the commit
hash, but it may return a 400 response if the provided prefix is
ambiguous. Using a full commit hash is the preferred approach.
| Name | In | Required | Type | Description |
|---|---|---|---|---|
| repo_slug | path | required | string | This can either be the repository slug or the UUID of the repository, |
| workspace | path | required | string | This can either be the workspace ID (slug) or the workspace UUID |
application/json
tag
| Property | Type | Required |
|---|---|---|
| name | string | optional |
| type | string | required |
| links | object | optional |
| └ html | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| └ self | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| └ commits | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| target | object | optional |
| └ type | string | required |
| └ date | string | optional |
| └ hash | string | optional |
| └ author | object | optional |
| └ type | string | required |
| └ raw | string | optional |
| └ user | object | optional |
| └ type | string | required |
| └ uuid | string | optional |
| └ links | object | optional |
| └ username | string | optional |
| └ created_on | string | optional |
| └ display_name | string | optional |
| └ message | string | optional |
| └ parents | array | optional |
| └ summary | object | optional |
| └ raw | string | optional |
| └ html | string | optional |
| └ markup | string | optional |
| └ repository | object | optional |
| └ type | string | required |
| └ scm | string | optional |
| └ name | string | optional |
| └ size | integer | optional |
| └ uuid | string | optional |
| └ links | object | optional |
| └ html | object | optional |
| └ self | object | optional |
| └ clone | array | optional |
| └ forks | object | optional |
| └ hooks | object | optional |
| └ avatar | object | optional |
| └ commits | object | optional |
| └ watchers | object | optional |
| └ downloads | object | optional |
| └ pullrequests | object | optional |
| └ owner | object | optional |
| └ type | string | required |
| └ uuid | string | optional |
| └ links | object | optional |
| └ username | string | optional |
| └ created_on | string | optional |
| └ display_name | string | optional |
| └ parent | object | optional |
| └ project | object | optional |
| └ type | string | required |
| └ key | string | optional |
| └ name | string | optional |
| └ uuid | string | optional |
| └ links | object | optional |
| └ owner | object | optional |
| └ created_on | string | optional |
| └ is_private | boolean | optional |
| └ updated_on | string | optional |
| └ description | string | optional |
| └ has_publicly_visible_repos | boolean | optional |
| └ has_wiki | boolean | optional |
| └ language | string | optional |
| └ full_name | string | optional |
| └ created_on | string | optional |
| └ has_issues | boolean | optional |
| └ is_private | boolean | optional |
| └ mainbranch | object | optional |
| └ merge_strategies | array | optional |
| └ default_merge_strategy | string | optional |
| └ updated_on | string | optional |
| └ description | string | optional |
| └ fork_policy | string | optional |
| └ participants | array | optional |
| └ type | string | required |
| └ role | string | optional |
| └ user | object | optional |
| └ type | string | required |
| └ uuid | string | optional |
| └ links | object | optional |
| └ username | string | optional |
| └ created_on | string | optional |
| └ display_name | string | optional |
| └ state | string | optional |
| └ approved | boolean | optional |
| └ participated_on | string | optional |
| date | string | optional |
| tagger | object | optional |
| └ type | string | required |
| └ raw | string | optional |
| └ user | object | optional |
| └ type | string | required |
| └ uuid | string | optional |
| └ links | object | optional |
| └ avatar | object | optional |
| └ username | string | optional |
| └ created_on | string | optional |
| └ display_name | string | optional |
| message | string | optional |
The newly created tag.
If the target hash is missing, ambiguous, or invalid, or if the name is not provided.
POST /repositories/{workspace}/{repo_slug}/refs/tags
/repositories/{workspace}/{repo_slug}/commit/{commit}/reports/{reportId}/annotations
Bulk upload of annotations.
Annotations are individual findings that have been identified as part of a report, for example, a line of code that represents a vulnerability. These annotations can be attached to a specific file and even a specific line in that file, however, that is optional. Annotations are not mandatory and a report can contain up to 1000 annotations.
Add the annotations you want to upload as objects in a JSON array and make sure each annotation has the external_id field set to a unique value. If you want to use an existing id from your own system, we recommend prefixing it with your system’s name to avoid collisions, for example, mySystem-annotation001. The external id can later be used to identify the report as an alternative to the generated UUID. You can upload up to 100 annotations per POST request.
curl --location 'https://api.bitbucket.org/2.0/repositories/<username>/<reposity-name>/commit/<commit-hash>/reports/mysystem-001/annotations' \
--header 'Content-Type: application/json' \
--data-raw '[
{
"external_id": "mysystem-annotation001",
"title": "Security scan report",
"annotation_type": "VULNERABILITY",
"summary": "This line represents a security threat.",
"severity": "HIGH",
"path": "my-service/src/main/java/com/myCompany/mysystem/logic/Main.java",
"line": 42
},
{
"external_id": "mySystem-annotation002",
"title": "Bug report",
"annotation_type": "BUG",
"result": "FAILED",
"summary": "This line might introduce a bug.",
"severity": "MEDIUM",
"path": "my-service/src/main/java/com/myCompany/mysystem/logic/Helper.java",
"line": 13
}
]'
annotation_type: VULNERABILITY, CODE_SMELL, BUG
result: PASSED, FAILED, IGNORED, SKIPPED
severity: HIGH, MEDIUM, LOW, CRITICAL
Please refer to the Code Insights documentation for more information.
| Name | In | Required | Type | Description |
|---|---|---|---|---|
| workspace | path | required | string | This can either be the workspace ID (slug) or the workspace UUID surrounded by curly-braces, for example |
| repo_slug | path | required | string | The repository. |
| commit | path | required | string | The commit for which to retrieve reports. |
| reportId | path | required | string | Uuid or external-if of the report for which to get annotations for. |
The annotations to create or update
application/json
ReportsBulkCreateOrUpdateAnnotationsRequest
of object
| Property | Type | Required |
|---|---|---|
| type | string | required |
| line | integer | optional |
| link | string | optional |
| path | string | optional |
| uuid | string | optional |
| result | string | optional |
| details | string | optional |
| summary | string | optional |
| severity | string | optional |
| created_on | string | optional |
| updated_on | string | optional |
| external_id | string | optional |
| annotation_type | string | optional |
OK
POST /repositories/{workspace}/{repo_slug}/commit/{commit}/reports/{reportId}/annotations
/repositories/{workspace}/{repo_slug}
Creates a new repository.
Note: In order to set the project for the newly created repository,
pass in either the project key or the project UUID as part of the
request body as shown in the examples below:
$ curl -X POST -H "Content-Type: application/json" -d '{
"scm": "git",
"project": {
"key": "MARS"
}
}' https://api.bitbucket.org/2.0/repositories/teamsinspace/hablanding
or
$ curl -X POST -H "Content-Type: application/json" -d '{
"scm": "git",
"project": {
"key": "{ba516952-992a-4c2d-acbd-17d502922f96}"
}
}' https://api.bitbucket.org/2.0/repositories/teamsinspace/hablanding
The project must be assigned for all repositories. If the project is not provided,
the repository is automatically assigned to the oldest project in the workspace.
Note: In the examples above, the workspace ID teamsinspace,
and/or the repository name hablanding can be replaced by UUIDs.
| Name | In | Required | Type | Description |
|---|---|---|---|---|
| repo_slug | path | required | string | This can either be the repository slug or the UUID of the repository, |
| workspace | path | required | string | This can either be the workspace ID (slug) or the workspace UUID |
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.
application/json
repository
| Property | Type | Required |
|---|---|---|
| type | string | required |
| scm | string | optional |
| name | string | optional |
| size | integer | optional |
| uuid | string | optional |
| links | object | optional |
| └ html | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| └ self | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| └ clone | array | optional |
| └ href | string | optional |
| └ name | string | optional |
| └ forks | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| └ hooks | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| └ avatar | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| └ commits | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| └ watchers | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| └ downloads | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| └ pullrequests | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| owner | object | optional |
| └ type | string | required |
| └ uuid | string | optional |
| └ links | object | optional |
| └ avatar | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| └ username | string | optional |
| └ created_on | string | optional |
| └ display_name | string | optional |
| parent | object | optional |
| project | object | optional |
| └ type | string | required |
| └ key | string | optional |
| └ name | string | optional |
| └ uuid | string | optional |
| └ links | object | optional |
| └ html | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| └ avatar | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| └ owner | object | optional |
| └ type | string | required |
| └ uuid | string | optional |
| └ links | object | optional |
| └ avatar | object | optional |
| └ html | object | optional |
| └ self | object | optional |
| └ members | object | optional |
| └ projects | object | optional |
| └ repositories | object | optional |
| └ username | string | optional |
| └ created_on | string | optional |
| └ display_name | string | optional |
| └ created_on | string | optional |
| └ is_private | boolean | optional |
| └ updated_on | string | optional |
| └ description | string | optional |
| └ has_publicly_visible_repos | boolean | optional |
| has_wiki | boolean | optional |
| language | string | optional |
| full_name | string | optional |
| created_on | string | optional |
| has_issues | boolean | optional |
| is_private | boolean | optional |
| mainbranch | object | optional |
| └ name | string | optional |
| └ type | string | required |
| └ links | object | optional |
| └ html | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| └ self | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| └ commits | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| └ target | object | optional |
| └ type | string | required |
| └ date | string | optional |
| └ hash | string | optional |
| └ author | object | optional |
| └ type | string | required |
| └ raw | string | optional |
| └ user | object | optional |
| └ message | string | optional |
| └ parents | array | optional |
| └ summary | object | optional |
| └ raw | string | optional |
| └ html | string | optional |
| └ markup | string | optional |
| └ repository | object | optional |
| └ participants | array | optional |
| └ type | string | required |
| └ role | string | optional |
| └ user | object | optional |
| └ state | string | optional |
| └ approved | boolean | optional |
| └ participated_on | string | optional |
| └ merge_strategies | array | optional |
| └ default_merge_strategy | string | optional |
| updated_on | string | optional |
| description | string | optional |
| fork_policy | string | optional |
The newly created repository.
If the input document was invalid, or if the caller lacks the privilege to create repositories under the targeted account.
If the request was not authenticated.
POST /repositories/{workspace}/{repo_slug}
/repositories/{workspace}/{repo_slug}/forks
Creates a new fork of the specified repository.
To create a fork, specify the workspace explicitly as part of the
request body:
$ curl -X POST -u jdoe https://api.bitbucket.org/2.0/repositories/atlassian/bbql/forks \
-H 'Content-Type: application/json' -d '{
"name": "bbql_fork",
"workspace": {
"slug": "atlassian"
}
}'
To fork a repository into the same workspace, also specify a new name.
When you specify a value for name, it will also affect the slug.
The slug is reflected in the repository URL of the new fork. It is
derived from name by substituting non-ASCII characters, removes
whitespace, and changes characters to lower case. For example,
My repo would turn into my_repo.
You need contributor access to create new forks within a workspace.
By default the fork inherits most of its properties from the parent.
However, since the optional POST body document follows the normal
repository JSON schema and you can override the new fork’s
properties.
Properties that can be overridden include:
is_private=False would fail)is_privatetrue)Properties that cannot be modified include:
| Name | In | Required | Type | Description |
|---|---|---|---|---|
| repo_slug | path | required | string | This can either be the repository slug or the UUID of the repository, |
| workspace | path | required | string | This can either be the workspace ID (slug) or the workspace UUID |
A repository object. This can be left blank.
application/json
repository
| Property | Type | Required |
|---|---|---|
| type | string | required |
| scm | string | optional |
| name | string | optional |
| size | integer | optional |
| uuid | string | optional |
| links | object | optional |
| └ html | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| └ self | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| └ clone | array | optional |
| └ href | string | optional |
| └ name | string | optional |
| └ forks | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| └ hooks | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| └ avatar | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| └ commits | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| └ watchers | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| └ downloads | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| └ pullrequests | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| owner | object | optional |
| └ type | string | required |
| └ uuid | string | optional |
| └ links | object | optional |
| └ avatar | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| └ username | string | optional |
| └ created_on | string | optional |
| └ display_name | string | optional |
| parent | object | optional |
| project | object | optional |
| └ type | string | required |
| └ key | string | optional |
| └ name | string | optional |
| └ uuid | string | optional |
| └ links | object | optional |
| └ html | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| └ avatar | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| └ owner | object | optional |
| └ type | string | required |
| └ uuid | string | optional |
| └ links | object | optional |
| └ avatar | object | optional |
| └ html | object | optional |
| └ self | object | optional |
| └ members | object | optional |
| └ projects | object | optional |
| └ repositories | object | optional |
| └ username | string | optional |
| └ created_on | string | optional |
| └ display_name | string | optional |
| └ created_on | string | optional |
| └ is_private | boolean | optional |
| └ updated_on | string | optional |
| └ description | string | optional |
| └ has_publicly_visible_repos | boolean | optional |
| has_wiki | boolean | optional |
| language | string | optional |
| full_name | string | optional |
| created_on | string | optional |
| has_issues | boolean | optional |
| is_private | boolean | optional |
| mainbranch | object | optional |
| └ name | string | optional |
| └ type | string | required |
| └ links | object | optional |
| └ html | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| └ self | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| └ commits | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| └ target | object | optional |
| └ type | string | required |
| └ date | string | optional |
| └ hash | string | optional |
| └ author | object | optional |
| └ type | string | required |
| └ raw | string | optional |
| └ user | object | optional |
| └ message | string | optional |
| └ parents | array | optional |
| └ summary | object | optional |
| └ raw | string | optional |
| └ html | string | optional |
| └ markup | string | optional |
| └ repository | object | optional |
| └ participants | array | optional |
| └ type | string | required |
| └ role | string | optional |
| └ user | object | optional |
| └ state | string | optional |
| └ approved | boolean | optional |
| └ participated_on | string | optional |
| └ merge_strategies | array | optional |
| └ default_merge_strategy | string | optional |
| updated_on | string | optional |
| description | string | optional |
| fork_policy | string | optional |
The newly created fork.
POST /repositories/{workspace}/{repo_slug}/forks
/repositories/{workspace}/{repo_slug}/hooks
Creates a new webhook on the specified repository.
Example:
$ curl -X POST -u credentials -H 'Content-Type: application/json'
https://api.bitbucket.org/2.0/repositories/my-workspace/my-repo-slug/hooks
-d '
{
"description": "Webhook Description",
"url": "https://example.com/",
"active": true,
"secret": "this is a really bad secret",
"events": [
"repo:push",
"issue:created",
"issue:updated"
]
}'
When the secret is provided it will be used as the key to generate a HMAC
digest value sent in the X-Hub-Signature header at delivery time. Passing
a null or empty secret or not passing a secret will leave the webhook’s
secret unset. Bitbucket only generates the X-Hub-Signature when the webhook’s
secret is set.
Note that this call requires the webhook scope, as well as any scope
that applies to the events that the webhook subscribes to. In the
example above that means: webhook, repository and issue.
Also note that the url must properly resolve and cannot be an
internal, non-routed address.
| Name | In | Required | Type | Description |
|---|---|---|---|---|
| repo_slug | path | required | string | This can either be the repository slug or the UUID of the repository, |
| workspace | path | required | string | This can either be the workspace ID (slug) or the workspace UUID |
If the webhook was registered successfully.
If the authenticated user does not have permission to install webhooks on the specified repository.
If the repository does not exist.
POST /repositories/{workspace}/{repo_slug}/hooks
/snippets
Creates a new snippet under the authenticated user’s account.
Snippets can contain multiple files. Both text and binary files are
supported.
The simplest way to create a new snippet from a local file:
$ curl -u username:password -X POST https://api.bitbucket.org/2.0/snippets -F file=@image.png
Creating snippets through curl has a few limitations and so let’s look
at a more complicated scenario.
Snippets are created with a multipart POST. Both multipart/form-data
and multipart/related are supported. Both allow the creation of
snippets with both meta data (title, etc), as well as multiple text
and binary files.
The main difference is that multipart/related can use rich encoding
for the meta data (currently JSON).
This is the most advanced and efficient way to create a paste.
POST /2.0/snippets/evzijst HTTP/1.1
Content-Length: 1188
Content-Type: multipart/related; start="snippet"; boundary="===============1438169132528273974=="
MIME-Version: 1.0
--===============1438169132528273974==
Content-Type: application/json; charset="utf-8"
MIME-Version: 1.0
Content-ID: snippet
{
"title": "My snippet",
"is_private": true,
"scm": "git",
"files": {
"foo.txt": {},
"image.png": {}
}
}
--===============1438169132528273974==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-ID: "foo.txt"
Content-Disposition: attachment; filename="foo.txt"
foo
--===============1438169132528273974==
Content-Type: image/png
MIME-Version: 1.0
Content-Transfer-Encoding: base64
Content-ID: "image.png"
Content-Disposition: attachment; filename="image.png"
iVBORw0KGgoAAAANSUhEUgAAABQAAAAoCAYAAAD+MdrbAAABD0lEQVR4Ae3VMUoDQRTG8ccUaW2m
TKONFxArJYJamCvkCnZTaa+VnQdJSBFl2SMsLFrEWNjZBZs0JgiL/+KrhhVmJRbCLPx4O+/DT2TB
cbblJxf+UWFVVRNsEGAtgvJxnLm2H+A5RQ93uIl+3632PZyl/skjfOn9Gvdwmlcw5aPUwimG+NT5
EnNN036IaZePUuIcK533NVfal7/5yjWeot2z9ta1cAczHEf7I+3J0ws9Cgx0fsOFpmlfwKcWPuBQ
73Oc4FHzBaZ8llq4q1mr5B2mOUCt815qYR8eB1hG2VJ7j35q4RofaH7IG+Xrf/PfJhfmwtfFYoIN
AqxFUD6OMxcvkO+UfKfkOyXfKdsv/AYCHMLVkHAFWgAAAABJRU5ErkJggg==
--===============1438169132528273974==--
The request contains multiple parts and is structured as follows.
The first part is the JSON document that describes the snippet’s
properties or meta data. It either has to be the first part, or the
request’s Content-Type header must contain the start parameter to
point to it.
The remaining parts are the files of which there can be zero or more.
Each file part should contain the Content-ID MIME header through
which the JSON meta data’s files element addresses it. The value
should be the name of the file.
Content-Disposition is an optional MIME header. The header’s
optional filename parameter can be used to specify the file name
that Bitbucket should use when writing the file to disk. When present,
filename takes precedence over the value of Content-ID.
When the JSON body omits the files element, the remaining parts are
not ignored. Instead, each file is added to the new snippet as if its
name was explicitly linked (the use of the files elements is
mandatory for some operations like deleting or renaming files).
The use of JSON for the snippet’s meta data is optional. Meta data can
also be supplied as regular form fields in a more conventional
multipart/form-data request:
$ curl -X POST -u credentials https://api.bitbucket.org/2.0/snippets -F title="My snippet" -F file=@foo.txt -F file=@image.png
POST /2.0/snippets HTTP/1.1
Content-Length: 951
Content-Type: multipart/form-data; boundary=----------------------------63a4b224c59f
------------------------------63a4b224c59f
Content-Disposition: form-data; name="file"; filename="foo.txt"
Content-Type: text/plain
foo
------------------------------63a4b224c59f
Content-Disposition: form-data; name="file"; filename="image.png"
Content-Type: application/octet-stream
?PNG
IHDR?1??I.....
------------------------------63a4b224c59f
Content-Disposition: form-data; name="title"
My snippet
------------------------------63a4b224c59f--
Here the meta data properties are included as flat, top-level form
fields. The file attachments use the file field name. To attach
multiple files, simply repeat the field.
The advantage of multipart/form-data over multipart/related is
that it can be easier to build clients.
Essentially all properties are optional, title and files included.
Snippets can be either public (visible to anyone on Bitbucket, as well
as anonymous users), or private (visible only to members of the workspace).
This is controlled through the snippet’s is_private element:
To create the snippet under a workspace, just append the workspace ID
to the URL. See /2.0/snippets/{workspace}.
The new snippet object.
application/json
snippet
| Property | Type | Required |
|---|---|---|
| type | string | required |
| id | integer | optional |
| scm | string | optional |
| owner | object | optional |
| └ type | string | required |
| └ uuid | string | optional |
| └ links | object | optional |
| └ avatar | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| └ username | string | optional |
| └ created_on | string | optional |
| └ display_name | string | optional |
| title | string | optional |
| creator | object | optional |
| └ type | string | required |
| └ uuid | string | optional |
| └ links | object | optional |
| └ avatar | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| └ username | string | optional |
| └ created_on | string | optional |
| └ display_name | string | optional |
| created_on | string | optional |
| is_private | boolean | optional |
| updated_on | string | optional |
The newly created snippet object.
If the request was not authenticated
POST /snippets
/snippets/{workspace}
Identical to /snippets, except that the new snippet will be
created under the workspace specified in the path parameter
{workspace}.
| Name | In | Required | Type | Description |
|---|---|---|---|---|
| workspace | path | required | string | This can either be the workspace ID (slug) or the workspace UUID |
The new snippet object.
application/json
snippet
| Property | Type | Required |
|---|---|---|
| type | string | required |
| id | integer | optional |
| scm | string | optional |
| owner | object | optional |
| └ type | string | required |
| └ uuid | string | optional |
| └ links | object | optional |
| └ avatar | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| └ username | string | optional |
| └ created_on | string | optional |
| └ display_name | string | optional |
| title | string | optional |
| creator | object | optional |
| └ type | string | required |
| └ uuid | string | optional |
| └ links | object | optional |
| └ avatar | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| └ username | string | optional |
| └ created_on | string | optional |
| └ display_name | string | optional |
| created_on | string | optional |
| is_private | boolean | optional |
| updated_on | string | optional |
The newly created snippet object.
If the request was not authenticated
If the authenticated user does not have permission to create snippets in the specified workspace.
POST /snippets/{workspace}
/snippets/{workspace}/{encoded_id}/comments
Creates a new comment.
The only required field in the body is content.raw.
To create a threaded reply to an existing comment, include parent.id.
| Name | In | Required | Type | Description |
|---|---|---|---|---|
| encoded_id | path | required | string | The snippet id. |
| workspace | path | required | string | This can either be the workspace ID (slug) or the workspace UUID |
The contents of the new comment.
application/json
snippet_comment
| Property | Type | Required |
|---|---|---|
| type | string | required |
| links | object | optional |
| └ html | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| └ self | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| snippet | object | optional |
| └ type | string | required |
| └ id | integer | optional |
| └ scm | string | optional |
| └ owner | object | optional |
| └ type | string | required |
| └ uuid | string | optional |
| └ links | object | optional |
| └ avatar | object | optional |
| └ username | string | optional |
| └ created_on | string | optional |
| └ display_name | string | optional |
| └ title | string | optional |
| └ creator | object | optional |
| └ type | string | required |
| └ uuid | string | optional |
| └ links | object | optional |
| └ avatar | object | optional |
| └ username | string | optional |
| └ created_on | string | optional |
| └ display_name | string | optional |
| └ created_on | string | optional |
| └ is_private | boolean | optional |
| └ updated_on | string | optional |
The newly created comment.
If the authenticated user does not have access to the snippet.
If the snippet does not exist.
POST /snippets/{workspace}/{encoded_id}/comments
/repositories/{workspace}/{repo_slug}/src
This endpoint is used to create new commits in the repository by
uploading files.
To add a new file to a repository:
$ curl https://api.bitbucket.org/2.0/repositories/username/slug/src \
-F /repo/path/to/image.png=@image.png
This will create a new commit on top of the main branch, inheriting the
contents of the main branch, but adding (or overwriting) the
image.png file to the repository in the /repo/path/to directory.
To create a commit that deletes files, use the files parameter:
$ curl https://api.bitbucket.org/2.0/repositories/username/slug/src \
-F files=/file/to/delete/1.txt \
-F files=/file/to/delete/2.txt
You can add/modify/delete multiple files in a request. Rename/move a
file by deleting the old path and adding the content at the new path.
This endpoint accepts multipart/form-data (as in the examples above),
as well as application/x-www-form-urlencoded.
Note: multipart/form-data is currently not supported by Forge apps
for this API.
A multipart/form-data post contains a series of “form fields” that
identify both the individual files that are being uploaded, as well as
additional, optional meta data.
Files are uploaded in file form fields (those that have a
Content-Disposition parameter) whose field names point to the remote
path in the repository where the file should be stored. Path field
names are always interpreted to be absolute from the root of the
repository, regardless whether the client uses a leading slash (as the
above curl example did).
File contents are treated as bytes and are not decoded as text.
The commit message, as well as other non-file meta data for the
request, is sent along as normal form field elements. Meta data fields
share the same namespace as the file objects. For multipart/form-data
bodies that should not lead to any ambiguity, as the
Content-Disposition header will contain the filename parameter to
distinguish between a file named “message” and the commit message field.
It is also possible to upload new files using a simple
application/x-www-form-urlencoded POST. This can be convenient when
uploading pure text files:
$ curl https://api.bitbucket.org/2.0/repositories/atlassian/bbql/src \
--data-urlencode "/path/to/me.txt=Lorem ipsum." \
--data-urlencode "message=Initial commit" \
--data-urlencode "author=Erik van Zijst <erik.van.zijst@gmail.com>"
There could be a field name clash if a client were to upload a file
named “message”, as this filename clashes with the meta data property
for the commit message. To avoid this and to upload files whose names
clash with the meta data properties, use a leading slash for the files,
e.g. curl --data-urlencode "/message=file contents".
When an explicit slash is omitted for a file whose path matches that of
a meta data parameter, then it is interpreted as meta data, not as a
file.
While this API aims to facilitate the most common use cases, it is
possible to perform some more advanced operations like creating a new
symlink in the repository, or creating an executable file.
Files can be supplied with a x-attributes value in the
Content-Disposition header. For example, to upload an executable
file, as well as create a symlink from README.txt to README:
--===============1438169132528273974==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-ID: "bin/shutdown.sh"
Content-Disposition: attachment; filename="shutdown.sh"; x-attributes:"executable"
#!/bin/sh
halt
--===============1438169132528273974==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-ID: "/README.txt"
Content-Disposition: attachment; filename="README.txt"; x-attributes:"link"
README
--===============1438169132528273974==--
Links are files that contain the target path and have
x-attributes:"link" set.
When overwriting links with files, or vice versa, the newly uploaded
file determines both the new contents, as well as the attributes. That
means uploading a file without specifying x-attributes="link" will
create a regular file, even if the parent commit hosted a symlink at
the same path.
The same applies to executables. When modifying an existing executable
file, the form-data file element must include
x-attributes="executable" in order to preserve the executable status
of the file.
Note that this API does not support the creation or manipulation of
subrepos / submodules.
| Name | In | Required | Type | Description |
|---|---|---|---|---|
| repo_slug | path | required | string | This can either be the repository slug or the UUID of the repository, |
| workspace | path | required | string | This can either be the workspace ID (slug) or the workspace UUID |
| message | query | optional | string | The commit message. When omitted, Bitbucket uses a canned string. |
| author | query | optional | string |
The raw string to be used as the new commit’s author. When omitted, Bitbucket uses the authenticated user’s |
| parents | query | optional | string |
A comma-separated list of SHA1s of the commits that should When omitted, the new commit will inherit from and become When more than one SHA1 is provided, the first SHA1 |
| files | query | optional | string |
Optional field that declares the files that the request is Paths in the repo that are referenced in neither files nor This API does not support renaming as an explicit feature. |
| branch | query | optional | string |
The name of the branch that the new commit should be When a branch name is provided that already exists in the When a new branch name is specified (that does not already When a branch name is not specified, but a parent SHA1 is When a branch name is not specified and the repo is empty, When a branch name is specified and the repo is empty, the This API cannot be used to create additional root commits The branch field cannot be repeated. As a side effect, this API can be used to create a new |
If the authenticated user does not have write or admin access
If the repository does not exist.
POST /repositories/{workspace}/{repo_slug}/src
/users/{selected_user}/ssh-keys
Adds a new SSH public key to the specified user account and returns the resulting key.
Example:
$ curl -X POST -H "Content-Type: application/json" -d '{"key": "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKqP3Cr632C2dNhhgKVcon4ldUSAeKiku2yP9O9/bDtY user@myhost"}' https://api.bitbucket.org/2.0/users/{ed08f5e1-605b-4f4a-aee4-6c97628a673e}/ssh-keys
| Name | In | Required | Type | Description |
|---|---|---|---|---|
| selected_user | path | required | string | This can either be an Atlassian Account ID OR the UUID of the account, |
The new SSH key object. Note that the username property has been deprecated due to privacy changes.
application/json
ssh_account_key
| Property | Type | Required |
|---|---|---|
| type | string | required |
| key | string | optional |
| uuid | string | optional |
| label | string | optional |
| links | object | optional |
| └ self | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| comment | string | optional |
| last_used | string | optional |
| created_on | string | optional |
| owner | object | optional |
| └ type | string | required |
| └ uuid | string | optional |
| └ links | object | optional |
| └ avatar | object | optional |
| └ href | string | optional |
| └ name | string | optional |
| └ username | string | optional |
| └ created_on | string | optional |
| └ display_name | string | optional |
The newly created SSH key.
If the submitted key or related value is invalid
If the current user does not have permission to add a key for the specified user
If the specified user does not exist
POST /users/{selected_user}/ssh-keys
/workspaces/{workspace}/hooks
Creates a new webhook on the specified workspace.
Workspace webhooks are fired for events from all repositories contained
by that workspace.
Example:
$ curl -X POST -u credentials -H 'Content-Type: application/json'
https://api.bitbucket.org/2.0/workspaces/my-workspace/hooks
-d '
{
"description": "Webhook Description",
"url": "https://example.com/",
"active": true,
"secret": "this is a really bad secret",
"events": [
"repo:push",
"issue:created",
"issue:updated"
]
}'
When the secret is provided it will be used as the key to generate a HMAC
digest value sent in the X-Hub-Signature header at delivery time. Passing
a null or empty secret or not passing a secret will leave the webhook’s
secret unset. Bitbucket only generates the X-Hub-Signature when the webhook’s
secret is set.
This call requires the webhook scope, as well as any scope
that applies to the events that the webhook subscribes to. In the
example above that means: webhook, repository and issue.
The url must properly resolve and cannot be an internal, non-routed address.
Only workspace owners can install webhooks on workspaces.
| Name | In | Required | Type | Description |
|---|---|---|---|---|
| workspace | path | required | string | This can either be the workspace ID (slug) or the workspace UUID |
If the webhook was registered successfully.
If the authenticated user does not have permission to install webhooks on the specified workspace.
If the specified workspace does not exist.
POST /workspaces/{workspace}/hooks
A_pull_request_task
{
"allOf": [
{
"$ref": "#/components/schemas/task"
},
{
"type": "object",
"title": "Pull Request Task",
"properties": {
"links": {
"type": "object",
"properties": {
"html": {
"type": "object",
"title": "Link",
"properties": {
"href": {
"type": "string",
"format": "uri"
},
"name": {
"type": "string"
}
},
"description": "A link to a resource related to this object."
},
"self": {
"type": "object",
"title": "Link",
"properties": {
"href": {
"type": "string",
"format": "uri"
},
"name": {
"type": "string"
}
},
"description": "A link to a resource related to this object."
}
}
}
},
"description": "A pull request task."
}
]
}
A_pullrequest_comment_task
{
"allOf": [
{
"$ref": "#/components/schemas/A_pull_request_task"
},
{
"type": "object",
"title": "Pull Request Comment Task",
"properties": {
"comment": {
"$ref": "#/components/schemas/comment"
}
},
"description": "A pullrequest comment task"
}
]
}
A_pullrequest_task_create
{
"type": "object",
"title": "Pull Request Task Create",
"required": [
"content"
],
"properties": {
"comment": {
"$ref": "#/components/schemas/comment"
},
"content": {
"type": "object",
"title": "Task Raw Content",
"required": [
"raw"
],
"properties": {
"raw": {
"type": "string",
"description": "The task contents"
}
},
"description": "task raw content"
},
"pending": {
"type": "boolean"
}
},
"description": "A pullrequest task create"
}
A_pullrequest_task_update
{
"type": "object",
"title": "Pull Request Task Update",
"properties": {
"state": {
"enum": [
"RESOLVED",
"UNRESOLVED"
],
"type": "string"
},
"content": {
"type": "object",
"title": "Task Raw Content",
"required": [
"raw"
],
"properties": {
"raw": {
"type": "string",
"description": "The task contents"
}
},
"description": "task raw content"
}
},
"description": "A pullrequest task update"
}
ReportsBulkCreateOrUpdateAnnotationsRequest
{
"type": "array",
"items": {
"$ref": "#/components/schemas/report_annotation"
},
"maxItems": 100,
"minItems": 1
}
ReportsBulkCreateOrUpdateAnnotationsResponse
{
"type": "array",
"items": {
"$ref": "#/components/schemas/report_annotation"
}
}
account
{
"allOf": [
{
"$ref": "#/components/schemas/object"
},
{
"type": "object",
"title": "Account",
"properties": {
"uuid": {
"type": "string"
},
"links": {
"$ref": "#/components/schemas/account_links"
},
"username": {
"type": "string",
"pattern": "^[a-zA-Z0-9_\\-]+$"
},
"created_on": {
"type": "string",
"format": "date-time"
},
"display_name": {
"type": "string"
}
},
"description": "An account object.",
"additionalProperties": true
}
]
}
account_links
{
"type": "object",
"title": "Account Links",
"properties": {
"avatar": {
"$ref": "#/components/schemas/link"
}
},
"description": "Links related to an Account.",
"additionalProperties": true
}
app_user
{
"allOf": [
{
"$ref": "#/components/schemas/account"
},
{
"type": "object",
"title": "App User",
"properties": {
"kind": {
"type": "string",
"description": "The kind of App User."
},
"account_id": {
"type": "string",
"description": "The user's Atlassian account ID."
},
"account_status": {
"type": "string",
"description": "The status of the account. Currently the only possible value is \"active\", but more values may be added in the future."
}
},
"description": "An app user object.",
"additionalProperties": true
}
]
}
application_property
{
"type": "object",
"title": "Application Property",
"properties": {
"_attributes": {
"type": "array",
"items": {
"enum": [
"public",
"read_only"
],
"type": "string"
}
}
},
"description": "An application property. It is a caller defined JSON object that Bitbucket will store and return. \nThe `_attributes` field at its top level can be used to control who is allowed to read and update the property. \nThe keys of the JSON object must match an allowed pattern. For details, \nsee [Application properties](https://dac-static.atlassian.com).\n",
"additionalProperties": true
}
author
{
"allOf": [
{
"$ref": "#/components/schemas/object"
},
{
"type": "object",
"title": "Author",
"properties": {
"raw": {
"type": "string",
"description": "The raw author value from the repository. This may be the only value available if the author does not match a user in Bitbucket."
},
"user": {
"$ref": "#/components/schemas/account"
}
},
"description": "The author of a change in a repository",
"additionalProperties": true
}
]
}
base_commit
{
"allOf": [
{
"$ref": "#/components/schemas/object"
},
{
"type": "object",
"title": "Base Commit",
"properties": {
"date": {
"type": "string",
"format": "date-time"
},
"hash": {
"type": "string",
"pattern": "[0-9a-f]{7,}?"
},
"author": {
"$ref": "#/components/schemas/author"
},
"message": {
"type": "string"
},
"parents": {
"type": "array",
"items": {
"$ref": "#/components/schemas/base_commit"
},
"minItems": 0
},
"summary": {
"type": "object",
"properties": {
"raw": {
"type": "string",
"description": "The text as it was typed by a user."
},
"html": {
"type": "string",
"description": "The user's content rendered as HTML."
},
"markup": {
"enum": [
"markdown",
"creole",
"plaintext"
],
"type": "string",
"description": "The type of markup language the raw content is to be interpreted in."
}
}
}
},
"description": "The common base type for both repository and snippet commits.",
"additionalProperties": true
}
]
}
bitbucket.apps.permissions.serializers.ProjectPermissionUpdateSchema
{
"type": "object",
"required": [
"permission"
],
"properties": {
"permission": {
"enum": [
"read",
"write",
"create-repo",
"admin"
],
"type": "string"
}
}
}
bitbucket.apps.permissions.serializers.RepoPermissionUpdateSchema
{
"type": "object",
"required": [
"permission"
],
"properties": {
"permission": {
"enum": [
"read",
"write",
"admin"
],
"type": "string"
}
}
}
branch
{
"allOf": [
{
"$ref": "#/components/schemas/ref"
},
{
"type": "object",
"title": "Branch",
"properties": {
"merge_strategies": {
"type": "array",
"items": {
"enum": [
"merge_commit",
"squash",
"fast_forward"
],
"type": "string"
},
"description": "Available merge strategies for pull requests targeting this branch."
},
"default_merge_strategy": {
"type": "string",
"description": "The default merge strategy for pull requests targeting this branch."
}
},
"description": "A branch object, representing a branch in a repository.",
"additionalProperties": true
}
]
}
branching_model
{
"allOf": [
{
"$ref": "#/components/schemas/object"
},
{
"type": "object",
"title": "Branching Model",
"properties": {
"production": {
"type": "object",
"required": [
"name",
"use_mainbranch"
],
"properties": {
"name": {
"type": "string",
"description": "Name of the target branch. Will be listed here even when the target branch does not exist. Will be `null` if targeting the main branch and the repository is empty."
},
"branch": {
"$ref": "#/components/schemas/branch"
},
"use_mainbranch": {
"type": "boolean",
"description": "Indicates if the setting points at an explicit branch (`false`) or tracks the main branch (`true`)."
}
}
},
"development": {
"type": "object",
"required": [
"name",
"use_mainbranch"
],
"properties": {
"name": {
"type": "string",
"description": "Name of the target branch. Will be listed here even when the target branch does not exist. Will be `null` if targeting the main branch and the repository is empty."
},
"branch": {
"$ref": "#/components/schemas/branch"
},
"use_mainbranch": {
"type": "boolean",
"description": "Indicates if the setting points at an explicit branch (`false`) or tracks the main branch (`true`)."
}
}
},
"branch_types": {
"type": "array",
"items": {
"type": "object",
"required": [
"kind",
"prefix"
],
"properties": {
"kind": {
"enum": [
"feature",
"bugfix",
"release",
"hotfix"
],
"type": "string",
"description": "The kind of branch."
},
"prefix": {
"type": "string",
"description": "The prefix for this branch type. A branch with this prefix will be classified as per `kind`. The prefix must be a valid prefix for a branch and must always exist. It cannot be blank, empty or `null`."
}
}
},
"maxItems": 4,
"minItems": 0,
"description": "The active branch types.",
"uniqueItems": true
}
},
"description": "A repository's branching model",
"additionalProperties": true
}
]
}
branching_model_settings
{
"allOf": [
{
"$ref": "#/components/schemas/object"
},
{
"type": "object",
"title": "Branching Model Settings",
"properties": {
"links": {
"type": "object",
"properties": {
"self": {
"type": "object",
"title": "Link",
"properties": {
"href": {
"type": "string",
"format": "uri"
},
"name": {
"type": "string"
}
},
"description": "A link to a resource related to this object."
}
}
},
"production": {
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "The configured branch. It must be `null` when `use_mainbranch` is `true`. Otherwise it must be a non-empty value. It is possible for the configured branch to not exist (e.g. it was deleted after the settings are set). In this case `is_valid` will be `false`. The branch must exist when updating/setting the `name` or an error will occur."
},
"enabled": {
"type": "boolean",
"description": "Indicates if branch is enabled or not."
},
"is_valid": {
"type": "boolean",
"description": "Indicates if the configured branch is valid, that is, if the configured branch actually exists currently. Is always `true` when `use_mainbranch` is `true` (even if the main branch does not exist). This field is read-only. This field is ignored when updating/creating settings."
},
"use_mainbranch": {
"type": "boolean",
"description": "Indicates if the setting points at an explicit branch (`false`) or tracks the main branch (`true`). When `true` the `name` must be `null` or not provided. When `false` the `name` must contain a non-empty branch name."
}
}
},
"development": {
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "The configured branch. It must be `null` when `use_mainbranch` is `true`. Otherwise it must be a non-empty value. It is possible for the configured branch to not exist (e.g. it was deleted after the settings are set). In this case `is_valid` will be `false`. The branch must exist when updating/setting the `name` or an error will occur."
},
"is_valid": {
"type": "boolean",
"description": "Indicates if the configured branch is valid, that is, if the configured branch actually exists currently. Is always `true` when `use_mainbranch` is `true` (even if the main branch does not exist). This field is read-only. This field is ignored when updating/creating settings."
},
"use_mainbranch": {
"type": "boolean",
"description": "Indicates if the setting points at an explicit branch (`false`) or tracks the main branch (`true`). When `true` the `name` must be `null` or not provided. When `false` the `name` must contain a non-empty branch name."
}
}
},
"branch_types": {
"type": "array",
"items": {
"type": "object",
"required": [
"kind"
],
"properties": {
"kind": {
"enum": [
"feature",
"bugfix",
"release",
"hotfix"
],
"type": "string",
"description": "The kind of the branch type."
},
"prefix": {
"type": "string",
"description": "The prefix for this branch type. A branch with this prefix will be classified as per `kind`. The `prefix` of an enabled branch type must be a valid branch prefix.Additionally, it cannot be blank, empty or `null`. The `prefix` for a disabled branch type can be empty or invalid."
},
"enabled": {
"type": "boolean",
"description": "Whether the branch type is enabled or not. A disabled branch type may contain an invalid `prefix`."
}
}
},
"maxItems": 4,
"minItems": 0,
"uniqueItems": true
}
},
"description": "A repository's branching model settings",
"additionalProperties": true
}
]
}
branchrestriction
{
"allOf": [
{
"$ref": "#/components/schemas/object"
},
{
"type": "object",
"title": "Branch Restriction",
"properties": {
"users": {
"type": "array",
"items": {
"$ref": "#/components/schemas/account"
},
"minItems": 0
},
"groups": {
"type": "array",
"items": {
"$ref": "#/components/schemas/group"
},
"minItems": 0
}
},
"description": "A branch restriction rule.",
"additionalProperties": true
}
]
}
comment
{
"allOf": [
{
"$ref": "#/components/schemas/object"
},
{
"type": "object",
"title": "Comment",
"properties": {
"id": {
"type": "integer"
},
"user": {
"$ref": "#/components/schemas/account"
},
"links": {
"type": "object",
"properties": {
"code": {
"type": "object",
"title": "Link",
"properties": {
"href": {
"type": "string",
"format": "uri"
},
"name": {
"type": "string"
}
},
"description": "A link to a resource related to this object."
},
"html": {
"type": "object",
"title": "Link",
"properties": {
"href": {
"type": "string",
"format": "uri"
},
"name": {
"type": "string"
}
},
"description": "A link to a resource related to this object."
},
"self": {
"type": "object",
"title": "Link",
"properties": {
"href": {
"type": "string",
"format": "uri"
},
"name": {
"type": "string"
}
},
"description": "A link to a resource related to this object."
}
}
},
"inline": {
"type": "object",
"required": [
"path"
],
"properties": {
"to": {
"type": "integer",
"minimum": 1,
"description": "The comment's anchor line in the new version of the file. If the 'from' line is also provided, this value will be removed."
},
"from": {
"type": "integer",
"minimum": 1,
"description": "The comment's anchor line in the old version of the file."
},
"path": {
"type": "string",
"description": "The path of the file this comment is anchored to."
}
}
},
"parent": {
"$ref": "#/components/schemas/comment"
},
"content": {
"type": "object",
"properties": {
"raw": {
"type": "string",
"description": "The text as it was typed by a user."
},
"html": {
"type": "string",
"description": "The user's content rendered as HTML."
},
"markup": {
"enum": [
"markdown",
"creole",
"plaintext"
],
"type": "string",
"description": "The type of markup language the raw content is to be interpreted in."
}
}
},
"deleted": {
"type": "boolean"
},
"created_on": {
"type": "string",
"format": "date-time"
},
"updated_on": {
"type": "string",
"format": "date-time"
}
},
"description": "The base type for all comments. This type should be considered abstract. Each of the \"commentable\" resources defines its own subtypes (e.g. `issue_comment`).",
"additionalProperties": true
}
]
}
comment_resolution
{
"type": "object",
"title": "Comment Resolution",
"required": [
"type"
],
"properties": {
"type": {
"type": "string"
},
"user": {
"$ref": "#/components/schemas/account"
},
"created_on": {
"type": "string",
"format": "date-time",
"description": "The ISO8601 timestamp the resolution was created."
}
},
"description": "The resolution object for a Comment.",
"additionalProperties": true
}
commit
{
"allOf": [
{
"$ref": "#/components/schemas/base_commit"
},
{
"type": "object",
"title": "Commit",
"properties": {
"repository": {
"$ref": "#/components/schemas/repository"
},
"participants": {
"type": "array",
"items": {
"$ref": "#/components/schemas/participant"
},
"minItems": 0
}
},
"description": "A repository commit object.",
"additionalProperties": true
}
]
}
commit_comment
{
"allOf": [
{
"$ref": "#/components/schemas/comment"
},
{
"type": "object",
"title": "Commit Comment",
"properties": {
"commit": {
"$ref": "#/components/schemas/commit"
}
},
"description": "A commit comment.",
"additionalProperties": true
}
]
}
commit_file
{
"type": "object",
"title": "Commit File",
"required": [
"type"
],
"properties": {
"path": {
"type": "string",
"description": "The path in the repository"
},
"type": {
"type": "string"
},
"commit": {
"$ref": "#/components/schemas/commit"
},
"attributes": {
"enum": [
"link",
"executable",
"subrepository",
"binary",
"lfs"
],
"type": "string"
},
"escaped_path": {
"type": "string",
"description": "The escaped version of the path as it appears in a diff. If the path does not require escaping this will be the same as path."
}
},
"description": "A file object, representing a file at a commit in a repository",
"additionalProperties": true
}
commitstatus
{
"allOf": [
{
"$ref": "#/components/schemas/object"
},
{
"type": "object",
"title": "Commit Status",
"properties": {
"key": {
"type": "string",
"description": "An identifier for the status that's unique to\n its type (current \"build\" is the only supported type) and the vendor,\n e.g. BB-DEPLOY"
},
"url": {
"type": "string",
"description": "A URL linking back to the vendor or build system, for providing more information about whatever process produced this status. Accepts context variables `repository` and `commit` that Bitbucket will evaluate at runtime whenever at runtime. For example, one could use https://foo.com/builds/{repository.full_name} which Bitbucket will turn into https://foo.com/builds/foo/bar at render time."
},
"name": {
"type": "string",
"description": "An identifier for the build itself, e.g. BB-DEPLOY-1"
},
"uuid": {
"type": "string",
"description": "The commit status' id."
},
"links": {
"type": "object",
"properties": {
"self": {
"type": "object",
"title": "Link",
"properties": {
"href": {
"type": "string",
"format": "uri"
},
"name": {
"type": "string"
}
},
"description": "A link to a resource related to this object."
},
"commit": {
"type": "object",
"title": "Link",
"properties": {
"href": {
"type": "string",
"format": "uri"
},
"name": {
"type": "string"
}
},
"description": "A link to a resource related to this object."
}
}
},
"state": {
"enum": [
"FAILED",
"INPROGRESS",
"STOPPED",
"SUCCESSFUL"
],
"type": "string",
"description": "Provides some indication of the status of this commit"
},
"refname": {
"type": "string",
"description": "\nThe name of the ref that pointed to this commit at the time the status\nobject was created. Note that this the ref may since have moved off of\nthe commit. This optional field can be useful for build systems whose\nbuild triggers and configuration are branch-dependent (e.g. a Pipeline\nbuild).\nIt is legitimate for this field to not be set, or even apply (e.g. a\nstatic linting job)."
},
"created_on": {
"type": "string",
"format": "date-time"
},
"updated_on": {
"type": "string",
"format": "date-time"
},
"description": {
"type": "string",
"description": "A description of the build (e.g. \"Unit tests in Bamboo\")"
}
},
"description": "A commit status object.",
"additionalProperties": true
}
]
}
component
{
"allOf": [
{
"$ref": "#/components/schemas/object"
},
{
"type": "object",
"title": "Component",
"properties": {
"id": {
"type": "integer"
},
"name": {
"type": "string"
},
"links": {
"type": "object",
"properties": {
"self": {
"type": "object",
"title": "Link",
"properties": {
"href": {
"type": "string",
"format": "uri"
},
"name": {
"type": "string"
}
},
"description": "A link to a resource related to this object."
}
}
}
},
"description": "A component as defined in a repository's issue tracker.",
"additionalProperties": true
}
]
}
ddev_report
{
"allOf": [
{
"$ref": "#/components/schemas/object"
},
{
"type": "object",
"description": "A report for a commit.",
"additionalProperties": true
}
],
"x-bb-url": "/rest/2.0/accounts/{target_user.uuid}/repositories/{repository.uuid}/commits/{commitHash}/reports/{uuid}",
"x-bb-default-fields": [
"uuid",
"commitHash"
]
}
default_reviewer_and_type
{
"type": "object",
"title": "Default Reviewer and Type",
"required": [
"type"
],
"properties": {
"type": {
"type": "string"
},
"user": {
"$ref": "#/components/schemas/user"
},
"reviewer_type": {
"type": "string"
}
},
"description": "Object containing a user that is a default reviewer and the type of reviewer",
"additionalProperties": true
}
deploy_key
{
"allOf": [
{
"$ref": "#/components/schemas/object"
},
{
"type": "object",
"title": "Deploy Key",
"properties": {
"key": {
"type": "string",
"description": "The deploy key value."
},
"label": {
"type": "string",
"description": "The user-defined label for the deploy key"
},
"links": {
"type": "object",
"properties": {
"self": {
"type": "object",
"title": "Link",
"properties": {
"href": {
"type": "string",
"format": "uri"
},
"name": {
"type": "string"
}
},
"description": "A link to a resource related to this object."
}
}
},
"owner": {
"$ref": "#/components/schemas/account"
},
"comment": {
"type": "string",
"description": "The comment parsed from the deploy key (if present)"
},
"added_on": {
"type": "string",
"format": "date-time"
},
"last_used": {
"type": "string",
"format": "date-time"
},
"repository": {
"$ref": "#/components/schemas/repository"
}
},
"description": "Represents deploy key for a repository.",
"additionalProperties": true
}
]
}
deployment
{
"allOf": [
{
"$ref": "#/components/schemas/object"
},
{
"type": "object",
"title": "Deployment",
"properties": {
"uuid": {
"type": "string",
"description": "The UUID identifying the deployment."
},
"state": {
"$ref": "#/components/schemas/deployment_state"
},
"release": {
"$ref": "#/components/schemas/deployment_release"
},
"environment": {
"$ref": "#/components/schemas/deployment_environment"
}
},
"description": "A Bitbucket Deployment.",
"additionalProperties": true
}
]
}
deployment_environment
{
"allOf": [
{
"$ref": "#/components/schemas/object"
},
{
"type": "object",
"title": "Deployment Environment",
"properties": {
"name": {
"type": "string",
"description": "The name of the environment."
},
"uuid": {
"type": "string",
"description": "The UUID identifying the environment."
}
},
"description": "A Bitbucket Deployment Environment.",
"additionalProperties": true
}
],
"x-bb-url": "/rest/2.0/accounts/{target_user.uuid}/repositories/{repository.uuid}/environments/{uuid}",
"x-bb-batch-url": "/rest/2.0/accounts/{target_user.uuid}/repositories/{repository.uuid}/environments_batch",
"x-bb-batch-max-size": 100,
"x-bb-default-fields": [
"uuid"
]
}
deployment_environment_lock
{
"allOf": [
{
"$ref": "#/components/schemas/object"
},
{
"type": "object",
"title": "Deployment Environment Lock",
"properties": {
"environmentUuid": {
"type": "string",
"description": "The UUID identifying the environment."
}
},
"description": "A Bitbucket Deployment Environment Lock.",
"additionalProperties": true
}
],
"x-bb-batch-url": "/rest/2.0/accounts/{target_user.uuid}/repositories/{repository.uuid}/environments/locks_batch",
"x-bb-batch-max-size": 100,
"x-bb-default-fields": [
"*",
"lock_opener.*",
"owner.*"
]
}
deployment_release
{
"allOf": [
{
"$ref": "#/components/schemas/object"
},
{
"type": "object",
"title": "Deployment Release",
"properties": {
"url": {
"type": "string",
"format": "uri",
"description": "Link to the pipeline that produced the release."
},
"name": {
"type": "string",
"description": "The name of the release."
},
"uuid": {
"type": "string",
"description": "The UUID identifying the release."
},
"commit": {
"$ref": "#/components/schemas/commit"
},
"created_on": {
"type": "string",
"format": "date-time",
"description": "The timestamp when the release was created."
}
},
"description": "A Bitbucket Deployment Release.",
"additionalProperties": true
}
]
}
deployment_state
{
"allOf": [
{
"$ref": "#/components/schemas/object"
},
{
"type": "object",
"title": "Deployment State",
"properties": {},
"description": "The representation of the progress state of a deployment.",
"additionalProperties": true
}
]
}
deployment_state_completed
{
"allOf": [
{
"$ref": "#/components/schemas/deployment_state"
},
{
"type": "object",
"properties": {
"url": {
"type": "string",
"format": "uri",
"description": "Link to the deployment result."
},
"name": {
"enum": [
"COMPLETED"
],
"type": "string",
"description": "The name of deployment state (COMPLETED)."
},
"status": {
"$ref": "#/components/schemas/deployment_state_completed_status"
},
"deployer": {
"$ref": "#/components/schemas/account"
},
"start_date": {
"type": "string",
"format": "date-time",
"description": "The timestamp when the deployment was started."
},
"completion_date": {
"type": "string",
"format": "date-time",
"description": "The timestamp when the deployment completed."
}
},
"description": "A Bitbucket Deployment COMPLETED deployment state.",
"additionalProperties": true
}
]
}
deployment_state_completed_status
{
"allOf": [
{
"$ref": "#/components/schemas/object"
},
{
"type": "object",
"title": "Completed Deployment",
"properties": {},
"description": "The status of a completed deployment.",
"additionalProperties": true
}
]
}
deployment_state_completed_status_failed
{
"allOf": [
{
"$ref": "#/components/schemas/deployment_state_completed_status"
},
{
"type": "object",
"properties": {
"name": {
"enum": [
"FAILED"
],
"type": "string",
"description": "The name of the completed deployment status (FAILED)."
}
},
"description": "A FAILED completed deployment status.",
"additionalProperties": true
}
]
}
deployment_state_completed_status_stopped
{
"allOf": [
{
"$ref": "#/components/schemas/deployment_state_completed_status"
},
{
"type": "object",
"properties": {
"name": {
"enum": [
"STOPPED"
],
"type": "string",
"description": "The name of the completed deployment status (STOPPED)."
}
},
"description": "A STOPPED completed deployment status.",
"additionalProperties": true
}
]
}
deployment_state_completed_status_successful
{
"allOf": [
{
"$ref": "#/components/schemas/deployment_state_completed_status"
},
{
"type": "object",
"properties": {
"name": {
"enum": [
"SUCCESSFUL"
],
"type": "string",
"description": "The name of the completed deployment status (SUCCESSFUL)."
}
},
"description": "A SUCCESSFUL completed deployment status.",
"additionalProperties": true
}
]
}
deployment_state_in_progress
{
"allOf": [
{
"$ref": "#/components/schemas/deployment_state"
},
{
"type": "object",
"properties": {
"url": {
"type": "string",
"format": "uri",
"description": "Link to the deployment result."
},
"name": {
"enum": [
"IN_PROGRESS"
],
"type": "string",
"description": "The name of deployment state (IN_PROGRESS)."
},
"deployer": {
"$ref": "#/components/schemas/account"
},
"start_date": {
"type": "string",
"format": "date-time",
"description": "The timestamp when the deployment was started."
}
},
"description": "A Bitbucket Deployment IN_PROGRESS deployment state.",
"additionalProperties": true
}
]
}
deployment_state_undeployed
{
"allOf": [
{
"$ref": "#/components/schemas/deployment_state"
},
{
"type": "object",
"properties": {
"name": {
"enum": [
"UNDEPLOYED"
],
"type": "string",
"description": "The name of deployment state (UNDEPLOYED)."
},
"trigger_url": {
"type": "string",
"format": "uri",
"description": "Link to trigger the deployment."
}
},
"description": "A Bitbucket Deployment UNDEPLOYED deployment state.",
"additionalProperties": true
}
]
}
deployment_variable
{
"allOf": [
{
"$ref": "#/components/schemas/object"
},
{
"type": "object",
"title": "Deployment Variable",
"properties": {
"key": {
"type": "string",
"description": "The unique name of the variable."
},
"uuid": {
"type": "string",
"description": "The UUID identifying the variable."
},
"value": {
"type": "string",
"description": "The value of the variable. If the variable is secured, this will be empty."
},
"secured": {
"type": "boolean",
"description": "If true, this variable will be treated as secured. The value will never be exposed in the logs or the REST API."
}
},
"description": "A Pipelines deployment variable.",
"additionalProperties": true
}
]
}
deployments_ddev_deployment_environment
{
"allOf": [
{
"$ref": "#/components/schemas/object"
},
{
"type": "object",
"title": "Deployment Environment",
"properties": {
"name": {
"type": "string",
"description": "The name of the environment."
},
"uuid": {
"type": "string",
"description": "The UUID identifying the environment."
}
},
"description": "A Bitbucket Deployment Environment.",
"additionalProperties": true
}
],
"x-bb-url": "/rest/2.0/accounts/{target_user.uuid}/repositories/{repository.uuid}/environments/{uuid}",
"x-bb-batch-url": "/rest/2.0/accounts/{target_user.uuid}/repositories/{repository.uuid}/environments_batch",
"x-bb-batch-max-size": 100,
"x-bb-default-fields": [
"uuid"
]
}
deployments_ddev_deployment_environment_lock
{
"allOf": [
{
"$ref": "#/components/schemas/object"
},
{
"type": "object",
"title": "Deployment Environment Lock",
"properties": {
"environmentUuid": {
"type": "string",
"description": "The UUID identifying the environment."
}
},
"description": "A Bitbucket Deployment Environment Lock.",
"additionalProperties": true
}
],
"x-bb-batch-url": "/rest/2.0/accounts/{target_user.uuid}/repositories/{repository.uuid}/environments/locks_batch",
"x-bb-batch-max-size": 100,
"x-bb-default-fields": [
"*",
"lock_opener.*",
"owner.*"
]
}
deployments_ddev_paginated_environments
{
"type": "object",
"title": "Paginated Deployment Environments",
"properties": {
"next": {
"type": "string",
"format": "uri",
"description": "Link to the next page if it exists. The last page of a collection does not have this value. Use this link to navigate the result set and refrain from constructing your own URLs."
},
"page": {
"type": "integer",
"description": "Page number of the current results. This is an optional element that is not provided in all responses."
},
"size": {
"type": "integer",
"description": "Total number of objects in the response. This is an optional element that is not provided in all responses, as it can be expensive to compute."
},
"values": {
"type": "array",
"items": {
"$ref": "#/components/schemas/deployments_ddev_deployment_environment"
},
"minItems": 0,
"description": "The values of the current page."
},
"pagelen": {
"type": "integer",
"description": "Current number of objects on the existing page. The default value is 10 with 100 being the maximum allowed value. Individual APIs may enforce different values."
},
"previous": {
"type": "string",
"format": "uri",
"description": "Link to previous page if it exists. A collections first page does not have this value. This is an optional element that is not provided in all responses. Some result sets strictly support forward navigation and never provide previous links. Clients must anticipate that backwards navigation is not always available. Use this link to navigate the result set and refrain from constructing your own URLs."
}
},
"description": "A paged list of environments"
}
deployments_stg_west_deployment_environment
{
"allOf": [
{
"$ref": "#/components/schemas/object"
},
{
"type": "object",
"title": "Deployment Environment",
"properties": {
"name": {
"type": "string",
"description": "The name of the environment."
},
"uuid": {
"type": "string",
"description": "The UUID identifying the environment."
}
},
"description": "A Bitbucket Deployment Environment.",
"additionalProperties": true
}
],
"x-bb-url": "/rest/2.0/accounts/{target_user.uuid}/repositories/{repository.uuid}/environments/{uuid}",
"x-bb-batch-url": "/rest/2.0/accounts/{target_user.uuid}/repositories/{repository.uuid}/environments_batch",
"x-bb-batch-max-size": 100,
"x-bb-default-fields": [
"uuid"
]
}
deployments_stg_west_deployment_environment_lock
{
"allOf": [
{
"$ref": "#/components/schemas/object"
},
{
"type": "object",
"title": "Deployment Environment Lock",
"properties": {
"environmentUuid": {
"type": "string",
"description": "The UUID identifying the environment."
}
},
"description": "A Bitbucket Deployment Environment Lock.",
"additionalProperties": true
}
],
"x-bb-batch-url": "/rest/2.0/accounts/{target_user.uuid}/repositories/{repository.uuid}/environments/locks_batch",
"x-bb-batch-max-size": 100,
"x-bb-default-fields": [
"*",
"lock_opener.*",
"owner.*"
]
}
deployments_stg_west_paginated_environments
{
"type": "object",
"title": "Paginated Deployment Environments",
"properties": {
"next": {
"type": "string",
"format": "uri",
"description": "Link to the next page if it exists. The last page of a collection does not have this value. Use this link to navigate the result set and refrain from constructing your own URLs."
},
"page": {
"type": "integer",
"description": "Page number of the current results. This is an optional element that is not provided in all responses."
},
"size": {
"type": "integer",
"description": "Total number of objects in the response. This is an optional element that is not provided in all responses, as it can be expensive to compute."
},
"values": {
"type": "array",
"items": {
"$ref": "#/components/schemas/deployments_stg_west_deployment_environment"
},
"minItems": 0,
"description": "The values of the current page."
},
"pagelen": {
"type": "integer",
"description": "Current number of objects on the existing page. The default value is 10 with 100 being the maximum allowed value. Individual APIs may enforce different values."
},
"previous": {
"type": "string",
"format": "uri",
"description": "Link to previous page if it exists. A collections first page does not have this value. This is an optional element that is not provided in all responses. Some result sets strictly support forward navigation and never provide previous links. Clients must anticipate that backwards navigation is not always available. Use this link to navigate the result set and refrain from constructing your own URLs."
}
},
"description": "A paged list of environments"
}
diffstat
{
"type": "object",
"title": "Diff Stat",
"required": [
"type"
],
"properties": {
"new": {
"$ref": "#/components/schemas/commit_file"
},
"old": {
"$ref": "#/components/schemas/commit_file"
},
"type": {
"type": "string"
},
"status": {
"enum": [
"added",
"removed",
"modified",
"renamed"
],
"type": "string"
},
"lines_added": {
"type": "integer"
},
"lines_removed": {
"type": "integer"
}
},
"description": "A diffstat object that includes a summary of changes made to a file between two commits.",
"additionalProperties": true
}
effective_repo_branching_model
{
"allOf": [
{
"$ref": "#/components/schemas/object"
},
{
"type": "object",
"title": "Effective Repository Branching Model",
"properties": {
"production": {
"type": "object",
"required": [
"name",
"use_mainbranch"
],
"properties": {
"name": {
"type": "string",
"description": "Name of the target branch. Will be listed here even when the target branch does not exist. Will be `null` if targeting the main branch and the repository is empty."
},
"branch": {
"$ref": "#/components/schemas/branch"
},
"use_mainbranch": {
"type": "boolean",
"description": "Indicates if the setting points at an explicit branch (`false`) or tracks the main branch (`true`)."
}
}
},
"development": {
"type": "object",
"required": [
"name",
"use_mainbranch"
],
"properties": {
"name": {
"type": "string",
"description": "Name of the target branch. Will be listed here even when the target branch does not exist. Will be `null` if targeting the main branch and the repository is empty."
},
"branch": {
"$ref": "#/components/schemas/branch"
},
"use_mainbranch": {
"type": "boolean",
"description": "Indicates if the setting points at an explicit branch (`false`) or tracks the main branch (`true`)."
}
}
},
"branch_types": {
"type": "array",
"items": {
"type": "object",
"required": [
"kind",
"prefix"
],
"properties": {
"kind": {
"enum": [
"feature",
"bugfix",
"release",
"hotfix"
],
"type": "string",
"description": "The kind of branch."
},
"prefix": {
"type": "string",
"description": "The prefix for this branch type. A branch with this prefix will be classified as per `kind`. The prefix must be a valid prefix for a branch and must always exist. It cannot be blank, empty or `null`."
}
}
},
"maxItems": 4,
"minItems": 0,
"description": "The active branch types.",
"uniqueItems": true
}
},
"description": "A repository's effective branching model",
"additionalProperties": true
}
]
}
error
{
"type": "object",
"title": "Error",
"required": [
"type"
],
"properties": {
"type": {
"type": "string"
},
"error": {
"type": "object",
"required": [
"message"
],
"properties": {
"data": {
"type": "object",
"properties": {},
"description": "Optional structured data that is endpoint-specific.",
"additionalProperties": true
},
"detail": {
"type": "string"
},
"message": {
"type": "string"
}
}
}
},
"description": "Base type for most resource objects. It defines the common `type` element that identifies an object's type. It also identifies the element as Swagger's `discriminator`.",
"additionalProperties": true
}
| Version | Endpoints | Schemas | Ingested | Status |
|---|---|---|---|---|
| 2.0 | 318 | 216 | 2026-05-11 | current |
| 2.0 | 318 | 216 | 2026-04-16 |