Server
Bitbucket Data Center / / Modules
Operations
GET/branch-permissions/latest/projects/{projectKey}/restrictionsPOST/branch-permissions/latest/projects/{projectKey}/restrictionsGET/branch-permissions/latest/projects/{projectKey}/restrictions/{id}DEL/branch-permissions/latest/projects/{projectKey}/restrictions/{id}GET/api/latest/hooks/{hookKey}/avatarGET/api/latest/projectsPOST/api/latest/projectsGET/api/latest/projects/{projectKey}PUT/api/latest/projects/{projectKey}DEL/api/latest/projects/{projectKey}GET/api/latest/projects/{projectKey}/avatar.pngPOST/api/latest/projects/{projectKey}/avatar.pngGET/api/latest/projects/{projectKey}/hook-scriptsPUT/api/latest/projects/{projectKey}/hook-scripts/{scriptId}DEL/api/latest/projects/{projectKey}/hook-scripts/{scriptId}DEL/api/latest/projects/{projectKey}/permissionsGET/api/latest/projects/{projectKey}/permissions/groupsPUT/api/latest/projects/{projectKey}/permissions/groupsDEL/api/latest/projects/{projectKey}/permissions/groupsGET/api/latest/projects/{projectKey}/permissions/groups/noneGET/api/latest/projects/{projectKey}/permissions/searchGET/api/latest/projects/{projectKey}/permissions/usersPUT/api/latest/projects/{projectKey}/permissions/usersDEL/api/latest/projects/{projectKey}/permissions/usersGET/api/latest/projects/{projectKey}/permissions/users/noneGET/api/latest/projects/{projectKey}/permissions/{permission}/allPOST/api/latest/projects/{projectKey}/permissions/{permission}/allGET/api/latest/projects/{projectKey}/reposPOST/api/latest/projects/{projectKey}/reposGET/api/latest/projects/{projectKey}/repos/{repositorySlug}PUT/api/latest/projects/{projectKey}/repos/{repositorySlug}POST/api/latest/projects/{projectKey}/repos/{repositorySlug}DEL/api/latest/projects/{projectKey}/repos/{repositorySlug}GET/api/latest/projects/{projectKey}/repos/{repositorySlug}/contributingGET/api/latest/projects/{projectKey}/repos/{repositorySlug}/default-branchPUT/api/latest/projects/{projectKey}/repos/{repositorySlug}/default-branchGET/api/latest/projects/{projectKey}/repos/{repositorySlug}/forksGET/api/latest/projects/{projectKey}/repos/{repositorySlug}/licenseGET/api/latest/projects/{projectKey}/repos/{repositorySlug}/readmePOST/api/latest/projects/{projectKey}/repos/{repositorySlug}/recreateGET/api/latest/projects/{projectKey}/repos/{repositorySlug}/relatedGET/api/latest/projects/{projectKey}/settings/auto-declinePUT/api/latest/projects/{projectKey}/settings/auto-declineDEL/api/latest/projects/{projectKey}/settings/auto-declineGET/api/latest/projects/{projectKey}/settings/hooksGET/api/latest/projects/{projectKey}/settings/hooks/{hookKey}PUT/api/latest/projects/{projectKey}/settings/hooks/{hookKey}/enabledDEL/api/latest/projects/{projectKey}/settings/hooks/{hookKey}/enabledGET/api/latest/projects/{projectKey}/settings/hooks/{hookKey}/settingsPUT/api/latest/projects/{projectKey}/settings/hooks/{hookKey}/settingsGET/api/latest/projects/{projectKey}/settings/pull-requests/{scmId}POST/api/latest/projects/{projectKey}/settings/pull-requests/{scmId}
GET

Search for ref restrictions

Search for restrictions using the supplied parameters.

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

Request

Path parameters

projectKey

string

Required

Query parameters

matcherType

string

matcherId

string

type

string

start

number

limit

number

Responses

A response containing a page of restrictions.

application/json

object
GET/branch-permissions/latest/projects/{projectKey}/restrictions
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/branch-permissions/latest/projects/{projectKey}/restrictions' \ --header 'Accept: application/json'
200Response
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 { "values": [ { "id": 1, "type": "pull-request-only", "matcher": { "id": "refs/heads/main", "type": { "name": "Branch", "id": "ANY_REF" }, "displayId": "main" }, "groups": [ "group_a", "group_b" ], "users": [ { "name": "jcitizen", "id": 101, "type": "NORMAL", "displayName": "Jane Citizen", "emailAddress": "jane@example.com", "slug": "jcitizen", "active": true } ], "scope": { "type": "GLOBAL", "resourceId": 2 }, "accessKeys": [ { "key": { "id": 1, "bitLength": 2154, "algorithmType": "<string>", "label": "me@127.0.0.1", "text": "sh-rsa AAAAB3... me@127.0.0.1" }, "permission": "USER_ADMIN", "repository": { "name": "My repo", "id": 2154, "state": "AVAILABLE", "public": true, "hierarchyId": "e3c939f9ef4a7fae272e", "statusMessage": "Available", "archived": true, "forkable": true, "defaultBranch": "main", "relatedLinks": {}, "partition": 2154, "origin": { "name": "My repo", "id": 2154, "state": "AVAILABLE", "public": true, "hierarchyId": "e3c939f9ef4a7fae272e", "statusMessage": "Available", "archived": true, "forkable": true, "defaultBranch": "main", "relatedLinks": {}, "partition": 2154, "project": { "name": "My Cool Project", "key": "PRJ", "id": 2154, "type": "NORMAL", "public": true, "avatar": "<string>", "namespace": "<string>", "description": "The description for my cool project", "scope": "PROJECT" }, "description": "My repo description", "scmId": "git", "slug": "my-repo", "scope": "REPOSITORY" }, "project": { "name": "My Cool Project", "key": "PRJ", "id": 2154, "type": "NORMAL", "public": true, "avatar": "<string>", "namespace": "<string>", "description": "The description for my cool project", "scope": "PROJECT" }, "description": "My repo description", "scmId": "git", "slug": "my-repo", "scope": "REPOSITORY" }, "project": { "name": "My Cool Project", "key": "PRJ", "id": 2154, "type": "NORMAL", "public": true, "avatar": "<string>", "namespace": "<string>", "description": "The description for my cool project", "scope": "PROJECT" } } ] } ], "size": 1, "limit": 25, "isLastPage": true, "nextPageStart": 2154, "start": 2154 }
POST

Create a ref restriction

Create a restriction for the supplied branch or set of branches to be applied on all repositories in the given project.

A restriction means preventing writes on the specified branch(es) by all except a set of users and/or groups, or preventing specific operations such as branch deletion.

For example, you can restrict write access on 'master' to just the 'senior-developer' group, or prevent anyone from deleting that branch.

