# Protect a single branch **PUT /projects/{id}/repository/branches/{branch}/protect** Protect a single branch ## Servers - https://www.gitlab.com/api/v4: https://www.gitlab.com/api/v4 () ## Authentication methods - Api key auth ## Parameters ### Path parameters - **id** (string | integer) The ID or [URL-encoded path of the project](https://docs.gitlab.com/api/rest/#namespaced-paths). - **branch** (string) The name of the branch ### Body: application/json (object) - **developers_can_push** (boolean) Flag if developers can push to that branch - **developers_can_merge** (boolean) Flag if developers can merge to that branch ## Responses ### 200 Protect a single branch #### Body: application/json (object) - **name** (string) - **commit** (object) - **merged** (boolean) - **protected** (boolean) - **developers_can_push** (boolean) - **developers_can_merge** (boolean) - **can_push** (boolean) - **default** (boolean) - **web_url** (string) ### 404 404 Branch Not Found [Powered by Bump.sh](https://bump.sh)