Projects 9 endpoints

PUT /workspaces/{workspace}/projects/{project_key}/default-reviewers/{selected_user}

Adds the specified user to the project’s list of default reviewers. The method is
idempotent. Accepts an optional body containing the uuid of the user to be added.

operationId: Projects_addDefaultReviewer

Parameters

Name In Required Type Description
project_key path required string

The project in question. This can either be the actual key assigned
to the project or the UUID (surrounded by curly-braces ({})).

selected_user path required string

This can either be the username or the UUID of the default reviewer,
surrounded by curly-braces, for example: {account UUID}.

workspace path required string

This can either be the workspace ID (slug) or the workspace UUID
surrounded by curly-braces, for example: {workspace UUID}.

Responses

200

The specified user was added as a project default reviewer

400

If the specified user cannot be added as a default reviewer for the project

403

If the authenticated user does not have admin access to the project

404

If the specified user, project, or workspace does not exist

PUT /workspaces/{workspace}/projects/{project_key}/default-reviewers/{selected_user}
GET /workspaces/{workspace}/projects/{project_key}/permissions-config/groups

Returns a paginated list of explicit group permissions for the given project.
This endpoint does not support BBQL features.

operationId: Projects_listGroupPermissions

Parameters

Name In Required Type Description
project_key path required string

The project in question. This is the actual key assigned to the project.

workspace path required string

This can either be the workspace ID (slug) or the workspace UUID
surrounded by curly-braces, for example: {workspace UUID}.

Responses

200

Paginated list of project group permissions

401

The user couldn’t be authenticated.

403

The user doesn’t have admin access to the project.

404

One or both of the workspace and project don’t exist for the given identifiers or the requesting user is not authenticated

GET /workspaces/{workspace}/projects/{project_key}/permissions-config/groups
DELETE /workspaces/{workspace}/projects/{project_key}/permissions-config/groups/{group_slug}

Deletes the project group permission between the requested project and group, if one exists.

Only users with admin permission for the project may access this resource.

operationId: Projects_deleteExplicitGroupPermission

Parameters

Name In Required Type Description
group_slug path required string

Slug of the requested group.

project_key path required string

The project in question. This is the actual key assigned to the project.

workspace path required string

This can either be the workspace ID (slug) or the workspace UUID
surrounded by curly-braces, for example: {workspace UUID}.

Responses

204

The project group permission was deleted and no content returned.

401

The user couldn’t be authenticated.

403

The requesting user isn’t an admin of the project, or the authentication method was not via app password.

404

One or more of the workspace, project, and group doesn’t exist for the given identifiers or the requesting user is not authenticated

DELETE /workspaces/{workspace}/projects/{project_key}/permissions-config/groups/{group_slug}
GET /workspaces/{workspace}/projects/{project_key}/permissions-config/groups/{group_slug}

Returns the group permission for a given group and project.

Only users with admin permission for the project may access this resource.

Permissions can be:

  • admin
  • create-repo
  • write
  • read
  • none
operationId: Projects_getGroupPermission

Parameters

Name In Required Type Description
group_slug path required string

Slug of the requested group.

project_key path required string

The project in question. This is the actual key assigned to the project.

workspace path required string

This can either be the workspace ID (slug) or the workspace UUID
surrounded by curly-braces, for example: {workspace UUID}.

Responses

200

Project group permission

401

The user couldn’t be authenticated.

403

The user doesn’t have admin access to the project.

404

One or more of the workspace, project, and group doesn’t exist for the given identifiers or the requesting user is not authenticated

GET /workspaces/{workspace}/projects/{project_key}/permissions-config/groups/{group_slug}
PUT /workspaces/{workspace}/projects/{project_key}/permissions-config/groups/{group_slug}

Updates the group permission, or grants a new permission if one does not already exist.

Only users with admin permission for the project may access this resource.

Due to security concerns, the JWT and OAuth authentication methods are unsupported.
This is to ensure integrations and add-ons are not allowed to change permissions.

Permissions can be:

  • admin
  • create-repo
  • write
  • read
operationId: Projects_updateGroupPermission

Parameters

Name In Required Type Description
group_slug path required string

Slug of the requested group.

project_key path required string

The project in question. This is the actual key assigned to the project.

workspace path required string

This can either be the workspace ID (slug) or the workspace UUID
surrounded by curly-braces, for example: {workspace UUID}.

Request Body

The permission to grant

application/json
schema bitbucket.apps.permissions.serializers.ProjectPermissionUpdateSchema
Property Type Required
permission string required

Responses

200

Project group permission updated.

400

No permission value was provided or the value is invalid(not one of read, write, create-repo, or admin).

401

The user couldn’t be authenticated.

402

You have reached your plan’s user limit and must upgrade before giving access to additional users.

403

The requesting user isn’t an admin of the project, or the authentication method was not via app password.

404

One or more of the workspace, project, and group doesn’t exist for the given identifiers or the requesting user is not authenticated

PUT /workspaces/{workspace}/projects/{project_key}/permissions-config/groups/{group_slug}
GET /workspaces/{workspace}/projects/{project_key}/permissions-config/users

Returns a paginated list of explicit user permissions for the given project.
This endpoint does not support BBQL features.

operationId: Projects_listUserPermissions

Parameters

Name In Required Type Description
project_key path required string

The project in question. This is the actual key assigned to the project.

workspace path required string

This can either be the workspace ID (slug) or the workspace UUID
surrounded by curly-braces, for example: {workspace UUID}.

Responses

200

Paginated list of explicit user permissions.

401

The user couldn’t be authenticated.

403

The user doesn’t have admin access to the project.

404

One or both of the workspace and project don’t exist for the given identifiers or the requesting user is not authenticated

GET /workspaces/{workspace}/projects/{project_key}/permissions-config/users
DELETE /workspaces/{workspace}/projects/{project_key}/permissions-config/users/{selected_user_id}

Deletes the project user permission between the requested project and user, if one exists.

Only users with admin permission for the project may access this resource.

Due to security concerns, the JWT and OAuth authentication methods are unsupported.
This is to ensure integrations and add-ons are not allowed to change permissions.

operationId: Projects_deleteExplicitUserPermission

Parameters

Name In Required Type Description
project_key path required string

The project in question. This is the actual key assigned to the project.

selected_user_id path required string

This can either be the username, the user’s UUID surrounded by curly-braces,
for example: {account UUID}, or the user’s Atlassian ID.

workspace path required string

This can either be the workspace ID (slug) or the workspace UUID
surrounded by curly-braces, for example: {workspace UUID}.

Responses

204

The project user permission was deleted and no content returned.

401

The user couldn’t be authenticated.

403

The requesting user isn’t an admin of the project, or the authentication method was not via app password.

404

One or more of the workspace, project, and selected user doesn’t exist for the given identifiers or the requesting user is not authenticated

DELETE /workspaces/{workspace}/projects/{project_key}/permissions-config/users/{selected_user_id}
GET /workspaces/{workspace}/projects/{project_key}/permissions-config/users/{selected_user_id}

Returns the explicit user permission for a given user and project.

Only users with admin permission for the project may access this resource.