The request matcher and type must conform to the following.

  • The matcher can be one of the following types
    • 'BRANCH' represents a specific Branch name. You must supply the fully qualified name of the ref to restrict, e.g. "refs/heads/master" instead of "master".
    • 'PATTERN' represents a wildcard pattern that may match multiple branches. You must specify a valid Branch Permission Pattern.
    • 'MODEL_CATEGORY' represents Branch prefixes in the Branching model for the project. The 'id' must be one of
      • 'FEATURE'
      • 'BUGFIX'
      • 'HOTFIX'
      • 'RELEASE'

See the Branch REST API for more information.

  • 'MODEL_BRANCH' represents either the Development or Production branch in the branching model for the project. The 'id' must be one of
    • 'development'
    • 'production'

See the Branch REST API for more information.

  • Type: Set and be one of

    • 'pull-request-only'
    • 'fast-forward-only'
    • 'no-deletes'
    • 'read-only'

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

Request

Path parameters

projectKey

string

Required

Request bodyapplication/json

The request containing the details of the restriction to create.

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

RestRefRestriction
POST/branch-permissions/latest/projects/{projectKey}/restrictions
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 curl --request POST \ --url 'http://{baseurl}/rest/branch-permissions/latest/projects/{projectKey}/restrictions' \ --header 'Accept: application/json' \ --header 'Content-Type: application/json' \ --data '{ "accessKeyIds": [ 1, 2, 3 ], "accessKeys": [ { "key": { "bitLength": 2154, "algorithmType": "<string>", "text": "sh-rsa AAAAB3... me@127.0.0.1" }, "permission": "USER_ADMIN", "repository": { "name": "My repo", "scmId": "git", "slug": "my-repo", "links": {} }, "project": { "key": "PRJ", "avatar": "<string>", "avatarUrl": "<string>", "links": {} } } ], "groupNames": [ "bitbucket-developers" ], "groups": [ "group_a", "group_b" ], "matcher": { "displayId": "main", "id": "refs/heads/main", "type": { "id": "ANY_REF", "name": "Branch" } }, "type": "pull-request-only", "userSlugs": [ "bman", "tstark", "hulk" ], "users": [ { "name": "jcitizen", "type": "NORMAL", "displayName": "Jane Citizen", "emailAddress": "jane@example.com", "slug": "jcitizen", "links": {}, "active": true, "avatarUrl": "<string>" } ] }'
200Response
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 { "id": 1, "type": "pull-request-only", "matcher": { "id": "refs/heads/main", "type": { "name": "Branch", "id": "ANY_REF" }, "displayId": "main" }, "groups": [ "group_a", "group_b" ], "users": [ { "name": "jcitizen", "id": 101, "type": "NORMAL", "displayName": "Jane Citizen", "emailAddress": "jane@example.com", "slug": "jcitizen", "active": true } ], "scope": { "type": "GLOBAL", "resourceId": 2 }, "accessKeys": [ { "key": { "id": 1, "bitLength": 2154, "algorithmType": "<string>", "label": "me@127.0.0.1", "text": "sh-rsa AAAAB3... me@127.0.0.1" }, "permission": "USER_ADMIN", "repository": { "name": "My repo", "id": 2154, "state": "AVAILABLE", "public": true, "hierarchyId": "e3c939f9ef4a7fae272e", "statusMessage": "Available", "archived": true, "forkable": true, "defaultBranch": "main", "relatedLinks": {}, "partition": 2154, "origin": { "name": "My repo", "id": 2154, "state": "AVAILABLE", "public": true, "hierarchyId": "e3c939f9ef4a7fae272e", "statusMessage": "Available", "archived": true, "forkable": true, "defaultBranch": "main", "relatedLinks": {}, "partition": 2154, "project": { "name": "My Cool Project", "key": "PRJ", "id": 2154, "type": "NORMAL", "public": true, "avatar": "<string>", "namespace": "<string>", "description": "The description for my cool project", "scope": "PROJECT" }, "description": "My repo description", "scmId": "git", "slug": "my-repo", "scope": "REPOSITORY" }, "project": { "name": "My Cool Project", "key": "PRJ", "id": 2154, "type": "NORMAL", "public": true, "avatar": "<string>", "namespace": "<string>", "description": "The description for my cool project", "scope": "PROJECT" }, "description": "My repo description", "scmId": "git", "slug": "my-repo", "scope": "REPOSITORY" }, "project": { "name": "My Cool Project", "key": "PRJ", "id": 2154, "type": "NORMAL", "public": true, "avatar": "<string>", "namespace": "<string>", "description": "The description for my cool project", "scope": "PROJECT" } } ] }
GET

Get a ref restriction

Returns a restriction as specified by a restriction id.

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

Request

Path parameters

projectKey

string

Required
id

string

Required

Responses

A response containing the restriction.

application/json

RestRefRestriction
GET/branch-permissions/latest/projects/{projectKey}/restrictions/{id}
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/branch-permissions/latest/projects/{projectKey}/restrictions/{id}' \ --header 'Accept: application/json'
200Response
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 { "id": 1, "type": "pull-request-only", "matcher": { "id": "refs/heads/main", "type": { "name": "Branch", "id": "ANY_REF" }, "displayId": "main" }, "groups": [ "group_a", "group_b" ], "users": [ { "name": "jcitizen", "id": 101, "type": "NORMAL", "displayName": "Jane Citizen", "emailAddress": "jane@example.com", "slug": "jcitizen", "active": true } ], "scope": { "type": "GLOBAL", "resourceId": 2 }, "accessKeys": [ { "key": { "id": 1, "bitLength": 2154, "algorithmType": "<string>", "label": "me@127.0.0.1", "text": "sh-rsa AAAAB3... me@127.0.0.1" }, "permission": "USER_ADMIN", "repository": { "name": "My repo", "id": 2154, "state": "AVAILABLE", "public": true, "hierarchyId": "e3c939f9ef4a7fae272e", "statusMessage": "Available", "archived": true, "forkable": true, "defaultBranch": "main", "relatedLinks": {}, "partition": 2154, "origin": { "name": "My repo", "id": 2154, "state": "AVAILABLE", "public": true, "hierarchyId": "e3c939f9ef4a7fae272e", "statusMessage": "Available", "archived": true, "forkable": true, "defaultBranch": "main", "relatedLinks": {}, "partition": 2154, "project": { "name": "My Cool Project", "key": "PRJ", "id": 2154, "type": "NORMAL", "public": true, "avatar": "<string>", "namespace": "<string>", "description": "The description for my cool project", "scope": "PROJECT" }, "description": "My repo description", "scmId": "git", "slug": "my-repo", "scope": "REPOSITORY" }, "project": { "name": "My Cool Project", "key": "PRJ", "id": 2154, "type": "NORMAL", "public": true, "avatar": "<string>", "namespace": "<string>", "description": "The description for my cool project", "scope": "PROJECT" }, "description": "My repo description", "scmId": "git", "slug": "my-repo", "scope": "REPOSITORY" }, "project": { "name": "My Cool Project", "key": "PRJ", "id": 2154, "type": "NORMAL", "public": true, "avatar": "<string>", "namespace": "<string>", "description": "The description for my cool project", "scope": "PROJECT" } } ] }
DEL

