Server
Bitbucket Data Center / / Modules

Security

Postman Collection
OpenAPI
Operations
GET/gpg/latest/keysPOST/gpg/latest/keysDEL/gpg/latest/keysDEL/gpg/latest/keys/{fingerprintOrId}GET/api/latest/projects/{projectKey}/repos/{repositorySlug}/secret-scanning/allowlistPOST/api/latest/projects/{projectKey}/repos/{repositorySlug}/secret-scanning/allowlistGET/api/latest/projects/{projectKey}/repos/{repositorySlug}/secret-scanning/allowlist/{id}PUT/api/latest/projects/{projectKey}/repos/{repositorySlug}/secret-scanning/allowlist/{id}DEL/api/latest/projects/{projectKey}/repos/{repositorySlug}/secret-scanning/allowlist/{id}GET/api/latest/projects/{projectKey}/repos/{repositorySlug}/secret-scanning/exemptPUT/api/latest/projects/{projectKey}/repos/{repositorySlug}/secret-scanning/exemptDEL/api/latest/projects/{projectKey}/repos/{repositorySlug}/secret-scanning/exemptGET/api/latest/projects/{projectKey}/repos/{repositorySlug}/secret-scanning/rulesPOST/api/latest/projects/{projectKey}/repos/{repositorySlug}/secret-scanning/rulesGET/api/latest/projects/{projectKey}/repos/{repositorySlug}/secret-scanning/rules/{id}PUT/api/latest/projects/{projectKey}/repos/{repositorySlug}/secret-scanning/rules/{id}DEL/api/latest/projects/{projectKey}/repos/{repositorySlug}/secret-scanning/rules/{id}GET/api/latest/projects/{projectKey}/secret-scanning/allowlistPOST/api/latest/projects/{projectKey}/secret-scanning/allowlistGET/api/latest/projects/{projectKey}/secret-scanning/allowlist/{id}PUT/api/latest/projects/{projectKey}/secret-scanning/allowlist/{id}DEL/api/latest/projects/{projectKey}/secret-scanning/allowlist/{id}GET/api/latest/projects/{projectKey}/secret-scanning/exemptPOST/api/latest/projects/{projectKey}/secret-scanning/exemptGET/api/latest/projects/{projectKey}/secret-scanning/rulesPOST/api/latest/projects/{projectKey}/secret-scanning/rulesGET/api/latest/projects/{projectKey}/secret-scanning/rules/{id}PUT/api/latest/projects/{projectKey}/secret-scanning/rules/{id}DEL/api/latest/projects/{projectKey}/secret-scanning/rules/{id}GET/api/latest/secret-scanning/exemptPOST/api/latest/secret-scanning/exemptGET/api/latest/secret-scanning/rulesPOST/api/latest/secret-scanning/rulesGET/api/latest/secret-scanning/rules/{id}PUT/api/latest/secret-scanning/rules/{id}DEL/api/latest/secret-scanning/rules/{id}
GET

Get all GPG keys

Find all the keys for the currently authenticated user. Optionally, users with ADMIN and higher permissions may choose to specify the user parameter to retrieve GPG keys for another user.

Only authenticated users may call this endpoint.

Request

Query parameters

user

string

start

number

limit

number

Responses

Returns a paged response of of keys for the user.

application/json

object
GET/gpg/latest/keys
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/gpg/latest/keys' \ --header 'Accept: application/json'
200Response
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 { "values": [ { "expiryDate": 61550496000000, "fingerprint": "43:51:43:a1:b5:fc:8b:b7:0a:3a:a9:b1:0f:66:73:a8", "emailAddress": "bitbucket@example.com", "subKeys": [], "id": "00000000000004d2" } ], "size": 1, "isLastPage": true, "nextPageStart": 2154, "start": 2154, "limit": 25 }
POST

Create a GPG key

Add a GPG key to the authenticated user's account. Optionally, users with ADMIN and higher permissions may choose to specify the user parameter to add a GPG key for another user.

Only authenticated users may call this endpoint.

Request

Query parameters

user

string

Request bodyapplication/json

The request body.

text

string

Responses

Response contains the GPG key that was just created.

application/json

