Server
Bitbucket Data Center / Reference / REST API
Operations
POST/branch-utils/latest/projects/{projectKey}/repos/{repositorySlug}/branchesDEL/branch-utils/latest/projects/{projectKey}/repos/{repositorySlug}/branchesGET/branch-utils/latest/projects/{projectKey}/repos/{repositorySlug}/branches/info/{commitId}GET/default-tasks/latest/projects/{projectKey}/repos/{repositorySlug}/tasksPOST/default-tasks/latest/projects/{projectKey}/repos/{repositorySlug}/tasksDEL/default-tasks/latest/projects/{projectKey}/repos/{repositorySlug}/tasksPUT/default-tasks/latest/projects/{projectKey}/repos/{repositorySlug}/tasks/{taskId}DEL/default-tasks/latest/projects/{projectKey}/repos/{repositorySlug}/tasks/{taskId}POST/git/latest/projects/{projectKey}/repos/{repositorySlug}/tagsDEL/git/latest/projects/{projectKey}/repos/{repositorySlug}/tags/{name}PUT/comment-likes/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/comments/{commentId}/reactions/{emoticon}DEL/comment-likes/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/comments/{commentId}/reactions/{emoticon}GET/branch-permissions/latest/projects/{projectKey}/repos/{repositorySlug}/restrictionsPOST/branch-permissions/latest/projects/{projectKey}/repos/{repositorySlug}/restrictionsGET/branch-permissions/latest/projects/{projectKey}/repos/{repositorySlug}/restrictions/{id}DEL/branch-permissions/latest/projects/{projectKey}/repos/{repositorySlug}/restrictions/{id}GET/sync/latest/projects/{projectKey}/repos/{repositorySlug}POST/sync/latest/projects/{projectKey}/repos/{repositorySlug}POST/sync/latest/projects/{projectKey}/repos/{repositorySlug}/synchronizeGET/api/latest/profile/recent/reposGET/api/latest/projects/{projectKey}/repos/{repositorySlug}/archiveGET/api/latest/projects/{projectKey}/repos/{repositorySlug}/attachments/{attachmentId}DEL/api/latest/projects/{projectKey}/repos/{repositorySlug}/attachments/{attachmentId}GET/api/latest/projects/{projectKey}/repos/{repositorySlug}/attachments/{attachmentId}/metadataPUT/api/latest/projects/{projectKey}/repos/{repositorySlug}/attachments/{attachmentId}/metadataDEL/api/latest/projects/{projectKey}/repos/{repositorySlug}/attachments/{attachmentId}/metadataGET/api/latest/projects/{projectKey}/repos/{repositorySlug}/branchesPOST/api/latest/projects/{projectKey}/repos/{repositorySlug}/branchesGET/api/latest/projects/{projectKey}/repos/{repositorySlug}/browseGET/api/latest/projects/{projectKey}/repos/{repositorySlug}/browse/{path}PUT/api/latest/projects/{projectKey}/repos/{repositorySlug}/browse/{path}GET/api/latest/projects/{projectKey}/repos/{repositorySlug}/changesGET/api/latest/projects/{projectKey}/repos/{repositorySlug}/commitsGET/api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}GET/api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/changesGET/api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/commentsPOST/api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/commentsGET/api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/comments/{commentId}PUT/api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/comments/{commentId}DEL/api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/comments/{commentId}GET/api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/diff-stats-summary/{path}GET/api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/diff/{path}GET/api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/merge-basePOST/api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/watchDEL/api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/watchGET/api/latest/projects/{projectKey}/repos/{repositorySlug}/compare/changesGET/api/latest/projects/{projectKey}/repos/{repositorySlug}/compare/commitsGET/api/latest/projects/{projectKey}/repos/{repositorySlug}/compare/diff-stats-summary{path}GET/api/latest/projects/{projectKey}/repos/{repositorySlug}/compare/diff{path}GET/api/latest/projects/{projectKey}/repos/{repositorySlug}/diffGET/api/latest/projects/{projectKey}/repos/{repositorySlug}/diff/{path}GET/api/latest/projects/{projectKey}/repos/{repositorySlug}/filesGET/api/latest/projects/{projectKey}/repos/{repositorySlug}/files/{path}GET/api/latest/projects/{projectKey}/repos/{repositorySlug}/hook-scriptsPUT/api/latest/projects/{projectKey}/repos/{repositorySlug}/hook-scripts/{scriptId}DEL/api/latest/projects/{projectKey}/repos/{repositorySlug}/hook-scripts/{scriptId}GET/api/latest/projects/{projectKey}/repos/{repositorySlug}/labelsPOST/api/latest/projects/{projectKey}/repos/{repositorySlug}/labelsDEL/api/latest/projects/{projectKey}/repos/{repositorySlug}/labels/{labelName}GET/api/latest/projects/{projectKey}/repos/{repositorySlug}/last-modifiedGET/api/latest/projects/{projectKey}/repos/{repositorySlug}/last-modified/{path}GET/api/latest/projects/{projectKey}/repos/{repositorySlug}/patchGET/api/latest/projects/{projectKey}/repos/{repositorySlug}/raw/{path}GET/api/latest/projects/{projectKey}/repos/{repositorySlug}/ref-change-activitiesGET/api/latest/projects/{projectKey}/repos/{repositorySlug}/ref-change-activities/branchesGET/api/latest/projects/{projectKey}/repos/{repositorySlug}/settings/auto-declinePUT/api/latest/projects/{projectKey}/repos/{repositorySlug}/settings/auto-declineDEL/api/latest/projects/{projectKey}/repos/{repositorySlug}/settings/auto-declineGET/api/latest/projects/{projectKey}/repos/{repositorySlug}/settings/auto-mergePUT/api/latest/projects/{projectKey}/repos/{repositorySlug}/settings/auto-mergeDEL/api/latest/projects/{projectKey}/repos/{repositorySlug}/settings/auto-mergeGET/api/latest/projects/{projectKey}/repos/{repositorySlug}/settings/hooksGET/api/latest/projects/{projectKey}/repos/{repositorySlug}/settings/hooks/{hookKey}DEL/api/latest/projects/{projectKey}/repos/{repositorySlug}/settings/hooks/{hookKey}PUT/api/latest/projects/{projectKey}/repos/{repositorySlug}/settings/hooks/{hookKey}/enabledDEL/api/latest/projects/{projectKey}/repos/{repositorySlug}/settings/hooks/{hookKey}/enabledGET/api/latest/projects/{projectKey}/repos/{repositorySlug}/settings/hooks/{hookKey}/settingsPUT/api/latest/projects/{projectKey}/repos/{repositorySlug}/settings/hooks/{hookKey}/settingsGET/api/latest/projects/{projectKey}/repos/{repositorySlug}/settings/pull-requestsPOST/api/latest/projects/{projectKey}/repos/{repositorySlug}/settings/pull-requestsGET/api/latest/projects/{projectKey}/repos/{repositorySlug}/tagsPOST/api/latest/projects/{projectKey}/repos/{repositorySlug}/tagsGET/api/latest/projects/{projectKey}/repos/{repositorySlug}/tags/{name}POST/api/latest/projects/{projectKey}/repos/{repositorySlug}/watchDEL/api/latest/projects/{projectKey}/repos/{repositorySlug}/watchGET/api/latest/projects/{projectKey}/repos/{repositorySlug}/webhooksPOST/api/latest/projects/{projectKey}/repos/{repositorySlug}/webhooksGET/api/latest/projects/{projectKey}/repos/{repositorySlug}/webhooks/searchPOST/api/latest/projects/{projectKey}/repos/{repositorySlug}/webhooks/testGET/api/latest/projects/{projectKey}/repos/{repositorySlug}/webhooks/{webhookId}PUT/api/latest/projects/{projectKey}/repos/{repositorySlug}/webhooks/{webhookId}DEL/api/latest/projects/{projectKey}/repos/{repositorySlug}/webhooks/{webhookId}GET/api/latest/projects/{projectKey}/repos/{repositorySlug}/webhooks/{webhookId}/latestGET/api/latest/projects/{projectKey}/repos/{repositorySlug}/webhooks/{webhookId}/statisticsGET/api/latest/projects/{projectKey}/repos/{repositorySlug}/webhooks/{webhookId}/statistics/summaryGET/api/latest/repos
POST

Create branch

Creates a branch in the specified repository.

The authenticated user must have an effective REPO_WRITE permission to call this resource. If branch permissions are set up in the repository, the authenticated user must also have access to the branch name that is to be created.

Request

Path parameters

projectKey

string

Required
repositorySlug

string

Required

Request bodyapplication/json

name

string

startPoint

string

Responses

JSON representation of the newly created branch

application/json;charset=UTF-8

RestBranch
POST/branch-utils/latest/projects/{projectKey}/repos/{repositorySlug}/branches
1 2 3 4 5 6 7 8 curl --request POST \ --url 'http://{baseurl}/rest/branch-utils/latest/projects/{projectKey}/repos/{repositorySlug}/branches' \ --header 'Accept: application/json;charset=UTF-8' \ --header 'Content-Type: application/json' \ --data '{ "name": "<string>", "startPoint": "<string>" }'
DEL

Delete branch

Deletes a branch in the specified repository.

If the branch does not exist, this operation will not raise an error. In other words after calling this resource and receiving a 204 response the branch provided in the request is guaranteed to not exist in the specified repository any more, regardless of its existence beforehand.

The optional 'endPoint' parameter of the request may contain a commit ID that the provided ref name is expected to point to. Should the ref point to a different commit ID, a 400 response will be returned with appropriate error details.

The authenticated user must have an effective REPO_WRITE permission to call this resource. If branch permissions are set up in the repository, the authenticated user must also have access to the branch name that is to be deleted.

Request

Path parameters

projectKey

string

Required
repositorySlug

string

Required

Request bodyapplication/json

Branch delete request

dryRun

boolean

endPoint

string

name

string

Responses

An empty response indicating that the branch no longer exists in the repository

DEL/branch-utils/latest/projects/{projectKey}/repos/{repositorySlug}/branches
1 2 3 4 5 6 7 8 curl --request DELETE \ --url 'http://{baseurl}/rest/branch-utils/latest/projects/{projectKey}/repos/{repositorySlug}/branches' \ --header 'Content-Type: application/json' \ --data '{ "dryRun": true, "endPoint": "<string>", "name": "<string>" }'
GET

Get branch