Delete a ref restriction

Deletes a restriction as specified by a restriction id.

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

Request

Path parameters

projectKey

string

Required
id

string

Required

Responses

An empty response indicating that the operation was successful

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

Get project avatar

Retrieve the avatar for the project matching the supplied moduleKey.

Request

Path parameters

hookKey

string

Required

Query parameters

version

string

Responses

The avatar of the project matching the supplied moduleKey.

application/json

any

GET/api/latest/hooks/{hookKey}/avatar
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/api/latest/hooks/{hookKey}/avatar' \ --header 'Accept: application/json'
GET

Get projects

Retrieve a page of projects.

Only projects for which the authenticated user has the PROJECT_VIEW permission will be returned.

Request

Query parameters

name

string

permission

string

start

number

limit

number

Responses

A page of projects.

application/json

object
GET/api/latest/projects
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/api/latest/projects' \ --header 'Accept: application/json'
200Response
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 { "values": [ { "name": "My Cool Project", "key": "PRJ", "id": 2154, "type": "NORMAL", "public": true, "avatar": "<string>", "namespace": "<string>", "description": "The description for my cool project", "scope": "PROJECT" } ], "size": 1, "limit": 25, "isLastPage": true, "nextPageStart": 2154, "start": 2154 }
POST

Create a new project

Create a new project.

To include a custom avatar for the project, the project definition should contain an additional attribute with the key avatar and the value a data URI containing Base64-encoded image data. The URI should be in the following format:

    data:(content type, e.g. image/png);base64,(data) 
If the data is not Base64-encoded, or if a character set is defined in the URI, or the URI is otherwise invalid, project creation will fail.

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

Request

Request bodyapplication/json

The project.

key

string

avatar

string

avatarUrl

string

links

object

Responses

The newly created project.

application/json

RestProject
POST/api/latest/projects
1 2 3 4 5 6 7 8 9 10 curl --request POST \ --url 'http://{baseurl}/rest/api/latest/projects' \ --header 'Accept: application/json' \ --header 'Content-Type: application/json' \ --data '{ "key": "PRJ", "avatar": "<string>", "avatarUrl": "<string>", "links": {} }'
201Response
1 2 3 4 5 6 7 8 9 10 11 { "name": "My Cool Project", "key": "PRJ", "id": 2154, "type": "NORMAL", "public": true, "avatar": "<string>", "namespace": "<string>", "description": "The description for my cool project", "scope": "PROJECT" }
GET

Get a project

Retrieve the project matching the supplied projectKey.

The authenticated user must have PROJECT_VIEW permission for the specified project to call this resource.

Request

Path parameters

projectKey

string

Required

Responses

The project matching the supplied projectKey.

application/json

RestProject
GET/api/latest/projects/{projectKey}
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}' \ --header 'Accept: application/json'
200Response
1 2 3 4 5 6 7 8 9 10 11 { "name": "My Cool Project", "key": "PRJ", "id": 2154, "type": "NORMAL", "public": true, "avatar": "<string>", "namespace": "<string>", "description": "The description for my cool project", "scope": "PROJECT" }
PUT

Update project

Update the project matching the projectKey supplied in the resource path.

To include a custom avatar for the updated project, the project definition should contain an additional attribute with the key avatar and the value a data URI containing Base64-encoded image data. The URI should be in the following format: data:(content type, e.g. image/png);base64,(data)

If the data is not Base64-encoded, or if a character set is defined in the URI, or the URI is otherwise invalid, project creation will fail.

The authenticated user must have PROJECT_ADMIN permission for the specified project to call this resource.

Request

Path parameters

projectKey

string

Required

Request bodyapplication/json

Project parameters to update.

key

string

avatar

string

avatarUrl

string

links

object

Responses

The updated project. The project's key was not updated.

application/json

RestProject
PUT/api/latest/projects/{projectKey}
1 2 3 4 5 6 7 8 9 10 curl --request PUT \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}' \ --header 'Accept: application/json' \ --header 'Content-Type: application/json' \ --data '{ "key": "PRJ", "avatar": "<string>", "avatarUrl": "<string>", "links": {} }'
200Response
1 2 3 4 5 6 7 8 9 10 11 { "name": "My Cool Project", "key": "PRJ", "id": 2154, "type": "NORMAL", "public": true, "avatar": "<string>", "namespace": "<string>", "description": "The description for my cool project", "scope": "PROJECT" }
DEL

Delete project

Delete the project matching the supplied projectKey.

The authenticated user must have PROJECT_ADMIN permission for the specified project to call this resource.

Request

Path parameters

projectKey

string

Required

Responses

The project matching the supplied projectKey was deleted.

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

Get avatar for project

Retrieve the avatar for the project matching the supplied projectKey.

The authenticated user must have PROJECT_VIEW permission for the specified project to call this resource.

Request

Path parameters

projectKey

string

Required

Query parameters

s

string

Responses

The avatar of the project matching the supplied projectKey.

application/json

any

GET/api/latest/projects/{projectKey}/avatar.png
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/avatar.png' \ --header 'Accept: application/json'
POST

Update project avatar

Update the avatar for the project matching the supplied projectKey.

This resource accepts POST multipart form data, containing a single image in a form-field named 'avatar'.

There are configurable server limits on both the dimensions (1024x1024 pixels by default) and uploaded file size (1MB by default). Several different image formats are supported, but PNG and JPEG are preferred due to the file size limit.

This resource has Cross-Site Request Forgery (XSRF) protection. To allow the request to pass the XSRF check the caller needs to send an X-Atlassian-Token HTTP header with the value no-check.

An example curl request to upload an image name 'avatar.png' would be: curl -X POST -u username:password -H "X-Atlassian-Token: no-check" http://example.com/rest/api/1.0/projects/STASH/avatar.png -F avatar=@avatar.png

The authenticated user must have PROJECT_ADMIN permission for the specified project to call this resource.

Request

Path parameters

projectKey

string

Required

Request bodymultipart/form-data

The mutlipart form data containing the file.

avatar

string

Responses

The avatar was uploaded successfully.

application/json

any

POST/api/latest/projects/{projectKey}/avatar.png
1 2 3 curl --request POST \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/avatar.png' \ --header 'Accept: application/json'
GET

Get configured hook scripts

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

This endpoint requires PROJECT_ADMIN permission.

Request

Path parameters

projectKey

string

Required

Query parameters

start

number

limit

number

Responses

A page of hook scripts.

application/json

object
GET/api/latest/projects/{projectKey}/hook-scripts
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/hook-scripts' \ --header 'Accept: application/json'
201Response
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 { "values": [ { "script": { "name": "<string>", "id": 2154, "type": "POST", "version": 2154, "createdDate": "<string>", "pluginKey": "<string>", "description": "<string>", "updatedDate": "<string>" }, "scope": { "type": "GLOBAL", "resourceId": 2 }, "triggerIds": [ "<string>" ] } ], "size": 1, "limit": 25, "isLastPage": true, "nextPageStart": 2154, "start": 2154 }
PUT

Create/update a hook script

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

This endpoint requires PROJECT_ADMIN permission.

Request

Path parameters

projectKey

string

Required
scriptId

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

RestHookScriptConfig
PUT/api/latest/projects/{projectKey}/hook-scripts/{scriptId}
1 2 3 4 5 6 7 8 9 curl --request PUT \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/hook-scripts/{scriptId}' \ --header 'Accept: application/json' \ --header 'Content-Type: application/json' \ --data '{ "triggerIds": [ "<string>" ] }'
200Response
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 { "script": { "name": "<string>", "id": 2154, "type": "POST", "version": 2154, "createdDate": "<string>", "pluginKey": "<string>", "description": "<string>", "updatedDate": "<string>" }, "scope": { "type": "GLOBAL", "resourceId": 2 }, "triggerIds": [ "<string>" ] }
DEL

Remove a hook script

Removes the hook script from the set of hook scripts configured to run in all repositories under the project.

This endpoint requires PROJECT_ADMIN permission.

Request

Path parameters

projectKey

string

Required
scriptId

string

Required

Responses

The hook script was successfully deleted.

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

Revoke project permissions

Revoke all permissions for the specified project for the given groups and users.

The authenticated user must have PROJECT_ADMIN permission for the specified project or a higher global permission to call this resource.

In addition, a user may not revoke a group's permission if their own permission would be revoked as a result, nor may they revoke their own permission unless they have a global permission that already implies that permission.

Request

Path parameters

projectKey

string

Required

Query parameters

user

string

group

string

Responses

All project permissions were revoked from the users and groups for the specified project.

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

Get groups with permission to project

Retrieve a page of groups that have been granted at least one permission for the specified project.

The authenticated user must have PROJECT_ADMIN permission for the specified project or a higher global permission to call this resource.

Request

Path parameters

projectKey

string

Required

Query parameters

filter

string

start

number

limit

number

Responses

A page of groups and their highest permissions for the specified project.

application/json

object
GET/api/latest/projects/{projectKey}/permissions/groups
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/permissions/groups' \ --header 'Accept: application/json'
200Response
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 { "values": [ { "permission": "ADMIN", "group": { "name": "group_a" } } ], "size": 1, "limit": 25, "isLastPage": true, "nextPageStart": 2154, "start": 2154 }
PUT

Update group project permission

Promote or demote a group's permission level for the specified project.

The authenticated user must have PROJECT_ADMIN permission for the specified project or a higher global permission to call this resource. In addition, a user may not demote a group's permission level if theirown permission level would be reduced as a result.

Request

Path parameters

projectKey

string

Required

Query parameters

name

string

permission

string

Responses

The requested permission was granted.

PUT/api/latest/projects/{projectKey}/permissions/groups
1 2 curl --request PUT \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/permissions/groups'
DEL

Revoke group project permission

Revoke all permissions for the specified project for a group.

The authenticated user must have PROJECT_ADMIN permission for the specified project or a higher global permission to call this resource.

In addition, a user may not revoke a group's permissions if it will reduce their own permission level.

Request

Path parameters

projectKey

string

Required

Query parameters

name

string

Responses

All project permissions were revoked from the group for the specified project.

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

Get groups without project permission

Retrieve a page of groups that have no granted permissions for the specified project.

The authenticated user must have PROJECT_ADMIN permission for the specified project or a higher

Request

Path parameters

projectKey

string

Required

Query parameters

filter

string

start

number

limit

number

Responses

A page of groups that have not been granted any permissions for the specifiedproject.

application/json

object
GET/api/latest/projects/{projectKey}/permissions/groups/none
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/permissions/groups/none' \ --header 'Accept: application/json'
202Response
1 2 3 4 5 6 7 8 9 10 11 12 13 { "values": [ { "name": "group-a", "deletable": true } ], "size": 1, "limit": 25, "isLastPage": true, "nextPageStart": 2154, "start": 2154 }
GET

Search project permissions

Search direct and implied permissions of principals (users and groups). This endpoint returns a superset of the results returned by the /users and /groups endpoints because it allows filtering by global permissions too.

The authenticated user must have PROJECT_ADMIN permission for the specified project or a higher global permission to call this resource.

Request

Path parameters

projectKey

string

Required

Query parameters

permission

string

filterText

string

type

string

Responses

default response

application/json;charset=UTF-8

any

GET/api/latest/projects/{projectKey}/permissions/search
1 2 curl --request GET \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/permissions/search'
GET

Get users with permission to project

Retrieve a page of users that have been granted at least one permission for the specified project.

The authenticated user must have PROJECT_ADMIN permission for the specified project or a higher global permission to call this resource.

Request

Path parameters

projectKey

string

Required

Query parameters

filter

string

start

number

limit

number

Responses

A page of users and their highest permissions for the specified project.

application/json

object
GET/api/latest/projects/{projectKey}/permissions/users
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/permissions/users' \ --header 'Accept: application/json'
200Response
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 { "values": [ { "permission": "USER_ADMIN", "user": { "name": "jcitizen", "id": 101, "type": "NORMAL", "displayName": "Jane Citizen", "emailAddress": "jane@example.com", "slug": "jcitizen", "active": true } } ], "size": 1, "limit": 25, "isLastPage": true, "nextPageStart": 2154, "start": 2154 }
PUT

Update user project permission

Promote or demote a user's permission level for the specified project.

The authenticated user must have PROJECT_ADMIN permission for the specified project or a higher global permission to call this resource. In addition, a user may not reduce their own permission level unless they have a global permission that already implies that permission.

Request

Path parameters

projectKey

string

Required

Query parameters

name

string

permission

string

Responses

The requested permission was granted.

PUT/api/latest/projects/{projectKey}/permissions/users
1 2 curl --request PUT \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/permissions/users'
DEL

Revoke user project permission

Revoke all permissions for the specified project for a user.

The authenticated user must have PROJECT_ADMIN permission for the specified project or a higher global permission to call this resource.

In addition, a user may not revoke their own project permissions if they do not have a higher global permission.

Request

Path parameters

projectKey

string

Required

Query parameters

name

string

Responses

All project permissions were revoked from the user for the specified project.

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

Get users without project permission

Retrieve a page of licensed users that have no granted permissions for the specified project.

The authenticated user must have PROJECT_ADMIN permission for the specified project or a higher global permission to call this resource.

Request

Path parameters

projectKey

string

Required

Query parameters

filter

string

start

number

limit

number

Responses

A page of users that have not been granted any permissions for the specified project

application/json

object
GET/api/latest/projects/{projectKey}/permissions/users/none
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/permissions/users/none' \ --header 'Accept: application/json'
200Response
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 { "values": [ { "name": "jcitizen", "id": 101, "type": "NORMAL", "displayName": "Jane Citizen", "emailAddress": "jane@example.com", "slug": "jcitizen", "active": true } ], "size": 1, "limit": 25, "isLastPage": true, "nextPageStart": 2154, "start": 2154 }
GET

Check default project permission

Check whether the specified permission is the default permission (granted to all users) for a project.

The authenticated user must have PROJECT_ADMIN permission for the specified project or a higher global permission to call this resource.

Request

Path parameters

projectKey

string

Required
permission

string

Required

Responses

A simple entity indicating whether the specified permission is the defaultpermission for this project.

application/json

RestPermitted
GET/api/latest/projects/{projectKey}/permissions/{permission}/all
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/permissions/{permission}/all' \ --header 'Accept: application/json'
200Response
1 2 3 { "permitted": true }
POST

Grant project permission

Grant or revoke a project permission to all users, i.e. set the default permission.

The authenticated user must have PROJECT_ADMIN permission for the specified project or a higher global permission to call this resource.

Request

Path parameters

projectKey

string

Required
permission

string

Required

Query parameters

allow

string

Responses

The requested permission was successfully granted or revoked.

POST/api/latest/projects/{projectKey}/permissions/{permission}/all
1 2 curl --request POST \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/permissions/{permission}/all'
GET

Get repositories for project

Retrieve repositories from the project corresponding to the supplied projectKey.

The authenticated user must have PROJECT_READ permission for the specified project to call this resource.

Request

Path parameters

projectKey

string

Required

Query parameters

start

number

limit

number

Responses

The repositories matching the supplied projectKey.

application/json

object
GET/api/latest/projects/{projectKey}/repos
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos' \ --header 'Accept: application/json'
201Response
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 { "values": [ { "name": "My repo", "id": 2154, "state": "AVAILABLE", "public": true, "hierarchyId": "e3c939f9ef4a7fae272e", "statusMessage": "Available", "archived": true, "forkable": true, "defaultBranch": "main", "relatedLinks": {}, "partition": 2154, "origin": { "name": "My repo", "id": 2154, "state": "AVAILABLE", "public": true, "hierarchyId": "e3c939f9ef4a7fae272e", "statusMessage": "Available", "archived": true, "forkable": true, "defaultBranch": "main", "relatedLinks": {}, "partition": 2154, "project": { "name": "My Cool Project", "key": "PRJ", "id": 2154, "type": "NORMAL", "public": true, "avatar": "<string>", "namespace": "<string>", "description": "The description for my cool project", "scope": "PROJECT" }, "description": "My repo description", "scmId": "git", "slug": "my-repo", "scope": "REPOSITORY" }, "project": { "name": "My Cool Project", "key": "PRJ", "id": 2154, "type": "NORMAL", "public": true, "avatar": "<string>", "namespace": "<string>", "description": "The description for my cool project", "scope": "PROJECT" }, "description": "My repo description", "scmId": "git", "slug": "my-repo", "scope": "REPOSITORY" } ], "size": 1, "limit": 25, "isLastPage": true, "nextPageStart": 2154, "start": 2154 }
POST

Create repository

Create a new repository. Requires an existing project in which this repository will be created. The only parameters which will be used are name and scmId.

The authenticated user must have REPO_CREATE permission or higher, for the context project to call this resource.

Request

Path parameters

projectKey

string

Required

Request bodyapplication/json

The repository

name

string

scmId

string

slug

string

links

object

Responses

The newly created repository.

application/json

RestRepository
POST/api/latest/projects/{projectKey}/repos
1 2 3 4 5 6 7 8 9 10 curl --request POST \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos' \ --header 'Accept: application/json' \ --header 'Content-Type: application/json' \ --data '{ "name": "My repo", "scmId": "git", "slug": "my-repo", "links": {} }'
201Response
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 { "name": "My repo", "id": 2154, "state": "AVAILABLE", "public": true, "hierarchyId": "e3c939f9ef4a7fae272e", "statusMessage": "Available", "archived": true, "forkable": true, "defaultBranch": "main", "relatedLinks": {}, "partition": 2154, "origin": { "name": "My repo", "id": 2154, "state": "AVAILABLE", "public": true, "hierarchyId": "e3c939f9ef4a7fae272e", "statusMessage": "Available", "archived": true, "forkable": true, "defaultBranch": "main", "relatedLinks": {}, "partition": 2154, "project": { "name": "My Cool Project", "key": "PRJ", "id": 2154, "type": "NORMAL", "public": true, "avatar": "<string>", "namespace": "<string>", "description": "The description for my cool project", "scope": "PROJECT" }, "description": "My repo description", "scmId": "git", "slug": "my-repo", "scope": "REPOSITORY" }, "project": { "name": "My Cool Project", "key": "PRJ", "id": 2154, "type": "NORMAL", "public": true, "avatar": "<string>", "namespace": "<string>", "description": "The description for my cool project", "scope": "PROJECT" }, "description": "My repo description", "scmId": "git", "slug": "my-repo", "scope": "REPOSITORY" }
GET

Get repository

Retrieve the repository matching the supplied projectKey and repositorySlug.

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

Responses

The repository which matches the supplied projectKey and repositorySlug.

application/json

RestRepository
GET/api/latest/projects/{projectKey}/repos/{repositorySlug}
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}' \ --header 'Accept: application/json'
201Response
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 { "name": "My repo", "id": 2154, "state": "AVAILABLE", "public": true, "hierarchyId": "e3c939f9ef4a7fae272e", "statusMessage": "Available", "archived": true, "forkable": true, "defaultBranch": "main", "relatedLinks": {}, "partition": 2154, "origin": { "name": "My repo", "id": 2154, "state": "AVAILABLE", "public": true, "hierarchyId": "e3c939f9ef4a7fae272e", "statusMessage": "Available", "archived": true, "forkable": true, "defaultBranch": "main", "relatedLinks": {}, "partition": 2154, "project": { "name": "My Cool Project", "key": "PRJ", "id": 2154, "type": "NORMAL", "public": true, "avatar": "<string>", "namespace": "<string>", "description": "The description for my cool project", "scope": "PROJECT" }, "description": "My repo description", "scmId": "git", "slug": "my-repo", "scope": "REPOSITORY" }, "project": { "name": "My Cool Project", "key": "PRJ", "id": 2154, "type": "NORMAL", "public": true, "avatar": "<string>", "namespace": "<string>", "description": "The description for my cool project", "scope": "PROJECT" }, "description": "My repo description", "scmId": "git", "slug": "my-repo", "scope": "REPOSITORY" }
PUT

Update repository

Update the repository matching the repositorySlug supplied in the resource path.

The repository's slug is derived from its name. If the name changes the slug may also change.

This resource can be used to change the repository's default branch by specifying a new default branch in the request. For example: "defaultBranch":"main"

This resource can be used to move the repository to a different project by specifying a new project in the request. For example: "project":{"key":"NEW_KEY"}

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 updated repository.

name

string

scmId

string

slug

string

links

object

Responses

The updated repository.

application/json

