# Update a pre-receive environment

From **GitHub v3 REST API**.

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

You cannot modify the default environment. If you attempt to modify the default environment, you will receive a `422 Unprocessable Entity` response.

## Parameters

### `pre_receive_environment_id`

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

## Request body

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

- Type: `object`

```json
{"properties":{"image_url":{"description":"URL from which to download a tarball of this environment.","type":"string"},"name":{"description":"This pre-receive environment's new name.","type":"string"}},"type":"object"}
```

## Responses

### `200`

Response

### `application/json`

- Type: `object`

```json
{
  "created_at": "2016-05-20T11:35:45-05:00",
  "default_environment": false,
  "download": {
    "downloaded_at": "2016-05-26T07:42:53-05:00",
    "message": null,
    "state": "success",
    "url": "https://github.example.com/api/v3/admin/pre-receive-environments/2/downloads/latest"
  },
  "hooks_count": 1,
  "html_url": "https://github.example.com/admin/pre-receive-environments/2",
  "id": 2,
  "image_url": "https://my_file_server/path/to/devtools_env.tar.gz",
  "name": "DevTools Hook Env",
  "url": "https://github.example.com/api/v3/admin/pre-receive-environments/2"
}
```

```json
{"properties":{"created_at":{"type":"string"},"default_environment":{"type":"boolean"},"download":{"properties":{"downloaded_at":{"nullable":true,"type":"string"},"message":{"nullable":true,"type":"string"},"state":{"type":"string"},"url":{"type":"string"}},"type":"object"},"hooks_count":{"type":"integer"},"html_url":{"type":"string"},"id":{"type":"integer"},"image_url":{"type":"string"},"name":{"type":"string"},"url":{"type":"string"}},"type":"object"}
```

### `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 PATCH \
  --url {protocol}://{hostname}/api/v3/admin/pre-receive-environments/{pre_receive_environment_id} \
  --header 'content-type: application/json' \
  --data '{
  "image_url": "string",
  "name": "string"
}'
```