Permissions can be:

  • admin
  • create-repo
  • write
  • read
  • none
operationId: Projects_getUserPermission

Parameters

Name In Required Type Description
project_key path required string

The project in question. This is the actual key assigned to the project.

selected_user_id path required string

This can either be the username, the user’s UUID surrounded by curly-braces,
for example: {account UUID}, or the user’s Atlassian ID.

workspace path required string

This can either be the workspace ID (slug) or the workspace UUID
surrounded by curly-braces, for example: {workspace UUID}.

Responses

200

Explicit user permission for user and project

401

The user couldn’t be authenticated.

403

The requesting user isn’t an admin of the project.

404

One or more of the workspace, project, and selected user doesn’t exist for the given identifiers or the requesting user is not authenticated

GET /workspaces/{workspace}/projects/{project_key}/permissions-config/users/{selected_user_id}
PUT /workspaces/{workspace}/projects/{project_key}/permissions-config/users/{selected_user_id}

Updates the explicit user permission for a given user and project. The selected
user must be a member of the workspace, and cannot be the workspace owner.

Only users with admin permission for the project may access this resource.

Due to security concerns, the JWT and OAuth authentication methods are unsupported.
This is to ensure integrations and add-ons are not allowed to change permissions.

Permissions can be:

  • admin
  • create-repo
  • write
  • read
operationId: Projects_updateUserPermission

Parameters

Name In Required Type Description
project_key path required string

The project in question. This is the actual key assigned to the project.

selected_user_id path required string

This can either be the username, the user’s UUID surrounded by curly-braces,
for example: {account UUID}, or the user’s Atlassian ID.

workspace path required string

This can either be the workspace ID (slug) or the workspace UUID
surrounded by curly-braces, for example: {workspace UUID}.

Request Body

The permission to grant

application/json
schema bitbucket.apps.permissions.serializers.ProjectPermissionUpdateSchema
Property Type Required
permission string required

Responses

200

Explicit user permission updated

400

No permission value was provided or the value is invalid (not one of read, write, create-repo, or admin)

401

The user couldn’t be authenticated.

402

You have reached your plan’s user limit and must upgrade before giving access to additional users.

403

The requesting user isn’t an admin of the project, or the authentication method was not via app password.

404

One or more of the workspace, project, and selected user doesn’t exist for the given identifiers or the requesting user is not authenticated

PUT /workspaces/{workspace}/projects/{project_key}/permissions-config/users/{selected_user_id}

Properties 12 endpoints

DELETE /repositories/{workspace}/{repo_slug}/commit/{commit}/properties/{app_key}/{property_name}

Delete an application property value stored against a commit.

operationId: Properties_deleteCommitApplicationProperty

Parameters

Name In Required Type Description
workspace path required string

The repository container; either the workspace slug or the UUID in curly braces.

repo_slug path required string

The repository.

commit path required string

The commit.

app_key path required string

The key of the Connect app.

property_name path required string

The name of the property.

Responses

204

An empty response.

DELETE /repositories/{workspace}/{repo_slug}/commit/{commit}/properties/{app_key}/{property_name}
GET /repositories/{workspace}/{repo_slug}/commit/{commit}/properties/{app_key}/{property_name}

Retrieve an application property value stored against a commit.

operationId: Properties_getValue

Parameters

Name In Required Type Description
workspace path required string

The repository container; either the workspace slug or the UUID in curly braces.

repo_slug path required string

The repository.

commit path required string

The commit.

app_key path required string

The key of the Connect app.

property_name path required string

The name of the property.

Responses

200

The value of the property.

GET /repositories/{workspace}/{repo_slug}/commit/{commit}/properties/{app_key}/{property_name}
PUT /repositories/{workspace}/{repo_slug}/commit/{commit}/properties/{app_key}/{property_name}

Update an application property value stored against a commit.

operationId: Properties_updateCommitApplicationProperty

Parameters

Name In Required Type Description
workspace path required string

The repository container; either the workspace slug or the UUID in curly braces.

repo_slug path required string

The repository.

commit path required string

The commit.

app_key path required string

The key of the Connect app.

property_name path required string

The name of the property.

Request Body

The application property to create or update.

application/json
schema application_property
Property Type Required
_attributes array optional

Responses

204

An empty response.

PUT /repositories/{workspace}/{repo_slug}/commit/{commit}/properties/{app_key}/{property_name}
DELETE /repositories/{workspace}/{repo_slug}/properties/{app_key}/{property_name}

Delete an application property value stored against a repository.

operationId: Properties_deleteRepositoryApplicationProperty

Parameters

Name In Required Type Description
workspace path required string

The repository container; either the workspace slug or the UUID in curly braces.

repo_slug path required string

The repository.

app_key path required string

The key of the Connect app.

property_name path required string

The name of the property.

Responses

204

An empty response.

DELETE /repositories/{workspace}/{repo_slug}/properties/{app_key}/{property_name}
GET /repositories/{workspace}/{repo_slug}/properties/{app_key}/{property_name}

Retrieve an application property value stored against a repository.

operationId: Properties_getApplicationValue

Parameters

Name In Required Type Description
workspace path required string

The repository container; either the workspace slug or the UUID in curly braces.

repo_slug path required string

The repository.

app_key path required string

The key of the Connect app.

property_name path required string

The name of the property.

Responses

200

The value of the property.

GET /repositories/{workspace}/{repo_slug}/properties/{app_key}/{property_name}
PUT /repositories/{workspace}/{repo_slug}/properties/{app_key}/{property_name}

Update an application property value stored against a repository.

operationId: Properties_updateApplicationProperty

Parameters

Name In Required Type Description
workspace path required string

The repository container; either the workspace slug or the UUID in curly braces.

repo_slug path required string

The repository.

app_key path required string

The key of the Connect app.

property_name path required string

The name of the property.

Request Body

The application property to create or update.

application/json
schema application_property
Property Type Required
_attributes array optional

Responses

204

An empty response.

PUT /repositories/{workspace}/{repo_slug}/properties/{app_key}/{property_name}
DELETE /repositories/{workspace}/{repo_slug}/pullrequests/{pullrequest_id}/properties/{app_key}/{property_name}

Delete an application property value stored against a pull request.

operationId: Properties_deletePullRequestApplicationProperty

Parameters

Name In Required Type Description
workspace path required string

The repository container; either the workspace slug or the UUID in curly braces.

repo_slug path required string

The repository.

pullrequest_id path required string

The pull request ID.

app_key path required string

The key of the Connect app.

property_name path required string

The name of the property.

Responses

204

An empty response.

DELETE /repositories/{workspace}/{repo_slug}/pullrequests/{pullrequest_id}/properties/{app_key}/{property_name}
GET /repositories/{workspace}/{repo_slug}/pullrequests/{pullrequest_id}/properties/{app_key}/{property_name}

Retrieve an application property value stored against a pull request.

operationId: Properties_getPullRequestApplicationProperty

Parameters

Name In Required Type Description
workspace path required string

The repository container; either the workspace slug or the UUID in curly braces.

repo_slug path required string

The repository.

pullrequest_id path required string

