Event payload
When you have a webhook with an event, Bitbucket Data Center sends the event request to the server URL for the webhook whenever that event occurs. This page describes the structure of these requests.
For Bitbucket to send event payload requests for a webhook with HTTPS endpoints, make sure your URL has a valid SSL certificate that a public certificate authority has signed. Learn how to use self-signed certificates
The following payloads contain some of the common entity types – U
ser
, Repository
, Comment
, and Pull Request
– which have consistent representations in all the payloads where they appear. For example, the actor
property in the repo:refs_changed
payload is a representation of the event's user.
The following events are supported:
Project event | Trigger |
---|---|
Project modified | The name of a project is modified. |
Repository event | Trigger |
Push | A push is made to the repository. |
Modified | The name of a repository is modified. |
Forked | A repository is forked. |
Comment added | A comment is added to a commit in the repository. |
Comment edited | A commit comment is modified in the repository. |
Comment deleted | A commit comment is deleted in the repository. |
Mirror synchronized | A mirror finishes synchronizing the repository. |
Secret deleted | A secret is pushed to the repository. |
Pull request event | Trigger |
Opened | A pull request is created. |
Source branch updated | The source branch of a pull request is updated. |
Target branch updated | The target branch of a pull request is updated. |
Modified | A pull request is modified. |
Reviewers updated | The reviewers in a pull request are updated. |
Approved | A pull request is approved. |
Unapproved | A pull request is unapproved. |
Changes requested | A pull request is marked as Changes requested. |
Merged | A pull request is merged. |
Declined | A pull request is declined. |
Deleted | A pull request is deleted. |
Comment added | A comment is added to a pull request. |
Comment edited | A comment on a pull request is edited. |
Comment deleted | A comment on a pull request is deleted. |
HTTP headers
All event payload requests may have the following HTTP headers:
HTTP header | Description |
---|---|
X-Request-Id | A unique UUID for each webhook request |
X-Event-Key | The event that kicked off this webhook. For example, a repository push will have |
X-Hub-Signature | See Webhook secrets |
Authorization | The Base64 encoded credentials that authenticate the webhook request. This header will only be present if the webhook has basic authentication configured. |
Project events
You can create project-level webhooks for the following events and all the events that occur in a repository.
Modified
A user updates the Name of a project. This payload, with an event key of project:modified
, provides the following fields:
Parameter | Description |
---|---|
old | The details of the old version of the project. |
new | The defaults of the current version of the project. |
actor | The user who made the update. |
Repository events
You can create webhooks for the following events that occur in a repository.
Push
A user pushes one or more commits to a repository. This payload, with an event key of repo:refs_changed
, provides the following fields:
Parameter | Description |
---|---|
actor | The user who pushed the commits. |
repository | The repository with the commits. |
changes | The details of the push. |
commits | The details of the commit pushed. By default, the maximum number of commits included is 5. If the number of commits pushed is greater than the limit set, the list will include only the most recent commits. |
toCommit | The details of the new head commit. |
Modified
A user updates the Name of a repository. This payload, with an event key of repo:modified
, provides the following fields:
Parameter | Description |
---|---|
old | The details of the old version of the repository. |
new | The defaults of the current version of the repository. |
actor | The user who made the update. |
Fork
A user forks a repository. This payload, with an event key of repo:fork
, provides the following fields:
Parameter | Description |
---|---|
actor | The user who forks the repository. This user is also the owner of the fork. |
repository | The new repository. |
repository.origin | The original repository that was forked. |
Commit comment created
A user comments on a commit in a repository. This payload, with an event key of repo:comment:added
, provides the following fields:
Parameter | Description |
---|---|
actor | The user who comments on the commit. |
comment | The comment created. |
repository | The repository with the commit. |
commit | The hash. |
Commit edit on comment
A user edits a comment on a commit in a repository. This payload, with an event key of repo:comment:edited
, provides the following fields:
Parameter | Description |
---|---|
actor | The user who edits the commit. |
comment | The comment edited. |
previousComment | The text of the comment prior to editing. |
repository | The repository with the commit. |
commit | The hash of the commit. |
Comment deleted on commit
A user deletes a comment on a commit in a repository. This payload, with an event key of repo:comment:deleted
, provides the following fields:
Parameter | Description |
---|---|
actor | The user who deletes the commit. |
comment | The comment deleted. |
repository | The repository with the commit. |
commit | The hash of the commit. |
Mirror synchronized
A mirror has finished synchronizing this repository. This payload, with an event key of mirror:repo_synchronized
, provides the following fields:
Parameter | Description |
---|---|
mirrorServer | The mirror which synchronized the changes. This JSON object contains both the name and the id of the mirrorServer which synchronized the changes. |
syncType | The sync type the mirror used to synchronize the changes which are announced by this webhook. This value can be |
repository | The repository. |
repository.links | This JSON object contains the HTTP and SSH clone URLs of the primary server as well as the mirror that synchronized these changes. It also contains a link to view this repository in Bitbucket. |
changes | The ref changes for this push. |
refLimitExceeded | If this value is true , the list of changes will be empty because it exceeded the limit of refs that can be included. |
Secret detected
A user pushes one or more commits that contain a secret to a repository. This payload, with an event key of repo:secret_detected,
provides the following fields:
Parameter | Description |
---|---|
actor | The user who pushed the commits. |
secretLocations | The details of the commits that contain a secret. |
Pull request events
You can create webhooks for the following events that occur on a pull request.
Opened
Parameter | Description |
---|---|
actor | The user who created the pull request. |
pullrequest | Details of the pull request created. |
Source branch updated
Parameter | Description |
---|---|
actor | The user who created the pull request. |
pullrequest | Details of the pull request created. |
previousFromHash | Previous from-ref hash |
Target branch updated
The Target branch updated webhook isn't available due to the following bug: BSERV-14136 - Getting issue details... STATUS . Share your feedback in this Jira issue or start watching it to follow the updates.
Parameter | Description |
---|---|
actor | The user who created the pull request. |
pullrequest | Details of the pull request created. |
previousToHash | Previous to-ref hash |
Modified
Parameter | Description |
---|---|
actor | The user who created the pull request. |
pullrequest | Details of the pull request created. |
previousTitle | Previous title of the pull request, may not have changed |
previousDescription | Previous description of the pull request, may not have changed |
previousTarget | Previous target of the pull request, may not have changed |
previousDraft | Previous draft status of the pull request, may not have changed Learn more about draft pull requests |
Reviewers Updated
Parameter | Description |
---|---|
actor | The user who created the pull request. |
pullrequest | Details of the pull request created. |
removedReviewers | Users that are no longer reviewers |
addedReviewers | Users that have been added as reviewers |
Approved
A user approves a pull request for a repository. This payload, with an event key of pr:reviewer:approved
, provides the following fields:
Parameter | Description |
---|---|
actor | The user which made the approval. |
pullrequest | Details of the pull request approved. |
participant | Details of the PR participant status of the user making the change |
previousStatus | The state of the approval before this change |
Unapproved
A user removes an approval from a pull request for a repository. This payload, with an event key of pr:reviewer:unapproved
, provides the following fields:
Parameter | Description |
---|---|
actor | The user which removed the approval. |
pullrequest | Details of the pull request unapproved. |
participant | Details of the PR participant status of the user making the change |
previousStatus | The state of the approval before this change |
Changes requested
A user marks a pull request as changes requested. This payload, with an event key of pr:reviewer:changes requested, provides the following fields:
Parameter | Description |
---|---|
actor | The user who marked the PR as "Changes requested". |
pullrequest | Details of the pull request marked "Changes requested". |
participant | Details of the PR participant status of the user making the change. |
previousStatus | The state of the approval before this change. |
Merged
A user merges a pull request for a repository. This payload, with an event key of pr:merged
, provides the following fields:
Parameter | Description |
---|---|
actor | The user who merged the pull request. |
pullrequest | Details of the pull request merged. |
Declined
A user declines a pull request for a repository. This payload, with an event key of pr:declined
, provides the following fields:
Parameter | Description |
---|---|
actor | The user who declined the pull request. |
pullrequest | Details of the pull request declined. |
Deleted
A user deletes a pull request for a repository. This payload, with an event key of pr:deleted
, provides the following fields:
Parameter | Description |
---|---|
actor | The user who deleted the pull request. |
pullrequest | Details of the pull request deleted. |
Comment added
A user comments on a pull request. This payload, with an event key of pr:comment:added
, provides the following fields:
Parameter | Description |
---|---|
actor | The user that created the comment. |
pullRequest | The pull request comment on. |
comment | The comment created. |
commentParentId | Id of the parent comment if one exists. |
Comment edited
This payload, with an event key of pr:comment:edited
, provides the following fields:
Parameter | Description |
---|---|
actor | The user that edited the comment. |
pullRequest | The pull request where the comment exists. |
comment | The comment edited. |
commentParentId | Id of the parent comment if one exists. |
previousComment | Text of the previous comment. |
Comment deleted
A user deletes a comment on a pull request. This payload, with an event key of pr:comment:deleted
, provides the following fields:
Parameter | Description |
---|---|
actor | The user that deleted the comment. |
pullRequest | The pull request where the comment existed. |
comment | The comment deleted. |
commentParentId | Id of the parent comment if one exists. |