Gets the branch information associated with a single commit from a given repository.

Request

Path parameters

projectKey

string

Required
commitId

string

Required
repositorySlug

string

Required

Query parameters

start

number

limit

number

Responses

A page of branch refs associated with the commit

application/json;charset=UTF-8

object
GET/branch-utils/latest/projects/{projectKey}/repos/{repositorySlug}/branches/info/{commitId}
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/branch-utils/latest/projects/{projectKey}/repos/{repositorySlug}/branches/info/{commitId}' \ --header 'Accept: application/json;charset=UTF-8'
GET

Get a page of default tasks

Retrieves the default tasks for the supplied repository.

The authenticated user must have REPO_VIEW permission for this repository to call the resource.

Request

Path parameters

projectKey

string

Required
repositorySlug

string

Required

Query parameters

markup

string

start

number

limit

number

Responses

A page of default tasks

application/json

object
GET/default-tasks/latest/projects/{projectKey}/repos/{repositorySlug}/tasks
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/default-tasks/latest/projects/{projectKey}/repos/{repositorySlug}/tasks' \ --header 'Accept: application/json'
200Response
1 2 3 4 5 6 7 8 9 10 11 12 13 { "isLastPage": true, "limit": 25, "nextPageStart": 2154, "size": 1, "start": 2154, "values": [ { "description": "Default task description", "id": 1 } ] }
POST

Add a default task

Creates a default task for the supplied repository.

The authenticated user must have REPO_ADMIN permission for this repository to call the resource.

Request

Path parameters

projectKey

string

Required
repositorySlug

string

Required

Request bodyapplication/json

The task to be added

description

string

sourceMatcher

object

targetMatcher

object

Responses

The default task

application/json

RestDefaultTask
POST/default-tasks/latest/projects/{projectKey}/repos/{repositorySlug}/tasks
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 curl --request POST \ --url 'http://{baseurl}/rest/default-tasks/latest/projects/{projectKey}/repos/{repositorySlug}/tasks' \ --header 'Accept: application/json' \ --header 'Content-Type: application/json' \ --data '{ "description": "Default task description", "sourceMatcher": { "displayId": "main", "id": "refs/heads/main", "type": { "id": "ANY_REF", "name": "Branch" } }, "targetMatcher": { "displayId": "main", "id": "refs/heads/main", "type": { "id": "ANY_REF", "name": "Branch" } } }'
200Response
1 2 3 4 { "description": "Default task description", "id": 1 }
DEL

Deletes all default tasks for the repository

Delete all the default tasks for the supplied repository

The authenticated user must have REPO_ADMIN permission for this repository to call the resource.

Request

Path parameters

projectKey

string

Required
repositorySlug

string

Required

Responses

The default tasks have been deleted successfully.

DEL/default-tasks/latest/projects/{projectKey}/repos/{repositorySlug}/tasks
1 2 curl --request DELETE \ --url 'http://{baseurl}/rest/default-tasks/latest/projects/{projectKey}/repos/{repositorySlug}/tasks'
PUT

Update a default task

Updates a default task for the supplied repository.

The authenticated user must have REPO_ADMIN permission for this repository to call the resource.

Request

Path parameters

projectKey

string

Required
repositorySlug

string

Required
taskId

string

Required

Request bodyapplication/json

The task to be updated

description

string

sourceMatcher

object

targetMatcher

object

Responses

The default task

application/json

RestDefaultTask
PUT/default-tasks/latest/projects/{projectKey}/repos/{repositorySlug}/tasks/{taskId}
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 curl --request PUT \ --url 'http://{baseurl}/rest/default-tasks/latest/projects/{projectKey}/repos/{repositorySlug}/tasks/{taskId}' \ --header 'Accept: application/json' \ --header 'Content-Type: application/json' \ --data '{ "description": "Default task description", "sourceMatcher": { "displayId": "main", "id": "refs/heads/main", "type": { "id": "ANY_REF", "name": "Branch" } }, "targetMatcher": { "displayId": "main", "id": "refs/heads/main", "type": { "id": "ANY_REF", "name": "Branch" } } }'
200Response
1 2 3 4 { "description": "Default task description", "id": 1 }
DEL

Delete a specific default task

Delete a specific default task for a repository.

The authenticated user must have REPO_ADMIN permission for this repository to call the resource.

Request

Path parameters

projectKey

string

Required
repositorySlug

string

Required
taskId

string

Required

Responses

The default task has been deleted successfully.

DEL/default-tasks/latest/projects/{projectKey}/repos/{repositorySlug}/tasks/{taskId}
1 2 curl --request DELETE \ --url 'http://{baseurl}/rest/default-tasks/latest/projects/{projectKey}/repos/{repositorySlug}/tasks/{taskId}'
POST

Create tag

Creates a tag in the specified repository.

The authenticated user must have an effective REPO_WRITE permission to call this resource.

'LIGHTWEIGHT' and 'ANNOTATED' are the two type of tags that can be created. The 'startPoint' can either be a ref or a 'commit'.

Request

Path parameters

projectKey

string

Required
repositorySlug

string

Required

Request bodyapplication/json

The create git tag request.

force

boolean

message

string

name

string

startPoint

string

type

string

Responses

A JSON representation of the newly created tag.

application/json;charset=UTF-8

RestTag
POST/git/latest/projects/{projectKey}/repos/{repositorySlug}/tags
1 2 3 4 5 6 7 8 9 10 11 curl --request POST \ --url 'http://{baseurl}/rest/git/latest/projects/{projectKey}/repos/{repositorySlug}/tags' \ --header 'Accept: application/json;charset=UTF-8' \ --header 'Content-Type: application/json' \ --data '{ "force": true, "message": "A new release tag", "name": "release-tag", "startPoint": "refs/heads/master", "type": "ANNOTATED" }'
DEL

Delete tag

Deletes a tag in the specified repository.

The authenticated user must have an effective REPO_WRITE permission to call this resource.

Request

Path parameters

projectKey

string

Required
name

string

Required
repositorySlug

string

Required

Responses

An empty response indicating that the tag no longer exists in the repository.

DEL/git/latest/projects/{projectKey}/repos/{repositorySlug}/tags/{name}
1 2 curl --request DELETE \ --url 'http://{baseurl}/rest/git/latest/projects/{projectKey}/repos/{repositorySlug}/tags/{name}'
PUT

React to a comment

Add an emoticon reaction to a comment

Request

Path parameters

projectKey

string

Required
commentId

string

Required
commitId

string

Required
emoticon

string

Required
repositorySlug

string

Required

Responses

The added reaction

application/json;charset=UTF-8

RestUserReaction
PUT/comment-likes/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/comments/{commentId}/reactions/{emoticon}
1 2 3 curl --request PUT \ --url 'http://{baseurl}/rest/comment-likes/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/comments/{commentId}/reactions/{emoticon}' \ --header 'Accept: application/json;charset=UTF-8'
DEL

Remove a reaction from comment

Remove an emoticon reaction from a comment

Request

Path parameters

projectKey

string

Required
commentId

string

Required
commitId

string

Required
emoticon

string

Required
repositorySlug

string

Required

Responses

The added reaction

DEL/comment-likes/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/comments/{commentId}/reactions/{emoticon}
1 2 curl --request DELETE \ --url 'http://{baseurl}/rest/comment-likes/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/comments/{commentId}/reactions/{emoticon}'
GET

Search for ref restrictions

Search for restrictions using the supplied parameters.

The authenticated user must have REPO_ADMIN permission or higher to call this resource. Only authenticated users may call this resource.

Request

Path parameters

projectKey

string

Required
repositorySlug

string

Required

Query parameters

matcherType

string

matcherId

string

type

string

start

number

limit

number

Responses

A response containing a page of restrictions.

application/json;charset=UTF-8

object
GET/branch-permissions/latest/projects/{projectKey}/repos/{repositorySlug}/restrictions
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/branch-permissions/latest/projects/{projectKey}/repos/{repositorySlug}/restrictions' \ --header 'Accept: application/json;charset=UTF-8'
POST

Create multiple ref restrictions

Allows creating multiple restrictions at once.

Request

Path parameters

projectKey

string

Required
repositorySlug

string

Required

Request bodyapplication/vnd.atl.bitbucket.bulk+json

The request containing a list of the details of the restrictions to create.

array<RestRestrictionRequest>

accessKeyIds

array<integer>

accessKeys

array<RestSshAccessKey>

groupNames

array<string>

groups

array<string>

matcher

object

type

string

userSlugs

array<string>

users

array<RestApplicationUser>

Responses

Response contains the ref restriction that was just created.

application/json;charset=UTF-8

RestRefRestriction
POST/branch-permissions/latest/projects/{projectKey}/repos/{repositorySlug}/restrictions
1 2 3 curl --request POST \ --url 'http://{baseurl}/rest/branch-permissions/latest/projects/{projectKey}/repos/{repositorySlug}/restrictions' \ --header 'Accept: application/json;charset=UTF-8'
GET

Get a ref restriction

Returns a restriction as specified by a restriction id.

The authenticated user must have REPO_ADMIN permission or higher to call this resource. Only authenticated users may call this resource.

Request

Path parameters

projectKey

string

Required
id

string

Required
repositorySlug

string

Required

Responses

A response containing the restriction.

application/json;charset=UTF-8

RestRefRestriction
GET/branch-permissions/latest/projects/{projectKey}/repos/{repositorySlug}/restrictions/{id}
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/branch-permissions/latest/projects/{projectKey}/repos/{repositorySlug}/restrictions/{id}' \ --header 'Accept: application/json;charset=UTF-8'
DEL

Delete a ref restriction

Deletes a restriction as specified by a restriction id.

The authenticated user must have REPO_ADMIN permission or higher to call this resource. Only authenticated users may call this resource.

Request

Path parameters

projectKey

string

Required
id

string

Required
repositorySlug

string

Required

Responses

An empty response indicating that the operation was successful

DEL/branch-permissions/latest/projects/{projectKey}/repos/{repositorySlug}/restrictions/{id}
1 2 curl --request DELETE \ --url 'http://{baseurl}/rest/branch-permissions/latest/projects/{projectKey}/repos/{repositorySlug}/restrictions/{id}'
GET

Get synchronization status

Retrieves the synchronization status for the specified repository. In addition to listing refs which cannot be synchronized, if any, the status also provides the timestamp for the most recent synchronization and indicates whether synchronization is available and enabled. If "?at" is specified in the URL, the synchronization status for the specified ref is returned, rather than the complete repository status.