The pull request ID.

app_key path required string

The key of the Connect app.

property_name path required string

The name of the property.

Responses

200

The value of the property.

GET /repositories/{workspace}/{repo_slug}/pullrequests/{pullrequest_id}/properties/{app_key}/{property_name}
PUT /repositories/{workspace}/{repo_slug}/pullrequests/{pullrequest_id}/properties/{app_key}/{property_name}

Update an application property value stored against a pull request.

operationId: Properties_updatePullRequestApplicationProperty

Parameters

Name In Required Type Description
workspace path required string

The repository container; either the workspace slug or the UUID in curly braces.

repo_slug path required string

The repository.

pullrequest_id path required string

The pull request ID.

app_key path required string

The key of the Connect app.

property_name path required string

The name of the property.

Request Body

The application property to create or update.

application/json
schema application_property
Property Type Required
_attributes array optional

Responses

204

An empty response.

PUT /repositories/{workspace}/{repo_slug}/pullrequests/{pullrequest_id}/properties/{app_key}/{property_name}
DELETE /users/{selected_user}/properties/{app_key}/{property_name}

Delete an application property value stored against a user.

operationId: Properties_deleteUserAppPropertyValue

Parameters

Name In Required Type Description
selected_user path required string

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

app_key path required string

The key of the Connect app.

property_name path required string

The name of the property.

Responses

204

An empty response.

DELETE /users/{selected_user}/properties/{app_key}/{property_name}
GET /users/{selected_user}/properties/{app_key}/{property_name}

Retrieve an application property value stored against a user.

operationId: Properties_getUserAppPropertyValue

Parameters

Name In Required Type Description
selected_user path required string

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

app_key path required string

The key of the Connect app.

property_name path required string

The name of the property.

Responses

200

The value of the property.

GET /users/{selected_user}/properties/{app_key}/{property_name}
PUT /users/{selected_user}/properties/{app_key}/{property_name}

Update an application property value stored against a user.

operationId: Properties_updateUserAppPropertyValue

Parameters

Name In Required Type Description
selected_user path required string

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

app_key path required string

The key of the Connect app.

property_name path required string

The name of the property.

Request Body

The application property to create or update.

application/json
schema application_property
Property Type Required
_attributes array optional

Responses

204

An empty response.

PUT /users/{selected_user}/properties/{app_key}/{property_name}

Pullrequests 29 endpoints

GET /pullrequests/{selected_user}

Returns all pull requests authored by the specified user.

By default only open pull requests are returned. This can be controlled
using the state query parameter. To retrieve pull requests that are
in one of multiple states, repeat the state parameter for each
individual state.

This endpoint also supports filtering and sorting of the results. See
filtering and sorting for more details.

operationId: Pullrequests_listForUser

Parameters

Name In Required Type Description
selected_user path required string

This can either be the username of the pull request author, the author’s UUID
surrounded by curly-braces, for example: {account UUID}, or the author’s Atlassian ID.

state query optional string

Only return pull requests that are in this state. This parameter can be repeated.

Responses

200

All pull requests authored by the specified user.

404

If the specified user does not exist.

GET /pullrequests/{selected_user}
GET /repositories/{workspace}/{repo_slug}/commit/{commit}/pullrequests

Returns a paginated list of all pull requests as part of which this commit was reviewed. Pull Request Commit Links app must be installed first before using this API; installation automatically occurs when ‘Go to pull request’ is clicked from the web interface for a commit’s details.

operationId: Pullrequests_listContainingCommit

Parameters

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

repo_slug path required string

The repository; either the UUID in curly braces, or the slug

commit path required string

The SHA1 of the commit

page query optional integer

Which page to retrieve

pagelen query optional integer

How many pull requests to retrieve per page

Responses

200

The paginated list of pull requests.

202

The repository’s pull requests are still being indexed.

404

Either the repository does not exist, or pull request commit links have not yet been indexed.

GET /repositories/{workspace}/{repo_slug}/commit/{commit}/pullrequests
GET /repositories/{workspace}/{repo_slug}/default-reviewers

Returns the repository’s default reviewers.

These are the users that are automatically added as reviewers on every
new pull request that is created. To obtain the repository’s default reviewers
as well as the default reviewers inherited from the project, use the
effective-default-reveiwers endpoint.

operationId: Pullrequests_listDefaultReviewers

Parameters

Name In Required Type Description
repo_slug path required string

This can either be the repository slug or the UUID of the repository,
surrounded by curly-braces, for example: {repository UUID}.

workspace path required string

This can either be the workspace ID (slug) or the workspace UUID
surrounded by curly-braces, for example: {workspace UUID}.

Responses

200

The paginated list of default reviewers

403

If the authenticated user does not have access to view the default reviewers

GET /repositories/{workspace}/{repo_slug}/default-reviewers
DELETE /repositories/{workspace}/{repo_slug}/default-reviewers/{target_username}

Removes a default reviewer from the repository.

operationId: Pullrequests_removeDefaultReviewer

Parameters

Name In Required Type Description
repo_slug path required string

This can either be the repository slug or the UUID of the repository,
surrounded by curly-braces, for example: {repository UUID}.

target_username path required string

This can either be the username or the UUID of the default reviewer,
surrounded by curly-braces, for example: {account UUID}.

workspace path required string

This can either be the workspace ID (slug) or the workspace UUID
surrounded by curly-braces, for example: {workspace UUID}.

Responses

204

The specified user successfully removed from the default reviewers

403

If the authenticated user does not have access modify the default reviewers

404

If the specified user does not exist

DELETE /repositories/{workspace}/{repo_slug}/default-reviewers/{target_username}
GET /repositories/{workspace}/{repo_slug}/default-reviewers/{target_username}

Returns the specified reviewer.

This can be used to test whether a user is among the repository’s
default reviewers list. A 404 indicates that that specified user is not
a default reviewer.

operationId: Pullrequests_getDefaultReviewer

Parameters

Name In Required Type Description
repo_slug path required string

This can either be the repository slug or the UUID of the repository,
surrounded by curly-braces, for example: {repository UUID}.

target_username path required string

This can either be the username or the UUID of the default reviewer,
surrounded by curly-braces, for example: {account UUID}.

workspace path required string

This can either be the workspace ID (slug) or the workspace UUID
surrounded by curly-braces, for example: {workspace UUID}.

Responses

200

The specified user is a default reviewer

403

If the authenticated user does not have access to check if the specified user is a default reviewer

404

If the specified user does not exist or is not a default reviewer

GET /repositories/{workspace}/{repo_slug}/default-reviewers/{target_username}
PUT /repositories/{workspace}/{repo_slug}/default-reviewers/{target_username}

Adds the specified user to the repository’s list of default
reviewers.

This method is idempotent. Adding a user a second time has no effect.

operationId: Pullrequests_addUserToDefaultReviewers

Parameters

Name In Required Type Description
repo_slug path required string

This can either be the repository slug or the UUID of the repository,
surrounded by curly-braces, for example: {repository UUID}.

target_username path required string

This can either be the username or the UUID of the default reviewer,
surrounded by curly-braces, for example: {account UUID}.

