# Update pre-receive hook enforcement for a repository

From **GitHub v3 REST API**.

`PATCH /repos/{owner}/{repo}/pre-receive-hooks/{pre_receive_hook_id}`

For pre-receive hooks which are allowed to be configured at the repo level, you can set `enforcement`

## Parameters

### `owner`

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

### `repo`

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

### `pre_receive_hook_id`

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

pre_receive_hook_id parameter

## Request body

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

- Type: `object`

```json
{
  "enforcement": "enabled"
}
```

```json
{"properties":{"enforcement":{"description":"The state of enforcement for the hook on this repository.","enum":["enabled","disabled","testing"],"type":"string"}},"type":"object"}
```

## Responses

### `200`

Response

### `application/json`

- Type: `object`

```json
{
  "configuration_url": "https://github.example.com/api/v3/repos/octocat/hello-world/pre-receive-hooks/42",
  "enforcement": "enabled",
  "id": 42,
  "name": "Check Commits"
}
```

```json
{"properties":{"configuration_url":{"type":"string"},"enforcement":{"type":"string"},"id":{"type":"integer"},"name":{"type":"string"}},"type":"object"}
```

## Request examples

### cURL

```shell
curl --request PATCH \
  --url {protocol}://{hostname}/api/v3/repos/{owner}/{repo}/pre-receive-hooks/{pre_receive_hook_id} \
  --header 'content-type: application/json' \
  --data '{
  "enforcement": "enabled"
}'
```