RestGpgKey
POST/gpg/latest/keys
1 2 3 4 5 6 7 curl --request POST \ --url 'http://{baseurl}/rest/gpg/latest/keys' \ --header 'Accept: application/json' \ --header 'Content-Type: application/json' \ --data '{ "text": "-----BEGIN PGP SIGNATURE-----\n\niQEzBAABCAAdFiEEM8MrWnoxlp3K1lFY5BMGiWNefn4FAlkqKE4ACgkQ5BMGiWNe\nfn6/kggAyzKhDDqdVb3Rq02hiSqeqKa1JuKRqDmzIpa6Pxa+1CpCnxwaIVrGgIii\nvj0ZNJzL1Bm2xm0JasotJDiZq5pFKi0FfQ0WmskuhsW1VY/f08TltHpHvK2kHVRr\nGEMVDUb0nj0I7Duc8XTipiYoDGS1GvydNR/bu3SsFTcZyapXirQcTCRT6/Sn0/IP\npUeIwQo1qK4e8gTOhWhfWEiVig39lQhiZFtm5S/vfAY72/Rgp68zMYmwasMSnBgF\n/LLFW6lXAqZIoAP8AnmsMRjCH6mS98+/lxKq2+K71+2YUUIAnNEeO09Lufo3B3Da\nPbs7BpD28w4lKlzb2EQ0n0C9rrxdPA==\n=VZpm\n-----END PGP SIGNATURE-----\n" }'
200Response
1 2 3 4 5 6 7 { "expiryDate": 61550496000000, "fingerprint": "43:51:43:a1:b5:fc:8b:b7:0a:3a:a9:b1:0f:66:73:a8", "emailAddress": "bitbucket@example.com", "subKeys": [], "id": "00000000000004d2" }
DEL

Delete all GPG keys for user

Delete all GPG keys for a supplied user.

Request

Query parameters

user

string

Responses

The GPG keys matching the supplied user were deleted.

DEL/gpg/latest/keys
1 2 curl --request DELETE \ --url 'http://{baseurl}/rest/gpg/latest/keys'
DEL

Delete a GPG key

Delete the GPG key with the specified ID or Key Fingerprint.

Request

Path parameters

fingerprintOrId

string

Required

Responses

The key has been deleted successfully.

DEL/gpg/latest/keys/{fingerprintOrId}
1 2 curl --request DELETE \ --url 'http://{baseurl}/rest/gpg/latest/keys/{fingerprintOrId}'
GET

Find repository secret scanning allowlist rules

Find repository secret scanning allowlist rules by filtering.

Repository Admin is required

Request

Path parameters

projectKey

string

Required
repositorySlug

string

Required

Query parameters

filter

string

order

string

start

number

limit

number

Responses

Page of allowlist rules

application/json

object
GET/api/latest/projects/{projectKey}/repos/{repositorySlug}/secret-scanning/allowlist
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/secret-scanning/allowlist' \ --header 'Accept: application/json'
200Response
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 { "values": [ { "lineRegex": "(BBDC-[a-zA-Z0-9+]{44})", "pathRegex": "*.pem", "name": "Bitbucket DC HTTP access token", "id": 7 } ], "size": 1, "isLastPage": true, "nextPageStart": 2154, "start": 2154, "limit": 25 }
POST

Create repository secret scanning allowlist rule

Create a new repository secret scanning allowlist rule. Repository allowlist rules are used when scanning the given repository.

Repository Admin is required

Request

Path parameters

projectKey

string

Required
repositorySlug

string

Required

Request body*/*

Allowlist rule to create, either the line regular expression or the path regular expression must be present

lineRegex

string

name

string

pathRegex

string

Responses

The created rule

application/json

RestSecretScanningAllowlistRule
POST/api/latest/projects/{projectKey}/repos/{repositorySlug}/secret-scanning/allowlist
1 2 3 curl --request POST \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/secret-scanning/allowlist' \ --header 'Accept: application/json'
200Response
1 2 3 4 5 6 { "lineRegex": "(BBDC-[a-zA-Z0-9+]{44})", "pathRegex": "*.pem", "name": "Bitbucket DC HTTP access token", "id": 7 }
GET

Get a repository secret scanning allowlist rule

Get a repository secret scanning allowlist rule by ID.

Repository Admin is required

Request

Path parameters

projectKey

string

Required
id

string

Required
repositorySlug

string

Required

Responses

The requested allowlist rule

application/json

RestSecretScanningAllowlistRule
GET/api/latest/projects/{projectKey}/repos/{repositorySlug}/secret-scanning/allowlist/{id}
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/secret-scanning/allowlist/{id}' \ --header 'Accept: application/json'
200Response
1 2 3 4 5 6 { "lineRegex": "(BBDC-[a-zA-Z0-9+]{44})", "pathRegex": "*.pem", "name": "Bitbucket DC HTTP access token", "id": 7 }
PUT

Edit an existing repository secret scanning allowlist rule

Edit a repository secret scanning allowlist rule.

Repository Admin is required

Request

Path parameters

projectKey

string

Required
id

string

Required
repositorySlug

string

Required

Request body*/*

lineRegex

string

name

string

pathRegex

string

Responses

The updated allowlist rule

application/json

RestSecretScanningAllowlistRule
PUT/api/latest/projects/{projectKey}/repos/{repositorySlug}/secret-scanning/allowlist/{id}
1 2 3 curl --request PUT \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/secret-scanning/allowlist/{id}' \ --header 'Accept: application/json'
200Response
1 2 3 4 5 6 { "lineRegex": "(BBDC-[a-zA-Z0-9+]{44})", "pathRegex": "*.pem", "name": "Bitbucket DC HTTP access token", "id": 7 }
DEL

Delete a repository secret scanning allowlist rule

Delete a repository secret scanning allowlist rule with the provided ID.

Repository Admin is required

Request

Path parameters

projectKey

string

Required
id

string

Required
repositorySlug

string

Required

Responses

Empty response indicating that the allowlist rule was deleted

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

Get whether a repository is exempt

Check whether a repository is exempt from secret scanning

Request

This request has no parameters.

Responses

True if the repository is exempt from secret scanning, false otherwise

application/json

any

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

Exempt a repo from secret scanningDeprecated

Exempt a repository from being scanned for secrets

Deprecated since 8.6. Exemptions are now managed by scope. Use POST /rest/api/1.0/secret-scanning/exempt for global scope Use POST /rest/api/1.0/projects/{projectKey}/secret-scanning/exempt for the project scope

Request

This request has no parameters.

Responses

An exempt repo was added

PUT/api/latest/projects/{projectKey}/repos/{repositorySlug}/secret-scanning/exempt
1 2 curl --request PUT \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/secret-scanning/exempt'
DEL

Delete an exempt repository

Remove a repository from being exempt from secret scanning

Request

This request has no parameters.

Responses

Empty response indicating that the exempt repository was deleted

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

Find repository secret scanning rules

Find repository secret scanning rules by filtering.

Repository Admin is required

Request

Path parameters

projectKey

string

Required
repositorySlug

string

Required

Query parameters

filter

string

order

string

start

number

limit

number

Responses

Page of rules

application/json

object
GET/api/latest/projects/{projectKey}/repos/{repositorySlug}/secret-scanning/rules
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/secret-scanning/rules' \ --header 'Accept: application/json'
200Response
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 { "values": [ { "lineRegex": "(BBDC-[a-zA-Z0-9+]{44})", "pathRegex": "*.pem", "scope": { "resourceId": 2, "type": "GLOBAL" }, "name": "Bitbucket DC HTTP access token", "id": 7 } ], "size": 1, "isLastPage": true, "nextPageStart": 2154, "start": 2154, "limit": 25 }
POST

Create repository secret scanning rule

Create a new repository secret scanning rule. Repository rules are used when scanning the given repository.

Repository Admin is required

Request

Path parameters

projectKey

string

Required
repositorySlug

string

Required

Request body*/*

Rule to create, either the line regular expression or the path regular expression must be present

lineRegex

string

name

string

pathRegex

string

Responses

The created rule

application/json

RestSecretScanningRule
POST/api/latest/projects/{projectKey}/repos/{repositorySlug}/secret-scanning/rules
1 2 3 curl --request POST \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/secret-scanning/rules' \ --header 'Accept: application/json'
200Response
1 2 3 4 5 6 7 8 9 10 { "lineRegex": "(BBDC-[a-zA-Z0-9+]{44})", "pathRegex": "*.pem", "scope": { "resourceId": 2, "type": "GLOBAL" }, "name": "Bitbucket DC HTTP access token", "id": 7 }
GET

Get a repository secret scanning rule

Get a repository secret scanning rule by ID.

Repository Admin is required

Request

Path parameters

projectKey

string

Required
id

string

Required
repositorySlug

string

Required

Responses

The requested rule

application/json

RestSecretScanningRule
GET/api/latest/projects/{projectKey}/repos/{repositorySlug}/secret-scanning/rules/{id}
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/secret-scanning/rules/{id}' \ --header 'Accept: application/json'
200Response
1 2 3 4 5 6 7 8 9 10 { "lineRegex": "(BBDC-[a-zA-Z0-9+]{44})", "pathRegex": "*.pem", "scope": { "resourceId": 2, "type": "GLOBAL" }, "name": "Bitbucket DC HTTP access token", "id": 7 }
PUT

Edit an existing repository secret scanning rule

Edit a repository secret scanning rule.

Repository Admin is required

Request

Path parameters

projectKey

string

Required
id

string

Required
repositorySlug

string

Required

Request body*/*

lineRegex

string

name

string

pathRegex

string

Responses

The updated rule

application/json

RestSecretScanningRule
PUT/api/latest/projects/{projectKey}/repos/{repositorySlug}/secret-scanning/rules/{id}
1 2 3 curl --request PUT \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/secret-scanning/rules/{id}' \ --header 'Accept: application/json'
200Response
1 2 3 4 5 6 7 8 9 10 { "lineRegex": "(BBDC-[a-zA-Z0-9+]{44})", "pathRegex": "*.pem", "scope": { "resourceId": 2, "type": "GLOBAL" }, "name": "Bitbucket DC HTTP access token", "id": 7 }
DEL

Delete a repository secret scanning rule

Delete a repository secret scanning rule with the provided ID.

Repository Admin is required

Request

Path parameters

projectKey

string

Required
id

string

Required
repositorySlug

string

Required

Responses

Empty response indicating that the rule was deleted

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

Find project secret scanning allowlist rules

Find project secret scanning allowlist rules by filtering.

Project Admin is required

Request

Path parameters

projectKey

string

Required

Query parameters

filter

string

order

string

start

number

limit

number

Responses

Page of allowlist rules

application/json

object
GET/api/latest/projects/{projectKey}/secret-scanning/allowlist
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/secret-scanning/allowlist' \ --header 'Accept: application/json'
200Response
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 { "values": [ { "lineRegex": "(BBDC-[a-zA-Z0-9+]{44})", "pathRegex": "*.pem", "name": "Bitbucket DC HTTP access token", "id": 7 } ], "size": 1, "isLastPage": true, "nextPageStart": 2154, "start": 2154, "limit": 25 }
POST

Create project secret scanning allowlist rule

Create a new project level secret scanning allowlist rule. Project allowlist rules are used when scanning all non exempt repositories in the provided project.

Project Admin is required

Request

Path parameters

projectKey

string

Required

Request body*/*

Allowlist rule to create, either the line regular expression or the path regular expression must be present

lineRegex

string

name

string

pathRegex

string

Responses

The created allowlist rule

application/json

RestSecretScanningAllowlistRule
POST/api/latest/projects/{projectKey}/secret-scanning/allowlist
1 2 3 curl --request POST \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/secret-scanning/allowlist' \ --header 'Accept: application/json'
200Response
1 2 3 4 5 6 { "lineRegex": "(BBDC-[a-zA-Z0-9+]{44})", "pathRegex": "*.pem", "name": "Bitbucket DC HTTP access token", "id": 7 }
GET

Get a project secret scanning allowlist rule

Get a project secret scanning allowlist rule by ID.

Project Admin is required

Request

Path parameters

projectKey

string

Required
id

string

Required

Responses

The requested allowlist rule

application/json

RestSecretScanningAllowlistRule
GET/api/latest/projects/{projectKey}/secret-scanning/allowlist/{id}
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/secret-scanning/allowlist/{id}' \ --header 'Accept: application/json'
200Response
1 2 3 4 5 6 { "lineRegex": "(BBDC-[a-zA-Z0-9+]{44})", "pathRegex": "*.pem", "name": "Bitbucket DC HTTP access token", "id": 7 }
PUT

Edit an existing project secret scanning allowlist rule

Edit a project secret scanning allowlist rule.

Project Admin is required

Request

Path parameters

projectKey

string

Required
id

string

Required

Request body*/*