RestRepository
PUT/api/latest/projects/{projectKey}/repos/{repositorySlug}
1 2 3 4 5 6 7 8 9 10 curl --request PUT \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}' \ --header 'Accept: application/json' \ --header 'Content-Type: application/json' \ --data '{ "name": "My repo", "scmId": "git", "slug": "my-repo", "links": {} }'
201Response
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 { "name": "My repo", "id": 2154, "state": "AVAILABLE", "public": true, "hierarchyId": "e3c939f9ef4a7fae272e", "statusMessage": "Available", "archived": true, "forkable": true, "defaultBranch": "main", "relatedLinks": {}, "partition": 2154, "origin": { "name": "My repo", "id": 2154, "state": "AVAILABLE", "public": true, "hierarchyId": "e3c939f9ef4a7fae272e", "statusMessage": "Available", "archived": true, "forkable": true, "defaultBranch": "main", "relatedLinks": {}, "partition": 2154, "project": { "name": "My Cool Project", "key": "PRJ", "id": 2154, "type": "NORMAL", "public": true, "avatar": "<string>", "namespace": "<string>", "description": "The description for my cool project", "scope": "PROJECT" }, "description": "My repo description", "scmId": "git", "slug": "my-repo", "scope": "REPOSITORY" }, "project": { "name": "My Cool Project", "key": "PRJ", "id": 2154, "type": "NORMAL", "public": true, "avatar": "<string>", "namespace": "<string>", "description": "The description for my cool project", "scope": "PROJECT" }, "description": "My repo description", "scmId": "git", "slug": "my-repo", "scope": "REPOSITORY" }
POST

Fork repository

Create a new repository forked from an existing repository.

The JSON body for this POST is not required to contain any properties. Even the name may be omitted. The following properties will be used, if provided:

  • "name":"Fork name" - Specifies the forked repository's name
    • Defaults to the name of the origin repository if not specified
  • "defaultBranch":"main" - Specifies the forked repository's default branch
    • Defaults to the origin repository's default branch if not specified
  • "project":{"key":"TARGET_KEY"} - Specifies the forked repository's target project by key
    • Defaults to the current user's personal project if not specified

The authenticated user must have REPO_READ permission for the specified repository and PROJECT_ADMIN on the target project to call this resource. Note that users always have PROJECT_ADMIN permission on their personal projects.

Request

Path parameters

projectKey

string

Required
repositorySlug

string

Required

Request bodyapplication/json

The rest fork.

name

string

scmId

string

slug

string

links

object

Responses

The newly created fork.

application/json

RestRepository
POST/api/latest/projects/{projectKey}/repos/{repositorySlug}
1 2 3 4 5 6 7 8 9 10 curl --request POST \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}' \ --header 'Accept: application/json' \ --header 'Content-Type: application/json' \ --data '{ "name": "My repo", "scmId": "git", "slug": "my-repo", "links": {} }'
201Response
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 { "name": "My repo", "id": 2154, "state": "AVAILABLE", "public": true, "hierarchyId": "e3c939f9ef4a7fae272e", "statusMessage": "Available", "archived": true, "forkable": true, "defaultBranch": "main", "relatedLinks": {}, "partition": 2154, "origin": { "name": "My repo", "id": 2154, "state": "AVAILABLE", "public": true, "hierarchyId": "e3c939f9ef4a7fae272e", "statusMessage": "Available", "archived": true, "forkable": true, "defaultBranch": "main", "relatedLinks": {}, "partition": 2154, "project": { "name": "My Cool Project", "key": "PRJ", "id": 2154, "type": "NORMAL", "public": true, "avatar": "<string>", "namespace": "<string>", "description": "The description for my cool project", "scope": "PROJECT" }, "description": "My repo description", "scmId": "git", "slug": "my-repo", "scope": "REPOSITORY" }, "project": { "name": "My Cool Project", "key": "PRJ", "id": 2154, "type": "NORMAL", "public": true, "avatar": "<string>", "namespace": "<string>", "description": "The description for my cool project", "scope": "PROJECT" }, "description": "My repo description", "scmId": "git", "slug": "my-repo", "scope": "REPOSITORY" }
DEL

Delete repository

Schedule the repository matching the supplied projectKey and repositorySlug to be deleted.

The authenticated user must have sufficient permissions specified by the repository delete policy to call this resource. The default permission required is REPO_ADMIN permission.

Request

Path parameters

projectKey

string

Required
repositorySlug

string

Required

Responses

The repository has been scheduled for deletion.

application/json

any

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

Get repository contributing guidelines

Retrieves the contributing guidelines for the repository, if they've been defined.

This checks the repository for a CONTRIBUTING file, optionally with an md or txt extension, and, if found, streams it. By default, the raw content of the file is streamed. Appending ?markup to the URL will stream an HTML-rendered version instead.

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

markup

string

htmlEscape

string

includeHeadingId

string

hardwrap

string

Responses

The contributing guidelines for the repository.

application/json

any

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

Get repository default branch

Retrieves the repository's configured default branch.

Every repository has a configured default branch, but that branch may not actually exist in the repository. For example, a newly-created repository will have a configured default branch even though no branches have been pushed yet.

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

Responses

The configured default branch for the repository.

application/json

RestMinimalRef
GET/api/latest/projects/{projectKey}/repos/{repositorySlug}/default-branch
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/default-branch' \ --header 'Accept: application/json'
200Response
1 2 3 4 5 { "id": "refs/heads/master", "type": "BRANCH", "displayId": "master" }
PUT

Update default branch for repository

Update the default branch of a 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

Request bodyapplication/json

The branch to set as default

type

RefType

id

string

Responses

The default branch was updated.

PUT/api/latest/projects/{projectKey}/repos/{repositorySlug}/default-branch
1 2 3 4 5 6 curl --request PUT \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/default-branch' \ --header 'Content-Type: application/json' \ --data '{ "id": "refs/heads/master" }'
GET

Get repository forks

Retrieve repositories which have been forked from this one. Unlike #getRelatedRepositories(Repository, PageRequest) related repositories, this only looks at a given repository's direct forks. If those forks have themselves been the origin of more forks, such "grandchildren" repositories will not be retrieved.

Only repositories to which the authenticated user has REPO_READ permission will be included, even if other repositories have been forked from this one.

Request

Path parameters

projectKey

string

Required
repositorySlug

string

Required

Query parameters

start

number

limit

number

Responses

A page of repositories related to the request repository.

application/json

object
GET/api/latest/projects/{projectKey}/repos/{repositorySlug}/forks
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/forks' \ --header 'Accept: application/json'
200Response
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 { "values": [ { "name": "My repo", "id": 2154, "state": "AVAILABLE", "public": true, "hierarchyId": "e3c939f9ef4a7fae272e", "statusMessage": "Available", "archived": true, "forkable": true, "defaultBranch": "main", "relatedLinks": {}, "partition": 2154, "origin": { "name": "My repo", "id": 2154, "state": "AVAILABLE", "public": true, "hierarchyId": "e3c939f9ef4a7fae272e", "statusMessage": "Available", "archived": true, "forkable": true, "defaultBranch": "main", "relatedLinks": {}, "partition": 2154, "project": { "name": "My Cool Project", "key": "PRJ", "id": 2154, "type": "NORMAL", "public": true, "avatar": "<string>", "namespace": "<string>", "description": "The description for my cool project", "scope": "PROJECT" }, "description": "My repo description", "scmId": "git", "slug": "my-repo", "scope": "REPOSITORY" }, "project": { "name": "My Cool Project", "key": "PRJ", "id": 2154, "type": "NORMAL", "public": true, "avatar": "<string>", "namespace": "<string>", "description": "The description for my cool project", "scope": "PROJECT" }, "description": "My repo description", "scmId": "git", "slug": "my-repo", "scope": "REPOSITORY" } ], "size": 1, "limit": 25, "isLastPage": true, "nextPageStart": 2154, "start": 2154 }
GET

Get repository license

Retrieves the license for the repository, if it's been defined.

This checks the repository for a

LICENSE
file, optionally with an
md
or
txt
extension, and, if found, streams it. By default, the raw content of the file is streamed. Appending
?markup
to the URL will stream an HTML-rendered version instead.

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

markup

string

htmlEscape

string

includeHeadingId

string

hardwrap

string

Responses

The license for the repository.

application/json

any

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

Get repository readme

Retrieves the README for the repository, if it's been defined.

This checks the repository for a

README
file, optionally with an
md
or
txt
extension, and, if found, streams it. By default, the raw content of the file is streamed. Appending
?markup
to the URL will stream an HTML-rendered version instead. Note that, when streaming HTML, relative URLs in the README will not work if applied relative to this URL.

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

markup

string

htmlEscape

string

includeHeadingId

string

hardwrap

string

Responses

The README for the repository.

application/json

any

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

Retry repository creation

If a create or fork operation fails, calling this method will clean up the broken repository and try again. The repository must be in an INITIALISATION_FAILED state.

The authenticated user must have PROJECT_ADMIN permission for the specified project to call this resource.

Request

Path parameters

projectKey

string

Required
repositorySlug

string

Required

Responses

The newly created repository.

application/json

RestRepository
POST/api/latest/projects/{projectKey}/repos/{repositorySlug}/recreate
1 2 3 curl --request POST \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/recreate' \ --header 'Accept: application/json'
201Response
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 { "name": "My repo", "id": 2154, "state": "AVAILABLE", "public": true, "hierarchyId": "e3c939f9ef4a7fae272e", "statusMessage": "Available", "archived": true, "forkable": true, "defaultBranch": "main", "relatedLinks": {}, "partition": 2154, "origin": { "name": "My repo", "id": 2154, "state": "AVAILABLE", "public": true, "hierarchyId": "e3c939f9ef4a7fae272e", "statusMessage": "Available", "archived": true, "forkable": true, "defaultBranch": "main", "relatedLinks": {}, "partition": 2154, "project": { "name": "My Cool Project", "key": "PRJ", "id": 2154, "type": "NORMAL", "public": true, "avatar": "<string>", "namespace": "<string>", "description": "The description for my cool project", "scope": "PROJECT" }, "description": "My repo description", "scmId": "git", "slug": "my-repo", "scope": "REPOSITORY" }, "project": { "name": "My Cool Project", "key": "PRJ", "id": 2154, "type": "NORMAL", "public": true, "avatar": "<string>", "namespace": "<string>", "description": "The description for my cool project", "scope": "PROJECT" }, "description": "My repo description", "scmId": "git", "slug": "my-repo", "scope": "REPOSITORY" }
GET

Retrieve repositories which are related to this one. Related repositories are from the same Repository#getHierarchyId() hierarchy as this repository.

Only repositories to which the authenticated user has REPO_READ permission will be included, even if more repositories are part of this repository's hierarchy.

projectKey

string

Required
repositorySlug

string

Required
start

number

limit

number

A page of repositories related to the request repository.

application/json

object
GET/api/latest/projects/{projectKey}/repos/{repositorySlug}/related
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/related' \ --header 'Accept: application/json'
200Response
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 { "values": [ { "name": "My repo", "id": 2154, "state": "AVAILABLE", "public": true, "hierarchyId": "e3c939f9ef4a7fae272e", "statusMessage": "Available", "archived": true, "forkable": true, "defaultBranch": "main", "relatedLinks": {}, "partition": 2154, "origin": { "name": "My repo", "id": 2154, "state": "AVAILABLE", "public": true, "hierarchyId": "e3c939f9ef4a7fae272e", "statusMessage": "Available", "archived": true, "forkable": true, "defaultBranch": "main", "relatedLinks": {}, "partition": 2154, "project": { "name": "My Cool Project", "key": "PRJ", "id": 2154, "type": "NORMAL", "public": true, "avatar": "<string>", "namespace": "<string>", "description": "The description for my cool project", "scope": "PROJECT" }, "description": "My repo description", "scmId": "git", "slug": "my-repo", "scope": "REPOSITORY" }, "project": { "name": "My Cool Project", "key": "PRJ", "id": 2154, "type": "NORMAL", "public": true, "avatar": "<string>", "namespace": "<string>", "description": "The description for my cool project", "scope": "PROJECT" }, "description": "My repo description", "scmId": "git", "slug": "my-repo", "scope": "REPOSITORY" } ], "size": 1, "limit": 25, "isLastPage": true, "nextPageStart": 2154, "start": 2154 }
GET

Get auto decline settings

Retrieves the auto decline settings for the supplied project. Default settings are returned if no explicit settings have been set for the project.

Request

Path parameters

projectKey

string

Required

Responses

The auto decline settings

application/json

RestAutoDeclineSettings
GET/api/latest/projects/{projectKey}/settings/auto-decline
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/settings/auto-decline' \ --header 'Accept: application/json'
200Response
1 2 3 4 5 6 7 8 { "enabled": true, "scope": { "type": "GLOBAL", "resourceId": 2 }, "inactivityWeeks": 4 }
PUT

Create/Update auto decline settings

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

The authenticated user must have PROJECT_ADMIN permission for this project to call the resource.

Request

Path parameters

projectKey

string

Required

Request bodyapplication/json

The settings to create or update

enabled

boolean

inactivityWeeks

integer

Responses

The auto decline settings

application/json

RestAutoDeclineSettings
PUT/api/latest/projects/{projectKey}/settings/auto-decline
1 2 3 4 5 6 7 8 curl --request PUT \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/settings/auto-decline' \ --header 'Accept: application/json' \ --header 'Content-Type: application/json' \ --data '{ "enabled": true, "inactivityWeeks": 4 }'
200Response
1 2 3 4 5 6 7 8 { "enabled": true, "scope": { "type": "GLOBAL", "resourceId": 2 }, "inactivityWeeks": 4 }
DEL

Delete auto decline settings

Delete auto decline settings for the supplied project.

The authenticated user must have PROJECT_ADMIN permission for this project to call the resource.

Request

Path parameters

projectKey

string

Required

Responses

The auto decline settings have been deleted successfully.

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

