# Enable or disable maintenance mode

From **GitHub v3 REST API**.

`POST /setup/api/maintenance`

**Note:** The request body for this operation must be submitted as `application/x-www-form-urlencoded` data. You can submit a parameter value as a string, or you can use a tool such as `curl` to submit a parameter value as the contents of a text file. For more information, see the [`curl` documentation](https://curl.se/docs/manpage.html#--data-urlencode).

## Request body

- Required: true
### `application/x-www-form-urlencoded`

- Type: `object`

```json
{
  "maintenance": "{\"enabled\":true, \"when\":\"now\"}"
}
```

```json
{"properties":{"maintenance":{"description":"A JSON string with the attributes `enabled` and `when`.\n\nThe possible values for `enabled` are `true` and `false`. When it's `false`, the attribute `when` is ignored and the maintenance mode is turned off. `when` defines the time period when the maintenance was enabled.\n\nThe possible values for `when` are `now` or any date parseable by [mojombo/chronic](https://github.com/mojombo/chronic).","type":"string"}},"required":["maintenance"],"type":"object"}
```

## Responses

### `200`

Response

### `application/json`

- Type: `object`

```json
{
  "connection_services": [
    {
      "name": "git operations",
      "number": 0
    },
    {
      "name": "mysql queries",
      "number": 233
    },
    {
      "name": "resque jobs",
      "number": 54
    }
  ],
  "scheduled_time": "Tuesday, January 22 at 15:34 -0800",
  "status": "scheduled"
}
```

```json
{"properties":{"connection_services":{"items":{"properties":{"name":{"type":"string"},"number":{"type":"integer"}},"required":["name","number"],"type":"object"},"type":"array"},"scheduled_time":{"type":"string"},"status":{"type":"string"}},"type":"object"}
```

## Request examples

### cURL

```shell
curl --request POST \
  --url {protocol}://{hostname}/api/v3/setup/api/maintenance \
  --header 'content-type: application/x-www-form-urlencoded' \
  --data '{
  "maintenance": "{\"enabled\":true, \"when\":\"now\"}"
}'
```
