GitLab API

GitlabTool

Actions1095

Projects → getApiV4ProjectsIdProtectedBranches

AI-generated

Summary

Retrieve a list of protected branches for a specific GitLab project by its ID or URL-encoded path, with optional pagination and search filtering.

Inputs

  • id (required) — The ID or URL-encoded path of the GitLab project whose protected branches are to be retrieved.
  • page — The page number to retrieve in pagination; defaults to 1 if not specified.
  • per_page — The number of protected branch items to return per page; defaults to 20 if not specified.
  • search — A string to filter protected branches by name using a search query.

Output shape

a list of protected branch objects corresponding to the specified project, subject to pagination and search criteria

Supports optional query parameters for pagination (page, per_page) and name filtering (search). The project is identified using the path parameter id. Authentication is required unless explicitly skipped. The base URL for GitLab API requests defaults to https://gitlab.com but can be customized.

Examples

Example 1: List protected branches for a project with default pagination

Set id to the project identifier, leave page and per_page empty for default values.

Example 2: Search protected branches by name

Provide search query parameter with the branch name or pattern to filter results.

Links

Discussion