workspace path required string

This can either be the workspace ID (slug) or the workspace UUID
surrounded by curly-braces, for example: {workspace UUID}.

Responses

200

The specified user was successfully added to the default reviewers

400

If the authenticated user tried to add a team, bot user, or user without access to the repository to the default reviewers

403

If the authenticated user does not have permission to modify the default reviewers

404

If the specified user does not exist

PUT /repositories/{workspace}/{repo_slug}/default-reviewers/{target_username}
GET /repositories/{workspace}/{repo_slug}/effective-default-reviewers

Returns the repository’s effective default reviewers. This includes both default
reviewers defined at the repository level as well as those inherited from its project.

These are the users that are automatically added as reviewers on every
new pull request that is created.

operationId: Pullrequests_listEffectiveDefaultReviewers

Parameters

Name In Required Type Description
repo_slug path required string

This can either be the repository slug or the UUID of the repository,
surrounded by curly-braces, for example: {repository UUID}.

workspace path required string

This can either be the workspace ID (slug) or the workspace UUID
surrounded by curly-braces, for example: {workspace UUID}.

Responses

200

The paginated list of effective default reviewers

403

If the authenticated user does not have access to view the default reviewers

GET /repositories/{workspace}/{repo_slug}/effective-default-reviewers
GET /repositories/{workspace}/{repo_slug}/pullrequests

Returns all pull requests on the specified repository.

By default only open pull requests are returned. This can be controlled
using the state query parameter. To retrieve pull requests that are
in one of multiple states, repeat the state parameter for each
individual state.

This endpoint also supports filtering and sorting of the results. See
filtering and sorting for more details.

operationId: Pullrequests_list

Parameters

Name In Required Type Description
repo_slug path required string

This can either be the repository slug or the UUID of the repository,
surrounded by curly-braces, for example: {repository UUID}.

workspace path required string

This can either be the workspace ID (slug) or the workspace UUID
surrounded by curly-braces, for example: {workspace UUID}.

state query optional string

Only return pull requests that are in this state. This parameter can be repeated.

Responses

200

All pull requests on the specified repository.

401

If the repository is private and the request was not authenticated.

404

If the specified repository does not exist.

GET /repositories/{workspace}/{repo_slug}/pullrequests
POST /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 string
  • close_source_branch - boolean that specifies if the source branch should be closed upon merging
operationId: Pullrequests_create

Parameters

Name In Required Type Description
repo_slug path required string

This can either be the repository slug or the UUID of the repository,
surrounded by curly-braces, for example: {repository UUID}.

workspace path required string

This can either be the workspace ID (slug) or the workspace UUID
surrounded by curly-braces, for example: {workspace UUID}.

Request Body

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
schema 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

Responses

201

The newly created pull request.

400

If the input document was invalid, or if the caller lacks the privilege to create repositories under the targeted account.

401

If the request was not authenticated.

POST /repositories/{workspace}/{repo_slug}/pullrequests
GET /repositories/{workspace}/{repo_slug}/pullrequests/activity

Returns a paginated list of the pull request’s activity log.

This handler serves both a v20 and internal endpoint. The v20 endpoint
returns reviewer comments, updates, approvals and request changes. The internal
endpoint includes those plus tasks and attachments.

Comments created on a file or a line of code have an inline property.

Comment example:

{
    "pagelen": 20,
    "values": [
        {
            "comment": {
                "links": {
                    "self": {
                        "href": "https://api.bitbucket.org/2.0/repositories/atlassian/atlaskit-mk-2/pullrequests/5695/comments/118571088"
                    },
                    "html": {
                        "href": "https://bitbucket.org/atlassian/atlaskit-mk-2/pull-requests/5695/_/diff#comment-118571088"
                    }
                },
                "deleted": false,
                "pullrequest": {
                    "type": "pullrequest",
                    "id": 5695,
                    "links": {
                        "self": {
                            "href": "https://api.bitbucket.org/2.0/repositories/atlassian/atlaskit-mk-2/pullrequests/5695"
                        },
                        "html": {
                            "href": "https://bitbucket.org/atlassian/atlaskit-mk-2/pull-requests/5695"
                        }
                    },
                    "title": "username/NONE: small change from onFocus to onClick to handle tabbing through the page and not expand the editor unless a click event triggers it"
                },
                "content": {
                    "raw": "inline with to a dn from lines",
                    "markup": "markdown",
                    "html": "<p>inline with to a dn from lines</p>",
                    "type": "rendered"
                },
                "created_on": "2019-09-27T00:33:46.039178+00:00",
                "user": {
                    "display_name": "Name Lastname",
                    "uuid": "{}",
                    "links": {
                        "self": {
                            "href": "https://api.bitbucket.org/2.0/users/%7B%7D"
                        },
                        "html": {
                            "href": "https://bitbucket.org/%7B%7D/"
                        },
                        "avatar": {
                            "href": "https://avatar-management--avatars.us-west-2.prod.public.atl-paas.net/:/128"
                        }
                    },
                    "type": "user",
                    "nickname": "Name",
                    "account_id": ""
                },
                "created_on": "2019-09-27T00:33:46.039178+00:00",
                "user": {
                    "display_name": "Name Lastname",
                    "uuid": "{}",
                    "links": {
                        "self": {
                            "href": "https://api.bitbucket.org/2.0/users/%7B%7D"
                        },
                        "html": {
                            "href": "https://bitbucket.org/%7B%7D/"
                        },
                        "avatar": {
                            "href": "https://avatar-management--avatars.us-west-2.prod.public.atl-paas.net/:/128"
                        }
                    },
                    "type": "user",
                    "nickname": "Name",
                    "account_id": ""
                },
                "updated_on": "2019-09-27T00:33:46.055384+00:00",
                "inline": {
                    "context_lines": "",
                    "to": null,
                    "path": "",
                    "outdated": false,
                    "from": 211
                },
                "type": "pullrequest_comment",
                "id": 118571088
            },
            "pull_request": {
                "type": "pullrequest",
                "id": 5695,
                "links": {
                    "self": {
                        "href": "https://api.bitbucket.org/2.0/repositories/atlassian/atlaskit-mk-2/pullrequests/5695"
                    },
                    "html": {
                        "href": "https://bitbucket.org/atlassian/atlaskit-mk-2/pull-requests/5695"
                    }
                },
                "title": "username/NONE: small change from onFocus to onClick to handle tabbing through the page and not expand the editor unless a click event triggers it"
            }
        }
    ]
}

Updates include a state property of OPEN, MERGED, or DECLINED.

Update example:

