Addon
Branch restrictions
Branching model
Commit statuses
Commits
Deployments
Downloads
Issue tracker
Pipelines
Projects
Pullrequests
Refs
Reports
Repositories
Snippets
Source
Ssh
Teams
Users
Webhooks
Workspaces
Other operations

Rate this page:

Repositories

A Git repository is a virtual storage of your project. It allows you to save versions of your code, which you can access when needed. The repo resource allows you to access public repos, or repos that belong to a specific workspace.

List public repositories

GET /2.0/repositories

Returns a paginated list of all public repositories.

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

OAuth scopes required
repository

Request

Query parameters
after

string

role

string

Filters the result based on the authenticated user's role on each repository.

  • member: returns repositories to which the user has explicit read access
  • contributor: returns repositories to which the user has explicit write access
  • admin: returns repositories to which the user has explicit administrator access
  • owner: returns all repositories owned by the current user

Valid values: admin, contributor, member, owner

q

string

Query string to narrow down the response as per filtering and sorting. role parameter must also be specified.

sort

string

Field by which the results should be sorted as per filtering and sorting.

Example

1
2
3
4
curl --request GET \
  --url 'https://api.bitbucket.org/2.0/repositories' \
  --header 'Authorization: Bearer <access_token>' \
  --header 'Accept: application/json'

Responses

All public repositories.

Content typeValue
application/json

Paginated Repositories

List repositories for a user

GET /2.0/repositories/{workspace}

Returns a paginated list of all repositories owned by the specified account or UUID.

The result can be narrowed down based on the authenticated user's role.

E.g. with ?role=contributor, only those repositories that the authenticated user has write access to are returned (this includes any repo the user is an admin on, as that implies write access).

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

OAuth scopes required
repository

Request

Path parameters
workspace Required

string

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