# Update status check protection

From **GitHub v3 REST API**.

`PATCH /repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks`

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](https://docs.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation.

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

## Parameters

### `owner`

- Location: path
- Required: true
- Type: `string`

### `repo`

- Location: path
- Required: true
- Type: `string`

### `branch`

- Location: path
- Required: true
- Type: `string`

The name of the branch.

## Request body

- Required: false
### `application/json`

- Type: `object`

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

```json
{"properties":{"contexts":{"deprecated":true,"description":"The list of status checks to require in order to merge into this branch","items":{"type":"string"},"type":"array"},"strict":{"description":"Require branches to be up to date before merging.","type":"boolean"}},"type":"object"}
```

## Responses

### `200`

Response

### `application/json`

- Type: `object`

Status Check Policy

```json
{
  "contexts": [
    "continuous-integration/travis-ci"
  ],
  "contexts_url": "https://api.github.com/repos/octocat/Hello-World/branches/master/protection/required_status_checks/contexts",
  "strict": true,
  "url": "https://api.github.com/repos/octocat/Hello-World/branches/master/protection/required_status_checks"
}
```

```json
{"description":"Status Check Policy","properties":{"contexts":{"example":["continuous-integration/travis-ci"],"items":{"type":"string"},"type":"array"},"contexts_url":{"example":"https://api.github.com/repos/octocat/Hello-World/branches/master/protection/required_status_checks/contexts","format":"uri","type":"string"},"strict":{"example":true,"type":"boolean"},"url":{"example":"https://api.github.com/repos/octocat/Hello-World/branches/master/protection/required_status_checks","format":"uri","type":"string"}},"required":["url","contexts_url","strict","contexts"],"title":"Status Check Policy","type":"object"}
```

### `404`

Resource not found

### `application/json`

- Type: `object`

Basic Error

```json
{"description":"Basic Error","properties":{"documentation_url":{"type":"string"},"message":{"type":"string"},"status":{"type":"string"},"url":{"type":"string"}},"title":"Basic Error","type":"object"}
```

### `422`

Validation failed

### `application/json`

- Type: `object`

Validation Error

```json
{"description":"Validation Error","properties":{"documentation_url":{"type":"string"},"errors":{"items":{"properties":{"code":{"type":"string"},"field":{"type":"string"},"index":{"type":"integer"},"message":{"type":"string"},"resource":{"type":"string"},"value":{"oneOf":[{"nullable":true,"type":"string"},{"nullable":true,"type":"integer"},{"items":{"type":"string"},"nullable":true,"type":"array"}]}},"required":["code"],"type":"object"},"type":"array"},"message":{"type":"string"}},"required":["message","documentation_url"],"title":"Validation Error","type":"object"}
```

## Request examples

### cURL

```shell
curl --request PATCH \
  --url {protocol}://{hostname}/api/v3/repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks \
  --header 'content-type: application/json' \
  --data '{
  "contexts": [
    "continuous-integration/travis-ci"
  ],
  "strict": true
}'
```
