Update branch protection

PUT {{baseUrl}}/repos/:owner/:repo/branches/:branch/protection

Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see GitHub's products in the GitHub Help documentation.

Protecting a branch requires admin or owner permissions to the repository.

Note: Passing new arrays of users and teams replaces their previous values.

Note: The list of users, apps, and teams in total is limited to 100 items.

Request Body

{"required_status_checks"=>{"strict"=>"<boolean>", "contexts"=>["<string>", "<string>"]}, "enforce_admins"=>"<boolean>", "required_pull_request_reviews"=>{"dismissal_restrictions"=>{"users"=>["<string>", "<string>"], "teams"=>["<string>", "<string>"]}, "dismiss_stale_reviews"=>"<boolean>", "require_code_owner_reviews"=>"<boolean>", "required_approving_review_count"=>"<integer>"}, "restrictions"=>{"users"=>["<string>", "<string>"], "teams"=>["<string>", "<string>"], "apps"=>["<string>", "<string>"]}, "required_linear_history"=>"<boolean>", "allow_force_pushes"=>"<boolean>", "allow_deletions"=>"<boolean>"}

HEADERS

KeyDatatypeRequiredDescription
Content-Typestring

RESPONSES

status: OK

{&quot;url&quot;:&quot;sed &quot;,&quot;required_status_checks&quot;:{&quot;url&quot;:&quot;https://api.github.com/repos/octocat/Hello-World/branches/master/protection/required_status_checks&quot;,&quot;contexts_url&quot;:&quot;https://api.github.com/repos/octocat/Hello-World/branches/master/protection/required_status_checks/contexts&quot;,&quot;strict&quot;:true,&quot;contexts&quot;:[&quot;continuous-integration/travis-ci&quot;]},&quot;required_pull_request_reviews&quot;:{&quot;url&quot;:&quot;pr&quot;,&quot;dismiss_stale_reviews&quot;:false,&quot;require_code_owner_reviews&quot;:true,&quot;required_approving_review_count&quot;:-59148144,&quot;dismissal_restrictions&quot;:{&quot;url&quot;:&quot;irure cupidatat incididunt ut non&quot;,&quot;users_url&quot;:&quot;nulla voluptate esse reprehenderit&quot;,&quot;teams_url&quot;:&quot;irure amet do&quot;,&quot;users&quot;:[{&quot;avatar_url&quot;:&quot;https://github.com/images/error/octocat_happy.gif&quot;,&quot;events_url&quot;:&quot;https://api.github.com/users/octocat/events{/privacy}&quot;,&quot;followers_url&quot;:&quot;https://api.github.com/users/octocat/followers&quot;,&quot;following_url&quot;:&quot;https://api.github.com/users/octocat/following{/other_user}&quot;,&quot;gists_url&quot;:&quot;https://api.github.com/users/octocat/gists{/gist_id}&quot;,&quot;gravatar_id&quot;:&quot;&quot;,&quot;html_url&quot;:&quot;https://github.com/octocat&quot;,&quot;id&quot;:1,&quot;node_id&quot;:&quot;MDQ6VXNlcjE=&quot;,&quot;login&quot;:&quot;octocat&quot;,&quot;organizations_url&quot;:&quot;https://api.github.com/users/octocat/orgs&quot;,&quot;received_events_url&quot;:&quot;https://api.github.com/users/octocat/received_events&quot;,&quot;repos_url&quot;:&quot;https://api.github.com/users/octocat/repos&quot;,&quot;site_admin&quot;:false,&quot;starred_url&quot;:&quot;https://api.github.com/users/octocat/starred{/owner}{/repo}&quot;,&quot;subscriptions_url&quot;:&quot;https://api.github.com/users/octocat/subscriptions&quot;,&quot;type&quot;:&quot;User&quot;,&quot;url&quot;:&quot;https://api.github.com/users/octocat&quot;,&quot;starred_at&quot;:&quot;\&quot;2020-07-09T00:17:55Z\&quot;&quot;},{&quot;avatar_url&quot;:&quot;https://github.com/images/error/octocat_happy.gif&quot;,&quot;events_url&quot;:&quot;https://api.github.com/users/octocat/events{/privacy}&quot;,&quot;followers_url&quot;:&quot;https://api.github.com/users/octocat/followers&quot;,&quot;following_url&quot;:&quot;https://api.github.com/users/octocat/following{/other_user}&quot;,&quot;gists_url&quot;:&quot;https://api.github.com/users/octocat/gists{/gist_id}&quot;,&quot;gravatar_id&quot;:&quot;&quot;,&quot;html_url&quot;:&quot;https://github.com/octocat&quot;,&quot;id&quot;:1,&quot;node_id&quot;:&quot;MDQ6VXNlcjE=&quot;,&quot;login&quot;:&quot;octocat&quot;,&quot;organizations_url&quot;:&quot;https://api.github.com/users/octocat/orgs&quot;,&quot;received_events_url&quot;:&quot;https://api.github.com/users/octocat/received_events&quot;,&quot;repos_url&quot;:&quot;https://api.github.com/users/octocat/repos&quot;,&quot;site_admin&quot;:false,&quot;starred_url&quot;:&quot;https://api.github.com/users/octocat/starred{/owner}{/repo}&quot;,&quot;subscriptions_url&quot;:&quot;https://api.github.com/users/octocat/subscriptions&quot;,&quot;type&quot;:&quot;User&quot;,&quot;url&quot;:&quot;https://api.github.com/users/octocat&quot;,&quot;starred_at&quot;:&quot;\&quot;2020-07-09T00:17:55Z\&quot;&quot;}],&quot;teams&quot;:[{&quot;id&quot;:-20758783,&quot;node_id&quot;:&quot;velit irure&quot;,&quot;url&quot;:&quot;eiusmod&quot;,&quot;members_url&quot;:&quot;exercitation cupidatat dolor&quot;,&quot;name&quot;:&quot;do quis&quot;,&quot;description&quot;:&quot;commodo veniam dolor sed&quot;,&quot;permission&quot;:&quot;sit dolor&quot;,&quot;html_url&quot;:&quot;https://github.com/orgs/rails/teams/core&quot;,&quot;repositories_url&quot;:&quot;aliquip quis&quot;,&quot;slug&quot;:&quot;consectetur dolor sed officia nulla&quot;,&quot;privacy&quot;:&quot;amet dolore dolor&quot;,&quot;parent&quot;:{&quot;id&quot;:1,&quot;node_id&quot;:&quot;MDQ6VGVhbTE=&quot;,&quot;url&quot;:&quot;https://api.github.com/organizations/1/team/1&quot;,&quot;members_url&quot;:&quot;https://api.github.com/organizations/1/team/1/members{/member}&quot;,&quot;name&quot;:&quot;Justice League&quot;,&quot;description&quot;:&quot;A great team.&quot;,&quot;permission&quot;:&quot;admin&quot;,&quot;html_url&quot;:&quot;https://github.com/orgs/rails/teams/core&quot;,&quot;repositories_url&quot;:&quot;https://api.github.com/organizations/1/team/1/repos&quot;,&quot;slug&quot;:&quot;justice-league&quot;,&quot;privacy&quot;:&quot;closed&quot;,&quot;ldap_dn&quot;:&quot;uid=example,ou=users,dc=github,dc=com&quot;}},{&quot;id&quot;:-28442548,&quot;node_id&quot;:&quot;minim ullamco esse&quot;,&quot;url&quot;:&quot;ea qui&quot;,&quot;members_url&quot;:&quot;adipisicing sint consectetur&quot;,&quot;name&quot;:&quot;ipsum&quot;,&quot;description&quot;:&quot;ad quis&quot;,&quot;permission&quot;:&quot;pariatur adipisicing id ut&quot;,&quot;html_url&quot;:&quot;https://github.com/orgs/rails/teams/core&quot;,&quot;repositories_url&quot;:&quot;fugiat&quot;,&quot;slug&quot;:&quot;incididunt dolor irure velit&quot;,&quot;privacy&quot;:&quot;aliquip fugiat sunt Duis&quot;,&quot;parent&quot;:{&quot;id&quot;:1,&quot;node_id&quot;:&quot;MDQ6VGVhbTE=&quot;,&quot;url&quot;:&quot;https://api.github.com/organizations/1/team/1&quot;,&quot;members_url&quot;:&quot;https://api.github.com/organizations/1/team/1/members{/member}&quot;,&quot;name&quot;:&quot;Justice League&quot;,&quot;description&quot;:&quot;A great team.&quot;,&quot;permission&quot;:&quot;admin&quot;,&quot;html_url&quot;:&quot;https://github.com/orgs/rails/teams/core&quot;,&quot;repositories_url&quot;:&quot;https://api.github.com/organizations/1/team/1/repos&quot;,&quot;slug&quot;:&quot;justice-league&quot;,&quot;privacy&quot;:&quot;closed&quot;,&quot;ldap_dn&quot;:&quot;uid=example,ou=users,dc=github,dc=com&quot;}}]}},&quot;required_signatures&quot;:{&quot;url&quot;:&quot;https://api.github.com/repos/octocat/Hello-World/branches/master/protection/required_signatures&quot;,&quot;enabled&quot;:true},&quot;enforce_admins&quot;:{&quot;url&quot;:&quot;ullamco dolor do cillum&quot;,&quot;enabled&quot;:false},&quot;required_linear_history&quot;:{&quot;enabled&quot;:true},&quot;allow_force_pushes&quot;:{&quot;enabled&quot;:true},&quot;allow_deletions&quot;:{&quot;enabled&quot;:false},&quot;restrictions&quot;:{&quot;url&quot;:&quot;anim&quot;,&quot;users_url&quot;:&quot;deserunt amet officia&quot;,&quot;teams_url&quot;:&quot;commodo velit aute&quot;,&quot;apps_url&quot;:&quot;ex &quot;,&quot;users&quot;:[{&quot;login&quot;:&quot;cillum&quot;,&quot;id&quot;:7182443,&quot;node_id&quot;:&quot;do&quot;,&quot;avatar_url&quot;:&quot;et anim Duis&quot;,&quot;gravatar_id&quot;:&quot;do id nisi&quot;,&quot;url&quot;:&quot;Excepteur&quot;,&quot;html_url&quot;:&quot;nostrud Excepteur ut tempor&quot;,&quot;followers_url&quot;:&quot;dolore aliqua ut&quot;,&quot;following_url&quot;:&quot;eiusmod Excepteur ullamco&quot;,&quot;gists_url&quot;:&quot;ullamco enim&quot;,&quot;starred_url&quot;:&quot;cupidatat commodo ex&quot;,&quot;subscriptions_url&quot;:&quot;commodo id dolore sunt culpa&quot;,&quot;organizations_url&quot;:&quot;do dolore ad&quot;,&quot;repos_url&quot;:&quot;eu elit&quot;,&quot;events_url&quot;:&quot;in elit id irure laborum&quot;,&quot;received_events_url&quot;:&quot;in sunt&quot;,&quot;type&quot;:&quot;exercitation eiu&quot;,&quot;site_admin&quot;:true},{&quot;login&quot;:&quot;eiusmod culpa consectetur nostrud&quot;,&quot;id&quot;:-34555638,&quot;node_id&quot;:&quot;ad id&quot;,&quot;avatar_url&quot;:&quot;exercitation non&quot;,&quot;gravatar_id&quot;:&quot;ut&quot;,&quot;url&quot;:&quot;veniam eiusmod&quot;,&quot;html_url&quot;:&quot;laboris dolor ad&quot;,&quot;followers_url&quot;:&quot;proident sint eu amet&quot;,&quot;following_url&quot;:&quot;pariatur quis aliquip&quot;,&quot;gists_url&quot;:&quot;veniam&quot;,&quot;starred_url&quot;:&quot;commodo exercitation ullamco&quot;,&quot;subscriptions_url&quot;:&quot;id&quot;,&quot;organizations_url&quot;:&quot;minim&quot;,&quot;repos_url&quot;:&quot;ex laborum proident labore&quot;,&quot;events_url&quot;:&quot;commodo deserunt proident&quot;,&quot;received_events_url&quot;:&quot;ea proident labore&quot;,&quot;type&quot;:&quot;do dolor non Duis voluptate&quot;,&quot;site_admin&quot;:false}],&quot;teams&quot;:[{&quot;id&quot;:-28356371,&quot;node_id&quot;:&quot;cillum ipsum ex aliquip deserunt&quot;,&quot;url&quot;:&quot;Lorem in aute et&quot;,&quot;html_url&quot;:&quot;irure ex sit dolor&quot;,&quot;name&quot;:&quot;consectetur Ut&quot;,&quot;slug&quot;:&quot;eiusmod proident nisi&quot;,&quot;description&quot;:&quot;ut sit&quot;,&quot;privacy&quot;:&quot;irure nostrud&quot;,&quot;permission&quot;:&quot;anim non nostrud irure&quot;,&quot;members_url&quot;:&quot;veniam Lorem voluptate&quot;,&quot;repositories_url&quot;:&quot;id sint&quot;,&quot;parent&quot;:&quot;fugiat&quot;},{&quot;id&quot;:44904358,&quot;node_id&quot;:&quot;sint ea&quot;,&quot;url&quot;:&quot;ea in cupidatat&quot;,&quot;html_url&quot;:&quot;Ut cillum aute&quot;,&quot;name&quot;:&quot;occaecat sed veniam&quot;,&quot;slug&quot;:&quot;est ea&quot;,&quot;description&quot;:&quot;dolore aute&quot;,&quot;privacy&quot;:&quot;mollit nisi id&quot;,&quot;permission&quot;:&quot;fugiat nisi laboris dolore&quot;,&quot;members_url&quot;:&quot;ad sed&quot;,&quot;repositories_url&quot;:&quot;laboris commodo enim sunt&quot;,&quot;parent&quot;:&quot;Duis aliquip esse ut commodo&quot;}],&quot;apps&quot;:[{&quot;id&quot;:-81364986,&quot;slug&quot;:&quot;in consequat&quot;,&quot;node_id&quot;:&quot;irure est reprehenderit&quot;,&quot;owner&quot;:{&quot;login&quot;:&quot;ex aute&quot;,&quot;id&quot;:-9192535,&quot;node_id&quot;:&quot;dolore ut qui consequat nulla&quot;,&quot;url&quot;:&quot;velit null&quot;,&quot;repos_url&quot;:&quot;veniam do&quot;,&quot;events_url&quot;:&quot;nulla quis cillum cupidatat&quot;,&quot;hooks_url&quot;:&quot;est mollit&quot;,&quot;issues_url&quot;:&quot;sunt aliquip ea ut&quot;,&quot;members_url&quot;:&quot;cillum commodo incididunt ullamco&quot;,&quot;public_members_url&quot;:&quot;tempor&quot;,&quot;avatar_url&quot;:&quot;fugiat ex&quot;,&quot;description&quot;:&quot;adipisicing dolo&quot;,&quot;gravatar_id&quot;:&quot;\&quot;\&quot;&quot;,&quot;html_url&quot;:&quot;\&quot;https://github.com/testorg-ea8ec76d71c3af4b\&quot;&quot;,&quot;followers_url&quot;:&quot;\&quot;https://api.github.com/users/testorg-ea8ec76d71c3af4b/followers\&quot;&quot;,&quot;following_url&quot;:&quot;\&quot;https://api.github.com/users/testorg-ea8ec76d71c3af4b/following{/other_user}\&quot;&quot;,&quot;gists_url&quot;:&quot;\&quot;https://api.github.com/users/testorg-ea8ec76d71c3af4b/gists{/gist_id}\&quot;&quot;,&quot;starred_url&quot;:&quot;\&quot;https://api.github.com/users/testorg-ea8ec76d71c3af4b/starred{/owner}{/repo}\&quot;&quot;,&quot;subscriptions_url&quot;:&quot;\&quot;https://api.github.com/users/testorg-ea8ec76d71c3af4b/subscriptions\&quot;&quot;,&quot;organizations_url&quot;:&quot;\&quot;https://api.github.com/users/testorg-ea8ec76d71c3af4b/orgs\&quot;&quot;,&quot;received_events_url&quot;:&quot;\&quot;https://api.github.com/users/testorg-ea8ec76d71c3af4b/received_events\&quot;&quot;,&quot;type&quot;:&quot;\&quot;Organization\&quot;&quot;},&quot;name&quot;:&quot;est in ut do&quot;,&quot;description&quot;:&quot;laborum in ea&quot;,&quot;external_url&quot;:&quot;est&quot;,&quot;html_url&quot;:&quot;in nostrud voluptate&quot;,&quot;created_at&quot;:&quot;laboris&quot;,&quot;updated_at&quot;:&quot;proident&quot;,&quot;permissions&quot;:{&quot;metadata&quot;:&quot;aliqua amet&quot;,&quot;contents&quot;:&quot;minim Lorem in&quot;,&quot;issues&quot;:&quot;consequat nostrud&quot;,&quot;single_file&quot;:&quot;exercitation incididunt&quot;},&quot;events&quot;:[&quot;elit culpa sint eiusmod eu&quot;,&quot;do&quot;]},{&quot;id&quot;:77404762,&quot;slug&quot;:&quot;i&quot;,&quot;node_id&quot;:&quot;sint velit elit&quot;,&quot;owner&quot;:{&quot;login&quot;:&quot;anim in laboris Lorem&quot;,&quot;id&quot;:-90108251,&quot;node_id&quot;:&quot;Ut adipisicing aute dolor&quot;,&quot;url&quot;:&quot;nisi esse pr&quot;,&quot;repos_url&quot;:&quot;reprehenderit ut&quot;,&quot;events_url&quot;:&quot;in fugiat Duis proident ullamco&quot;,&quot;hooks_url&quot;:&quot;quis ut aliqua&quot;,&quot;issues_url&quot;:&quot;Lorem dolore&quot;,&quot;members_url&quot;:&quot;quis ex cupidatat tempor&quot;,&quot;public_members_url&quot;:&quot;ad Excep&quot;,&quot;avatar_url&quot;:&quot;sunt enim ex qui&quot;,&quot;description&quot;:&quot;sint&quot;,&quot;gravatar_id&quot;:&quot;\&quot;\&quot;&quot;,&quot;html_url&quot;:&quot;\&quot;https://github.com/testorg-ea8ec76d71c3af4b\&quot;&quot;,&quot;followers_url&quot;:&quot;\&quot;https://api.github.com/users/testorg-ea8ec76d71c3af4b/followers\&quot;&quot;,&quot;following_url&quot;:&quot;\&quot;https://api.github.com/users/testorg-ea8ec76d71c3af4b/following{/other_user}\&quot;&quot;,&quot;gists_url&quot;:&quot;\&quot;https://api.github.com/users/testorg-ea8ec76d71c3af4b/gists{/gist_id}\&quot;&quot;,&quot;starred_url&quot;:&quot;\&quot;https://api.github.com/users/testorg-ea8ec76d71c3af4b/starred{/owner}{/repo}\&quot;&quot;,&quot;subscriptions_url&quot;:&quot;\&quot;https://api.github.com/users/testorg-ea8ec76d71c3af4b/subscriptions\&quot;&quot;,&quot;organizations_url&quot;:&quot;\&quot;https://api.github.com/users/testorg-ea8ec76d71c3af4b/orgs\&quot;&quot;,&quot;received_events_url&quot;:&quot;\&quot;https://api.github.com/users/testorg-ea8ec76d71c3af4b/received_events\&quot;&quot;,&quot;type&quot;:&quot;\&quot;Organization\&quot;&quot;},&quot;name&quot;:&quot;Excepteur commodo adipisicing laboris minim&quot;,&quot;description&quot;:&quot;cupidatat enim&quot;,&quot;external_url&quot;:&quot;aute sint enim&quot;,&quot;html_url&quot;:&quot;enim sit&quot;,&quot;created_at&quot;:&quot;eu dolor&quot;,&quot;updated_at&quot;:&quot;laboris&quot;,&quot;permissions&quot;:{&quot;metadata&quot;:&quot;incididunt labore anim veniam nos&quot;,&quot;contents&quot;:&quot;quis ipsum Ut&quot;,&quot;issues&quot;:&quot;minim aute in&quot;,&quot;single_file&quot;:&quot;ad ut enim commodo sint&quot;},&quot;events&quot;:[&quot;ad sunt incididunt&quot;,&quot;officia anim commodo veniam&quot;]}]}}