• Addon
  • Branch restrictions
  • Branching model
  • Commit statuses
  • Commits
  • Deployments
  • Downloads
  • Issue tracker
  • Pipelines
  • Projects
  • Pullrequests
  • Refs
  • Reports
  • Repositories
  • Snippets
  • Source
  • Ssh
  • Users
  • Webhooks
  • Workspaces
  • Other operations
Cloud
Bitbucket Cloud / Reference / REST APIs

Workspaces

Postman Collection
OpenAPI
GET

List workspaces for the current user

Returns an object for each workspace the caller is a member of, and their effective role - the highest level of privilege the caller has. If a user is a member of multiple groups with distinct roles, only the highest level is returned.

Permissions can be:

  • owner
  • collaborator
  • member

The collaborator role is being removed from the Bitbucket Cloud API. For more information, see the deprecation announcement.

When you move your administration from Bitbucket Cloud to admin.atlassian.com, the following fields on workspace_membership will no longer be present: last_accessed and added_on. See the deprecation announcement.

Results may be further filtered or sorted by workspace or permission by adding the following query string parameters:

  • q=workspace.slug="bbworkspace1" or q=permission="owner"
  • sort=workspace.slug

Note that the query parameter values need to be URL escaped so that = would become %3D.

account

Request

Query parameters

q

string

sort

string

Responses

All of the workspace memberships for the authenticated user.

application/json

Paginated Workspace Memberships

A paginated list of workspace memberships.

GET/user/permissions/workspaces
1 2 3 4 curl --request GET \ --url 'https://api.bitbucket.org/2.0/user/permissions/workspaces' \ --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 { "pagelen": 10, "page": 1, "size": 1, "values": [ { "type": "workspace_membership", "permission": "owner", "last_accessed": "2019-03-07T12:35:02.900024+00:00", "added_on": "2018-10-11T17:42:02.961424+00:00", "user": { "type": "user", "uuid": "{470c176d-3574-44ea-bb41-89e8638bcca4}", "nickname": "evzijst", "display_name": "Erik van Zijst" }, "workspace": { "type": "workspace", "uuid": "{a15fb181-db1f-48f7-b41f-e1eff06929d6}", "slug": "bbworkspace1", "name": "Atlassian Bitbucket" } } ] }
GET

List workspaces for user

Returns a list of workspaces accessible by the authenticated user.

Results may be further filtered or sorted by workspace or permission by adding the following query string parameters:

  • q=slug="bbworkspace1" or q=is_private=true
  • sort=created_on

Note that the query parameter values need to be URL escaped so that = would become %3D.

The collaborator role is being removed from the Bitbucket Cloud API. For more information, see the deprecation announcement.

account

Request

Query parameters

role

string

q

string

sort

string

Responses

The list of workspaces accessible by the authenticated user.

application/json

Paginated Workspaces

A paginated list of workspaces.

GET/workspaces
1 2 3 4 curl --request GET \ --url 'https://api.bitbucket.org/2.0/workspaces' \ --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 { "pagelen": 10, "page": 1, "size": 1, "values": [ { "uuid": "{a15fb181-db1f-48f7-b41f-e1eff06929d6}", "links": { "owners": { "href": "https://api.bitbucket.org/2.0/workspaces/bbworkspace1/members?q=permission%3D%22owner%22" }, "self": { "href": "https://api.bitbucket.org/2.0/workspaces/bbworkspace1" }, "repositories": { "href": "https://api.bitbucket.org/2.0/repositories/bbworkspace1" }, "snippets": { "href": "https://api.bitbucket.org/2.0/snippets/bbworkspace1" }, "html": { "href": "https://bitbucket.org/bbworkspace1/" }, "avatar": { "href": "https://bitbucket.org/workspaces/bbworkspace1/avatar/?ts=1543465801" }, "members": { "href": "https://api.bitbucket.org/2.0/workspaces/bbworkspace1/members" }, "projects": { "href": "https://api.bitbucket.org/2.0/workspaces/bbworkspace1/projects" } }, "created_on": "2018-11-14T19:15:05.058566+00:00", "type": "workspace", "slug": "bbworkspace1", "is_private": true, "name": "Atlassian Bitbucket" } ] }
GET

Get a workspace

Returns the requested workspace.

Request

Path parameters

workspace

string

Required

Responses

The workspace.

application/json

allOf [object, Workspace]

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.

Workspace

A Bitbucket workspace. Workspaces are used to organize repositories.

GET/workspaces/{workspace}
1 2 3 4 curl --request GET \ --url 'https://api.bitbucket.org/2.0/workspaces/{workspace}' \ --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 { "type": "<string>", "links": { "avatar": { "href": "<string>", "name": "<string>" }, "html": { "href": "<string>", "name": "<string>" }, "members": { "href": "<string>", "name": "<string>" }, "owners": { "href": "<string>", "name": "<string>" }, "projects": { "href": "<string>", "name": "<string>" }, "repositories": { "href": "<string>", "name": "<string>" }, "snippets": { "href": "<string>", "name": "<string>" }, "self": { "href": "<string>", "name": "<string>" } }, "uuid": "<string>", "name": "<string>", "slug": "<string>", "is_private": true, "created_on": "<string>", "updated_on": "<string>" }
GET

List webhooks for a workspace

Returns a paginated list of webhooks installed on this workspace.

webhook

Request

Path parameters

workspace

string

Required

Responses

The paginated list of installed webhooks.

application/json

Paginated Webhook Subscriptions

A paginated list of webhook subscriptions

GET/workspaces/{workspace}/hooks
1 2 3 4 curl --request GET \ --url 'https://api.bitbucket.org/2.0/workspaces/{workspace}/hooks' \ --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 { "size": 142, "page": 102, "pagelen": 159, "next": "<string>", "previous": "<string>", "values": [ { "type": "<string>", "uuid": "<string>", "url": "<string>", "description": "<string>", "subject_type": "repository", "active": true, "created_at": "<string>", "events": [ "repo:created" ], "secret_set": true, "secret": "<string>" } ] }
POST

Create a webhook for a workspace

Creates a new webhook on the specified workspace.

Workspace webhooks are fired for events from all repositories contained by that workspace.

Example:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 $ curl -X POST -u credentials -H 'Content-Type: application/json' https://api.bitbucket.org/2.0/workspaces/my-workspace/hooks -d ' { "description": "Webhook Description", "url": "https://example.com/", "active": true, "secret": "this is a really bad secret", "events": [ "repo:push", "issue:created", "issue:updated" ] }'

When the secret is provided it will be used as the key to generate a HMAC digest value sent in the X-Hub-Signature header at delivery time. Passing a null or empty secret or not passing a secret will leave the webhook's secret unset. Bitbucket only generates the X-Hub-Signature when the webhook's secret is set.

This call requires the webhook scope, as well as any scope that applies to the events that the webhook subscribes to. In the example above that means: webhook, repository and issue.

The url must properly resolve and cannot be an internal, non-routed address.

Only workspace owners can install webhooks on workspaces.

webhook

Request

Path parameters

workspace

string

Required

Responses

If the webhook was registered successfully.

Headers

Location

string

application/json

allOf [object, Webhook Subscription]

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.

Webhook Subscription

A Webhook subscription.

POST/workspaces/{workspace}/hooks
1 2 3 4 curl --request POST \ --url 'https://api.bitbucket.org/2.0/workspaces/{workspace}/hooks' \ --header 'Authorization: Bearer <access_token>' \ --header 'Accept: application/json'
201Response
1 2 3 4 5 6 7 8 9 10 11 12 13 14 { "type": "<string>", "uuid": "<string>", "url": "<string>", "description": "<string>", "subject_type": "repository", "active": true, "created_at": "<string>", "events": [ "repo:created" ], "secret_set": true, "secret": "<string>" }
GET

Get a webhook for a workspace

Returns the webhook with the specified id installed on the given workspace.

webhook

Request

Path parameters

uid

string

Required
workspace

string

Required

Responses

The webhook subscription object.

application/json

allOf [object, Webhook Subscription]

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.

Webhook Subscription

A Webhook subscription.

GET/workspaces/{workspace}/hooks/{uid}
1 2 3 4 curl --request GET \ --url 'https://api.bitbucket.org/2.0/workspaces/{workspace}/hooks/{uid}' \ --header 'Authorization: Bearer <access_token>' \ --header 'Accept: application/json'
200Response
1 2 3 4 5 6 7 8 9 10 11 12 13 14 { "type": "<string>", "uuid": "<string>", "url": "<string>", "description": "<string>", "subject_type": "repository", "active": true, "created_at": "<string>", "events": [ "repo:created" ], "secret_set": true, "secret": "<string>" }
PUT

Update a webhook for a workspace

Updates the specified webhook subscription.

The following properties can be mutated:

  • description
  • url
  • secret
  • active
  • events

The hook's secret is used as a key to generate the HMAC hex digest sent in the X-Hub-Signature header at delivery time. This signature is only generated when the hook has a secret.

Set the hook's secret by passing the new value in the secret field. Passing a null value in the secret field will remove the secret from the hook. The hook's secret can be left unchanged by not passing the secret field in the request.

webhook

Request

Path parameters

uid

string

Required
workspace

string

Required

Responses

The webhook subscription object.

application/json

allOf [object, Webhook Subscription]

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.

Webhook Subscription

A Webhook subscription.

