How AI is applied across API Evangelist and APIs.io. Read my AI disclosure →
API Evangelist API Evangelist
Discovery
Learnings
Guidance
Toolbox
Alignment
API Evangelist LLC

GitLab Protected branches API

Use this API to manage [protected branches](https://docs.gitlab.com/user/project/repository/branches/protected/)for a project, and the [protected branch settings](https://docs.gitlab.com/user/project/repository/branches/protected/#in-a-group)that all projects in a group inherit.GitLab Premium and GitLab Ultimate support more granular protections for pushing to branches.Administrators can grant permission to modify and push to protected branches only to deploy keys,instead of specific users.> [!warning]> Group protected branch settings are restricted to top-level groups. They support only> [valid access levels](https://docs.gitlab.com/api/group_protected_branches/#valid-access-levels),> and cannot name individual users or groups.

GitLab Protected branches API is one of 189 APIs that GitLab publishes on the APIs.io network, described by a machine-readable OpenAPI specification and an AsyncAPI event-driven specification.

This API exposes 16 JSON Schema definitions.

Tagged areas include Protected Branches. The published artifact set on APIs.io includes an OpenAPI specification, API documentation, authentication docs, an API reference, rate-limit docs, an AsyncAPI specification, and 16 JSON Schemas.

This API exposes 10 operations across 4 paths, and defines 7 schemas. It is described by OpenAPI 3.2.0, at version 19.6.

Requests are made against a single base URL, https://{hostname}.

10 operations 4 paths 7 schemas 2 DELETE4 GET2 PATCH2 POST

Metadata

The identity and technical contract details declared by the specification.

Specification
OpenAPI 3.2.0
API Version
19.6
Base URL
https://gitlab.com/api/v4
Authentication
HTTP Bearer, OAuth 2.0, API Key
Terms of Service
Resource Areas
1

Authentication & Security 3

GitLab Protected branches API declares 3 security schemes for authenticating requests. It accepts HTTP bearer tokens (http). It supports OAuth 2.0 (oauth2) using the authorizationCode flow, exposing 9 scopes. An API key is passed in the header as PRIVATE-TOKEN (apiKey). By default, every request must be authenticated.

Paths & Operations 10

Across 4 paths, the API surfaces 10 operations — 2 DELETE, 4 GET, 2 PATCH, 2 POST. Each is listed below with its method, path, parameters, and response codes.

Protected branches 10

Use this API to manage protected branches for a project, and the protected branch settings that all projects in a group inherit. GitLab Premium and GitLab Ultimate support more gr…

GET
/api/v4/groups/{id}/protected_branches
List all protected branches
getApiV4GroupsIdProtectedBranches 4 params → 200404401400
POST
/api/v4/groups/{id}/protected_branches
Protect a repository branch
postApiV4GroupsIdProtectedBranches 1 param body → 201422409404401400
GET
/api/v4/groups/{id}/protected_branches/{name}
Retrieve a protected branch
getApiV4GroupsIdProtectedBranchesName 2 params → 200404401400
PATCH
/api/v4/groups/{id}/protected_branches/{name}
Update a protected branch
patchApiV4GroupsIdProtectedBranchesName 2 params body → 200422404401400
DELETE
/api/v4/groups/{id}/protected_branches/{name}
Unprotect repository branches
deleteApiV4GroupsIdProtectedBranchesName 2 params → 204404401400
GET
/api/v4/projects/{id}/protected_branches
List all protected branches
getApiV4ProjectsIdProtectedBranches 4 params → 200404401400
POST
/api/v4/projects/{id}/protected_branches
Protect repository branches
postApiV4ProjectsIdProtectedBranches 1 param body → 201422409404401400
GET
/api/v4/projects/{id}/protected_branches/{name}
Retrieve a protected branch or wildcard protected branch
getApiV4ProjectsIdProtectedBranchesName 2 params → 200404401400
PATCH
/api/v4/projects/{id}/protected_branches/{name}
Update a protected branch
patchApiV4ProjectsIdProtectedBranchesName 2 params body → 200422404401400
DELETE
/api/v4/projects/{id}/protected_branches/{name}
Unprotect repository branches
deleteApiV4ProjectsIdProtectedBranchesName 2 params → 204404401400

Schemas 7

The contract defines 7 schemas that model the data the API accepts and returns. The most detailed are postApiV4GroupsIdProtectedBranchesRequest (9 properties), postApiV4ProjectsIdProtectedBranchesRequest (9 properties), APIEntitiesProtectedRefAccess (8 properties), APIEntitiesProtectedBranch (8 properties). Each schema is shown below with its type and property counts.

patchApiV4GroupsIdProtectedBranchesNameRequest
object
6 properties
patchApiV4ProjectsIdProtectedBranchesNameRequest
object
6 properties
postApiV4ProjectsIdProtectedBranchesRequest
object
9 properties 1 required
APIEntitiesProtectedBranch
object
8 properties
APIEntitiesProtectedRefAccess
object
8 properties
postApiV4GroupsIdProtectedBranchesRequest
object
9 properties 1 required
APIEntitiesGroupProtectedBranch
object
7 properties

Specification

The full machine-readable OpenAPI contract behind this narrative.

Source

gitlab-protected-branches-api-openapi.yml Raw ↑

Other APIs GitLab publishes across the network.

GitLab Orbit gRPC API
GitLab GraphQL API
GitLab Applications API
GitLab Authorization API
GitLab Broadcast Messages API
GitLab Groups API
GitLab Metadata API
GitLab Project Webhooks API
GitLab Projects API
GitLab Tokens API
GitLab User Info API
GitLab Webhook Configuration API
Where this information came from

This is an independent, third-party profile of GitLab Protected branches API, published by API Evangelist. We do not operate, host, resell, or support these APIs, and we are not affiliated with or endorsed by the company unless stated above. Everything here is built from publicly available information — the company's own site, developer portal, documentation, public repositories, and the specifications it publishes for public use. Nothing is obtained by breaching a system, defeating an access control, or using credentials.

The Kin Score and Agent Readiness rating are independently calculated assessments of a company's public API artifacts, scored against a published rubric. They are not certifications, endorsements, security assessments, or audits.

Corrections, re-scores, and removal are free — no partnership or purchase required, and you do not need to justify the request. A removed company is recorded as unrated, never scored zero for having asked. Acknowledgement within one business day; removal within two.

info@apievangelist.com · Read the full data-sourcing policy →
On a security or compliance team? Put security in the subject line and you will get a person, not a form — we will tell you exactly which public URLs this profile was built from.