# Create a pre-receive environment

From **GitHub v3 REST API**.

`POST /admin/pre-receive-environments`

Create a pre-receive environment

## Request body

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

- Type: `object`

```json
{
  "image_url": "https://my_file_server/path/to/devtools_env.tar.gz",
  "name": "DevTools Hook Env"
}
```

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

## Responses

### `201`

Response

### `application/json`

- Type: `object`

```json
{
  "created_at": "2016-05-20T11:35:45-05:00",
  "default_environment": false,
  "download": {
    "downloaded_at": null,
    "message": null,
    "state": "not_started",
    "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"}
```

## Request examples

### cURL

```shell
curl --request POST \
  --url {protocol}://{hostname}/api/v3/admin/pre-receive-environments \
  --header 'content-type: application/json' \
  --data '{
  "image_url": "https://my_file_server/path/to/devtools_env.tar.gz",
  "name": "DevTools Hook Env"
}'
```
