Repository administrators can add a POST hook to a repository. Bitbucket POSTs to a hook URL you specify. Bitbucket supports HTTPS and basic authentication. For example, you can use a URL in the format:
The POST request originates from the IP addresses described in our firewall information page. You may need to configure your firewall to accept connections from these IP addresses.
The hook receives an POST whenever user pushes to the repository. The content header of the POST has an
application/x-www-form-urlencoded type. This hook behave similarly to an HTTP publish/subscribe hook. The payload has
payload= prepended to the actual payload. The payload is url encoded content.
Set up the POST hook
You can set up the POST hook manually or you can automate the creation of a hook from your own application.
Manually from Repository Administration
- Go to the repository's settings.
- Click Hooks in the left-hand navigation.
The Hooks page appears.
- Select the POST hook from the Hook dropdown.
- Click Add hook.
A new section appears for the POST hook.
Enter the URL where Bitbucket should send its update messages.
- Press Save.
Automatically fill in from another application
If you are integrating with Bitbucket and looking for an easy way to add the hook for your users, there are two methods you can use to automate this. You can send the user to a URL structured in the following way:
If you're using OAuth or passing through basic authentication, you can use the api to accomplish this as well
When a user makes a push against a repository, Bitbucket POSTs to the URL you provided. The body of POST request contains information about the repository where the change originated, a list of recent commits, and the user that made the push.