GitLab API icon

GitLab API

Gitlab

Actions1062

Projects → getApiV4ProjectsIdProtectedBranchesName

AI-generated

Summary

Retrieve details of a specific protected branch within a GitLab project by providing the project ID (or URL-encoded path) and branch name.

Inputs

  • id (required) — The ID or URL-encoded path of the GitLab project from which to get the protected branch information.
  • name (required) — The name of the branch or wildcard pattern identifying the protected branch to retrieve.
  • skipAuthentication — Optionally skip authentication if true; otherwise uses the configured GitLab API credentials.
  • baseUrl — The base URL of the GitLab instance; defaults to https://gitlab.com.

Output shape

a single JSON object representing the protected branch details.

Returns the protected branch resource as returned by the GitLab API. Requires specifying both project and branch name path parameters. Authentication is used by default unless explicitly skipped.

Examples

Example 1: Get the protected branch named 'main' for project 'gitlab-org/gitlab' with authentication.

Set id to 'gitlab-org/gitlab', name to 'main', and ensure GitLab API credentials are configured.

Links

Discussion