GitLab Personal Access Token Setup for Git-Zen

Create a PAT, give it the right scopes, and connect it to Git-Zen โ€” about 8 minutes.

Last updated April 2026 ยท works for gitlab.com and self-hosted GitLab (CE & EE)

When you need this guide

Git-Zen prefers OAuth 2.0 for GitLab connections โ€” it's automatic and refreshes on its own. Use a Personal Access Token (PAT) instead when:

Self-hosted GitLab Git-Zen Enterprise plan supports self-hosted GitLab (CE and EE). The PAT setup below works the same way on your own instance — just create the token in your own GitLab UI. See the self-hosted setup guide for the additional firewall allowlist step.

Required scopes

Git-Zen needs the following scopes on your PAT. Anything more is unnecessary; anything less and parts of the integration will fail silently.

Scope Why Git-Zen needs it
apiFull read/write access to the GitLab API — create issues from Zendesk tickets, sync labels, milestones, comments, and field updates.
read_repositoryRead commits referenced from Zendesk tickets via gz# tags.
Why does api grant write access? GitLab's api scope is broader than ideal — it does include write. That's a GitLab limitation, not a Git-Zen design choice. The narrower read_api scope alone would mean Git-Zen could read your data but never create or update issues from Zendesk, which defeats the integration.

Step-by-step

1

Open Access Tokens in GitLab

On gitlab.com (or your self-hosted instance), click your avatar in the top-left and select Edit profile. Then click Access Tokens in the left sidebar.

2

Create a new token

Click Add new token. Fill in:

  • Token name: Git-Zen Integration
  • Expiration date: 1 year out (or as long as your security policy allows)
3

Select scopes

Check the boxes for:

  • api
  • read_repository

Leave everything else unchecked.

4

Copy the token immediately

Click Create personal access token. GitLab shows the token once at the top of the page, with a copy button. Copy it to your clipboard or a password manager right now — if you navigate away without copying, you have to start over.

5

Paste the token into Git-Zen

Inside Zendesk, open any ticket and find the Git-Zen sidebar. Then:

  1. Click the gear icon → Settings
  2. Open the Authentication section
  3. Switch from OAuth to PAT
  4. Paste the token and (if self-hosted) confirm your GitLab Base URL
  5. Click Save

Git-Zen will validate the token immediately. If something is wrong with the scopes, the validator tells you which scope is missing.

Group access tokens (GitLab Premium / self-hosted)

If your GitLab instance supports Group access tokens (Premium or self-hosted), prefer those over personal tokens for service-account-style usage. They follow the same scope requirements but don't break when an employee leaves. Create one at Group settings → Access Tokens, give it the Maintainer role, then paste it into Git-Zen the same way.

Troubleshooting

"401 Unauthorized" after pasting

"403 Forbidden" or "Insufficient scope"

Comments aren't syncing back to Zendesk

The token expired

GitLab emails you 7 days before expiration. Repeat steps 1–5 to create a new one and paste it into Git-Zen Settings. Your settings, links, and history stay intact during the rotation.

Security best practices

Other auth setup guides

GitHub Personal Access Tokens → · Azure DevOps Personal Access Tokens → · Back to Git-Zen for GitLab →