Use API to permit a Deploy Key to push to a protected branch

My organization uses Gitlab Premium.

Using the Gitlab API, how can I permit a deploy key to push to a protected branch? I can do this through the GUI, and I have managed to permit a single user to push to a protected branch, but I don’t see how to permit a deploy key.

I’ve read this whole document and don’t see any examples that talk about deploy keys: Protected branches API | GitLab

Hi, @jlofgren1.

The creator of the deploy key must have permission to push to the protected branch:

  • When a deploy key is used to push a commit to a protected branch, the creator of the deploy key must have access to the branch.

By extension, I believe that if you create a deploy key using API credentials that belong to a permitted user, the generated key should be able to push to the relevant protected branch.

If this doesn’t solve your issues, remember that as a Premium customer you’re entitled to support.