git.branch-protection.updateChange a branch protection rule
Only the fields sent are written. Editing in place matters because the alternative — create the replacement, delete the old one — leaves the branch unprotected in between.
Request syntax
PATCH /git/api/repositories/{repoId}/branch-protection/{ruleId}
{
"branchPattern": "string",
"requirePullRequest": "boolean",
"requiredApprovals": "number",
"dismissStaleApprovals": "boolean",
"requireCodeOwnerReview": "boolean",
"requireStatusChecks": "boolean",
"requiredChecks": "array of string",
"blockForcePush": "boolean",
"blockDeletion": "boolean",
"requireMergeQueue": "boolean",
"mergeQueueMethod": "enum",
"mergeQueueBuildConcurrency": "number",
"mergeQueueMinGroupSize": "number",
"mergeQueueMaxGroupSize": "number",
"mergeQueueWaitMinutes": "number",
"mergeQueueCheckTimeoutMinutes": "number",
"mergeQueueOnlyNonFailing": "boolean"
}Path parameters
repoIdRequiredstring
Constraints: uuid
ruleIdRequiredstring
Constraints: uuid
Request body
branchPatternOptionalstring
The branch name or glob the rule covers, e.g. main or release/*
Constraints: 1-200 chars
requirePullRequestOptionalboolean
Changes land only through a pull request; direct pushes are refused (true on a new rule)
requiredApprovalsOptionalnumber
Approvals a pull request needs before it can merge (0 on a new rule)
Constraints: integer, 0-10
dismissStaleApprovalsOptionalboolean
A push to the pull request dismisses the approvals given before it (false on a new rule)
requireCodeOwnerReviewOptionalboolean
Every changed file CODEOWNERS assigns needs an approval from one of its owners
requireStatusChecksOptionalboolean
Required checks must pass before a pull request can merge (false on a new rule)
requiredChecksOptionalarray of string
Workflow or status names that must pass; empty means every workflow a pull request to the branch triggers
Constraints: 1-200 chars
blockForcePushOptionalboolean
Refuse pushes that rewrite the branch history (true on a new rule)
blockDeletionOptionalboolean
Refuse deleting the branch (true on a new rule)
requireMergeQueueOptionalboolean
The branch moves only through its merge queue; direct pushes and the merge button are refused (false on a new rule)
mergeQueueMethodOptionalenum
How the queue merges each pull request (merge on a new rule)
One of:
merge,squash,rebasemergeQueueBuildConcurrencyOptionalnumber
How many queued pull requests may be building at once (5 on a new rule)
Constraints: integer, 1-100
mergeQueueMinGroupSizeOptionalnumber
Fewest pull requests the queue waits for before it builds, up to the wait time (1 on a new rule)
Constraints: integer, 1-100
mergeQueueMaxGroupSizeOptionalnumber
Most pull requests landed by one fast-forward (5 on a new rule)
Constraints: integer, 1-100
mergeQueueWaitMinutesOptionalnumber
Minutes to wait for the minimum group size before building anyway (5 on a new rule)
Constraints: integer, 0-360
mergeQueueCheckTimeoutMinutesOptionalnumber
Minutes a queue build may wait for its checks before it fails (60 on a new rule)
Constraints: integer, 1-360
mergeQueueOnlyNonFailingOptionalboolean
Land only pull requests whose own build passed; off, a failed build still lands if a later build containing it passes (true on a new rule)
Response
200 with the rule after the change, every setting included.
A JSON response is wrapped as { "success": true, "data": … }; the CLI prints the whole body with --json.
Fields of data
idAlwaysstring
The rule's idorgIdAlwaysstring
Your organizationrepoIdAlwaysstring
The repository the record belongs tobranchPatternAlwaysstring
The branch name or glob the rule coversrequirePullRequestAlwaysboolean
Changes must land through a pull requestrequiredApprovalsAlwaysnumber
Approvals a pull request needs to mergedismissStaleApprovalsAlwaysboolean
A new push withdraws earlier approvalsrequireCodeOwnerReviewAlwaysboolean
Every changed file CODEOWNERS assigns needs an approval from one of its ownersrequireStatusChecksAlwaysboolean
Required checks must pass before a mergerequiredChecksAlwaysarray of string
Checks that must pass, by workflow or status context name; empty means every workflow a pull request triggersblockForcePushAlwaysboolean
Pushes that rewrite the branch history are refusedblockDeletionAlwaysboolean
Deleting the branch is refusedrequireMergeQueueAlwaysboolean
The branch moves only through the merge queue; direct pushes and merges are refusedmergeQueueMethodAlwaysone of merge, squash, rebase
How the queue merges each pull requestmergeQueueBuildConcurrencyAlwaysnumber
How many queued pull requests may be building at oncemergeQueueMinGroupSizeAlwaysnumber
Fewest pull requests to wait for before the first build startsmergeQueueMaxGroupSizeAlwaysnumber
Most pull requests landed by one fast-forwardmergeQueueWaitMinutesAlwaysnumber
Minutes to wait for the minimum group size before building anywaymergeQueueCheckTimeoutMinutesAlwaysnumber
Minutes a queue build may wait for its checks before it failsmergeQueueOnlyNonFailingAlwaysboolean
Only pull requests whose own build passed land; off lets a later passing build carry themcreatedAtAlwaysstring
When the rule was added (ISO 8601)updatedAtAlwaysstring
When the rule was last changed (ISO 8601)
Checked against the handlers: every route test validates their answers against this schema.
Errors
- 400The request does not pass the schema above. The body is { "error": …, "issues": […] }, one issue per field.
- 401No credentials, or an access key that is unknown, revoked or expired.
- 403The caller's policies do not allow git:ManageBranchProtection on this resource. The body names the action and the resource, and the refusal is recorded in the audit log.
- 404The resource does not exist in your organization.
Examples
The required parameters only, with example values. Replace id and the other placeholders with your own.
dcloud git branch-protection update repoId ruleIdcurl -X PATCH "https://console.platform-development.deutschecloud.app/git/api/repositories/repoId/branch-protection/ruleId" \
-H "Authorization: EWS-ACCESS-KEY $ACCESS_KEY" \
-H "Content-Type: application/json" \
-d '{}'Generated from the API description, the same one the API checks requests against and the CLI is built from. MCP tool: dcloud_git_branch-protection_update.