---
title: "Update how a site deploys"
url: https://docs.corefinity.com/api/reference/deployments/update-site-deployment-mode
type: endpoint
last_updated: 2026-11-13
feature: deployments
related:
  - https://docs.corefinity.com/guides/sites/code-and-deployments/connect-a-repository.md
  - https://docs.corefinity.com/mcp/tools/corestack_deployments_mode_set.md
---
# Update how a site deploys

Switches the site between deploying from git (`git`) and by upload (`manual`). Switching to git answers `201`
with the `operation` that moves the site's files into the releases layout; switching to manual answers `200`
with the `command` that moves them back, or null when the site already deploys by upload. Your role needs the
Manage Deployment Source permission.

```http
PUT /api/corestack/sites/{site}/deployments/mode
```

- Scope: `write`
- Two-factor: required on your account (all)
- Rate limit: 10 a minute
- Long-running: answers with an operation to poll
- Try it in the console: off. It runs commands on a live site. Copy the request and run it yourself when you are sure.

## Path parameters

- `site` (integer, required): The id of a site row. A website's production site and each of its environments has its own id. Digits only.

## Body

- `mode` (string, required) One of `git`, `manual`.
- `reconvert` (boolean): With `mode` `git` on a site whose conversion is pending, converts again.

## Request

### curl

```bash
curl -X PUT https://manage.corefinity.com/api/corestack/sites/1042/deployments/mode \
  -H "Authorization: Bearer $COREFINITY_TOKEN" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{
    "mode": "git"
  }'
```

### PHP

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

$response = Http::withToken(env('COREFINITY_TOKEN'))
    ->acceptJson()
    ->put('https://manage.corefinity.com/api/corestack/sites/1042/deployments/mode', [
        'mode' => 'git',
    ]);

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

### Node

```javascript
const res = await fetch('https://manage.corefinity.com/api/corestack/sites/1042/deployments/mode', {
  method: 'PUT',
  headers: {
    Authorization: `Bearer ${process.env.COREFINITY_TOKEN}`,
    Accept: 'application/json',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    mode: 'git',
  }),
});

// 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.put(
    "https://manage.corefinity.com/api/corestack/sites/1042/deployments/mode",
    headers={
        "Authorization": f"Bearer {os.environ['COREFINITY_TOKEN']}",
        "Accept": "application/json",
    },
    json={
        "mode": "git",
    },
)

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

## Responses

### 200 The settings, and the command that switches the site to manual deployments, if one was started.

```json
{
  "command": null,
  "settings": {
    "can_change_mode": {
      "available": true,
      "reason": null
    },
    "can_change_repository": {
      "available": true,
      "reason": null
    },
    "can_deploy": {
      "available": false,
      "reason": "Switch this site to git deployments first"
    },
    "can_retry_deployments": {
      "available": true,
      "reason": null
    },
    "can_rollback": {
      "available": false,
      "reason": "Switch this site to git deployments first"
    },
    "can_stop_deployments": {
      "available": true,
      "reason": null
    },
    "can_switch_to_git": {
      "available": true,
      "reason": null
    },
    "can_turn_off_auto_deploy": {
      "available": true,
      "reason": null
    },
    "can_turn_on_auto_deploy": {
      "available": true,
      "reason": null
    },
    "connections": [
      {
        "id": 4217,
        "label": "GitLab (self-hosted) · daniel-reyes",
        "needs_reauth": false,
        "provider": "gitlab_self_hosted",
        "provider_label": "GitLab (self-hosted)"
      }
    ],
    "conversion": null,
    "deployments": [],
    "layout": "plain",
    "manual": {
      "note": "Files you change over SFTP or in the terminal are live on refresh",
      "sftp_command": "sftp -P 20001 web@ssh-northwind.example.net"
    },
    "mode": "manual",
    "mode_label": "Manual",
    "node": {
      "adopted": false,
      "major": null
    },
    "pipeline": {
      "bindings": [],
      "version": 3
    },
    "releases": {
      "count": 0,
      "current": null,
      "keep": 5,
      "previous": null
    },
    "repository": null,
    "repository_options": {
      "default_contents": "whole_site",
      "default_target_path": null,
      "layout_target_path": "wp-content",
      "release_root": "",
      "site_content": true
    }
  }
}
```

### 201 The settings, and the operation that moves the site's files into the releases layout.

```json
{
  "operation": {
    "applied_at": "2026-11-09T09:16:40Z",
    "can_retry": false,
    "cluster": {
      "id": 17,
      "name": "Northwind UK 1"
    },
    "committed_at": null,
    "completed_at": null,
    "created_at": "2026-11-09T09:16:40Z",
    "environment": {
      "env_id": "rs-northwind-harbourandfinch-example-com",
      "hostname": "harbourandfinch-example-com.northwind.cfstack.example.net",
      "id": 1042,
      "name": "Production",
      "role": "production",
      "role_label": "Production",
      "slug": "production"
    },
    "error": null,
    "failure_reason": null,
    "from_version": "plain",
    "hot": false,
    "id": 4410,
    "install": null,
    "label": "Release prepared",
    "notes": [],
    "parent_operation_id": null,
    "requested_by": {
      "id": 3301,
      "name": "Daniel Reyes"
    },
    "reset_target": null,
    "result": null,
    "result_state": "none",
    "retried_by_operation_id": null,
    "retries_operation_id": null,
    "retry_requires": null,
    "revealed": null,
    "scope": "site",
    "site": {
      "domain": "harbourandfinch.example.com",
      "id": 1042
    },
    "status": "executing",
    "status_label": "Preparing the first release",
    "step": "prepared",
    "steps": [
      {
        "key": "prepared",
        "label": "Release prepared",
        "state": "current"
      },
      {
        "key": "converted",
        "label": "Files moved into releases",
        "state": "todo"
      },
      {
        "key": "verified",
        "label": "Verified",
        "state": "todo"
      }
    ],
    "subject": null,
    "summary": "Move the site's files into the releases layout",
    "to_version": "releases",
    "type": "releases_convert",
    "type_label": "Deployment layout"
  },
  "settings": {
    "can_deploy": {
      "available": false,
      "reason": "Connect a repository first"
    },
    "can_rollback": {
      "available": false,
      "reason": "There is no earlier release to roll back to"
    },
    "connections": [],
    "conversion": {
      "id": 4410,
      "scope": "site",
      "status": "executing",
      "status_label": "Running",
      "summary": "Move the site's files into the releases layout",
      "to_version": "releases",
      "type": "releases_convert",
      "type_label": "Deployment layout"
    },
    "deployments": [],
    "layout": "plain",
    "manual": {
      "note": "Files you change over SFTP or in the terminal are live on refresh",
      "sftp_command": "sftp -P 20001 web@ssh-northwind.example.net"
    },
    "mode": "git",
    "mode_label": "Git",
    "node": {
      "adopted": false,
      "major": null
    },
    "pipeline": {
      "bindings": [],
      "version": 3
    },
    "releases": {
      "count": 0,
      "current": null,
      "keep": 5,
      "previous": null
    },
    "repository": null,
    "repository_options": {
      "default_contents": "whole_site",
      "default_target_path": null,
      "layout_target_path": "wp-content",
      "release_root": "",
      "site_content": true
    }
  }
}
```

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

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

### 403 As every site deployment change, with one more case: switching back to `git` while automatic deployment was left on makes each push deploy on its own again, so it also needs the Create Deployments permission.

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

### 404 The id does not exist or is something you cannot see, or the feature is not on for your company (`feature_off`).

```json
{
  "code": "feature_off",
  "message": "Not found.",
  "reason": "feature_off"
}
```

### 409 The mode cannot change now. `reason` says why: `busy` (another change to the site is in progress), `deployment_running`, `bedrock_layout` (a WordPress site built with Bedrock cannot switch to `manual` yet), `layout_unknown` (how the WordPress site is built could not be confirmed: try again in a minute), `managed_elsewhere`, `deleted` or `removed`. Another `reason` means the conversion could not start, and the message says why.

```json
{
  "code": "bedrock_layout",
  "message": "This WordPress site is built with Bedrock, so it cannot switch to manual deployments yet. Keep deploying it with Git.",
  "reason": "bedrock_layout"
}
```

### 422 `mode` is missing or is not `git` or `manual`, or the site already deploys from git (send `reconvert` true only while its conversion is pending).

```json
{
  "code": "invalid",
  "errors": {
    "mode": [
      "This site already uses git deployments"
    ]
  },
  "field": "mode",
  "message": "This site already uses git deployments",
  "reason": "invalid"
}
```

### 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
}
```

### 503 Switching to `manual` moves the site's files with a site command, and Corefinity has switched site commands off for the moment. A message only, with no `reason`.

```json
{
  "message": "Site commands are switched off at the moment"
}
```

## 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 | `feature_off` | This feature is not on for your organisation yet. |
| 409 | `bedrock_layout` | The WordPress site is built with Bedrock, so it cannot switch to manual deployments yet. Keep deploying it with Git. |
| 409 | `busy` | Another operation is running on the site. Wait for it to finish. |
| 409 | `layout_unknown` | The Control Panel could not confirm whether this WordPress site is built with Bedrock, so it stays on Git deployments. Try again in a minute. |
| 422 | `invalid` | Fix the field named in `field`; `errors` says why. |
| 429 | `rate_limited` | Wait for the seconds in `Retry-After`. |
| 503 |  | Try again shortly. |

## The same task elsewhere

- Guide: [Connect a repository](https://docs.corefinity.com/guides/sites/code-and-deployments/connect-a-repository.md)
- MCP tool: [`corestack_deployments_mode_set`](https://docs.corefinity.com/mcp/tools/corestack_deployments_mode_set.md)
