# Delete a pre-receive environment

From **GitHub v3 REST API**.

`DELETE /admin/pre-receive-environments/{pre_receive_environment_id}`

If you attempt to delete an environment that cannot be deleted, you will receive a `422 Unprocessable Entity` response.

The possible error messages are:

*   _Cannot modify or delete the default environment_
*   _Cannot delete environment that has hooks_
*   _Cannot delete environment when download is in progress_

## Parameters

### `pre_receive_environment_id`

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

## Responses

### `204`

Response

### `422`

Client Errors

### `application/json`

- Type: `object`

```json
{
  "errors": [
    {
      "code": "custom",
      "message": "Cannot modify or delete the default environment",
      "resource": "PreReceiveEnvironment"
    }
  ],
  "message": "Validation Failed"
}
```

```json
{"properties":{"errors":{"items":{"properties":{"code":{"type":"string"},"message":{"type":"string"},"resource":{"type":"string"}},"type":"object"},"type":"array"},"message":{"type":"string"}},"type":"object"}
```

## Request examples

### cURL

```shell
curl --request DELETE \
  --url {protocol}://{hostname}/api/v3/admin/pre-receive-environments/{pre_receive_environment_id}
```