The authenticated user must have REPO_READ permission for the repository, or it must be public if the request is anonymous. Additionally, after synchronization is enabled for a repository, meaning synchronization was available at that time, permission changes and other actions can cause it to become unavailable. Even when synchronization is enabled, if it is no longer available for the repository it will not be performed.

Request

Path parameters

projectKey

string

Required
repositorySlug

string

Required

Query parameters

at

string

Responses

Synchronization status for the specified repository, or specific ref within that repository.

application/json;charset=UTF-8

RestRefSyncStatus
GET/sync/latest/projects/{projectKey}/repos/{repositorySlug}
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/sync/latest/projects/{projectKey}/repos/{repositorySlug}' \ --header 'Accept: application/json;charset=UTF-8'
POST

Disable synchronization

Enables or disables synchronization for the specified repository. When synchronization is enabled, branches within the repository are immediately synchronized and the status is updated with the outcome. That initial synchronization is performed before the REST request returns, allowing it to return the updated status.

The authenticated user must have REPO_ADMIN permission for the specified repository. Anonymous users cannot manage synchronization, even on public repositories. Additionally, synchronization must be available for the specified repository. Synchronization is only available if:

  • The repository is a fork, since its origin is used as upstream
  • The owning user still has access to the fork's origin, if the repository is a personalfork

Request

Path parameters

projectKey

string

Required
repositorySlug

string

Required

Request bodyapplication/json

enabled

boolean

Responses

The updated synchronization status for the repository, after enabling synchronization. 204 NO CONTENT is returned instead after disabling synchronization.

application/json;charset=UTF-8

RestRefSyncStatus
POST/sync/latest/projects/{projectKey}/repos/{repositorySlug}
1 2 3 4 5 6 7 curl --request POST \ --url 'http://{baseurl}/rest/sync/latest/projects/{projectKey}/repos/{repositorySlug}' \ --header 'Accept: application/json;charset=UTF-8' \ --header 'Content-Type: application/json' \ --data '{ "enabled": true }'
POST

Manual synchronization