PUT/workspaces/{workspace}/hooks/{uid}
1 2 3 4 curl --request PUT \ --url 'https://api.bitbucket.org/2.0/workspaces/{workspace}/hooks/{uid}' \ --header 'Authorization: Bearer <access_token>' \ --header 'Accept: application/json'
200Response
1 2 3 4 5 6 7 8 9 10 11 12 13 14 { "type": "<string>", "uuid": "<string>", "url": "<string>", "description": "<string>", "subject_type": "repository", "active": true, "created_at": "<string>", "events": [ "repo:created" ], "secret_set": true, "secret": "<string>" }
DEL

Delete a webhook for a workspace

Deletes the specified webhook subscription from the given workspace.

webhook

Request

Path parameters

uid

string

Required
workspace

string

Required

Responses

When the webhook was deleted successfully

DEL/workspaces/{workspace}/hooks/{uid}
1 2 3 curl --request DELETE \ --url 'https://api.bitbucket.org/2.0/workspaces/{workspace}/hooks/{uid}' \ --header 'Authorization: Bearer <access_token>'
GET

List users in a workspace

Returns all members of the requested workspace.

Scopes
account
read:workspace:bitbucket, read:user:bitbucket

Request

Path parameters

workspace

string

Required

Responses

The list of users that are part of a workspace.

application/json

Paginated Workspace Memberships

A paginated list of workspace memberships.

GET/workspaces/{workspace}/members
1 2 3 4 curl --request GET \ --url 'https://api.bitbucket.org/2.0/workspaces/{workspace}/members' \ --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 { "size": 142, "page": 102, "pagelen": 159, "next": "<string>", "previous": "<string>", "values": [ { "type": "<string>", "links": { "self": { "href": "<string>", "name": "<string>" } }, "user": { "type": "<string>" }, "workspace": { "type": "<string>" } } ] }
GET

Get user membership for a workspace

Returns the workspace membership, which includes a User object for the member and a Workspace object for the requested workspace.

Scopes
account
read:workspace:bitbucket, read:user:bitbucket

Request

Path parameters

member

string

Required
workspace

string

Required

Responses

The user that is part of a workspace.

application/json

allOf [object, Workspace Membership]

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.

Workspace Membership

A Bitbucket workspace membership. Links a user to a workspace.

GET/workspaces/{workspace}/members/{member}
1 2 3 4 curl --request GET \ --url 'https://api.bitbucket.org/2.0/workspaces/{workspace}/members/{member}' \ --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 { "type": "<string>", "links": { "self": { "href": "<string>", "name": "<string>" } }, "user": { "type": "<string>" }, "workspace": { "type": "<string>" } }
GET

List user permissions in a workspace

Returns the list of members in a workspace and their permission levels. Permission can be:

  • owner
  • collaborator
  • member

The collaborator role is being removed from the Bitbucket Cloud API. For more information, see the deprecation announcement.

When you move your administration from Bitbucket Cloud to admin.atlassian.com, the following fields on workspace_membership will no longer be present: last_accessed and added_on. See the deprecation announcement.

Results may be further filtered by permission by adding the following query string parameters:

  • q=permission="owner"
Scopes
account
read:workspace:bitbucket, read:user:bitbucket

Request

Path parameters

workspace

string

Required

Query parameters

q

string

Responses

The list of users that are part of a workspace, along with their permission.

application/json

Paginated Workspace Memberships

A paginated list of workspace memberships.

GET/workspaces/{workspace}/permissions
1 2 3 4 curl --request GET \ --url 'https://api.bitbucket.org/2.0/workspaces/{workspace}/permissions' \ --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 { "pagelen": 10, "values": [ { "permission": "owner", "type": "workspace_membership", "user": { "type": "user", "uuid": "{470c176d-3574-44ea-bb41-89e8638bcca4}", "display_name": "Erik van Zijst" }, "workspace": { "type": "workspace", "uuid": "{a15fb181-db1f-48f7-b41f-e1eff06929d6}", "slug": "bbworkspace1", "name": "Atlassian Bitbucket" } }, { "permission": "member", "type": "workspace_membership", "user": { "type": "user", "nickname": "seanaty", "display_name": "Sean Conaty", "uuid": "{504c3b62-8120-4f0c-a7bc-87800b9d6f70}" }, "workspace": { "type": "workspace", "uuid": "{a15fb181-db1f-48f7-b41f-e1eff06929d6}", "slug": "bbworkspace1", "name": "Atlassian Bitbucket" } } ], "page": 1, "size": 2 }
GET

List all repository permissions for a workspace

Returns an object for each repository permission for all of a workspace's repositories.

Permissions returned are effective permissions: the highest level of permission the user has. This does not distinguish between direct and indirect (group) privileges.

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

Permissions can be:

  • admin
  • write
  • read

Results may be further filtered or sorted by repository, user, or permission by adding the following query string parameters:

  • q=repository.name="geordi" or q=permission>"read"
  • sort=user.display_name

Note that the query parameter values need to be URL escaped so that = would become %3D.

Scopes
account
read:repository:bitbucket, read:user:bitbucket

Request

Path parameters

workspace

string

Required

Query parameters

q

string

sort

string

Responses

List of workspace's repository permissions.

application/json

Paginated Repository Permissions

A paginated list of repository permissions.

GET/workspaces/{workspace}/permissions/repositories
1 2 3 4 curl --request GET \ --url 'https://api.bitbucket.org/2.0/workspaces/{workspace}/permissions/repositories' \ --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 { "pagelen": 10, "values": [ { "type": "repository_permission", "user": { "type": "user", "display_name": "Erik van Zijst", "uuid": "{d301aafa-d676-4ee0-88be-962be7417567}" }, "repository": { "type": "repository", "name": "geordi", "full_name": "atlassian_tutorial/geordi", "uuid": "{85d08b4e-571d-44e9-a507-fa476535aa98}" }, "permission": "admin" }, { "type": "repository_permission", "user": { "type": "user", "display_name": "Sean Conaty", "uuid": "{504c3b62-8120-4f0c-a7bc-87800b9d6f70}" }, "repository": { "type": "repository", "name": "geordi", "full_name": "atlassian_tutorial/geordi", "uuid": "{85d08b4e-571d-44e9-a507-fa476535aa98}" }, "permission": "write" }, { "type": "repository_permission", "user": { "type": "user", "display_name": "Jeff Zeng", "uuid": "{47f92a9a-c3a3-4d0b-bc4e-782a969c5c72}" }, "repository": { "type": "repository", "name": "whee", "full_name": "atlassian_tutorial/whee", "uuid": "{30ba25e9-51ff-4555-8dd0-fc7ee2fa0895}" }, "permission": "admin" } ], "page": 1, "size": 3 }
GET

List a repository permissions for a workspace

Returns an object for the repository permission of each user in the requested repository.

Permissions returned are effective permissions: the highest level of permission the user has. This does not distinguish between direct and indirect (group) privileges.

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

Permissions can be:

  • admin
  • write
  • read

Results may be further filtered or sorted by user, or permission by adding the following query string parameters:

  • q=permission>"read"
  • sort=user.display_name

Note that the query parameter values need to be URL escaped so that = would become %3D.

Scopes
repository
read:repository:bitbucket, read:user:bitbucket

Request

Path parameters

repo_slug

string

Required
workspace

string

Required

Query parameters

q

string

sort

string

Responses

The repository permission for all users in this repository.

application/json

Paginated Repository Permissions

A paginated list of repository permissions.

GET/workspaces/{workspace}/permissions/repositories/{repo_slug}
1 2 3 4 curl --request GET \ --url 'https://api.bitbucket.org/2.0/workspaces/{workspace}/permissions/repositories/{repo_slug}' \ --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 { "pagelen": 10, "values": [ { "type": "repository_permission", "user": { "type": "user", "display_name": "Erik van Zijst", "uuid": "{d301aafa-d676-4ee0-88be-962be7417567}" }, "repository": { "type": "repository", "name": "geordi", "full_name": "atlassian_tutorial/geordi", "uuid": "{85d08b4e-571d-44e9-a507-fa476535aa98}" }, "permission": "admin" }, { "type": "repository_permission", "user": { "type": "user", "display_name": "Sean Conaty", "uuid": "{504c3b62-8120-4f0c-a7bc-87800b9d6f70}" }, "repository": { "type": "repository", "name": "geordi", "full_name": "atlassian_tutorial/geordi", "uuid": "{85d08b4e-571d-44e9-a507-fa476535aa98}" }, "permission": "write" } ], "page": 1, "size": 2 }
GET

List projects in a workspace

Returns the list of projects in this workspace.

Scopes
project
read:project:bitbucket

Request

Path parameters

workspace

string

Required

Responses

The list of projects in this workspace.

application/json

Paginated Projects

A paginated list of projects

GET/workspaces/{workspace}/projects
1 2 3 4 curl --request GET \ --url 'https://api.bitbucket.org/2.0/workspaces/{workspace}/projects' \ --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 { "size": 142, "page": 102, "pagelen": 159, "next": "<string>", "previous": "<string>", "values": [ { "type": "<string>", "links": { "html": { "href": "<string>", "name": "<string>" }, "avatar": { "href": "<string>", "name": "<string>" } }, "uuid": "<string>", "key": "<string>", "owner": { "type": "<string>" }, "name": "<string>", "description": "<string>", "is_private": true, "created_on": "<string>", "updated_on": "<string>", "has_publicly_visible_repos": true } ] }

Rate this page: