GitHub v3 REST API

Get status checks 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.

get
{protocol}://{hostname}/api/v3/repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks

Path Parameters

ownerstringrequired
repostringrequired
branchstringrequired

The name of the branch.

Response

application/json

Response

Status Check Policy

Status Check Policy

urlstring(uri)required

Example:https://api.github.com/repos/octocat/Hello-World/branches/master/protection/required_status_checks

strictbooleanrequired

Example:true

contextsarray[string]required

Example:["continuous-integration/travis-ci"]

contexts_urlstring(uri)required

Example:https://api.github.com/repos/octocat/Hello-World/branches/master/protection/required_status_checks/contexts

get/repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks
 
application/json

Update status check 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.

Updating required status checks requires admin or owner permissions to the repository and branch protection to be enabled.

patch
{protocol}://{hostname}/api/v3/repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks

Path Parameters

ownerstringrequired
repostringrequired
branchstringrequired

The name of the branch.

Body

application/json
strictboolean

Require branches to be up to date before merging.

contextsarray[string]DEPRECATED

The list of status checks to require in order to merge into this branch

Response

application/json

Response

Status Check Policy

Status Check Policy

urlstring(uri)required

Example:https://api.github.com/repos/octocat/Hello-World/branches/master/protection/required_status_checks

strictbooleanrequired

Example:true

contextsarray[string]required

Example:["continuous-integration/travis-ci"]

contexts_urlstring(uri)required

Example:https://api.github.com/repos/octocat/Hello-World/branches/master/protection/required_status_checks/contexts

patch/repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks

Body

{ "strict": true, "contexts": [ "continuous-integration/travis-ci" ] }
 
application/json

Remove status check 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.

delete
{protocol}://{hostname}/api/v3/repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks

Path Parameters

ownerstringrequired
repostringrequired
branchstringrequired

The name of the branch.

Response

204

Response

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

Get all 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.

get
{protocol}://{hostname}/api/v3/repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks/contexts

Path Parameters

ownerstringrequired
repostringrequired
branchstringrequired

The name of the branch.

Response

application/json

Response

array[string]
get/repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks/contexts
 
application/json

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
{protocol}://{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

{ "contexts": [ "[]" ] }
 
application/json