Allows developers to apply a manual operation to bring a ref back in sync with upstream when it becomes out of sync due to conflicting changes. The following actions are supported:

  • MERGE: Merges in commits from the upstream ref. After applying this action, the synchronized ref will be AHEAD (as it still includes commits that do not exist upstream.
    • This action is only supported for DIVERGED refs
    • If a "commitMessage" is provided in the context, it will be used on the merge commit. Otherwise a default message is used.
  • DISCARD: Throws away local changes in favour of those made upstream. This is a destructive operation where commits in the local repository are lost.
    • No context entries are supported for this action
    • If the upstream ref has been deleted, the local ref is deleted as well
    • Otherwise, the local ref is updated to reference the same commit as upstream, even if the update is not fast-forward (similar to a forced push)

The authenticated user must have REPO_WRITE permission for the specified repository. Anonymous users cannot synchronize refs, even on public repositories. Additionally, synchronization must be enabled and available for the specified repository.

Request

Path parameters

projectKey

string

Required
repositorySlug

string

Required

Request bodyapplication/json

action

string

context

Context

refId

string

Responses

The requested action was successfully performed, and has updated the ref's state, but the ref if is still not in sync with upstream. For example, after applying the MERGE action, the ref will still be AHEAD of upstream. If the action brings the ref in sync with upstream, 204 NO CONTENT is returned instead.

application/json;charset=UTF-8

RestRejectedRef
POST/sync/latest/projects/{projectKey}/repos/{repositorySlug}/synchronize
1 2 3 4 5 6 7 8 9 10 11 curl --request POST \ --url 'http://{baseurl}/rest/sync/latest/projects/{projectKey}/repos/{repositorySlug}/synchronize' \ --header 'Accept: application/json;charset=UTF-8' \ --header 'Content-Type: application/json' \ --data '{ "action": "MERGE", "context": { "commitMessage": "Merging in latest from upstream." }, "refId": "refs/heads/master" }'
GET

Get recently accessed repositories

Retrieve a page of recently accessed repositories for the currently authenticated user.

Repositories are ordered from most recently to least recently accessed.

Only authenticated users may call this resource.

Request

Query parameters

permission

string

start

number

limit

number

Responses

A page of recently accessed repositories.

application/json;charset=UTF-8

object
GET/api/latest/profile/recent/repos
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/api/latest/profile/recent/repos' \ --header 'Accept: application/json;charset=UTF-8'
GET

Stream archive of repository

Streams an archive of the repository's contents at the requested commit. If no at= commit is requested, an archive of the default branch is streamed.

The filename= query parameter may be used to specify the exact filename to include in the "Content-Disposition" header. If an explicit filename is not provided, one will be automatically generated based on what is being archived. Its format depends on the at= value:

  • No at= commit: <slug>-<default-branch-name>@<commit>.<format>; e.g. example-master@43c2f8a0fe8.zip

  • at=sha: <slug>-<at>.<format>; e.g. example-09bcbb00100cfbb5310fb6834a1d5ce6cac253e9.tar.gz

  • at=branchOrTag: <slug>-<branchOrTag>@<commit>.<format>; e.g. example-feature@bbb225f16e1.tar

    • If the branch or tag is qualified (e.g. refs/heads/master, the short name (master) will be included in the filename
    • If the branch or tag's short name includes slashes (e.g. release/4.6), they will be converted to hyphens in the filename (release-4.5)

Archives may be requested in the following formats by adding the format= query parameter:

  • zip: A zip file using standard compression (Default)
  • tar: An uncompressed tarball
  • tar.gz or tgz: A GZip-compressed tarball

The contents of the archive may be filtered by using the path= query parameter to specify paths to include. path= may be specified multiple times to include multiple paths.

The prefix= query parameter may be used to define a directory (or multiple directories) where the archive's contents should be placed. If the prefix does not end with /, one will be added automatically. The prefix is always treated as a directory; it is not possible to use it to prepend characters to the entries in the archive.

Archives of public repositories may be streamed by any authenticated or anonymous user. Streaming archives for non-public repositories requires an authenticated user with at least REPO_READ permission.

Request

Path parameters

projectKey

string

Required
repositorySlug

string

Required

Query parameters

path

string

filename

string

at

string

prefix

string

format

string

Responses

An archive or the requested commit, in zip, tar or gzipped-tar format.

application/octet-stream application/x-tar

any

GET/api/latest/projects/{projectKey}/repos/{repositorySlug}/archive
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/archive' \ --header 'Accept: application/octet-stream'
GET

Get an attachment

Retrieve the attachment.

The authenticated user must have REPO_READ permission for the specified repository that is associated to the attachment.

Range requests (see IETF RFC7233) are supported. However only a single range issupported. If multiple ranges are passed the ranges will be ignored and the entire content will be returned in the response.

Request

Path parameters

projectKey

string

Required
attachmentId

string

Required
repositorySlug

string

Required

Header parameters

User-Agent

string

Range

string

Responses

the attachment

application/json

any

GET/api/latest/projects/{projectKey}/repos/{repositorySlug}/attachments/{attachmentId}
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/attachments/{attachmentId}' \ --header 'Accept: application/json'
DEL

Delete an attachment

Delete an attachment.

The user must be authenticated and have REPO_ADMIN permission for the specified repository.

Request

Path parameters

projectKey

string

Required
attachmentId

string

Required
repositorySlug

string

Required

Responses

This status code has no content.

DEL/api/latest/projects/{projectKey}/repos/{repositorySlug}/attachments/{attachmentId}
1 2 curl --request DELETE \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/attachments/{attachmentId}'
GET

Get attachment metadata

Retrieve the attachment metadata.

The authenticated user must have REPO_READ permission for the specified repository that is associated to the attachment that has the attachment metadata.

Request

Path parameters

projectKey

string

Required
attachmentId

string

Required
repositorySlug

string

Required

Responses

The attachment metadata

application/json;charset=UTF-8

RestAttachmentMetadata
GET/api/latest/projects/{projectKey}/repos/{repositorySlug}/attachments/{attachmentId}/metadata
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/attachments/{attachmentId}/metadata' \ --header 'Accept: application/json;charset=UTF-8'
PUT

Save attachment metadata

Save attachment metadata.

The authenticated user must have REPO_READ permission for the specified repository that is associated to the attachment that has the attachment metadata.

Request

Path parameters

projectKey

string

Required
attachmentId

string

Required
repositorySlug

string

Required

Request bodyapplication/json

The attachment metadata can be any valid JSON content

string

Responses

The attachment metadata

application/json;charset=UTF-8

any

PUT/api/latest/projects/{projectKey}/repos/{repositorySlug}/attachments/{attachmentId}/metadata
1 2 3 4 5 curl --request PUT \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/attachments/{attachmentId}/metadata' \ --header 'Accept: application/json;charset=UTF-8' \ --header 'Content-Type: application/json' \ --data '"<string>"'
DEL

Delete attachment metadata

Delete attachment metadata.

The user must be authenticated and have REPO_ADMIN permission for the specified repository.

Request

Path parameters

projectKey

string

Required
attachmentId

string

Required
repositorySlug

string

Required

Responses

This status code has no content.

DEL/api/latest/projects/{projectKey}/repos/{repositorySlug}/attachments/{attachmentId}/metadata
1 2 curl --request DELETE \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/attachments/{attachmentId}/metadata'
GET

Find branches

Retrieve the branches matching the supplied filterText param.

The authenticated user must have REPO_READ permission for the specified repository to call this resource.

Request

Path parameters

projectKey

string

Required
repositorySlug

string

Required

Query parameters

boostMatches

boolean

context

string

orderBy

string

details

boolean

filterText

string

base

string

start

number

limit

number

Responses

The branches matching the supplied filterText.

application/json;charset=UTF-8

object
GET/api/latest/projects/{projectKey}/repos/{repositorySlug}/branches
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/branches' \ --header 'Accept: application/json;charset=UTF-8'
POST

Create branch

Creates a branch using the information provided in the RestCreateBranchRequest request

The authenticated user must have REPO_WRITE permission for the context repository to call this resource.

Request

Path parameters

projectKey

string

Required
repositorySlug

string

Required

Request bodyapplication/json

The request to create a branch containing a name, startPoint, and optionally a message

message

string

name

string

startPoint

string

Responses

The created branch.

application/json;charset=UTF-8

RestBranch
POST/api/latest/projects/{projectKey}/repos/{repositorySlug}/branches
1 2 3 4 5 6 7 8 9 curl --request POST \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/branches' \ --header 'Accept: application/json;charset=UTF-8' \ --header 'Content-Type: application/json' \ --data '{ "message": "This is my branch or tag", "name": "my-branch-or-tag", "startPoint": "8d351a10fb428c0c1239530256e21cf24f136e73" }'
GET

Get file content at revision

Retrieve a page of content for a file path at a specified revision.

Responses from this endpoint vary widely depending on the query parameters. The example JSON is for a request that does not use size, type, blame or noContent.

  1. size will return a response like {"size":10000}
  2. type will return a response like {"type":"FILE"}, where possible values are "DIRECTORY", "FILE" and "SUBMODULE"
  3. blame without noContent will include blame for the lines of content returned on the page
  4. blame with noContent will omit file contents and only return blame for the requested lines
  5. noContent without blame is ignored and does nothing

The various parameters are "processed" in the above order. That means ?size=true&type=truewill return a size response, not a type one; the type parameter will be ignored.

The blame and noContent query parameters are handled differently from size and type. For blame and noContent, the presence of the parameter implies "true" if no value is specified; size and and type both require an explicit=true or they're treated as "false".

  • ?blame is the same as ?blame=true
  • ?blame&noContent is the same as ?blame=true&noContent=true
  • ?size is the same as ?size=false
  • ?type is the same as ?type=false

The authenticated user must have REPO_READ permission for the specified repository to call this resource.

Request

Path parameters

projectKey

string

Required
repositorySlug

string

Required

Query parameters

noContent

string

at

string

size

string

blame

string

type

string

Responses

A page of contents from a file.

application/json;charset=UTF-8

any

GET/api/latest/projects/{projectKey}/repos/{repositorySlug}/browse
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/browse' \ --header 'Accept: application/json;charset=UTF-8'
GET

Get file content

Retrieve a page of content for a file path at a specified revision.

Responses from this endpoint vary widely depending on the query parameters. The example JSON is for a request that does not use size, type, blame or noContent.

  1. size will return a response like {"size":10000}
  2. type will return a response like {"type":"FILE"}, where possible values are "DIRECTORY", "FILE" and "SUBMODULE"
  3. blame without noContent will include blame for the lines of content returned on the page
  4. blame with noContent will omit file contents and only return blame for the requested lines
  5. noContent without blame is ignored and does nothing

The various parameters are "processed" in the above order. That means ?size=true&type=truewill return a size response, not a type one; the type parameter will be ignored.

The blame and noContent query parameters are handled differently from size and type. For blame and noContent, the presence of the parameter implies "true" if no value is specified; size and and type both require an explicit=true or they're treated as "false".

  • ?blame is the same as ?blame=true
  • ?blame&noContent is the same as ?blame=true&noContent=true
  • ?size is the same as ?size=false
  • ?type is the same as ?type=false

The authenticated user must have REPO_READ permission for the specified repository to call this resource.

Request

Path parameters

path

string

Required
projectKey

string

Required
repositorySlug

string

Required

Query parameters

noContent

string

at

string

size

string

blame

string

type

string

Responses

A page of contents from a file.

application/json;charset=UTF-8

any

GET/api/latest/projects/{projectKey}/repos/{repositorySlug}/browse/{path}
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/browse/{path}' \ --header 'Accept: application/json;charset=UTF-8'
PUT

Edit file

Update the content of path, on the given repository and branch.

This resource accepts PUT multipart form data, containing the file in a form-field named content.

An example curl request to update 'README.md' would be:

curl -X PUT -u username:password -F content=@README.md -F 'message=Updated using file-edit REST API' -F branch=master -F sourceCommitId=5636641a50b http://example.com/rest/api/latest/projects/PROJECT_1/repos/repo_1/browse/README.md

  • branch: the branch on which the path should be modified or created
  • content: the full content of the file at path
  • message: the message associated with this change, to be used as the commit message. Or null if the default message should be used.
  • sourceCommitId: the commit ID of the file before it was edited, used to identify if content has changed. Or null if this is a new file

The file can be updated or created on a new branch. In this case, the sourceBranch parameter should be provided to identify the starting point for the new branch and the branch parameter identifies the branch to create the new commit on.

Request

Path parameters

path

string

Required
projectKey

string

Required
repositorySlug

string

Required

Request bodymultipart/form-data

The multipart form data containing the file

branch

string

content

string

message

string

sourceBranch

string

sourceCommitId

string

Responses

The newly created commit.

application/json;charset=UTF-8

RestCommit
PUT/api/latest/projects/{projectKey}/repos/{repositorySlug}/browse/{path}
1 2 3 curl --request PUT \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/browse/{path}' \ --header 'Accept: application/json;charset=UTF-8'
GET

Get changes made in commit

Retrieve a page of changes made in a specified commit.

Note: The implementation will apply a hard cap ({@code page.max.changes}) and it is not possible to request subsequent content when that cap is exceeded.

The authenticated user must have REPO_READ permission for the specified repository to call this resource.

Request

Path parameters

projectKey

string

Required
repositorySlug

string

Required

Query parameters

until

string

since

string

start

number

limit

number

Responses

A page of changes

application/json;charset=UTF-8

object
GET/api/latest/projects/{projectKey}/repos/{repositorySlug}/changes
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/changes' \ --header 'Accept: application/json;charset=UTF-8'
GET

Get commits

Retrieve a page of commits from a given starting commit or "between" two commits. If no explicit commit is specified, the tip of the repository's default branch is assumed. commits may be identified by branch or tag name or by ID. A path may be supplied to restrict the returned commits to only those which affect that path.

The authenticated user must have REPO_READ permission for the specified repository to call this resource.

Request

Path parameters

projectKey

string

Required
repositorySlug

string

Required

Query parameters

avatarScheme

string

path

string

withCounts

string

followRenames

string

until

string

avatarSize

string

since

string

merges

string

ignoreMissing

string

start

number

Responses

A page of commits

application/json;charset=UTF-8

object
GET/api/latest/projects/{projectKey}/repos/{repositorySlug}/commits
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/commits' \ --header 'Accept: application/json;charset=UTF-8'
GET

Get commit by ID

Retrieve a single commit identified by its ID. In general, that ID is a SHA1. From 2.11, ref names like "refs/heads/master" are no longer accepted by this resource.

The authenticated user must have REPO_READ permission for the specified repository to call this resource.

Request

Path parameters

projectKey

string

Required
commitId

string

Required
repositorySlug

string

Required

Query parameters

path

string

Responses

A commit

application/json;charset=UTF-8

RestCommit
GET/api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}' \ --header 'Accept: application/json;charset=UTF-8'
GET

Get changes in commit

Retrieve a page of changes made in a specified commit.

Note: The implementation will apply a hard cap (page.max.changes) and it is not possible to request subsequent content when that cap is exceeded.

The authenticated user must have REPO_READ permission for the specified repository to call this resource.

Request

Path parameters

projectKey

string

Required
commitId

string

Required
repositorySlug

string

Required

Query parameters

withComments

string

since

string

start

number

limit

number

Responses

A page of changes

application/json;charset=UTF-8

object
GET/api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/changes
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/changes' \ --header 'Accept: application/json;charset=UTF-8'
GET

Search for commit comments

Retrieves the commit discussion comments that match the specified search criteria.

It is possible to retrieve commit discussion comments that are anchored to a range of commits by providing the sinceId that the comments anchored from.

The authenticated user must have REPO_READ permission for the repository that the commit is in to call this resource.

Request

Path parameters

projectKey

string

Required
commitId

string

Required
repositorySlug

string

Required

Query parameters

path

string

since

string

start

number

limit

number

Responses

A page of comments that match the search criteria

application/json;charset=UTF-8

object
GET/api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/comments
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/comments' \ --header 'Accept: application/json;charset=UTF-8'
POST

Add a new commit comment

Add a new comment.

Comments can be added in a few places by setting different attributes:

General commit comment:

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 "text": "An insightful general comment on a commit." } </pre> Reply to a comment: <pre>{ "text": "A measured reply.", "parent": { "id": 1 } } </pre> General file comment: <pre>{ "text": "An insightful general comment on a file.", "anchor": { "diffType": "COMMIT", "fromHash": "6df3858eeb9a53a911cd17e66a9174d44ffb02cd", "path": "path/to/file", "srcPath": "path/to/file", "toHash": "04c7c5c931b9418ca7b66f51fe934d0bd9b2ba4b" } } </pre> File line comment: <pre>{ "text": "A pithy comment on a particular line within a file.", "anchor": { "diffType": "COMMIT", "line": 1, "lineType": "CONTEXT", "fileType": "FROM", "fromHash": "6df3858eeb9a53a911cd17e66a9174d44ffb02cd", "path": "path/to/file", "srcPath": "path/to/file", "toHash": "04c7c5c931b9418ca7b66f51fe934d0bd9b2ba4b" } }

Note: general file comments are an experimental feature and may change in the near future!

For file and line comments, 'path' refers to the path of the file to which the comment should be applied and 'srcPath' refers to the path the that file used to have (only required for copies and moves). Also, fromHash and toHash refer to the sinceId / untilId (respectively) used to produce the diff on which the comment was added. fromHash will be resolved automatically as first parent if not specified. Note that this behaviour differs from /pull-requests/comments

Finally diffType refers to the type of diff the comment was added on.

For line comments, 'line' refers to the line in the diff that the comment should apply to. 'lineType' refers to the type of diff hunk, which can be:- 'ADDED' - for an added line;- 'REMOVED' - for a removed line; or- 'CONTEXT' - for a line that was unmodified but is in the vicinity of the diff.'fileType' refers to the file of the diff to which the anchor should be attached - which is of relevance when displaying the diff in a side-by-side way. Currently the supported values are:- 'FROM' - the source file of the diff- 'TO' - the destination file of the diffIf the current user is not a participant the user is added as one and updated to watch the commit.

The authenticated user must have REPO_READ permission for the repository that the commit is in to call this resource.

Request

Path parameters

projectKey

string

Required
commitId

string

Required
repositorySlug

string

Required

Query parameters

since

string

Request bodyapplication/json

the comment

id

integer

properties

object

severity

string

state

string

text

string

threadResolved

boolean

version

integer

Responses

The newly created comment.

application/json;charset=UTF-8

RestComment
POST/api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/comments
1 2 3 4 5 6 7 8 9 10 11 12 13 curl --request POST \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/comments' \ --header 'Accept: application/json;charset=UTF-8' \ --header 'Content-Type: application/json' \ --data '{ "id": 1, "properties": {}, "severity": "NORMAL", "state": "OPEN", "text": "An insightful comment.", "threadResolved": true, "version": 1 }'
GET

Get a commit comment

Retrieves a commit discussion comment.

The authenticated user must have REPO_READ permission for the repository that the commit is in to call this resource.

Request

Path parameters

projectKey

string

Required
commentId

string

Required
commitId

string

Required
repositorySlug

string

Required

Responses

The requested comment.

application/json;charset=UTF-8

RestComment
GET/api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/comments/{commentId}
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/comments/{commentId}' \ --header 'Accept: application/json;charset=UTF-8'
PUT

Update a commit comment

Update a comment, with the following restrictions:

  • only the author of the comment may update the text of the comment
  • only the author of the comment or repository admins and above may update the other fields of a comment

Note: the supplied supplied JSON object must contain a version that must match the server's version of the comment or the update will fail. To determine the current version of the comment, the comment should be fetched from the server prior to the update. Look for the 'version' attribute in the returned JSON structure.

The authenticated user must have REPO_READ permission for the repository that the commit is in to call this resource.

Request

Path parameters

projectKey

string

Required
commentId

string

Required
commitId

string

Required
repositorySlug

string

Required

Request bodyapplication/json

The comment to update

id

integer

properties

object

severity

string

state

string

text

string

threadResolved

boolean

version

integer

Responses

The newly updated comment.

application/json;charset=UTF-8

RestComment
PUT/api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/comments/{commentId}
1 2 3 4 5 6 7 8 9 10 11 12 13 curl --request PUT \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/comments/{commentId}' \ --header 'Accept: application/json;charset=UTF-8' \ --header 'Content-Type: application/json' \ --data '{ "id": 1, "properties": {}, "severity": "NORMAL", "state": "OPEN", "text": "An insightful comment.", "threadResolved": true, "version": 1 }'
DEL

Delete a commit comment

Delete a commit comment. Anyone can delete their own comment. Only users with REPO_ADMIN and above may delete comments created by other users. Comments which have replies may not be deleted, regardless of the user's granted permissions.

The authenticated user must have REPO_READ permission for the repository that the commit is in to call this resource.

Request

Path parameters

projectKey

string

Required
commentId

string

Required
commitId

string

Required
repositorySlug

string

Required

Query parameters

version

string

Responses

The operation was successful

DEL/api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/comments/{commentId}
1 2 curl --request DELETE \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/comments/{commentId}'
GET

Get diff stats summary between revisions

Retrieve the diff stats summary for a commit.

The stats summary include the total number of modified files, added lines, and deleted lines.

The authenticated user must have REPO_READ permission for the specified repository to call this resource.

Request

Path parameters

path

string

Required
projectKey

string

Required
commitId

string

Required
repositorySlug

string

Required

Query parameters

srcPath

string

autoSrcPath

string

whitespace

string

since

string

Responses

The diff stats summary for a commit.

application/json;charset=UTF-8

RestDiffStatsSummary

GET/api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/diff-stats-summary/{path}
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/diff-stats-summary/{path}' \ --header 'Accept: application/json;charset=UTF-8'
GET

Get diff between revisions

Retrieve the diff between two provided revisions.

To stream a raw text representation of the diff, this endpoint can be called with the request header 'Accept: text/plain'.

Note: This resource is currently not paged. The server will internally apply a hard cap to the streamed lines, and it is not possible to request subsequent pages if that cap is exceeded. In the event that the cap is reached, the diff will be cut short and one or more {@code truncated} flags will be set to true on the "segments", "hunks" and "diffs" properties, as well as the top-level object, in the returned JSON response.

The authenticated user must have REPO_READ permission for the specified repository to call this resource.

Request

Path parameters

commitId

string

Required
repositorySlug

string

Required
path

string

Required
projectKey

string

Required

Query parameters

srcPath

string

avatarSize

string

filter

string

avatarScheme

string

contextLines

string

autoSrcPath

string

whitespace

string

withComments

string

since

string

Responses

A diff between two revisions.

application/json;charset=UTF-8

RestDiff
GET/api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/diff/{path}
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/diff/{path}' \ --header 'Accept: application/json;charset=UTF-8'
GET

Get the common ancestor between two commits

Returns the best common ancestor between two commits. If more than one best common ancestor exists, only one will be returned. It is unspecified which will be returned.

Request

Path parameters

projectKey

string

Required
commitId

string

Required
repositorySlug

string

Required

Query parameters

otherCommitId

string

Responses

The common ancestor of the two given commits

application/json;charset=UTF-8

RestCommit
GET/api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/merge-base
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/merge-base' \ --header 'Accept: application/json;charset=UTF-8'
POST

Watch commit

Add the authenticated user as a watcher for the specified commit.

The authenticated user must have REPO_READ permission for the repository containing the commit to call this resource.

Request

Path parameters

projectKey

string

Required
commitId

string

Required
repositorySlug

string

Required

Responses

The user is now watching the commit.

POST/api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/watch
1 2 curl --request POST \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/watch'
DEL

Stop watching commit

Remove the authenticated user as a watcher for the specified commit.

The authenticated user must have REPO_READ permission for the repository containing the commit to call this resource.

Request

Path parameters

projectKey

string

Required
commitId

string

Required
repositorySlug

string

Required

Responses

The user is no longer watching the commit.

DEL/api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/watch
1 2 curl --request DELETE \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/watch'
GET

Compare commits

Gets the file changes available in the from commit but not in the to commit.

If either the from or to commit are not specified, they will be replaced by the default branch of their containing repository.

Request

Path parameters

projectKey

string

Required
repositorySlug

string

Required

Query parameters

fromRepo

string

from

string

to

string

start

number

limit

number

Responses

A page of changes.

application/json;charset=UTF-8

object
GET/api/latest/projects/{projectKey}/repos/{repositorySlug}/compare/changes
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/compare/changes' \ --header 'Accept: application/json;charset=UTF-8'
GET

Get accessible commits

Gets the commits accessible from the from commit but not in the to commit.

If either the from or to commit are not specified, they will be replaced by the default branch of their containing repository.

Request

Path parameters

projectKey

string

Required
repositorySlug

string

Required

Query parameters

fromRepo

string

from

string

to

string

start

number

limit

number

Responses

A page of commits.

application/json;charset=UTF-8

object
GET/api/latest/projects/{projectKey}/repos/{repositorySlug}/compare/commits
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/compare/commits' \ --header 'Accept: application/json;charset=UTF-8'
GET

Retrieve the diff stats summary between commits

Retrieve the diff stats summary of the changes available in the from commit but not in the to commit.

If either the from or to commit are not specified, they will be replaced by the default branch of their containing repository.

Request

Path parameters

path

string

Required
projectKey

string

Required
repositorySlug

string

Required

Query parameters

fromRepo

string

srcPath

string

from

string

to

string

whitespace

string

Responses

The diff stats summary for the changes.

application/json;charset=UTF-8

RestDiff
GET/api/latest/projects/{projectKey}/repos/{repositorySlug}/compare/diff-stats-summary{path}
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/compare/diff-stats-summary{path}' \ --header 'Accept: application/json;charset=UTF-8'
GET

Get diff between commits

Gets a diff of the changes available in the from commit but not in the to commit.

If either the from or to commit are not specified, they will be replaced by the default branch of their containing repository.

Request

Path parameters

path

string

Required
projectKey

string

Required
repositorySlug

string

Required

Query parameters

contextLines

string

fromRepo

string

srcPath

string

from

string

to

string

whitespace

string

Responses

The diff of the changes.

application/json;charset=UTF-8

RestDiff
GET/api/latest/projects/{projectKey}/repos/{repositorySlug}/compare/diff{path}
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/compare/diff{path}' \ --header 'Accept: application/json;charset=UTF-8'
GET

Get raw diff for path

Stream the raw diff between two provided revisions.

The authenticated user must have REPO_READ permission for the specified repository to call this resource.

Request

Path parameters

projectKey

string

Required
repositorySlug

string

Required

Query parameters

contextLines

string

srcPath

string

until

string

whitespace

string

since

string

Responses

A raw diff between two revisions.

text/plain; qs=0.1

any

GET/api/latest/projects/{projectKey}/repos/{repositorySlug}/diff
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/diff' \ --header 'Accept: text/plain; qs=0.1'
GET

Get raw diff for path

Stream the raw diff between two provided revisions.

The authenticated user must have REPO_READ permission for the specified repository to call this resource.

Request

Path parameters

path

string

Required
projectKey

string

Required
repositorySlug

string

Required

Query parameters

contextLines

string

srcPath

string

until

string

whitespace

string

since

string

Responses

A raw diff between two revisions.

text/plain; qs=0.1

any

GET/api/latest/projects/{projectKey}/repos/{repositorySlug}/diff/{path}
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/diff/{path}' \ --header 'Accept: text/plain; qs=0.1'
GET

Get files in directory

Retrieve a page of files from particular directory of a repository. The search is done recursively, so all files from any sub-directory of the specified directory will be returned.

The authenticated user must have REPO_READ permission for the specified repository to call this resource.

Request

Path parameters

projectKey

string

Required
repositorySlug

string

Required

Query parameters

at

string

start

number

limit

number

Responses

A page of files.

application/json;charset=UTF-8

object
GET/api/latest/projects/{projectKey}/repos/{repositorySlug}/files
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/files' \ --header 'Accept: application/json;charset=UTF-8'
GET

Get files in directory

Retrieve a page of files from particular directory of a repository. The search is done recursively, so all files from any sub-directory of the specified directory will be returned.

The authenticated user must have REPO_READ permission for the specified repository to call this resource.

Request

Path parameters

path

string

Required
projectKey

string

Required
repositorySlug

string

Required

Query parameters

at

string

start

number

limit

number

Responses

A page of files.

application/json;charset=UTF-8

object
GET/api/latest/projects/{projectKey}/repos/{repositorySlug}/files/{path}
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/files/{path}' \ --header 'Accept: application/json;charset=UTF-8'
GET

Get hook scripts

Return a page of hook scripts configured for the specified repository.

This endpoint requires REPO_ADMIN permission.

Request

Path parameters

projectKey

string

Required
repositorySlug

string

Required

Query parameters

start

number

limit

number

Responses

A page of hook scripts.

application/json;charset=UTF-8

object
GET/api/latest/projects/{projectKey}/repos/{repositorySlug}/hook-scripts
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/hook-scripts' \ --header 'Accept: application/json;charset=UTF-8'
PUT

Create/update a hook script

Creates/updates the hook script configuration for the provided hook script and repository.

This endpoint requires REPO_ADMIN permission.

Request

Path parameters

projectKey

string

Required
scriptId

string

Required
repositorySlug

string

Required

Request bodyapplication/json

The hook triggers for which the hook script should be run

triggerIds

array<string>

Responses

The updated hook script.

application/json;charset=UTF-8

RestHookScriptConfig
PUT/api/latest/projects/{projectKey}/repos/{repositorySlug}/hook-scripts/{scriptId}
1 2 3 4 5 6 7 8 9 curl --request PUT \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/hook-scripts/{scriptId}' \ --header 'Accept: application/json;charset=UTF-8' \ --header 'Content-Type: application/json' \ --data '{ "triggerIds": [ "<string>" ] }'
DEL

Remove a hook script

Removes the hook script from the set of hook scripts configured to run in the repository.

This endpoint requires REPO_ADMIN permission.

Request

Path parameters

projectKey

string

Required
scriptId

string

Required
repositorySlug

string

Required

Responses

The hook script was successfully deleted.

DEL/api/latest/projects/{projectKey}/repos/{repositorySlug}/hook-scripts/{scriptId}
1 2 curl --request DELETE \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/hook-scripts/{scriptId}'
GET

Get repository labels

Get all labels applied to the given repository.

The authenticated user must have REPO_READ permission for the specified repository.

Request

Path parameters

projectKey

string

Required
repositorySlug

string

Required

Responses

The applied label.

application/json;charset=UTF-8

RestLabel
GET/api/latest/projects/{projectKey}/repos/{repositorySlug}/labels
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/labels' \ --header 'Accept: application/json;charset=UTF-8'
POST

Add repository label

Applies a label to the repository.

The authenticated user must have REPO_ADMIN permission for the specified repository.

Request

Path parameters

projectKey

string

Required
repositorySlug

string

Required

Request bodyapplication/json

The label to apply

name

string

Responses

The applied label.

application/json;charset=UTF-8

RestLabel
POST/api/latest/projects/{projectKey}/repos/{repositorySlug}/labels
1 2 3 4 5 6 7 curl --request POST \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/labels' \ --header 'Accept: application/json;charset=UTF-8' \ --header 'Content-Type: application/json' \ --data '{ "name": "labelName" }'
DEL

Remove repository label

Remove label that is applied to the given repository.

The authenticated user must have REPO_ADMIN permission for the specified repository.

Request

Path parameters

projectKey

string

Required
labelName

string

Required
repositorySlug

string

Required

Responses

An empty response indicating that the label is no longer associated to the repository.

DEL/api/latest/projects/{projectKey}/repos/{repositorySlug}/labels/{labelName}
1 2 curl --request DELETE \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/labels/{labelName}'
GET

Stream files

Streams files from the repository's root with the last commit to modify each file. Commit modifications are traversed starting from the at commit or, if not specified, from the tip of the default branch.

Unless the repository is public, the authenticated user must have REPO_READ access to call this resource.

Request

Path parameters

projectKey

string

Required
repositorySlug

string

Required

Query parameters

at

string

Responses

A map of files to the last commit that modified them, and the latest commit to the repository (by nature, any commit to a repository modifies its root).

application/json;charset=UTF-8

ExampleFiles
GET/api/latest/projects/{projectKey}/repos/{repositorySlug}/last-modified
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/last-modified' \ --header 'Accept: application/json;charset=UTF-8'
GET

Stream files with last modified commit in path

Streams files in the requested path with the last commit to modify each file. Commit modifications are traversed starting from the at commit or, if not specified, from the tip of the default branch.

Unless the repository is public, the authenticated user must have REPO_READ access to call this resource.

Request

Path parameters

path

string

Required
projectKey

string

Required
repositorySlug

string

Required

Query parameters

at

string

Responses

A map of files to the last commit that modified them, and the latest commit to update the requested path.

application/json;charset=UTF-8

ExampleFiles
GET/api/latest/projects/{projectKey}/repos/{repositorySlug}/last-modified/{path}
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/last-modified/{path}' \ --header 'Accept: application/json;charset=UTF-8'
GET

Get patch content at revision

Retrieve the patch content for a repository at a specified revision.

Cache headers are added to the response (only if full commit hashes are used, not in the case of short hashes).

The authenticated user must have REPO_READ permission for the specified repository to call this resource.

Request

Path parameters

projectKey

string

Required
repositorySlug

string

Required

Query parameters

until

string

allAncestors

string

since

string

Responses

The patch contents from a repository.

text/plain

any

GET/api/latest/projects/{projectKey}/repos/{repositorySlug}/patch
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/patch' \ --header 'Accept: text/plain'
GET

Get raw content of a file at revision

Retrieve the raw content for a file path at a specified revision.

The authenticated user must have REPO_READ permission for the specified repository to call this resource.

Request

Path parameters

path

string

Required
projectKey

string

Required
repositorySlug

string

Required

Query parameters

at

string

markup

string

htmlEscape

string

includeHeadingId

string

hardwrap

string

Responses

The raw contents from a file.

application/json

any

GET/api/latest/projects/{projectKey}/repos/{repositorySlug}/raw/{path}
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/raw/{path}' \ --header 'Accept: application/json'
GET

Get ref change activity

Retrieve a page of repository ref change activity.

The authenticated user must have REPO_ADMIN permission to call this resource.

Request

Path parameters

projectKey

string

Required
repositorySlug

string

Required

Query parameters

ref

string

start

number

limit

number

Responses

A page of ref change activity.

application/json;charset=UTF-8

object
GET/api/latest/projects/{projectKey}/repos/{repositorySlug}/ref-change-activities
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/ref-change-activities' \ --header 'Accept: application/json;charset=UTF-8'
GET

Get branches with ref change activities for repository

Retrieve a page of branches with ref change activities for a specific repository.

The authenticated user must have REPO_ADMIN permission to call this resource.

Request

Path parameters

projectKey

string

Required
repositorySlug

string

Required

Query parameters

filterText

string

start

number

limit

number

Responses

A page of branches with ref change activities.

application/json;charset=UTF-8

object
GET/api/latest/projects/{projectKey}/repos/{repositorySlug}/ref-change-activities/branches
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/ref-change-activities/branches' \ --header 'Accept: application/json;charset=UTF-8'
GET

Get auto decline settings

Retrieves the auto decline settings for the supplied repository. Project settings will be returned if no explicit settings have been set for the repository. In the case that there are no project settings, the default settings will be returned.

The authenticated user must have REPO_READ permission for this repository to call the resource.

Request

Path parameters

projectKey

string

Required
repositorySlug

string

Required

Responses

The auto decline settings

application/json;charset=UTF-8

RestAutoDeclineSettings
GET/api/latest/projects/{projectKey}/repos/{repositorySlug}/settings/auto-decline
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/settings/auto-decline' \ --header 'Accept: application/json;charset=UTF-8'
PUT

Create auto decline settings

Creates or updates the auto decline settings for the supplied repository.

The authenticated user must have REPO_ADMIN permission for this repository to call the resource

Request

Path parameters

projectKey

string

Required
repositorySlug

string

Required

Request bodyapplication/json

The settings to create or update

enabled

boolean

inactivityWeeks

integer

Responses

The auto decline settings

application/json;charset=UTF-8

RestAutoDeclineSettings
PUT/api/latest/projects/{projectKey}/repos/{repositorySlug}/settings/auto-decline
1 2 3 4 5 6 7 8 curl --request PUT \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/settings/auto-decline' \ --header 'Accept: application/json;charset=UTF-8' \ --header 'Content-Type: application/json' \ --data '{ "enabled": true, "inactivityWeeks": 4 }'
DEL

Delete auto decline settings

Delete auto decline settings for the supplied repository.

The authenticated user must have REPO_ADMIN permission for this repository to call the resource.

Request

Path parameters

projectKey

string

Required
repositorySlug

string

Required

Responses

The auto decline settings have been deleted successfully.

DEL/api/latest/projects/{projectKey}/repos/{repositorySlug}/settings/auto-decline
1 2 curl --request DELETE \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/settings/auto-decline'
GET

Get pull request auto-merge settings

Retrieves the pull request auto-merge settings for the supplied repository. Project settings will be returned if no explicit settings have been set for the repository. In the case that there are no project settings, the default settings will be returned. If the repository's project has restricted its auto-merge settings, then the settings of the project will be returned.

The authenticated user must have REPO_READ permission for this repository to call the resource.

Request

Path parameters

projectKey

string

Required
repositorySlug

string

Required

Responses

The pull request auto-merge settings

application/json;charset=UTF-8

RestAutoMergeRestrictedSettings
GET/api/latest/projects/{projectKey}/repos/{repositorySlug}/settings/auto-merge
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/settings/auto-merge' \ --header 'Accept: application/json;charset=UTF-8'
PUT

Create or update the pull request auto-merge settings

Creates or updates the pull request auto-merge settings for the supplied repository.

The authenticated user must have REPO_ADMIN permission for this repository to call the resource.

Request

Path parameters

projectKey

string

Required
repositorySlug

string

Required

Request bodyapplication/json

The settings to create or update

enabled

boolean

Responses

The pull request auto-merge settings

application/json;charset=UTF-8

RestAutoMergeRestrictedSettings
PUT/api/latest/projects/{projectKey}/repos/{repositorySlug}/settings/auto-merge
1 2 3 4 5 6 7 curl --request PUT \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/settings/auto-merge' \ --header 'Accept: application/json;charset=UTF-8' \ --header 'Content-Type: application/json' \ --data '{ "enabled": false }'
DEL

Delete pull request auto-merge settings

Deletes pull request auto-merge settings for the supplied repository.

The authenticated user must have REPO_ADMIN permission for this repository to call the resource.

Request

Path parameters

projectKey

string

Required
repositorySlug

string

Required

Responses

The pull request auto-merge settings

DEL/api/latest/projects/{projectKey}/repos/{repositorySlug}/settings/auto-merge
1 2 curl --request DELETE \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/settings/auto-merge'
GET

Get repository hooks

