GitHub v3 REST API

Add status check contexts

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.

post
http://HOSTNAME/api/v3/repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks/contexts

Path Parameters

ownerstringrequired
repostringrequired
branchstringrequired

The name of the branch.

Body

application/json
One Of
contextsarray[string]required

contexts parameter

Response

application/json

Response

array[string]
post/repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks/contexts

Body

{}
 
application/json

Set status check contexts

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.

put
http://HOSTNAME/api/v3/repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks/contexts

Path Parameters

ownerstringrequired
repostringrequired
branchstringrequired

The name of the branch.

Body

application/json
One Of
contextsarray[string]required

contexts parameter

Response

application/json

Response

array[string]
put/repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks/contexts

Body

{}
 
application/json

Remove status check contexts

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.

delete
http://HOSTNAME/api/v3/repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks/contexts

Path Parameters

ownerstringrequired
repostringrequired
branchstringrequired

The name of the branch.

Body

application/json
One Of
contextsarray[string]required

contexts parameter

Response

application/json

Response

array[string]
delete/repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks/contexts

Body

{}
 
application/json

Get access restrictions

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.

Lists who has access to this protected branch.

Note: Users, apps, and teams restrictions are only available for organization-owned repositories.

get
http://HOSTNAME/api/v3/repos/{owner}/{repo}/branches/{branch}/protection/restrictions

Path Parameters

ownerstringrequired
repostringrequired
branchstringrequired

The name of the branch.

Response

application/json

Response

Branch Restriction Policy

Branch Restriction Policy

urlstring(uri)required
users_urlstring(uri)required
teams_urlstring(uri)required
apps_urlstring(uri)required
usersarray[object]required
Show Child Parameters
teamsarray[object]required
Show Child Parameters
appsarray[object]required
Show Child Parameters
get/repos/{owner}/{repo}/branches/{branch}/protection/restrictions
 
application/json

Delete access restrictions

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.

Disables the ability to restrict who can push to this branch.

delete
http://HOSTNAME/api/v3/repos/{owner}/{repo}/branches/{branch}/protection/restrictions

Path Parameters

ownerstringrequired
repostringrequired
branchstringrequired

The name of the branch.

Response

204

Response

delete/repos/{owner}/{repo}/branches/{branch}/protection/restrictions
 
204