Get repository hooks

Retrieve a page of repository hooks for this project.

The authenticated user must have PROJECT_READ permission for the specified project to call this resource.

Request

Path parameters

projectKey

string

Required

Query parameters

type

string

start

number

limit

number

Responses

A page of repository hooks with their associated enabled state.

application/json

object
GET/api/latest/projects/{projectKey}/settings/hooks
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/settings/hooks' \ --header 'Accept: application/json'
200Response
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 { "values": [ { "enabled": true, "details": { "name": "<string>", "key": "<string>", "type": "PRE_RECEIVE", "version": "<string>", "configFormKey": "<string>", "supportedScopes": [ "GLOBAL" ], "description": "<string>" }, "scope": { "type": "GLOBAL", "resourceId": 2 }, "configured": true } ], "size": 1, "limit": 25, "isLastPage": true, "nextPageStart": 2154, "start": 2154 }
GET

Get a repository hook

Retrieve a repository hook for this project.

The authenticated user must have PROJECT_READ permission for the specified project to call this resource.

Request

Path parameters

projectKey

string

Required
hookKey

string

Required

Responses

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

application/json

RestRepositoryHook
GET/api/latest/projects/{projectKey}/settings/hooks/{hookKey}
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/settings/hooks/{hookKey}' \ --header 'Accept: application/json'
200Response
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 { "enabled": true, "details": { "name": "<string>", "key": "<string>", "type": "PRE_RECEIVE", "version": "<string>", "configFormKey": "<string>", "supportedScopes": [ "GLOBAL" ], "description": "<string>" }, "scope": { "type": "GLOBAL", "resourceId": 2 }, "configured": true }
PUT

Enable repository hook

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

The authenticated user must have PROJECT_ADMIN permission for the specified project 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

Header parameters

Content-Length

integer

Responses

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

application/json

RestRepositoryHook
PUT/api/latest/projects/{projectKey}/settings/hooks/{hookKey}/enabled
1 2 3 curl --request PUT \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/settings/hooks/{hookKey}/enabled' \ --header 'Accept: application/json'
200Response
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 { "enabled": true, "details": { "name": "<string>", "key": "<string>", "type": "PRE_RECEIVE", "version": "<string>", "configFormKey": "<string>", "supportedScopes": [ "GLOBAL" ], "description": "<string>" }, "scope": { "type": "GLOBAL", "resourceId": 2 }, "configured": true }
DEL

Disable repository hook

Disable a repository hook for this project.

The authenticated user must have PROJECT_ADMIN permission for the specified project to call this resource.

Request

Path parameters

projectKey

string

Required
hookKey

string

Required

Responses

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

application/json

RestRepositoryHook
DEL/api/latest/projects/{projectKey}/settings/hooks/{hookKey}/enabled
1 2 3 curl --request DELETE \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/settings/hooks/{hookKey}/enabled' \ --header 'Accept: application/json'
200Response
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 { "enabled": true, "details": { "name": "<string>", "key": "<string>", "type": "PRE_RECEIVE", "version": "<string>", "configFormKey": "<string>", "supportedScopes": [ "GLOBAL" ], "description": "<string>" }, "scope": { "type": "GLOBAL", "resourceId": 2 }, "configured": true }
GET

Get repository hook settings

Retrieve the settings for a repository hook for this project.

The authenticated user must have PROJECT_READ permission for the specified project to call this resource.

Request

Path parameters

projectKey

string

Required
hookKey

string

Required

Responses

The settings for the hook.

application/json

ExampleSettings
GET/api/latest/projects/{projectKey}/settings/hooks/{hookKey}/settings
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/settings/hooks/{hookKey}/settings' \ --header 'Accept: application/json'
200Response
1 2 3 4 5 6 7 { "stringValue": "This is an arbitrary string", "booleanValue": true, "doubleValue": 1.1, "integerValue": 1, "longValue": -2147483648 }
PUT

Update repository hook settings

Modify the settings for a repository hook for this project.

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

The authenticated user must have PROJECT_ADMIN permission for the specified project 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

Request bodyapplication/json

The raw settings.

stringValue

string

booleanValue

boolean

doubleValue

number

integerValue

integer

longValue

integer

Responses

The settings for the hook.

application/json

ExampleSettings
PUT/api/latest/projects/{projectKey}/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}/settings/hooks/{hookKey}/settings' \ --header 'Accept: application/json' \ --header 'Content-Type: application/json' \ --data '{ "stringValue": "This is an arbitrary string", "booleanValue": true, "doubleValue": 1.1, "integerValue": 1, "longValue": -2147483648 }'
200Response
1 2 3 4 5 6 7 { "stringValue": "This is an arbitrary string", "booleanValue": true, "doubleValue": 1.1, "integerValue": 1, "longValue": -2147483648 }
GET

Get merge strategy

Retrieve the merge strategy configuration for this project and SCM.

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

Request

Path parameters

projectKey

string

Required
scmId

string

Required

Responses

The merge configuration of the request project.

application/json

RestPullRequestSettings
GET/api/latest/projects/{projectKey}/settings/pull-requests/{scmId}
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/settings/pull-requests/{scmId}' \ --header 'Accept: application/json'
200Response
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 { "mergeConfig": { "type": "repository", "strategies": [ { "enabled": true, "name": "Merge commit", "id": "no-ff", "description": "Always create a merge commit", "flag": "--no-ff" } ], "defaultStrategy": { "enabled": true, "name": "Merge commit", "id": "no-ff", "description": "Always create a merge commit", "flag": "--no-ff" }, "commitSummaries": 2154 } }
POST

Update merge strategy

Update the pull request merge strategy configuration for this project and SCM.

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

Only the strategies provided will be enabled, the default must be set and included in the set of strategies.

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

{ 
    "mergeConfig": {} 
} 

Upon completion of this request, the effective configuration will be the configuration explicitly set for the SCM, or if no such explicit configuration is set then the default configuration will be used.

Request

Path parameters

projectKey

string

Required
scmId

string

Required

Request bodyapplication/json

The settings.

mergeConfig

object

Responses

The merge configuration of the request project.

application/json

RestPullRequestSettings
POST/api/latest/projects/{projectKey}/settings/pull-requests/{scmId}
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 curl --request POST \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/settings/pull-requests/{scmId}' \ --header 'Accept: application/json' \ --header 'Content-Type: application/json' \ --data '{ "mergeConfig": { "strategies": [ { "id": "no-ff", "links": {} } ], "defaultStrategy": { "id": "no-ff", "links": {} }, "commitSummaries": 2154 } }'
200Response
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 { "mergeConfig": { "type": "repository", "strategies": [ { "enabled": true, "name": "Merge commit", "id": "no-ff", "description": "Always create a merge commit", "flag": "--no-ff" } ], "defaultStrategy": { "enabled": true, "name": "Merge commit", "id": "no-ff", "description": "Always create a merge commit", "flag": "--no-ff" }, "commitSummaries": 2154 } }

Rate this page: