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

Reports

Postman Collection
OpenAPI
GET

List reports

Returns a paginated list of Reports linked to this commit.

Scopes
repository
read:repository:bitbucket

Request

Path parameters

workspace

string

Required
repo_slug

string

Required
commit

string

Required

Responses

OK

application/json

Paginated Reports

A paginated list of reports.

GET/repositories/{workspace}/{repo_slug}/commit/{commit}/reports
1 2 3 4 curl --request GET \ --url 'https://api.bitbucket.org/2.0/repositories/{workspace}/{repo_slug}/commit/{commit}/reports' \ --header 'Authorization: Bearer <access_token>' \ --header 'Accept: application/json'
200Response
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 { "page": 102, "values": [ { "type": "<string>", "uuid": "<string>", "title": "<string>", "details": "<string>", "external_id": "<string>", "reporter": "<string>", "link": "<string>", "remote_link_enabled": true, "logo_url": "<string>", "report_type": "SECURITY", "result": "PASSED", "data": [ {} ], "created_on": "<string>", "updated_on": "<string>" } ], "size": 142, "pagelen": 159, "next": "<string>", "previous": "<string>" }
GET

Get a report

Returns a single Report matching the provided ID.

Scopes
repository
read:repository:bitbucket

Request

Path parameters

workspace

string

Required
repo_slug

string

Required
commit

string

Required
reportId

string

Required

Responses

OK

application/json

allOf [object, Commit Report]

object

Base type for most resource objects. It defines the common type element that identifies an object's type. It also identifies the element as Swagger's discriminator.

Commit Report

A report for a commit.

GET/repositories/{workspace}/{repo_slug}/commit/{commit}/reports/{reportId}
1 2 3 4 curl --request GET \ --url 'https://api.bitbucket.org/2.0/repositories/{workspace}/{repo_slug}/commit/{commit}/reports/{reportId}' \ --header 'Authorization: Bearer <access_token>' \ --header 'Accept: application/json'
200Response
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 { "type": "<string>", "uuid": "<string>", "title": "<string>", "details": "<string>", "external_id": "<string>", "reporter": "<string>", "link": "<string>", "remote_link_enabled": true, "logo_url": "<string>", "report_type": "SECURITY", "result": "PASSED", "data": [ { "type": "BOOLEAN", "title": "<string>", "value": {} } ], "created_on": "<string>", "updated_on": "<string>" }
PUT

Create or update a report

Creates or updates a report for the specified commit. To upload a report, make sure to generate an ID that is unique across all reports for that commit. If you want to use an existing id from your own system, we recommend prefixing it with your system's name to avoid collisions, for example, mySystem-001.

Sample cURL request:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 curl --request PUT 'https://api.bitbucket.org/2.0/repositories/<username>/<reposity-name>/commit/<commit-hash>/reports/mysystem-001' \ --header 'Content-Type: application/json' \ --data-raw '{ "title": "Security scan report", "details": "This pull request introduces 10 new dependency vulnerabilities.", "report_type": "SECURITY", "reporter": "mySystem", "link": "http://www.mysystem.com/reports/001", "result": "FAILED", "data": [ { "title": "Duration (seconds)", "type": "DURATION", "value": 14 }, { "title": "Safe to merge?", "type": "BOOLEAN", "value": false } ] }'

Possible field values:

report_type: SECURITY, COVERAGE, TEST, BUG result: PASSED, FAILED, PENDING data.type: BOOLEAN, DATE, DURATION, LINK, NUMBER, PERCENTAGE, TEXT

Data field formats

Type FieldValue Field TypeValue Field Display
None/ OmittedNumber, String or Boolean (not an array or object)Plain text
BOOLEANBooleanThe value will be read as a JSON boolean and displayed as 'Yes' or 'No'.
DATENumberThe value will be read as a JSON number in the form of a Unix timestamp (milliseconds) and will be displayed as a relative date if the date is less than one week ago, otherwise it will be displayed as an absolute date.
DURATIONNumberThe value will be read as a JSON number in milliseconds and will be displayed in a human readable duration format.
LINKObject: {"text": "Link text here", "href": "https://link.to.annotation/in/external/tool"}The value will be read as a JSON object containing the fields "text" and "href" and will be displayed as a clickable link on the report.
NUMBERNumberThe value will be read as a JSON number and large numbers will be displayed in a human readable format (e.g. 14.3k).
PERCENTAGENumber (between 0 and 100)The value will be read as a JSON number between 0 and 100 and will be displayed with a percentage sign.
TEXTStringThe value will be read as a JSON string and will be displayed as-is

Please refer to the Code Insights documentation for more information.

Scopes
repository
read:repository:bitbucket

Request

Path parameters

workspace

string

Required
repo_slug

string

Required
commit

string

Required
reportId

string

Required

Request bodyapplication/json

The report to create or update

allOf [object, Commit Report]

object

Base type for most resource objects. It defines the common type element that identifies an object's type. It also identifies the element as Swagger's discriminator.

Commit Report

A report for a commit.

Responses

OK

application/json

allOf [object, Commit Report]

object

Base type for most resource objects. It defines the common type element that identifies an object's type. It also identifies the element as Swagger's discriminator.

Commit Report

A report for a commit.

PUT/repositories/{workspace}/{repo_slug}/commit/{commit}/reports/{reportId}
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 curl --request PUT \ --url 'https://api.bitbucket.org/2.0/repositories/{workspace}/{repo_slug}/commit/{commit}/reports/{reportId}' \ --header 'Authorization: Bearer <access_token>' \ --header 'Accept: application/json' \ --header 'Content-Type: application/json' \ --data '{ "type": "<string>", "uuid": "<string>", "title": "<string>", "details": "<string>", "external_id": "<string>", "reporter": "<string>", "link": "<string>", "remote_link_enabled": true, "logo_url": "<string>", "report_type": "SECURITY", "result": "PASSED", "data": [ { "type": "BOOLEAN", "title": "<string>", "value": {} } ], "created_on": "<string>", "updated_on": "<string>" }'
200Response
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 { "type": "<string>", "uuid": "<string>", "title": "<string>", "details": "<string>", "external_id": "<string>", "reporter": "<string>", "link": "<string>", "remote_link_enabled": true, "logo_url": "<string>", "report_type": "SECURITY", "result": "PASSED", "data": [ { "type": "BOOLEAN", "title": "<string>", "value": {} } ], "created_on": "<string>", "updated_on": "<string>" }
DEL

Delete a report

Deletes a single Report matching the provided ID.

Scopes
repository
read:repository:bitbucket

Request

Path parameters

workspace

string

Required
repo_slug

string

Required
commit

string

Required
reportId

string

Required

Responses

No content

DEL/repositories/{workspace}/{repo_slug}/commit/{commit}/reports/{reportId}
1 2 3 curl --request DELETE \ --url 'https://api.bitbucket.org/2.0/repositories/{workspace}/{repo_slug}/commit/{commit}/reports/{reportId}' \ --header 'Authorization: Bearer <access_token>'
GET

List annotations

Returns a paginated list of Annotations for a specified report.

Scopes
repository
read:repository:bitbucket

Request

Path parameters

workspace

string

Required
repo_slug

string

Required
commit

string

Required
reportId

string

Required

Responses

OK

application/json

Paginated Annotations

A paginated list of annotations.

GET/repositories/{workspace}/{repo_slug}/commit/{commit}/reports/{reportId}/annotations
1 2 3 4 curl --request GET \ --url 'https://api.bitbucket.org/2.0/repositories/{workspace}/{repo_slug}/commit/{commit}/reports/{reportId}/annotations' \ --header 'Authorization: Bearer <access_token>' \ --header 'Accept: application/json'
200Response
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 { "page": 102, "values": [ { "type": "<string>", "external_id": "<string>", "uuid": "<string>", "annotation_type": "VULNERABILITY", "path": "<string>", "line": 199, "summary": "<string>", "details": "<string>", "result": "PASSED", "severity": "CRITICAL", "link": "<string>", "created_on": "<string>", "updated_on": "<string>" } ], "size": 142, "pagelen": 159, "next": "<string>", "previous": "<string>" }
POST

Bulk create or update annotations

Bulk upload of annotations. Annotations are individual findings that have been identified as part of a report, for example, a line of code that represents a vulnerability. These annotations can be attached to a specific file and even a specific line in that file, however, that is optional. Annotations are not mandatory and a report can contain up to 1000 annotations.

Add the annotations you want to upload as objects in a JSON array and make sure each annotation has the external_id field set to a unique value. If you want to use an existing id from your own system, we recommend prefixing it with your system's name to avoid collisions, for example, mySystem-annotation001. The external id can later be used to identify the report as an alternative to the generated UUID. You can upload up to 100 annotations per POST request.

Sample cURL request:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 curl --location 'https://api.bitbucket.org/2.0/repositories/<username>/<reposity-name>/commit/<commit-hash>/reports/mysystem-001/annotations' \ --header 'Content-Type: application/json' \ --data-raw '[ { "external_id": "mysystem-annotation001", "title": "Security scan report", "annotation_type": "VULNERABILITY", "summary": "This line represents a security threat.", "severity": "HIGH", "path": "my-service/src/main/java/com/myCompany/mysystem/logic/Main.java", "line": 42 }, { "external_id": "mySystem-annotation002", "title": "Bug report", "annotation_type": "BUG", "result": "FAILED", "summary": "This line might introduce a bug.", "severity": "MEDIUM", "path": "my-service/src/main/java/com/myCompany/mysystem/logic/Helper.java", "line": 13 } ]'

Possible field values:

annotation_type: VULNERABILITY, CODE_SMELL, BUG result: PASSED, FAILED, IGNORED, SKIPPED severity: HIGH, MEDIUM, LOW, CRITICAL

Please refer to the Code Insights documentation for more information.

Scopes
repository
read:repository:bitbucket

Request

Path parameters

workspace

string

Required
repo_slug

string

Required
commit

string

Required
reportId

string

Required

Request bodyapplication/json

The annotations to create or update

array<allOf [object, Report Annotation]>

Min items: 1Max items: 100

Responses

OK

application/json

array<allOf [object, Report Annotation]>

POST/repositories/{workspace}/{repo_slug}/commit/{commit}/reports/{reportId}/annotations
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 curl --request POST \ --url 'https://api.bitbucket.org/2.0/repositories/{workspace}/{repo_slug}/commit/{commit}/reports/{reportId}/annotations' \ --header 'Authorization: Bearer <access_token>' \ --header 'Accept: application/json' \ --header 'Content-Type: application/json' \ --data '[ { "type": "<string>", "external_id": "<string>", "uuid": "<string>", "annotation_type": "VULNERABILITY", "path": "<string>", "line": 199, "summary": "<string>", "details": "<string>", "result": "PASSED", "severity": "CRITICAL", "link": "<string>", "created_on": "<string>", "updated_on": "<string>" } ]'
200Response
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 [ { "type": "<string>", "external_id": "<string>", "uuid": "<string>", "annotation_type": "VULNERABILITY", "path": "<string>", "line": 199, "summary": "<string>", "details": "<string>", "result": "PASSED", "severity": "CRITICAL", "link": "<string>", "created_on": "<string>", "updated_on": "<string>" } ]
GET

Get an annotation

Returns a single Annotation matching the provided ID.

Scopes
repository
read:repository:bitbucket

Request

Path parameters

workspace

string

Required
repo_slug

string

Required
commit

string

Required
reportId

string

Required
annotationId

string

Required

Responses

OK

application/json

allOf [object, Report Annotation]

object

Base type for most resource objects. It defines the common type element that identifies an object's type. It also identifies the element as Swagger's discriminator.

Report Annotation

A report for a commit.

GET/repositories/{workspace}/{repo_slug}/commit/{commit}/reports/{reportId}/annotations/{annotationId}
1 2 3 4 curl --request GET \ --url 'https://api.bitbucket.org/2.0/repositories/{workspace}/{repo_slug}/commit/{commit}/reports/{reportId}/annotations/{annotationId}' \ --header 'Authorization: Bearer <access_token>' \ --header 'Accept: application/json'
200Response
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 { "type": "<string>", "external_id": "<string>", "uuid": "<string>", "annotation_type": "VULNERABILITY", "path": "<string>", "line": 199, "summary": "<string>", "details": "<string>", "result": "PASSED", "severity": "CRITICAL", "link": "<string>", "created_on": "<string>", "updated_on": "<string>" }
PUT

Create or update an annotation

Creates or updates an individual annotation for the specified report. Annotations are individual findings that have been identified as part of a report, for example, a line of code that represents a vulnerability. These annotations can be attached to a specific file and even a specific line in that file, however, that is optional. Annotations are not mandatory and a report can contain up to 1000 annotations.

Just as reports, annotation needs to be uploaded with a unique ID that can later be used to identify the report as an alternative to the generated UUID. If you want to use an existing id from your own system, we recommend prefixing it with your system's name to avoid collisions, for example, mySystem-annotation001.

Sample cURL request:

1 2 3 4 5 6 7 8 9 10 curl --request PUT 'https://api.bitbucket.org/2.0/repositories/<username>/<reposity-name>/commit/<commit-hash>/reports/mySystem-001/annotations/mysystem-annotation001' \ --header 'Content-Type: application/json' \ --data-raw '{ "title": "Security scan report", "annotation_type": "VULNERABILITY", "summary": "This line represents a security thread.", "severity": "HIGH", "path": "my-service/src/main/java/com/myCompany/mysystem/logic/Main.java", "line": 42 }'

Possible field values:

annotation_type: VULNERABILITY, CODE_SMELL, BUG result: PASSED, FAILED, IGNORED, SKIPPED severity: HIGH, MEDIUM, LOW, CRITICAL

Please refer to the Code Insights documentation for more information.

Scopes
repository
read:repository:bitbucket

Request

Path parameters

workspace

string

Required
repo_slug

string

Required
commit

string

Required
reportId

string

Required
annotationId

string

Required

Request bodyapplication/json

The annotation to create or update

allOf [object, Report Annotation]

object

Base type for most resource objects. It defines the common type element that identifies an object's type. It also identifies the element as Swagger's discriminator.

Report Annotation

A report for a commit.

Responses

OK

application/json

allOf [object, Report Annotation]

object

Base type for most resource objects. It defines the common type element that identifies an object's type. It also identifies the element as Swagger's discriminator.

Report Annotation

A report for a commit.

PUT/repositories/{workspace}/{repo_slug}/commit/{commit}/reports/{reportId}/annotations/{annotationId}
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 curl --request PUT \ --url 'https://api.bitbucket.org/2.0/repositories/{workspace}/{repo_slug}/commit/{commit}/reports/{reportId}/annotations/{annotationId}' \ --header 'Authorization: Bearer <access_token>' \ --header 'Accept: application/json' \ --header 'Content-Type: application/json' \ --data '{ "type": "<string>", "external_id": "<string>", "uuid": "<string>", "annotation_type": "VULNERABILITY", "path": "<string>", "line": 199, "summary": "<string>", "details": "<string>", "result": "PASSED", "severity": "CRITICAL", "link": "<string>", "created_on": "<string>", "updated_on": "<string>" }'
200Response
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 { "type": "<string>", "external_id": "<string>", "uuid": "<string>", "annotation_type": "VULNERABILITY", "path": "<string>", "line": 199, "summary": "<string>", "details": "<string>", "result": "PASSED", "severity": "CRITICAL", "link": "<string>", "created_on": "<string>", "updated_on": "<string>" }
DEL

Delete an annotation

Deletes a single Annotation matching the provided ID.

Scopes
repository
read:repository:bitbucket

Request

Path parameters

workspace

string

Required
repo_slug

string

Required
commit

string

Required
reportId

string

Required
annotationId

string

Required

Responses

No content

DEL/repositories/{workspace}/{repo_slug}/commit/{commit}/reports/{reportId}/annotations/{annotationId}
1 2 3 curl --request DELETE \ --url 'https://api.bitbucket.org/2.0/repositories/{workspace}/{repo_slug}/commit/{commit}/reports/{reportId}/annotations/{annotationId}' \ --header 'Authorization: Bearer <access_token>'

Rate this page: