GitHub v3 REST API

Create commit signature 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.

When authenticated with admin or owner permissions to the repository, you can use this endpoint to require signed commits on a branch. You must enable branch protection to require signed commits.

post
{protocol}://{hostname}/api/v3/repos/{owner}/{repo}/branches/{branch}/protection/required_signatures

Path Parameters

ownerstringrequired
repostringrequired
branchstringrequired

The name of the branch.

Response

application/json

Response

Protected Branch Admin Enforced

Protected Branch Admin Enforced

urlstring(uri)required

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

enabledbooleanrequired

Example:true

post/repos/{owner}/{repo}/branches/{branch}/protection/required_signatures
 
application/json

Delete commit signature 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.

When authenticated with admin or owner permissions to the repository, you can use this endpoint to disable required signed commits on a branch. You must enable branch protection to require signed commits.

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

Path Parameters

ownerstringrequired
repostringrequired
branchstringrequired

The name of the branch.

Response

Response

delete/repos/{owner}/{repo}/branches/{branch}/protection/required_signatures
 

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