{
    "pagelen": 20,
    "values": [
        {
            "update": {
                "description": "",
                "title": "username/NONE: small change from onFocus to onClick to handle tabbing through the page and not expand the editor unless a click event triggers it",
                "destination": {
                    "commit": {
                        "type": "commit",
                        "hash": "6a2c16e4a152",
                        "links": {
                            "self": {
                                "href": "https://api.bitbucket.org/2.0/repositories/atlassian/atlaskit-mk-2/commit/6a2c16e4a152"
                            },
                            "html": {
                                "href": "https://bitbucket.org/atlassian/atlaskit-mk-2/commits/6a2c16e4a152"
                            }
                        }
                    },
                    "branch": {
                        "name": "master"
                    },
                    "repository": {
                        "name": "Atlaskit-MK-2",
                        "type": "repository",
                        "full_name": "atlassian/atlaskit-mk-2",
                        "links": {
                            "self": {
                                "href": "https://api.bitbucket.org/2.0/repositories/atlassian/atlaskit-mk-2"
                            },
                            "html": {
                                "href": "https://bitbucket.org/atlassian/atlaskit-mk-2"
                            },
                            "avatar": {
                                "href": "https://bytebucket.org/ravatar/%7B%7D?ts=js"
                            }
                        },
                        "uuid": "{}"
                    }
                },
                "reason": "",
                "source": {
                    "commit": {
                        "type": "commit",
                        "hash": "728c8bad1813",
                        "links": {
                            "self": {
                                "href": "https://api.bitbucket.org/2.0/repositories/atlassian/atlaskit-mk-2/commit/728c8bad1813"
                            },
                            "html": {
                                "href": "https://bitbucket.org/atlassian/atlaskit-mk-2/commits/728c8bad1813"
                            }
                        }
                    },
                    "branch": {
                        "name": "username/NONE-add-onClick-prop-for-accessibility"
                    },
                    "repository": {
                        "name": "Atlaskit-MK-2",
                        "type": "repository",
                        "full_name": "atlassian/atlaskit-mk-2",
                        "links": {
                            "self": {
                                "href": "https://api.bitbucket.org/2.0/repositories/atlassian/atlaskit-mk-2"
                            },
                            "html": {
                                "href": "https://bitbucket.org/atlassian/atlaskit-mk-2"
                            },
                            "avatar": {
                                "href": "https://bytebucket.org/ravatar/%7B%7D?ts=js"
                            }
                        },
                        "uuid": "{}"
                    }
                },
                "state": "OPEN",
                "author": {
                    "display_name": "Name Lastname",
                    "uuid": "{}",
                    "links": {
                        "self": {
                            "href": "https://api.bitbucket.org/2.0/users/%7B%7D"
                        },
                        "html": {
                            "href": "https://bitbucket.org/%7B%7D/"
                        },
                        "avatar": {
                            "href": "https://avatar-management--avatars.us-west-2.prod.public.atl-paas.net/:/128"
                        }
                    },
                    "type": "user",
                    "nickname": "Name",
                    "account_id": ""
                },
                "date": "2019-05-10T06:48:25.305565+00:00"
            },
            "pull_request": {
                "type": "pullrequest",
                "id": 5695,
                "links": {
                    "self": {
                        "href": "https://api.bitbucket.org/2.0/repositories/atlassian/atlaskit-mk-2/pullrequests/5695"
                    },
                    "html": {
                        "href": "https://bitbucket.org/atlassian/atlaskit-mk-2/pull-requests/5695"
                    }
                },
                "title": "username/NONE: small change from onFocus to onClick to handle tabbing through the page and not expand the editor unless a click event triggers it"
            }
        }
    ]
}

Approval example:

{
    "pagelen": 20,
    "values": [
        {
            "approval": {
                "date": "2019-09-27T00:37:19.849534+00:00",
                "pullrequest": {
                    "type": "pullrequest",
                    "id": 5695,
                    "links": {
                        "self": {
                            "href": "https://api.bitbucket.org/2.0/repositories/atlassian/atlaskit-mk-2/pullrequests/5695"
                        },
                        "html": {
                            "href": "https://bitbucket.org/atlassian/atlaskit-mk-2/pull-requests/5695"
                        }
                    },
                    "title": "username/NONE: small change from onFocus to onClick to handle tabbing through the page and not expand the editor unless a click event triggers it"
                },
                "user": {
                    "display_name": "Name Lastname",
                    "uuid": "{}",
                    "links": {
                        "self": {
                            "href": "https://api.bitbucket.org/2.0/users/%7B%7D"
                        },
                        "html": {
                            "href": "https://bitbucket.org/%7B%7D/"
                        },
                        "avatar": {
                            "href": "https://avatar-management--avatars.us-west-2.prod.public.atl-paas.net/:/128"
                        }
                    },
                    "type": "user",
                    "nickname": "Name",
                    "account_id": ""
                }
            },
            "pull_request": {
                "type": "pullrequest",
                "id": 5695,
                "links": {
                    "self": {
                        "href": "https://api.bitbucket.org/2.0/repositories/atlassian/atlaskit-mk-2/pullrequests/5695"
                    },
                    "html": {
                        "href": "https://bitbucket.org/atlassian/atlaskit-mk-2/pull-requests/5695"
                    }
                },
                "title": "username/NONE: small change from onFocus to onClick to handle tabbing through the page and not expand the editor unless a click event triggers it"
            }
        }
    ]
}
operationId: Pullrequests_listActivityLog

Parameters

Name In Required Type Description
repo_slug path required string

This can either be the repository slug or the UUID of the repository,
surrounded by curly-braces, for example: {repository UUID}.

workspace path required string

This can either be the workspace ID (slug) or the workspace UUID
surrounded by curly-braces, for example: {workspace UUID}.

Responses

200

The pull request activity log

401

If the repository is private and the request was not authenticated.

404

If the specified repository does not exist.

GET /repositories/{workspace}/{repo_slug}/pullrequests/activity
GET /repositories/{workspace}/{repo_slug}/pullrequests/{pull_request_id}

Returns the specified pull request.

operationId: Pullrequests_getPullRequest

Parameters

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,
surrounded by curly-braces, for example: {repository UUID}.

workspace path required string

This can either be the workspace ID (slug) or the workspace UUID
surrounded by curly-braces, for example: {workspace UUID}.

Responses

200

The pull request object

401

If the repository is private and the request was not authenticated.

404

If the repository or pull request does not exist

GET /repositories/{workspace}/{repo_slug}/pullrequests/{pull_request_id}
PUT /repositories/{workspace}/{repo_slug}/pullrequests/{pull_request_id}

Mutates the specified pull request.

This can be used to change the pull request’s branches or description.

Only open pull requests can be mutated.

operationId: Pullrequests_updatePullRequest

Parameters

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,
surrounded by curly-braces, for example: {repository UUID}.

workspace path required string

This can either be the workspace ID (slug) or the workspace UUID
surrounded by curly-braces, for example: {workspace UUID}.

Request Body

The pull request that is to be updated.

application/json
schema 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

Responses

200

The updated pull request

400

If the input document was invalid.

401

If the request was not authenticated.

404

If the repository or pull request id does not exist

PUT /repositories/{workspace}/{repo_slug}/pullrequests/{pull_request_id}
GET /repositories/{workspace}/{repo_slug}/pullrequests/{pull_request_id}/activity

Returns a paginated list of the pull request’s activity log.

This handler serves both a v20 and internal endpoint. The v20 endpoint
returns reviewer comments, updates, approvals and request changes. The internal
endpoint includes those plus tasks and attachments.

Comments created on a file or a line of code have an inline property.

Comment example:

{
    "pagelen": 20,
    "values": [
        {
            "comment": {
                "links": {
                    "self": {
                        "href": "https://api.bitbucket.org/2.0/repositories/atlassian/atlaskit-mk-2/pullrequests/5695/comments/118571088"
                    },
                    "html": {
                        "href": "https://bitbucket.org/atlassian/atlaskit-mk-2/pull-requests/5695/_/diff#comment-118571088"
                    }
                },
                "deleted": false,
                "pullrequest": {
                    "type": "pullrequest",
                    "id": 5695,
                    "links": {
                        "self": {
                            "href": "https://api.bitbucket.org/2.0/repositories/atlassian/atlaskit-mk-2/pullrequests/5695"
                        },
                        "html": {
                            "href": "https://bitbucket.org/atlassian/atlaskit-mk-2/pull-requests/5695"
                        }
                    },
                    "title": "username/NONE: small change from onFocus to onClick to handle tabbing through the page and not expand the editor unless a click event triggers it"
                },
                "content": {
                    "raw": "inline with to a dn from lines",
                    "markup": "markdown",
                    "html": "<p>inline with to a dn from lines</p>",
                    "type": "rendered"
                },
                "created_on": "2019-09-27T00:33:46.039178+00:00",
                "user": {
                    "display_name": "Name Lastname",
                    "uuid": "{}",
                    "links": {
                        "self": {
                            "href": "https://api.bitbucket.org/2.0/users/%7B%7D"
                        },
                        "html": {
                            "href": "https://bitbucket.org/%7B%7D/"
                        },
                        "avatar": {
                            "href": "https://avatar-management--avatars.us-west-2.prod.public.atl-paas.net/:/128"
                        }
                    },
                    "type": "user",
                    "nickname": "Name",
                    "account_id": ""
                },
                "created_on": "2019-09-27T00:33:46.039178+00:00",
                "user": {
                    "display_name": "Name Lastname",
                    "uuid": "{}",
                    "links": {
                        "self": {
                            "href": "https://api.bitbucket.org/2.0/users/%7B%7D"
                        },
                        "html": {
                            "href": "https://bitbucket.org/%7B%7D/"
                        },
                        "avatar": {
                            "href": "https://avatar-management--avatars.us-west-2.prod.public.atl-paas.net/:/128"
                        }
                    },
                    "type": "user",
                    "nickname": "Name",
                    "account_id": ""
                },
                "updated_on": "2019-09-27T00:33:46.055384+00:00",
                "inline": {
                    "context_lines": "",
                    "to": null,
                    "path": "",
                    "outdated": false,
                    "from": 211
                },
                "type": "pullrequest_comment",
                "id": 118571088
            },
            "pull_request": {
                "type": "pullrequest",
                "id": 5695,
                "links": {
                    "self": {
                        "href": "https://api.bitbucket.org/2.0/repositories/atlassian/atlaskit-mk-2/pullrequests/5695"
                    },
                    "html": {
                        "href": "https://bitbucket.org/atlassian/atlaskit-mk-2/pull-requests/5695"
                    }
                },
                "title": "username/NONE: small change from onFocus to onClick to handle tabbing through the page and not expand the editor unless a click event triggers it"
            }
        }
    ]
}

Updates include a state property of OPEN, MERGED, or DECLINED.

Update example:

{
    "pagelen": 20,
    "values": [
        {
            "update": {
                "description": "",
                "title": "username/NONE: small change from onFocus to onClick to handle tabbing through the page and not expand the editor unless a click event triggers it",
                "destination": {
                    "commit": {
                        "type": "commit",
                        "hash": "6a2c16e4a152",
                        "links": {
                            "self": {
                                "href": "https://api.bitbucket.org/2.0/repositories/atlassian/atlaskit-mk-2/commit/6a2c16e4a152"
                            },
                            "html": {
                                "href": "https://bitbucket.org/atlassian/atlaskit-mk-2/commits/6a2c16e4a152"
                            }
                        }
                    },
                    "branch": {
                        "name": "master"
                    },
                    "repository": {
                        "name": "Atlaskit-MK-2",
                        "type": "repository",
                        "full_name": "atlassian/atlaskit-mk-2",
                        "links": {
                            "self": {
                                "href": "https://api.bitbucket.org/2.0/repositories/atlassian/atlaskit-mk-2"
                            },
                            "html": {
                                "href": "https://bitbucket.org/atlassian/atlaskit-mk-2"
                            },
                            "avatar": {
                                "href": "https://bytebucket.org/ravatar/%7B%7D?ts=js"
                            }
                        },
                        "uuid": "{}"
                    }
                },
                "reason": "",
                "source": {
                    "commit": {
                        "type": "commit",
                        "hash": "728c8bad1813",
                        "links": {
                            "self": {
                                "href": "https://api.bitbucket.org/2.0/repositories/atlassian/atlaskit-mk-2/commit/728c8bad1813"
                            },
                            "html": {
                                "href": "https://bitbucket.org/atlassian/atlaskit-mk-2/commits/728c8bad1813"
                            }
                        }
                    },
                    "branch": {
                        "name": "username/NONE-add-onClick-prop-for-accessibility"
                    },
                    "repository": {
                        "name": "Atlaskit-MK-2",
                        "type": "repository",
                        "full_name": "atlassian/atlaskit-mk-2",
                        "links": {
                            "self": {
                                "href": "https://api.bitbucket.org/2.0/repositories/atlassian/atlaskit-mk-2"
                            },
                            "html": {
                                "href": "https://bitbucket.org/atlassian/atlaskit-mk-2"
                            },
                            "avatar": {
                                "href": "https://bytebucket.org/ravatar/%7B%7D?ts=js"
                            }
                        },
                        "uuid": "{}"
                    }
                },
                "state": "OPEN",
                "author": {
                    "display_name": "Name Lastname",
                    "uuid": "{}",
                    "links": {
                        "self": {
                            "href": "https://api.bitbucket.org/2.0/users/%7B%7D"
                        },
                        "html": {
                            "href": "https://bitbucket.org/%7B%7D/"
                        },
                        "avatar": {
                            "href": "https://avatar-management--avatars.us-west-2.prod.public.atl-paas.net/:/128"
                        }
                    },
                    "type": "user",
                    "nickname": "Name",
                    "account_id": ""
                },
                "date": "2019-05-10T06:48:25.305565+00:00"
            },
            "pull_request": {
                "type": "pullrequest",
                "id": 5695,
                "links": {
                    "self": {
                        "href": "https://api.bitbucket.org/2.0/repositories/atlassian/atlaskit-mk-2/pullrequests/5695"
                    },
                    "html": {
                        "href": "https://bitbucket.org/atlassian/atlaskit-mk-2/pull-requests/5695"
                    }
                },
                "title": "username/NONE: small change from onFocus to onClick to handle tabbing through the page and not expand the editor unless a click event triggers it"
            }
        }
    ]
}

Approval example:

{
    "pagelen": 20,
    "values": [
        {
            "approval": {
                "date": "2019-09-27T00:37:19.849534+00:00",
                "pullrequest": {
                    "type": "pullrequest",
                    "id": 5695,
                    "links": {
                        "self": {
                            "href": "https://api.bitbucket.org/2.0/repositories/atlassian/atlaskit-mk-2/pullrequests/5695"
                        },
                        "html": {
                            "href": "https://bitbucket.org/atlassian/atlaskit-mk-2/pull-requests/5695"
                        }
                    },
                    "title": "username/NONE: small change from onFocus to onClick to handle tabbing through the page and not expand the editor unless a click event triggers it"
                },
                "user": {
                    "display_name": "Name Lastname",
                    "uuid": "{}",
                    "links": {
                        "self": {
                            "href": "https://api.bitbucket.org/2.0/users/%7B%7D"
                        },
                        "html": {
                            "href": "https://bitbucket.org/%7B%7D/"
                        },
                        "avatar": {
                            "href": "https://avatar-management--avatars.us-west-2.prod.public.atl-paas.net/:/128"
                        }
                    },
                    "type": "user",
                    "nickname": "Name",
                    "account_id": ""
                }
            },
            "pull_request": {
                "type": "pullrequest",
                "id": 5695,
                "links": {
                    "self": {
                        "href": "https://api.bitbucket.org/2.0/repositories/atlassian/atlaskit-mk-2/pullrequests/5695"
                    },
                    "html": {
                        "href": "https://bitbucket.org/atlassian/atlaskit-mk-2/pull-requests/5695"
                    }
                },
                "title": "username/NONE: small change from onFocus to onClick to handle tabbing through the page and not expand the editor unless a click event triggers it"
            }
        }
    ]
}
operationId: Pullrequests_listActivityLog

Parameters

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,
surrounded by curly-braces, for example: {repository UUID}.

workspace path required string

This can either be the workspace ID (slug) or the workspace UUID
surrounded by curly-braces, for example: {workspace UUID}.

Responses

200

The pull request activity log

401

If the repository is private and the request was not authenticated.

404

If the specified repository does not exist.

GET /repositories/{workspace}/{repo_slug}/pullrequests/{pull_request_id}/activity
DELETE /repositories/{workspace}/{repo_slug}/pullrequests/{pull_request_id}/approve

Redact the authenticated user’s approval of the specified pull
request.

operationId: Pullrequests_unapprovePullRequest

Parameters

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,
surrounded by curly-braces, for example: {repository UUID}.

workspace path required string

This can either be the workspace ID (slug) or the workspace UUID
surrounded by curly-braces, for example: {workspace UUID}.

Responses

204

An empty response indicating the authenticated user’s approval has been withdrawn.

400

Pull request cannot be unapproved because the pull request has already been merged.

401

The request wasn’t authenticated.

404

The specified pull request or the repository does not exist.

DELETE /repositories/{workspace}/{repo_slug}/pullrequests/{pull_request_id}/approve
POST /repositories/{workspace}/{repo_slug}/pullrequests/{pull_request_id}/approve

Approve the specified pull request as the authenticated user.

operationId: Pullrequests_approveRequest

Parameters

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,
surrounded by curly-braces, for example: {repository UUID}.

workspace path required string

This can either be the workspace ID (slug) or the workspace UUID
surrounded by curly-braces, for example: {workspace UUID}.

Responses

200

The participant object recording that the authenticated user approved the pull request.

401

The request wasn’t authenticated.

404

The specified pull request or the repository does not exist.

POST /repositories/{workspace}/{repo_slug}/pullrequests/{pull_request_id}/approve
GET /repositories/{workspace}/{repo_slug}/pullrequests/{pull_request_id}/comments

Returns a paginated list of the pull request’s comments.

This includes both global, inline comments and replies.

The default sorting is oldest to newest and can be overridden with
the sort query parameter.

This endpoint also supports filtering and sorting of the results. See
filtering and sorting for more
details.

operationId: Pullrequests_listComments

Parameters

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,
surrounded by curly-braces, for example: {repository UUID}.

workspace path required string

This can either be the workspace ID (slug) or the workspace UUID
surrounded by curly-braces, for example: {workspace UUID}.

Responses

200

A paginated list of comments made on the given pull request, in chronological order.

403

If the authenticated user does not have access to the pull request.

404

If the pull request does not exist.

GET /repositories/{workspace}/{repo_slug}/pullrequests/{pull_request_id}/comments
POST /repositories/{workspace}/{repo_slug}/pullrequests/{pull_request_id}/comments

Creates a new pull request comment.

Returns the newly created pull request comment.

operationId: Pullrequests_createComment

Parameters

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,
surrounded by curly-braces, for example: {repository UUID}.

workspace path required string

This can either be the workspace ID (slug) or the workspace UUID
surrounded by curly-braces, for example: {workspace UUID}.

Request Body

required

The comment object.

application/json
schema 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

Responses

201

The newly created comment.

403

If the authenticated user does not have access to the pull request.

404

If the pull request does not exist.

POST /repositories/{workspace}/{repo_slug}/pullrequests/{pull_request_id}/comments
DELETE /repositories/{workspace}/{repo_slug}/pullrequests/{pull_request_id}/comments/{comment_id}

Deletes a specific pull request comment.

operationId: Pullrequests_deleteComment

Parameters

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,
surrounded by curly-braces, for example: {repository UUID}.

workspace path required string

This can either be the workspace ID (slug) or the workspace UUID
surrounded by curly-braces, for example: {workspace UUID}.

Responses

204

Successful deletion.

403

If the authenticated user does not have access to delete the comment.

404

If the comment does not exist.

DELETE /repositories/{workspace}/{repo_slug}/pullrequests/{pull_request_id}/comments/{comment_id}
GET /repositories/{workspace}/{repo_slug}/pullrequests/{pull_request_id}/comments/{comment_id}

Returns a specific pull request comment.

operationId: Pullrequests_getComment

Parameters

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,
surrounded by curly-braces, for example: {repository UUID}.

workspace path required string

This can either be the workspace ID (slug) or the workspace UUID
surrounded by curly-braces, for example: {workspace UUID}.

Responses

200

The comment.

403

If the authenticated user does not have access to the pull request.

404

If the comment does not exist.

GET /repositories/{workspace}/{repo_slug}/pullrequests/{pull_request_id}/comments/{comment_id}
PUT /repositories/{workspace}/{repo_slug}/pullrequests/{pull_request_id}/comments/{comment_id}

Updates a specific pull request comment.

operationId: Pullrequests_updateComment

Parameters

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,
surrounded by curly-braces, for example: {repository UUID}.

workspace path required string

This can either be the workspace ID (slug) or the workspace UUID
surrounded by curly-braces, for example: {workspace UUID}.

Request Body

required

The contents of the updated comment.

application/json
schema 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

Responses

200

The updated comment.

403

If the authenticated user does not have access to the comment.

404

If the comment does not exist.

PUT /repositories/{workspace}/{repo_slug}/pullrequests/{pull_request_id}/comments/{comment_id}
DELETE /repositories/{workspace}/{repo_slug}/pullrequests/{pull_request_id}/comments/{comment_id}/resolve
operationId: Pullrequests_reopenCommentThread

Parameters

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,
surrounded by curly-braces, for example: {repository UUID}.

workspace path required string

This can either be the workspace ID (slug) or the workspace UUID
surrounded by curly-braces, for example: {workspace UUID}.

Responses

204

The comment is reopened.

403

If the authenticated user does not have access to the pull request,
or if the provided comment is not a top-level comment.

404

If the comment does not exist, or if the comment has not been resolved

DELETE /repositories/{workspace}/{repo_slug}/pullrequests/{pull_request_id}/comments/{comment_id}/resolve
POST /repositories/{workspace}/{repo_slug}/pullrequests/{pull_request_id}/comments/{comment_id}/resolve
operationId: Pullrequests_resolveCommentThread

Parameters

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,
surrounded by curly-braces, for example: {repository UUID}.

workspace path required string

This can either be the workspace ID (slug) or the workspace UUID
surrounded by curly-braces, for example: {workspace UUID}.

Responses

200

The comment resolution details.

403

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.

404

If the comment does not exist.

409

If the comment has already been resolved.

POST /repositories/{workspace}/{repo_slug}/pullrequests/{pull_request_id}/comments/{comment_id}/resolve
GET /repositories/{workspace}/{repo_slug}/pullrequests/{pull_request_id}/commits

Returns a paginated list of the pull request’s commits.

These are the commits that are being merged into the destination
branch when the pull requests gets accepted.

operationId: Pullrequests_listCommits

Parameters

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,
surrounded by curly-braces, for example: {repository UUID}.

workspace path required string

This can either be the workspace ID (slug) or the workspace UUID
surrounded by curly-braces, for example: {workspace UUID}.

Responses

200

A paginated list of commits made on the given pull request, in chronological order. This list will be empty if the source branch no longer exists.

403

If the authenticated user does not have access to the pull request.

404

If the pull request does not exist or the source branch is from a forked repository which no longer exists.

GET /repositories/{workspace}/{repo_slug}/pullrequests/{pull_request_id}/commits
POST /repositories/{workspace}/{repo_slug}/pullrequests/{pull_request_id}/decline

Declines the pull request.

operationId: Pullrequests_declinePullRequest

Parameters

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,
surrounded by curly-braces, for example: {repository UUID}.

workspace path required string

This can either be the workspace ID (slug) or the workspace UUID
surrounded by curly-braces, for example: {workspace UUID}.

Responses

200

The pull request was successfully declined.

555

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
GET /repositories/{workspace}/{repo_slug}/pullrequests/{pull_request_id}/diff

Redirects to the repository diff
with the revspec that corresponds to the pull request.

operationId: Pullrequests_listDiff

Parameters

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,
surrounded by curly-braces, for example: {repository UUID}.

workspace path required string

This can either be the workspace ID (slug) or the workspace UUID
surrounded by curly-braces, for example: {workspace UUID}.

Responses

default

Redirects to the repository diff with the
revspec that corresponds to the pull request.

GET /repositories/{workspace}/{repo_slug}/pullrequests/{pull_request_id}/diff
GET /repositories/{workspace}/{repo_slug}/pullrequests/{pull_request_id}/diffstat

Redirects to the repository diffstat
with the revspec that corresponds to the pull request.

operationId: Pullrequests_getDiffstat

Parameters

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,
surrounded by curly-braces, for example: {repository UUID}.

workspace path required string

This can either be the workspace ID (slug) or the workspace UUID
surrounded by curly-braces, for example: {workspace UUID}.

Responses

default

Redirects to the repository diffstat with
the revspec that corresponds to pull request.

GET /repositories/{workspace}/{repo_slug}/pullrequests/{pull_request_id}/diffstat
POST /repositories/{workspace}/{repo_slug}/pullrequests/{pull_request_id}/merge

Merges the pull request.

operationId: Pullrequests_mergePullRequest

Parameters

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,
surrounded by curly-braces, for example: {repository UUID}.

workspace path required string

This can either be the workspace ID (slug) or the workspace UUID
surrounded by curly-braces, for example: {workspace UUID}.

async query optional boolean

Default value is false.

When set to true, runs merge asynchronously and
immediately returns a 202 with polling link to
the task-status API in the Location header.

When set to false, runs merge and waits for it to
complete, returning 200 when it succeeds. If the
duration of the merge exceeds a timeout threshold,
the API returns a 202 with polling link to the
task-status API in the Location header.

Request Body

application/json
schema pullrequest_merge_parameters
Property Type Required
type string required
message string optional
merge_strategy string optional
close_source_branch boolean optional

Responses

200

The pull request object.

202

In the Location header, the URL to poll for the pull request merge status

555

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
GET /repositories/{workspace}/{repo_slug}/pullrequests/{pull_request_id}/merge/task-status/{task_id}

When merging a pull request takes too long, the client receives a
task ID along with a 202 status code. The task ID can be used in a call
to this endpoint to check the status of a merge task.

curl -X GET https://api.bitbucket.org/2.0/repositories/atlassian/bitbucket/pullrequests/2286/merge/task-status/<task_id>

If the merge task is not yet finished, a PENDING status will be returned.

HTTP/2 200
{
    "task_status": "PENDING",
    "links": {
        "self": {
            "href": "https://api.bitbucket.org/2.0/repositories/atlassian/bitbucket/pullrequests/2286/merge/task-status/<task_id>"
        }
    }
}

If the merge was successful, a SUCCESS status will be returned.

HTTP/2 200
{
    "task_status": "SUCCESS",
    "links": {
        "self": {
            "href": "https://api.bitbucket.org/2.0/repositories/atlassian/bitbucket/pullrequests/2286/merge/task-status/<task_id>"
        }
    },
    "merge_result": <the merged pull request object>
}

If the merge task failed, an error will be returned.

{
    "type": "error",
    "error": {
        "message": "<error message>"
    }
}
operationId: Pullrequests_mergeTaskStatus

Parameters

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,
surrounded by curly-braces, for example: {repository UUID}.

task_id path required string

ID of the merge task

workspace path required string

This can either be the workspace ID (slug) or the workspace UUID
surrounded by curly-braces, for example: {workspace UUID}.

Responses

200

Returns a task status if the merge is either pending or successful, and if it is successful, a pull request

400

If the provided task ID does not relate to this pull request, or if something went wrong during the merge operation

403

The user making the request does not have permission to the repo and is different from the user who queued the task

GET /repositories/{workspace}/{repo_slug}/pullrequests/{pull_request_id}/merge/task-status/{task_id}
GET /repositories/{workspace}/{repo_slug}/pullrequests/{pull_request_id}/patch

Redirects to the repository patch
with the revspec that corresponds to pull request.

operationId: Pullrequests_getPatch

Parameters

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,
surrounded by curly-braces, for example: {repository UUID}.

workspace path required string

This can either be the workspace ID (slug) or the workspace UUID
surrounded by curly-braces, for example: {workspace UUID}.

Responses

default

Redirects to the repository patch with
the revspec that corresponds to pull request.

GET /repositories/{workspace}/{repo_slug}/pullrequests/{pull_request_id}/patch
Load more endpoints