POST/v2/projects/{projectId}/branches/{branchId}/protected

Set a branch's protection status

Updates the protection setting for a branch in a project. Set isProtected to indicate whether the branch is protected; the response includes the updated branch details.

  • IdempotentThe SDK sends Idempotency-Key, so a retried request is only applied once.

2 parameters · 1 body field
branchIdintegerrequired
The integer identifier of the branch whose protection setting to change.
projectIdintegerrequired
The integer identifier of the project containing the branch.

The protection setting to apply to the branch.

isProtectedbooleanrequired
Whether the branch is protected

5 status codes
200Returns the updated branch, including its identifier, name, active state, default status, and protection status.
activebooleanrequired
Indicates whether this branch is currently active (visible and usable for editing translations and keys). Inactive branches are hidden but still stored in the project.
authorobjectoptional
createdAtintegeroptional
Date of branch creation
idintegerrequired
Unique identifier of the branch
isDefaultbooleanrequired
Is branch default
isProtectedbooleanrequired
Is branch protected
mergeobjectoptional
namestringrequired
Human-readable name of the branch. Similar to Git branch names, it identifies the feature or purpose of this branch (e.g. 'feature-login-page')
originBranchNamestringoptional
Name of the branch this branch was created from
400Returned when the request is invalid, including when `isProtected` is missing.
codestringrequired
Allowed:unauthenticatedapi_access_forbiddenapi_key_not_foundinvalid_api_keyinvalid_project_api_keyproject_api_key_expiredbad_credentialsmfa_enabledinvalid_otp_codemfa_not_enabledcan_not_revoke_own_permissionsdata_corrupted
paramsarray<object>optional
401Returned when the request is unauthenticated.
codestringrequired
Allowed:unauthenticatedapi_access_forbiddenapi_key_not_foundinvalid_api_keyinvalid_project_api_keyproject_api_key_expiredbad_credentialsmfa_enabledinvalid_otp_codemfa_not_enabledcan_not_revoke_own_permissionsdata_corrupted
paramsarray<object>optional
403Returned when the authenticated user does not have permission to change the branch setting.
codestringrequired
Allowed:unauthenticatedapi_access_forbiddenapi_key_not_foundinvalid_api_keyinvalid_project_api_keyproject_api_key_expiredbad_credentialsmfa_enabledinvalid_otp_codemfa_not_enabledcan_not_revoke_own_permissionsdata_corrupted
paramsarray<object>optional
404Returned when the project or branch cannot be found.
codestringrequired
Allowed:unauthenticatedapi_access_forbiddenapi_key_not_foundinvalid_api_keyinvalid_project_api_keyproject_api_key_expiredbad_credentialsmfa_enabledinvalid_otp_codemfa_not_enabledcan_not_revoke_own_permissionsdata_corrupted
paramsarray<object>optional

Error handling

A 400 is returned when the request is invalid. A 401 is returned when the request is unauthenticated, and a 403 is returned when the authenticated user lacks permission to change the branch setting. A 404 is returned when the project or branch cannot be found. isProtected is required. The branchId and projectId path parameters must identify the branch and project.