GitLab API icon

GitLab API

Gitlab

Actions1062

Projects → postApiV4ProjectsIdProtectedBranches

AI-generated

Summary

Create a new protected branch for a specified GitLab project by providing the project's ID or URL-encoded path and the branch protection settings in the request body.

Inputs

  • id (required) — The ID or URL-encoded path of the GitLab project to protect a branch in.
  • postApiV4ProjectsIdProtectedBranches (required) — The body parameters defining the settings for the new protected branch; this follows the postApiV4ProjectsIdProtectedBranches schema defined by the GitLab API.
  • skipAuthentication — Optionally skip authentication for this request; defaults to false.
  • baseUrl — The base URL of the GitLab instance; defaults to https://gitlab.com.

Output shape

A JSON object representing the newly created protected branch as returned by the GitLab API.

The response contains the details of the protected branch created. Requires authentication unless 'Skip Authentication' is set true. The operation uses HTTP POST on the path /api/v4/projects/{id}/protected_branches.

Links

Discussion