---
title: "Update an environment's deployment settings"
url: https://docs.corefinity.com/api/reference/enterprise/update-environment-deployment-settings
type: endpoint
last_updated: 2026-11-13
feature: enterprise-deployments
related:
  - https://docs.corefinity.com/guides/corestack-enterprise/deployments-and-pipelines.md
---
# Update an environment's deployment settings

Changes the settings you send and answers them all as they are now. Moving the source off git removes the
environment's repositories, so it needs `confirm_remove_repositories` true when there are any. To change a
pipeline's folders or build switches, send its `pipeline_id` with them; a refused folder refuses the whole
request.

```http
PATCH /api/environments/{environment}/deployment-settings
```

- Scope: `write`
- Two-factor: required on your account (all)
- Rate limit: 60 a minute
- Try it in the console: off. It deletes data that cannot be brought back. Copy the request and run it yourself when you are sure.

## Path parameters

- `environment` (integer, required): The id of a CoreStack Enterprise environment. Not the same number as a site row id.

## Body

- `confirm_remove_repositories` (boolean): True to move an environment that has repositories off git, which removes them and their webhooks.
- `deployment_source` (string): `manual` or `git`. `sftp` is accepted only for an environment that already uses it. One of `manual`, `git`, `sftp`.
- `git_deploys` (string): Whether a push deploys on its own. Applies only while the pipeline is on and the source is `git`. One of `manual`, `automatic`.
- `isolate_build_var` (boolean): Whether a build keeps its own `var` folder. Only on a pipeline it applies to.
- `pause_crons_during_build` (boolean): Whether scheduled tasks pause while a build runs. Only on a pipeline it applies to.
- `pipeline_enabled` (boolean): Turn the deployment pipeline on or off.
- `pipeline_id` (integer): The pipeline whose folders or build switches change. Goes with at least one of them.
- `root_directory` (string): The pipeline's web folder: an absolute path that starts and ends with a slash, of letters, digits, `.`, `_`, `-` and `/`, with no `..` part, at most 255 characters, under `/var/www/`, `/var/www_m2/`, `/var/www_vsf/` or `/var/www_blog/`, and never one of those itself.
- `root_storage` (string): The pipeline's storage folder, held to the same rule as `root_directory`.

## Request

### curl

```bash
curl -X PATCH https://manage.corefinity.com/api/environments/1311/deployment-settings \
  -H "Authorization: Bearer $COREFINITY_TOKEN" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{
    "git_deploys": "automatic"
  }'
```

### PHP

```php
use Illuminate\Support\Facades\Http;

$response = Http::withToken(env('COREFINITY_TOKEN'))
    ->acceptJson()
    ->patch('https://manage.corefinity.com/api/environments/1311/deployment-settings', [
        'git_deploys' => 'automatic',
    ]);

$data = $response->json();
```

### Node

```javascript
const res = await fetch('https://manage.corefinity.com/api/environments/1311/deployment-settings', {
  method: 'PATCH',
  headers: {
    Authorization: `Bearer ${process.env.COREFINITY_TOKEN}`,
    Accept: 'application/json',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    git_deploys: 'automatic',
  }),
});

// An answer with no body (204) has nothing to parse.
const text = await res.text();
const data = text && JSON.parse(text);
```

### Python

```python
import os
import requests

res = requests.patch(
    "https://manage.corefinity.com/api/environments/1311/deployment-settings",
    headers={
        "Authorization": f"Bearer {os.environ['COREFINITY_TOKEN']}",
        "Accept": "application/json",
    },
    json={
        "git_deploys": "automatic",
    },
)

data = res.json() if res.content else None
```

## Responses

### 200 The deployment settings after the change.

```json
{
  "deployment_settings": {
    "deployment_source": "git",
    "deployment_sources": [
      "manual",
      "git"
    ],
    "enterprise_env_id": 1311,
    "git_deploys": "automatic",
    "pipeline_enabled": true,
    "pipelines": [
      {
        "build_switches_editable": false,
        "folders_editable": true,
        "isolate_build_var": null,
        "name": "Storefront (Wordpress)",
        "notes": [],
        "pause_crons_during_build": null,
        "pipeline_id": 2210,
        "root_directory": "/var/www/harbourandfinch.example.com/",
        "root_storage": "/var/www/harbourandfinch.example.com/shared/"
      }
    ],
    "repositories": 1
  }
}
```

### 401 No token, or a token that is not valid.

```json
{
  "message": "Unauthenticated."
}
```

### 403 The token lacks the `write` scope (`scope_required`), your company requires two-factor authentication and you have not set it up, or your role lacks a permission the change needs (`forbidden`, with `permission`): Manage Deployment Source for `deployment_source` and `git_deploys`, Manage Deployment Repositories as well to move off git, Create Deployments as well to make a push deploy on its own, and Edit Environment Deployment Pipeline for a pipeline's folders and build switches.

```json
{
  "code": "company_unavailable",
  "message": "Your company is unavailable.",
  "reason": "company_unavailable"
}
```

### 404 The id does not exist, or it is something you cannot see. Both answer the same body.

```json
{
  "message": "Not found."
}
```

### 409 The setting does not apply to the environment as it is (`not_available`): a DevBox environment, a source or git setting while the pipeline is off, `git_deploys` on an environment that does not deploy from git, or a build switch on a pipeline it does not apply to.

```json
{
  "code": "not_available",
  "message": "Git deploys apply only to an environment that deploys from git.",
  "reason": "not_available"
}
```

### 422 A value is not offered, no setting was named or a folder is refused (`invalid`), or moving off git would remove repositories and `confirm_remove_repositories` is not true (`confirm`). A folder is refused when it is not written plainly under `/var/www/`, `/var/www_m2/`, `/var/www_vsf/` or `/var/www_blog/`, is longer than 255 characters, is a folder every site shares, or is one another site on the same build server uses, and while another folder change on the same build server is being saved (try again in a moment). A CoreStack or CoreCluster environment is refused `invalid` on `environment`.

```json
{
  "code": "confirm",
  "errors": {
    "confirm_remove_repositories": [
      "Moving this environment off git deployments removes its repository and that repository's webhook. Ask the person, then send confirm_remove_repositories: true."
    ]
  },
  "message": "Moving this environment off git deployments removes its repository and that repository's webhook. Ask the person, then send confirm_remove_repositories: true.",
  "reason": "confirm"
}
```

### 429 Too many requests (`rate_limited`). Wait for the number of seconds in `Retry-After`, which `retry_after_seconds` repeats.

```json
{
  "code": "rate_limited",
  "message": "Too many requests. Try again in 60 seconds.",
  "reason": "rate_limited",
  "retry_after_seconds": 60
}
```

## If it is refused

| Status | Reason | What to do |
|---|---|---|
| 401 |  | Send a valid token as `Authorization: Bearer <token>`. |
| 403 | `company_unavailable` | Your company is unavailable. |
| 403 | `forbidden` | The person is not allowed to do this. |
| 403 | `scope_required` | Use a token with the scope named in `scope`. |
| 403 | `two_factor_required` | Turn on two-factor on your account, then send again. |
| 404 |  | Check the id. You see only what your account can reach. |
| 409 | `not_available` | The tool does not apply to this object. |
| 422 | `confirm` | The action needs an explicit confirmation field. Ask the person, then send it. |
| 422 | `invalid` | Fix the field named in `field`; `errors` says why. |
| 429 | `rate_limited` | Wait for the seconds in `Retry-After`. |

## The same task elsewhere

- Guide: [Deployments and pipelines](https://docs.corefinity.com/guides/corestack-enterprise/deployments-and-pipelines.md)