Retrieve a page of repository hooks for this repository.

The authenticated user must have REPO_ADMIN permission for the specified repository to call this resource.

Request

Path parameters

projectKey

string

Required
repositorySlug

string

Required

Query parameters

type

string

start

number

limit

number

Responses

A page of repository hooks with their associated enabled state.

application/json;charset=UTF-8

object
GET/api/latest/projects/{projectKey}/repos/{repositorySlug}/settings/hooks
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/settings/hooks' \ --header 'Accept: application/json;charset=UTF-8'
GET

Get repository hook

Retrieve a repository hook for this repository.

The authenticated user must have REPO_ADMIN permission for the specified repository to call this resource.

Request

Path parameters

projectKey

string

Required
hookKey

string

Required
repositorySlug

string

Required

Responses

The repository hooks with their associated enabled state for the supplied hookKey.

application/json;charset=UTF-8

RestRepositoryHook
GET/api/latest/projects/{projectKey}/repos/{repositorySlug}/settings/hooks/{hookKey}
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/settings/hooks/{hookKey}' \ --header 'Accept: application/json;charset=UTF-8'
DEL

Delete repository hook

Delete repository hook configuration for the supplied hookKey and repositorySlug

The authenticated user must have REPO_ADMIN permission for the specified repository to call this resource.

Request

Path parameters

projectKey

string

Required
hookKey

string

Required
repositorySlug

string

Required

Responses

The hook configuration matching the supplied hookKey and repositorySlug was deleted

DEL/api/latest/projects/{projectKey}/repos/{repositorySlug}/settings/hooks/{hookKey}
1 2 curl --request DELETE \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/settings/hooks/{hookKey}'
PUT

Enable repository hook

Enable a repository hook for this repository and optionally apply new configuration.

The authenticated user must have REPO_ADMIN permission for the specified repository to call this resource.

A JSON document may be provided to use as the settings for the hook. These structure and validity of the document is decided by the plugin providing the hook.

Request

Path parameters

projectKey

string

Required
hookKey

string

Required
repositorySlug

string

Required

Header parameters

Content-Length

string

Responses

The repository hooks with their associated enabled state for the supplied hookKey.

application/json;charset=UTF-8

RestRepositoryHook
PUT/api/latest/projects/{projectKey}/repos/{repositorySlug}/settings/hooks/{hookKey}/enabled
1 2 3 curl --request PUT \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/settings/hooks/{hookKey}/enabled' \ --header 'Accept: application/json;charset=UTF-8'
DEL

Disable repository hook

Disable a repository hook for this repository.

The authenticated user must have REPO_ADMIN permission for the specified repository to call this resource.

Request

Path parameters

projectKey

string

Required
hookKey

string

Required
repositorySlug

string

Required

Responses

The repository hooks with their associated enabled state for the supplied hookKey.

application/json;charset=UTF-8

RestRepositoryHook
DEL/api/latest/projects/{projectKey}/repos/{repositorySlug}/settings/hooks/{hookKey}/enabled
1 2 3 curl --request DELETE \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/settings/hooks/{hookKey}/enabled' \ --header 'Accept: application/json;charset=UTF-8'
GET

Get repository hook settings

Retrieve the settings for a repository hook for this repository.

The authenticated user must have REPO_ADMIN permission for the specified repository to call this resource.

Request

Path parameters

projectKey

string

Required
hookKey

string

Required
repositorySlug

string

Required

Responses

The settings for the hook.

application/json;charset=UTF-8

ExampleSettings
GET/api/latest/projects/{projectKey}/repos/{repositorySlug}/settings/hooks/{hookKey}/settings
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/settings/hooks/{hookKey}/settings' \ --header 'Accept: application/json;charset=UTF-8'
PUT

Update repository hook settings

Modify the settings for a repository hook for this repository.

The service will reject any settings which are too large, the current limit is 32KB once serialized.

The authenticated user must have REPO_ADMIN permission for the specified repository to call this resource.

A JSON document can be provided to use as the settings for the hook. These structure and validity of the document is decided by the plugin providing the hook.

Request

Path parameters

projectKey

string

Required
hookKey

string

Required
repositorySlug

string

Required

Request bodyapplication/json

The raw settings.

booleanValue

boolean

doubleValue

number

integerValue

integer

longValue

integer

stringValue

string

Responses

The settings for the hook.

application/json;charset=UTF-8

ExampleSettings
PUT/api/latest/projects/{projectKey}/repos/{repositorySlug}/settings/hooks/{hookKey}/settings
1 2 3 4 5 6 7 8 9 10 11 curl --request PUT \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/settings/hooks/{hookKey}/settings' \ --header 'Accept: application/json;charset=UTF-8' \ --header 'Content-Type: application/json' \ --data '{ "booleanValue": true, "doubleValue": 1.1, "integerValue": 1, "longValue": -2147483648, "stringValue": "This is an arbitrary string" }'
GET

Get pull request settings

Retrieve the pull request settings for the context repository.

The authenticated user must have REPO_READ permission for the context repository to call this resource.

This resource will call all RestFragments that are registered with the key bitbucket.repository.settings.pullRequests. If any fragment fails validations by returning a non-empty Map of errors, then no fragments will execute.

The property keys for the settings that are bundled with the application are

  • mergeConfig - the merge strategy configuration for pull requests
  • requiredApprovers - (Deprecated, please use com.atlassian.bitbucket.server.bundled-hooks.requiredApproversMergeHook instead) the number of approvals required on a pull request for it to be mergeable, or 0 if the merge check is disabled
  • com.atlassian.bitbucket.server.bundled-hooks.requiredApproversMergeHook - the merge check configuration for required approvers
  • requiredAllApprovers - whether or not all approvers must approve a pull request for it to be mergeable
  • requiredAllTasksComplete - whether or not all tasks on a pull request need to be completed for it to be mergeable
  • requiredSuccessfulBuilds - (Deprecated, please use com.atlassian.bitbucket.server.bitbucket-build.requiredBuildsMergeCheck instead) the number of successful builds on a pull request for it to be mergeable, or 0 if the merge check is disabled
  • com.atlassian.bitbucket.server.bitbucket-build.requiredBuildsMergeCheck - the merge check configuration for required builds

Request

Path parameters

projectKey

string

Required
repositorySlug

string

Required

Responses

The repository pull request settings for the context repository.

application/json;charset=UTF-8

RestRepositoryPullRequestSettings
GET/api/latest/projects/{projectKey}/repos/{repositorySlug}/settings/pull-requests
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/settings/pull-requests' \ --header 'Accept: application/json;charset=UTF-8'
POST

Update pull request settings

Update the pull request settings for the context repository.

The authenticated user must have REPO_ADMIN permission for the context repository to call this resource.

This resource will call all RestFragments that are registered with the key bitbucket.repository.settings.pullRequests. If any fragment fails validations by returning a non-empty Map of errors, then no fragments will execute.

Only the settings that should be updated need to be included in the request.

The property keys for the settings that are bundled with the application are

  • mergeConfig - the merge strategy configuration for pull requests
  • requiredApprovers - (Deprecated, please use com.atlassian.bitbucket.server.bundled-hooks.requiredApproversMergeHook instead) the number of approvals required on a pull request for it to be mergeable, or 0 to disable the merge check
  • com.atlassian.bitbucket.server.bundled-hooks.requiredApproversMergeHook - a json map containing the keys 'enabled' (a boolean to enable or disable this merge check) and 'count' (an integer to set the number of required approvals)
  • requiredAllApprovers - whether or not all approvers must approve a pull request for it to be mergeable
  • requiredAllTasksComplete - whether or not all tasks on a pull request need to be completed for it to be mergeable
  • requiredSuccessfulBuilds - (Deprecated, please use com.atlassian.bitbucket.server.bitbucket-build.requiredBuildsMergeCheck instead) the number of successful builds on a pull request for it to be mergeable, or 0 to disable the merge check
  • com.atlassian.bitbucket.server.bitbucket-build.requiredBuildsMergeCheck - a json map containing the keys 'enabled' (a boolean to enable or disable this merge check) and 'count' (an integer to set the number of required builds)

Merge strategy configuration deletion:

An explicitly set pull request merge strategy configuration can be deleted by POSTing a document with an empty "mergeConfig" attribute. i.e:

1 2 3 "mergeConfig": { } }

Upon completion of this request, the effective configuration will be:

  • The configuration set for this repository's SCM type as set at the project level, if present, otherwise
  • the configuration set for this repository's SCM type as set at the instance level, if present, otherwise
  • the default configuration for this repository's SCM type

Request

Path parameters

projectKey

string

Required
repositorySlug

string

Required

Request bodyapplication/json

The updated settings.

mergeConfig

object

requiredAllApprovers

boolean

requiredAllTasksComplete

boolean

requiredApprovers

object

requiredApproversDeprecated

integer

requiredSuccessfulBuilds

object

requiredSuccessfulBuildsDeprecated

integer

Responses

The repository pull request settings for the context repository.

application/json;charset=UTF-8

RestRepositoryPullRequestSettings
POST/api/latest/projects/{projectKey}/repos/{repositorySlug}/settings/pull-requests
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 curl --request POST \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/settings/pull-requests' \ --header 'Accept: application/json;charset=UTF-8' \ --header 'Content-Type: application/json' \ --data '{ "mergeConfig": { "commitMessageTemplate": { "body": "Merge in ${toProjectKey}/${toRepoSlug} from ${crossRepoProjectRepo}${fromRefName} to ${toRefName}", "title": "Pull request #${id}: ${title}" }, "commitSummaries": 2154, "defaultStrategy": { "id": "no-ff", "links": {} }, "strategies": [ { "id": "no-ff", "links": {} } ] }, "requiredAllApprovers": true, "requiredAllTasksComplete": true, "requiredApprovers": { "count": "3", "enabled": true }, "requiredApproversDeprecated": 2154, "requiredSuccessfulBuilds": { "count": "3", "enabled": true }, "requiredSuccessfulBuildsDeprecated": 2154 }'
GET

Find tag

Retrieve the tags matching the supplied filterText param.

The authenticated user must have REPO_READ permission for the context repository to call this resource.

Request

Path parameters

projectKey

string

Required
repositorySlug

string

Required

Query parameters

orderBy

string

filterText

string

start

number

limit

number

Responses

The tags matching the supplied filterText.

application/json;charset=UTF-8

