Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How do you add custom HTTP headers to a webhook?

Matthew Adams March 3, 2020

I'm trying to mirror a bitbucket repo to gitlab and need to add a custom header, PRIVATE-TOKEN, containing my gitlab access token, in order to invoke gitlab's mirror pull API:

There's no option for it in the webhook creation dialog.  How can I do that?



2 answers

1 accepted

1 vote
Answer accepted
Dario B
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 4, 2020

Hi @Matthew Adams ,

Welcome to the Atlassian Community!

Even if there is no possibility at the moment to add custom headers to Bitbucket Webhooks, the way to send authenticated WebHooks to Gitlab seems to be described in the below documentation page (from Gitlab):

  • Using GitLab CI/CD with a Bitbucket Cloud repository
    1. In GitLab create a CI/CD for external repo, select Repo by URL and create the project.

      Create project

      GitLab will import the repository and enable Pull Mirroring.

    2. In GitLab create a Personal Access Token with api scope. This will be used to authenticate requests from the web hook that will be created in Bitbucket to notify GitLab of new commits.

    3. In Bitbucket, from Settings > Webhooks, create a new web hook to notify GitLab of new commits.

      The web hook URL should be set to the GitLab API to trigger pull mirroring, using the Personal Access Token we just generated for authentication.<PROJECT_ID>/mirror/pull?private_token=<PERSONAL_ACCESS_TOKEN>

      The web hook Trigger should be set to ‘Repository Push’.

      4. [....]



Together with the above one, you may want to also review below liks:



For the rest, it might be worth also mentioning that:

  1. Two way integration can also be achieved by using the add-on: "Sync Bitbucket with GitLab"
  2. There are the below feature requests open in our system that you may want to vote for, and watch for updates:


I hope this helps.



Matthew Adams March 4, 2020

Hi @Dario B

Thanks for the suggestion.  Adding the query string argument `private_token` to the gitlab url actually worked.  Thanks!


Like Dario B likes this
Matthew Adams March 4, 2020

There is a compromise in this solution:  the GitLab token is viewable in clear text by anyone who can see the project settings.

I'll see if I can chime in on the issues linked herein.

Like Dario B likes this
0 votes
Wolfgang Maurer
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
July 26, 2023

Honestly, custom headers are such an obvious feature, that is missing from webhooks.

Suggest an answer

Log in or Sign up to answer
AUG Leaders

Atlassian Community Events