Skip to main content

Merge Pull Request

Merges the pull request.

External Documentation

To learn more, visit the Bitbucket documentation.

Parameters

ParameterDescription
AsyncDefault value is false.When set to true, runs merge asynchronously andimmediately returns a 202 with polling link tothe task-status API in the Location header.When set to false, runs merge and waits for it tocomplete, returning 200 when it succeeds. If theduration of the merge exceeds a timeout threshold,the API returns a 202 with polling link to thetask-status API in the Location header.
Close Source BranchWhether the source branch should be deleted. If this is not provided, we fallback to the value used when the pull request was created, which defaults to False.
Merge StrategyThe merge strategy that will be used to merge the pull request.
MessageThe commit message that will be used on the resulting commit.
Pull Request IDThe id of the pull request.
Repo SlugThis can either be the repository slug or the UUID of the repository,surrounded by curly-braces, for example: {repository UUID}.
Workspace SlugThis can either be the workspace ID (slug) or the workspace UUIDsurrounded by curly-braces, for example: {workspace UUID}.

Example Output

{
"author": {
"account_id": "123456:daffbc08-1a80-4bd0-98bf-7997de0a3d10",
"display_name": "Example Username",
"links": {
"avatar": {
"href": "https://bitbucket.org/account/example-username/avatar/"
},
"html": {
"href": "https://bitbucket.org/example-username/"
},
"self": {
"href": "https://api.bitbucket.org/2.0/users/example-username"
}
},
"nickname": "example-username",
"type": "user",
"username": "example-username",
"uuid": "{58021780-82b6-4517-b153-0ae73ce3e4b4}"
},
"close_source_branch": true,
"comment_count": 0,
"created_on": "2018-06-20T23:17:33.616Z",
"description": "Everything is awesome!",
"destination": {
"branch": {
"name": "master"
},
"commit": {
"hash": "230269fdfabd",
"links": {
"html": {
"href": "https://bitbucket.org/example-username/bits_and_bobs/commits/230269fdfabd"
},
"self": {
"href": "https://api.bitbucket.org/2.0/repositories/example-username/bits_and_bobs/commit/230269fdfabd"
}
},
"type": "commit"
},
"repository": {
"full_name": "example-username/bits_and_bobs",
"links": {
"avatar": {
"href": "https://bytebucket.org/ravatar/%7B7708d810-964c-403f-aa6d-4e949280d614%7D?ts=python"
},
"html": {
"href": "https://bitbucket.org/example-username/bits_and_bobs"
},
"self": {
"href": "https://api.bitbucket.org/2.0/repositories/example-username/bits_and_bobs"
}
},
"name": "bits_and_bobs",
"type": "repository",
"uuid": "{7708d810-964c-403f-aa6d-4e949280d614}"
}
},
"id": 1,
"links": {
"activity": {
"href": "https://api.bitbucket.org/2.0/repositories/example-username/bits_and_bobs/pullrequests/1/activity"
},
"approve": {
"href": "https://api.bitbucket.org/2.0/repositories/example-username/bits_and_bobs/pullrequests/1/approve"
},
"comments": {
"href": "https://api.bitbucket.org/2.0/repositories/example-username/bits_and_bobs/pullrequests/1/comments"
},
"commits": {
"href": "https://api.bitbucket.org/2.0/repositories/example-username/bits_and_bobs/pullrequests/1/commits"
},
"decline": {
"href": "https://api.bitbucket.org/2.0/repositories/example-username/bits_and_bobs/pullrequests/1/decline"
},
"diff": {
"href": "https://api.bitbucket.org/2.0/repositories/example-username/bits_and_bobs/pullrequests/1/diff"
},
"html": {
"href": "https://bitbucket.org/example-username/bits_and_bobs/pull-requests/1"
},
"merge": {
"href": "https://api.bitbucket.org/2.0/repositories/example-username/bits_and_bobs/pullrequests/1/merge"
},
"self": {
"href": "https://api.bitbucket.org/2.0/repositories/example-username/bits_and_bobs/pullrequests/1"
},
"statuses": {
"href": "https://api.bitbucket.org/2.0/repositories/example-username/bits_and_bobs/pullrequests/1/statuses"
}
},
"participants": [],
"reason": "",
"reviewers": [],
"source": {
"branch": {
"name": "branch_magnificent_internet"
},
"commit": {
"hash": "c184aab5708b",
"links": {
"html": {
"href": "https://bitbucket.org/example-username/bits_and_bobs/commits/c184aab5708b"
},
"self": {
"href": "https://api.bitbucket.org/2.0/repositories/example-username/bits_and_bobs/commit/c184aab5708b"
}
},
"type": "commit"
},
"repository": {
"full_name": "example-username/bits_and_bobs",
"links": {
"avatar": {
"href": "https://bytebucket.org/ravatar/%7B7708d810-964c-403f-aa6d-4e949280d614%7D?ts=python"
},
"html": {
"href": "https://bitbucket.org/example-username/bits_and_bobs"
},
"self": {
"href": "https://api.bitbucket.org/2.0/repositories/example-username/bits_and_bobs"
}
},
"name": "bits_and_bobs",
"type": "repository",
"uuid": "{7708d810-964c-403f-aa6d-4e949280d614}"
}
},
"state": "OPEN",
"summary": {
"html": "\u003cp\u003eEverything is awesome!\u003c/p\u003e",
"markup": "markdown",
"raw": "Everything is awesome!",
"type": "rendered"
},
"task_count": 0,
"title": "Change a cooperative standard to a smiling disease",
"type": "pullrequest",
"updated_on": "2018-06-20T23:17:33.616Z"
}

Workflow Library Example

Merge Pull Request with Bitbucket and Send Results Via Email

Workflow LibraryPreview this Workflow on desktop