object
GET/api/latest/projects/{projectKey}/repos/{repositorySlug}/tags
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/tags' \ --header 'Accept: application/json;charset=UTF-8'
POST

Create tag

Creates a tag using the information provided in the RestCreateTagRequest request

The authenticated user must have REPO_WRITE permission for the context repository to call this resource.

Request

Path parameters

projectKey

string

Required
repositorySlug

string

Required

Request bodyapplication/json

The request to create a tag containing a name, startPoint, and optionally a message

message

string

name

string

startPoint

string

Responses

The created tag.

application/json;charset=UTF-8

RestTag
POST/api/latest/projects/{projectKey}/repos/{repositorySlug}/tags
1 2 3 4 5 6 7 8 9 curl --request POST \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/tags' \ --header 'Accept: application/json;charset=UTF-8' \ --header 'Content-Type: application/json' \ --data '{ "message": "This is my branch or tag", "name": "my-branch-or-tag", "startPoint": "8d351a10fb428c0c1239530256e21cf24f136e73" }'
GET

Get tag

Retrieve a tag in the specified repository.

The authenticated user must have REPO_READ permission for the context repository to call this resource.

Request

Path parameters

projectKey

string

Required
name

string

Required
repositorySlug

string

Required

Responses

The tag which matches the supplied name.

application/json;charset=UTF-8

RestTag
GET/api/latest/projects/{projectKey}/repos/{repositorySlug}/tags/{name}
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/tags/{name}' \ --header 'Accept: application/json;charset=UTF-8'
POST

Watch repository

Add the authenticated user as a watcher for the specified repository.

The authenticated user must have REPO_READ permission for the repository to call this resource.

Request

Path parameters

projectKey

string

Required
repositorySlug

string

Required

Request bodyapplication/json

The repository to watch.

defaultBranch

string

links

object

name

string

project

object

scmId

string

slug

string

Responses

The user is now watching the repository.

POST/api/latest/projects/{projectKey}/repos/{repositorySlug}/watch
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 curl --request POST \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/watch' \ --header 'Content-Type: application/json' \ --data '{ "defaultBranch": "main", "links": {}, "name": "My repo", "project": { "avatar": "<string>", "avatarUrl": "<string>", "key": "PRJ", "links": {} }, "scmId": "git", "slug": "my-repo" }'
DEL

Stop watching repository

Remove the authenticated user as a watcher for the specified repository.

The authenticated user must have REPO_READ permission for the repository to call this resource.

Request

Path parameters

projectKey

string

Required
repositorySlug

string

Required

Responses

The user is no longer watching the repository.

DEL/api/latest/projects/{projectKey}/repos/{repositorySlug}/watch
1 2 curl --request DELETE \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/watch'
GET

Find webhooks

Find webhooks in this repository.

The authenticated user must have REPO_ADMIN permission for the specified repository to call this resource.

Request

Path parameters

projectKey

string

Required
repositorySlug

string

Required

Query parameters

event

string

statistics

boolean

Responses

A page of webhooks.

application/json;charset=UTF-8

any

GET/api/latest/projects/{projectKey}/repos/{repositorySlug}/webhooks
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/webhooks' \ --header 'Accept: application/json;charset=UTF-8'
POST

Create webhook

Create a webhook for the repository specified via the URL.

The authenticated user must have REPO_ADMIN permission for the specified repository to call this resource.

Request

Path parameters

projectKey

string

Required
repositorySlug

string

Required

Request bodyapplication/json

The webhook to be created for this repository.

active

boolean

configuration

object

credentials

RestWebhookCredentials

events

array<string>

name

string

scopeType

string

sslVerificationRequired

boolean

statistics

object

url

string

Responses

A created webhook.

application/json;charset=UTF-8

RestWebhook
POST/api/latest/projects/{projectKey}/repos/{repositorySlug}/webhooks
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 curl --request POST \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/webhooks' \ --header 'Accept: application/json;charset=UTF-8' \ --header 'Content-Type: application/json' \ --data '{ "active": true, "configuration": {}, "credentials": { "password": "<string>", "username": "<string>" }, "events": [ "<string>" ], "name": "<string>", "scopeType": "<string>", "sslVerificationRequired": true, "statistics": {}, "url": "<string>" }'
GET

Search webhooks

Search webhooks in this repository and parent project. This endpoint returns a superset of the results returned by the /webhooks endpoint because it allows filtering by project scope too, not just repository webhooks.

The authenticated user must have REPO_ADMIN permission for the specified repository to call this resource.

Request

Path parameters

projectKey

string

Required
repositorySlug

string

Required

Query parameters

scopeType

string

event

string

statistics

boolean

Responses

A page of webhooks.

application/json;charset=UTF-8

any

GET/api/latest/projects/{projectKey}/repos/{repositorySlug}/webhooks/search
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/webhooks/search' \ --header 'Accept: application/json;charset=UTF-8'
POST

Test webhook

Test connectivity to a specific endpoint.

The authenticated user must have REPO_ADMIN permission for the specified repository to call this resource.

Request

Path parameters

projectKey

string

Required
repositorySlug

string

Required

Query parameters

webhookId

integer

sslVerificationRequired

string

url

string

Request bodyapplication/json

Basic authentication credentials, if required.

password

string

username

string

Responses

A webhook.

application/json;charset=UTF-8

RestWebhookRequestResponse

POST/api/latest/projects/{projectKey}/repos/{repositorySlug}/webhooks/test
1 2 3 4 5 6 7 8 curl --request POST \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/webhooks/test' \ --header 'Accept: application/json;charset=UTF-8' \ --header 'Content-Type: application/json' \ --data '{ "password": "<string>", "username": "<string>" }'
GET

Get webhook

Get a webhook by ID.

The authenticated user must have REPO_ADMIN permission for the specified repository to call this resource.

Request

Path parameters

projectKey

string

Required
webhookId

string

Required
repositorySlug

string

Required

Query parameters

statistics

string

Responses

A webhook.

application/json;charset=UTF-8

RestWebhook
GET/api/latest/projects/{projectKey}/repos/{repositorySlug}/webhooks/{webhookId}
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/webhooks/{webhookId}' \ --header 'Accept: application/json;charset=UTF-8'
PUT

Update webhook

Update an existing webhook.

The authenticated user must have REPO_ADMIN permission for the specified repository to call this resource.

Request

Path parameters

projectKey

string

Required
webhookId

string

Required
repositorySlug

string

Required

Request bodyapplication/json

The representation of the updated values for the webhook

active

boolean

configuration

object

credentials

RestWebhookCredentials

events

array<string>

name

string

scopeType

string

sslVerificationRequired

boolean

statistics

object

url

string

Responses

A webhook.

application/json;charset=UTF-8

RestWebhook
PUT/api/latest/projects/{projectKey}/repos/{repositorySlug}/webhooks/{webhookId}
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 curl --request PUT \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/webhooks/{webhookId}' \ --header 'Accept: application/json;charset=UTF-8' \ --header 'Content-Type: application/json' \ --data '{ "active": true, "configuration": {}, "credentials": { "password": "<string>", "username": "<string>" }, "events": [ "<string>" ], "name": "<string>", "scopeType": "<string>", "sslVerificationRequired": true, "statistics": {}, "url": "<string>" }'
DEL

Delete webhook

Delete a webhook for the repository specified via the URL.

The authenticated user must have REPO_ADMIN permission for the specified repository to call this resource.

Request

Path parameters

projectKey

string

Required
webhookId

string

Required
repositorySlug

string

Required

Responses

The webhook for the repository has been deleted.

DEL/api/latest/projects/{projectKey}/repos/{repositorySlug}/webhooks/{webhookId}
1 2 curl --request DELETE \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/webhooks/{webhookId}'
GET

Get last webhook invocation details

Get the latest invocations for a specific webhook.

The authenticated user must have REPO_ADMIN permission for the specified repository to call this resource.

Request

Path parameters

projectKey

string

Required
webhookId

string

Required
repositorySlug

string

Required

Query parameters

event

string

outcome

string

Responses

A webhook invocation dataset.

application/json;charset=UTF-8

RestDetailedInvocation
GET/api/latest/projects/{projectKey}/repos/{repositorySlug}/webhooks/{webhookId}/latest
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/webhooks/{webhookId}/latest' \ --header 'Accept: application/json;charset=UTF-8'
GET

Get webhook statistics

Get the statistics for a specific webhook.

The authenticated user must have REPO_ADMIN permission for the specified repository to call this resource.

Request

Path parameters

projectKey

string

Required
webhookId

string

Required
repositorySlug

string

Required

Query parameters

event

string

Responses

A webhook invocation dataset.

application/json;charset=UTF-8

RestInvocationHistory

GET/api/latest/projects/{projectKey}/repos/{repositorySlug}/webhooks/{webhookId}/statistics
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/webhooks/{webhookId}/statistics' \ --header 'Accept: application/json;charset=UTF-8'
GET

Get webhook statistics summary

Get the statistics summary for a specific webhook.

The authenticated user must have REPO_ADMIN permission for the specified repository to call this resource.

Request

Path parameters

projectKey

string

Required
webhookId

string

Required
repositorySlug

string

Required

Responses

A webhook invocation dataset.

application/json;charset=UTF-8

RestInvocationHistory

GET/api/latest/projects/{projectKey}/repos/{repositorySlug}/webhooks/{webhookId}/statistics/summary
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/webhooks/{webhookId}/statistics/summary' \ --header 'Accept: application/json;charset=UTF-8'
GET

Search for repositories

Retrieve a page of repositories based on query parameters that control the search. See the documentation of the parameters for more details.

This resource is anonymously accessible, if anonymous access is enabled.

Note on permissions. In absence of the permission query parameter the implicit 'read' permission is assumed. Please note that this permission is lower than the REPO_READ permission rather than being equal to it. The implicit 'read' permission for a given repository is assigned to any user that has any of the higher permissions, such as REPO_READ, as well as to anonymous users if the repository is marked as public. The important implication of the above is that an anonymous request to this resource with a permission level REPO_READ is guaranteed to receive an empty list of repositories as a result. For anonymous requests it is therefore recommended to not specify the permission parameter at all.

Request

Query parameters

archived

string

projectname

string

projectkey

string

visibility

string

name

string

permission

string

state

string

start

number

limit

number

Responses

A page of repositories.

application/json;charset=UTF-8

object
GET/api/latest/repos
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/api/latest/repos' \ --header 'Accept: application/json;charset=UTF-8'

Rate this page: