This method allows you to enable or disable automatic deployments for individual servers and server groups within a project.

**Tip**: You can explore and test this endpoint interactively using our [OpenAPI documentation](https://api.deployhq.com/docs).

## URL

```text
/projects/<project>/auto_deployments
```

Replace `<project>` with either the `permalink` or `identifier` of the project.

## HTTP Method

```text
POST
```

## Supported Parameters

| Parameter | Type | Description |
|-----------|------|-------------|
| `deployables` | Hash | A hash of deployable identifiers mapped to their settings. Each entry should contain an `auto_deploy` boolean. |

You can update multiple servers and server groups in a single request by including multiple entries in the `deployables` hash.

## Example cURL Request

```shell
curl -H "Content-type: application/json" \
-H "Accept: application/json" \
--user adam@atechmedia.com:my-api-key \
-X POST \
-d '{"deployables":{"79c6a008-c7fa-4648-82fc-692f546d6c76":{"auto_deploy":true},"49d23a7d-322e-4714-81d4-a159dca5c2a7":{"auto_deploy":false}}}' \
https://test.deployhq.com/projects/my-project/auto_deployments
```

## Example Response

```json
{
  "deployables": [
    {
      "identifier": "79c6a008-c7fa-4648-82fc-692f546d6c76",
      "name": "Production Server",
      "type": "server",
      "auto_deploy": true,
      "preferred_branch": "main"
    },
    {
      "identifier": "49d23a7d-322e-4714-81d4-a159dca5c2a7",
      "name": "Staging Group",
      "type": "server_group",
      "auto_deploy": false,
      "preferred_branch": "develop"
    }
  ]
}
```

The response includes the updated state of all servers and server groups in the project, not just the ones that were changed.