lineRegex

string

name

string

pathRegex

string

Responses

The updated allowlist rule

application/json

RestSecretScanningAllowlistRule
PUT/api/latest/projects/{projectKey}/secret-scanning/allowlist/{id}
1 2 3 curl --request PUT \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/secret-scanning/allowlist/{id}' \ --header 'Accept: application/json'
200Response
1 2 3 4 5 6 { "lineRegex": "(BBDC-[a-zA-Z0-9+]{44})", "pathRegex": "*.pem", "name": "Bitbucket DC HTTP access token", "id": 7 }
DEL

Delete a project secret scanning allowlist rule

Delete a project secret scanning allowlist rule with the provided ID.

Project Admin is required

Request

Path parameters

projectKey

string

Required
id

string

Required

Responses

Empty response indicating that the rule was deleted, or not found at this location

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

Find repos exempt from secret scanning for a project

Find repositories exempt from secret scanning in a project

Request

Query parameters

order

string

start

number

limit

number

Responses

Page of repositories

application/json

object
GET/api/latest/projects/{projectKey}/secret-scanning/exempt
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/secret-scanning/exempt' \ --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": [ { "hierarchyId": "e3c939f9ef4a7fae272e", "statusMessage": "Available", "relatedLinks": {}, "partition": 2154, "defaultBranch": "main", "description": "My repo description", "scmId": "git", "slug": "my-repo", "archived": true, "forkable": true, "project": { "description": "The description for my cool project", "namespace": "<string>", "avatar": "<string>", "scope": "PROJECT", "name": "My Cool Project", "key": "PRJ", "public": true, "id": 2154, "type": "NORMAL" }, "scope": "REPOSITORY", "origin": { "hierarchyId": "e3c939f9ef4a7fae272e", "statusMessage": "Available", "relatedLinks": {}, "partition": 2154, "defaultBranch": "main", "description": "My repo description", "scmId": "git", "slug": "my-repo", "archived": true, "forkable": true, "project": { "description": "The description for my cool project", "namespace": "<string>", "avatar": "<string>", "scope": "PROJECT", "name": "My Cool Project", "key": "PRJ", "public": true, "id": 2154, "type": "NORMAL" }, "scope": "REPOSITORY", "name": "My repo", "public": true, "id": 2154, "state": "AVAILABLE" }, "name": "My repo", "public": true, "id": 2154, "state": "AVAILABLE" } ], "size": 1, "isLastPage": true, "nextPageStart": 2154, "start": 2154, "limit": 25 }
POST

Bulk exempt repos from secret scanning

Bulk exempt a list of repositories from being scanned for secrets. User must be have PROJECT ADMIN permissions.

Request

Request body*/*

array<RestRepositorySelector>

Unique items: true
projectKey

string

slug

string

Responses

All requested repositories were made exempt

POST/api/latest/projects/{projectKey}/secret-scanning/exempt
1 2 curl --request POST \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/secret-scanning/exempt'
GET

Find project secret scanning rules

Find project secret scanning rules by filtering.

Project Admin is required

Request

Path parameters

projectKey

string

Required

Query parameters

filter

string

order

string

start

number

limit

number

Responses

Page of rules

application/json

object
GET/api/latest/projects/{projectKey}/secret-scanning/rules
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/secret-scanning/rules' \ --header 'Accept: application/json'
200Response
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 { "values": [ { "lineRegex": "(BBDC-[a-zA-Z0-9+]{44})", "pathRegex": "*.pem", "scope": { "resourceId": 2, "type": "GLOBAL" }, "name": "Bitbucket DC HTTP access token", "id": 7 } ], "size": 1, "isLastPage": true, "nextPageStart": 2154, "start": 2154, "limit": 25 }
POST

Create project secret scanning rule

Create a new project level secret scanning rule. Project rules are used when scanning all non exempt repositories in the provided project.

Project Admin is required

Request

Path parameters

projectKey

string

Required

Request body*/*

Rule to create, either the line regular expression or the path regular expression must be present

lineRegex

string

name

string

pathRegex

string

Responses

The created rule

application/json

RestSecretScanningRule
POST/api/latest/projects/{projectKey}/secret-scanning/rules
1 2 3 curl --request POST \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/secret-scanning/rules' \ --header 'Accept: application/json'
200Response
1 2 3 4 5 6 7 8 9 10 { "lineRegex": "(BBDC-[a-zA-Z0-9+]{44})", "pathRegex": "*.pem", "scope": { "resourceId": 2, "type": "GLOBAL" }, "name": "Bitbucket DC HTTP access token", "id": 7 }
GET

Get a project secret scanning rule

Get a project secret scanning rule by ID.

Project Admin is required

Request

Path parameters

projectKey

string

Required
id

string

Required

Responses

The requested rule

application/json

RestSecretScanningRule
GET/api/latest/projects/{projectKey}/secret-scanning/rules/{id}
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/secret-scanning/rules/{id}' \ --header 'Accept: application/json'
200Response
1 2 3 4 5 6 7 8 9 10 { "lineRegex": "(BBDC-[a-zA-Z0-9+]{44})", "pathRegex": "*.pem", "scope": { "resourceId": 2, "type": "GLOBAL" }, "name": "Bitbucket DC HTTP access token", "id": 7 }
PUT

Edit an existing project secret scanning rule

Edit a project secret scanning rule.

Project Admin is required

Request

Path parameters

projectKey

string

Required
id

string

Required

Request body*/*

lineRegex

string

name

string

pathRegex

string

Responses

The updated rule

application/json

RestSecretScanningRule
PUT/api/latest/projects/{projectKey}/secret-scanning/rules/{id}
1 2 3 curl --request PUT \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/secret-scanning/rules/{id}' \ --header 'Accept: application/json'
200Response
1 2 3 4 5 6 7 8 9 10 { "lineRegex": "(BBDC-[a-zA-Z0-9+]{44})", "pathRegex": "*.pem", "scope": { "resourceId": 2, "type": "GLOBAL" }, "name": "Bitbucket DC HTTP access token", "id": 7 }
DEL

Delete a project secret scanning rule

Delete a project secret scanning rule with the provided ID.

Project Admin is required

Request

Path parameters

projectKey

string

Required
id

string

Required

Responses

Empty response indicating that the rule was deleted, or not found at this location

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

Find all repos exempt from secret scan

Find all repositories exempt from secret scanning

Request

Query parameters

order

string

start

number

limit

number

Responses

Page of repositories

application/json

object
GET/api/latest/secret-scanning/exempt
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/api/latest/secret-scanning/exempt' \ --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": [ { "hierarchyId": "e3c939f9ef4a7fae272e", "statusMessage": "Available", "relatedLinks": {}, "partition": 2154, "defaultBranch": "main", "description": "My repo description", "scmId": "git", "slug": "my-repo", "archived": true, "forkable": true, "project": { "description": "The description for my cool project", "namespace": "<string>", "avatar": "<string>", "scope": "PROJECT", "name": "My Cool Project", "key": "PRJ", "public": true, "id": 2154, "type": "NORMAL" }, "scope": "REPOSITORY", "origin": { "hierarchyId": "e3c939f9ef4a7fae272e", "statusMessage": "Available", "relatedLinks": {}, "partition": 2154, "defaultBranch": "main", "description": "My repo description", "scmId": "git", "slug": "my-repo", "archived": true, "forkable": true, "project": { "description": "The description for my cool project", "namespace": "<string>", "avatar": "<string>", "scope": "PROJECT", "name": "My Cool Project", "key": "PRJ", "public": true, "id": 2154, "type": "NORMAL" }, "scope": "REPOSITORY", "name": "My repo", "public": true, "id": 2154, "state": "AVAILABLE" }, "name": "My repo", "public": true, "id": 2154, "state": "AVAILABLE" } ], "size": 1, "isLastPage": true, "nextPageStart": 2154, "start": 2154, "limit": 25 }
POST

Bulk exempt repos from secret scanning

Bulk exempt a list of repositories from being scanned for secrets. User must be have global ADMIN permissions.

Request

Request body*/*

array<RestRepositorySelector>

Unique items: true
projectKey

string

slug

string

Responses

All requested repositories were made exempt

POST/api/latest/secret-scanning/exempt
1 2 curl --request POST \ --url 'http://{baseurl}/rest/api/latest/secret-scanning/exempt'
GET

Find global secret scanning rules

Find global secret scanning rules by filtering.

Request

Query parameters

filter

string

order

string

start

number

limit

number

Responses

Page of rules

application/json

object
GET/api/latest/secret-scanning/rules
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/api/latest/secret-scanning/rules' \ --header 'Accept: application/json'
200Response
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 { "values": [ { "lineRegex": "(BBDC-[a-zA-Z0-9+]{44})", "pathRegex": "*.pem", "scope": { "resourceId": 2, "type": "GLOBAL" }, "name": "Bitbucket DC HTTP access token", "id": 7 } ], "size": 1, "isLastPage": true, "nextPageStart": 2154, "start": 2154, "limit": 25 }
POST

Create global secret scanning rule

Create a new global secret scanning rule. Global rules are used when scanning all non exempt repositories.

Request

Request body*/*

Rule to create, either the line regular expression or the path regular expression must be present

lineRegex

string

name

string

pathRegex

string

Responses

The created rule

application/json

RestSecretScanningRule
POST/api/latest/secret-scanning/rules
1 2 3 curl --request POST \ --url 'http://{baseurl}/rest/api/latest/secret-scanning/rules' \ --header 'Accept: application/json'
200Response
1 2 3 4 5 6 7 8 9 10 { "lineRegex": "(BBDC-[a-zA-Z0-9+]{44})", "pathRegex": "*.pem", "scope": { "resourceId": 2, "type": "GLOBAL" }, "name": "Bitbucket DC HTTP access token", "id": 7 }
GET

Get a global secret scanning rule

Get a global secret scanning rule by ID.

Request

Path parameters

id

string

Required

Responses

The requested rule

application/json

RestSecretScanningRule
GET/api/latest/secret-scanning/rules/{id}
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/api/latest/secret-scanning/rules/{id}' \ --header 'Accept: application/json'
200Response
1 2 3 4 5 6 7 8 9 10 { "lineRegex": "(BBDC-[a-zA-Z0-9+]{44})", "pathRegex": "*.pem", "scope": { "resourceId": 2, "type": "GLOBAL" }, "name": "Bitbucket DC HTTP access token", "id": 7 }
PUT

Edit a global secret scanning rule.

Edit an existing global secret scanning rule

Request

Path parameters

id

string

Required

Request body*/*

lineRegex

string

name

string

pathRegex

string

Responses

The updated rule

application/json

RestSecretScanningRule
PUT/api/latest/secret-scanning/rules/{id}
1 2 3 curl --request PUT \ --url 'http://{baseurl}/rest/api/latest/secret-scanning/rules/{id}' \ --header 'Accept: application/json'
200Response
1 2 3 4 5 6 7 8 9 10 { "lineRegex": "(BBDC-[a-zA-Z0-9+]{44})", "pathRegex": "*.pem", "scope": { "resourceId": 2, "type": "GLOBAL" }, "name": "Bitbucket DC HTTP access token", "id": 7 }
DEL

Delete a global secret scanning rule

Delete a global secret scanning rule with the provided ID

Request

Path parameters

id

string

Required

Responses

Empty response indicating that the rule was deleted

DEL/api/latest/secret-scanning/rules/{id}
1 2 curl --request DELETE \ --url 'http://{baseurl}/rest/api/latest/secret-scanning/rules/{id}'

Rate this page: