Developer
News and Updates
Get Support
Sign in
Get Support
Sign in
DOCUMENTATION
Cloud
Data Center
Resources
Sign in
Sign in
DOCUMENTATION
Cloud
Data Center
Resources
Sign in
  • Addon
  • Branch restrictions
  • Branching model
  • Commit statuses
  • Commits
  • Deployments
  • Downloads
  • GPG
  • Merge queues
  • Pipelines
  • Projects
  • Pullrequests
  • Refs
  • Reports
  • Repositories
  • SSH
  • Snippets
  • Source
  • Users
  • Webhooks
  • Workspaces
  • Other operations
Cloud
Bitbucket Cloud / Reference / REST APIs

Merge queues

Postman Collection
OpenAPI

Merge queues help keep a branch healthy by merging pull requests in order, only after each one has been validated with Bitbucket Pipelines against the latest state of the branch. When a pull request targeting a branch with an active merge queue is merged, it is added to the queue instead of being merged immediately. The merge queues resource lets you list the merge queues configured for a repository, inspect the pull requests currently in a queue, and remove a pull request from a queue.

GET

List merge queues

Lists merge queues configured for a repository. Optionally filter by branch.

Scopes
repository
read:repository:bitbucket

Request

Path parameters

workspace

string

Required
repo_slug

string

Required

Query parameters

target_branch

string

page

integer

pagelen

integer

Responses

Merge queues retrieved successfully.

application/json

Paginated Merge Queues
GET/repositories/{workspace}/{repo_slug}/merge-queues
1 2 3 4 curl --request GET \ --url 'https://api.bitbucket.org/2.0/repositories/{workspace}/{repo_slug}/merge-queues' \ --header 'Authorization: Bearer <access_token>' \ --header 'Accept: application/json'
200Response
1 2 3 4 5 6 7 8 9 10 11 12 13 { "page": 2154, "size": 2154, "pagelen": 2154, "values": [ { "type": "<string>", "uuid": "<string>", "name": "<string>", "state": "<string>" } ] }
GET

Get a merge queue

Gets a merge queue by UUID.

Scopes
repository
read:repository:bitbucket

Request

Path parameters

workspace

string

Required
repo_slug

string

Required
merge_queue_uuid

string

Required

Responses

Merge queue retrieved successfully.

application/json

allOf [object, Merge Queue]

object

Base type for most resource objects. It defines the common type element that identifies an object's type. It also identifies the element as Swagger's discriminator.

Merge Queue

Identity and state of the merge queue configured for the destination branch.

GET/repositories/{workspace}/{repo_slug}/merge-queues/{merge_queue_uuid}
1 2 3 4 curl --request GET \ --url 'https://api.bitbucket.org/2.0/repositories/{workspace}/{repo_slug}/merge-queues/{merge_queue_uuid}' \ --header 'Authorization: Bearer <access_token>' \ --header 'Accept: application/json'
200Response
1 2 3 4 5 6 { "type": "<string>", "uuid": "<string>", "name": "<string>", "state": "<string>" }
GET

List pullrequests in a merge queue

Lists pullrequests currently associated with a merge queue.

Scopes
pullrequest
read:pullrequest:bitbucket

Request

Path parameters

workspace

string

Required
repo_slug

string

Required
merge_queue_uuid

string

Required

Query parameters

page

integer

pagelen

integer

Responses

Merge queue pullrequests retrieved successfully.

application/json

Paginated Merge Queue PullRequests
GET/repositories/{workspace}/{repo_slug}/merge-queues/{merge_queue_uuid}/queue
1 2 3 4 curl --request GET \ --url 'https://api.bitbucket.org/2.0/repositories/{workspace}/{repo_slug}/merge-queues/{merge_queue_uuid}/queue' \ --header 'Authorization: Bearer <access_token>' \ --header 'Accept: application/json'
200Response
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 { "page": 2154, "size": 2154, "pagelen": 2154, "values": [ { "type": "queued_pullrequest", "status": "QUEUED", "rank": 61, "queued_on": "<string>", "last_activity_on": "<string>", "merge_queue": { "type": "merge_queue", "uuid": "<string>" }, "pipeline": { "type": "<string>" }, "pullrequest": { "type": "<string>" } } ] }
GET

Get a pullrequest in a merge queue

Gets a specific pullrequest in a merge queue.

Scopes
pullrequest
read:pullrequest:bitbucket

Request

Path parameters

workspace

string

Required
repo_slug

string

Required
merge_queue_uuid

string

Required
pullrequest_id

integer

Required

Responses

Merge queue pullrequest retrieved successfully.

application/json

Merge Queue PullRequest Object

The pullrequest object in a merge queue.

GET/repositories/{workspace}/{repo_slug}/merge-queues/{merge_queue_uuid}/queue/{pullrequest_id}
1 2 3 4 curl --request GET \ --url 'https://api.bitbucket.org/2.0/repositories/{workspace}/{repo_slug}/merge-queues/{merge_queue_uuid}/queue/{pullrequest_id}' \ --header 'Authorization: Bearer <access_token>' \ --header 'Accept: application/json'
200Response
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 { "type": "queued_pullrequest", "status": "QUEUED", "rank": 61, "queued_on": "<string>", "last_activity_on": "<string>", "merge_queue": { "type": "merge_queue", "uuid": "<string>" }, "pipeline": { "type": "<string>", "uuid": "<string>", "build_number": 33, "creator": { "type": "<string>" }, "repository": { "type": "<string>" }, "target": { "type": "<string>" }, "trigger": { "type": "<string>" }, "state": { "type": "<string>" }, "variables": [ { "type": "<string>" } ], "created_on": "<string>", "completed_on": "<string>", "build_seconds_used": 50, "configuration_sources": [ { "source": "<string>", "uri": "<string>" } ], "links": { "type": "<string>" } }, "pullrequest": { "type": "<string>", "links": { "self": { "href": "<string>", "name": "<string>" }, "html": { "href": "<string>", "name": "<string>" }, "commits": { "href": "<string>", "name": "<string>" }, "approve": { "href": "<string>", "name": "<string>" }, "diff": { "href": "<string>", "name": "<string>" }, "diffstat": { "href": "<string>", "name": "<string>" }, "comments": { "href": "<string>", "name": "<string>" }, "activity": { "href": "<string>", "name": "<string>" }, "merge": { "href": "<string>", "name": "<string>" }, "decline": { "href": "<string>", "name": "<string>" }, "mergeability_checks": { "href": "<string>", "name": "<string>" } }, "id": 108, "title": "<string>", "rendered": { "title": { "raw": "<string>", "markup": "markdown", "html": "<string>" }, "description": { "raw": "<string>", "markup": "markdown", "html": "<string>" }, "reason": { "raw": "<string>", "markup": "markdown", "html": "<string>" } }, "summary": { "raw": "<string>", "markup": "markdown", "html": "<string>" }, "state": "OPEN", "author": { "type": "<string>" }, "source": {}, "destination": {}, "merge_commit": { "hash": "<string>" }, "comment_count": 51, "task_count": 53, "close_source_branch": true, "closed_by": { "type": "<string>" }, "reason": "<string>", "created_on": "<string>", "updated_on": "<string>", "reviewers": [ { "type": "<string>" } ], "participants": [ { "type": "<string>" } ], "draft": true, "queued": true } }
DEL

Remove a pullrequest from a merge queue

Removes a pullrequest from the specified merge queue asynchronously.

Scopes
pullrequest:write
write:pullrequest:bitbucket

Request

Path parameters

workspace

string

Required
repo_slug

string

Required
merge_queue_uuid

string

Required
pullrequest_id

integer

Required

Responses

The remove request was accepted.

DEL/repositories/{workspace}/{repo_slug}/merge-queues/{merge_queue_uuid}/queue/{pullrequest_id}
1 2 3 curl --request DELETE \ --url 'https://api.bitbucket.org/2.0/repositories/{workspace}/{repo_slug}/merge-queues/{merge_queue_uuid}/queue/{pullrequest_id}' \ --header 'Authorization: Bearer <access_token>'

Rate this page: