---
title: "Copy Node.js configuration to other environments"
url: https://docs.corefinity.com/api/reference/runtime/copy-node-runtime
type: endpoint
last_updated: 2026-11-13
feature: node-runtime
related:
  - https://docs.corefinity.com/guides/sites/software-and-services/node-js.md
  - https://docs.corefinity.com/mcp/tools/corestack_node_runtime_copy.md
---
# Copy Node.js configuration to other environments

Copies this site's Node.js version, packages or follow mode to other environments of the same site. The request
is checked whole first, so a refusal applies nothing anywhere. Then each target is changed on its own: a part a
target refuses is left out there while its other parts apply, and the other targets still go ahead.

```http
POST /api/corestack/sites/{site}/node-runtime/apply-to
```

- Scope: `write`
- Also needs `exec` when The copied packages turn install scripts on for a package that does not run them on a target now
- Two-factor: required on your account (all)
- Rate limit: 20 a minute
- Long-running: answers with an operation to poll
- Try it in the console: off. It overwrites data that cannot be brought back. 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

- `acknowledge` (array of strings): `eol` when the version copied is past its end of life.
- `confirm_production` (boolean): Must be true when a target is production. Defaults to `false`.
- `parts` (array of strings, required): What to copy.
- `targets` (array of integers, required): The ids of the environments to copy to, each once. Each must be another environment of this site that you may change.

## Request

### curl

```bash
curl -X POST https://manage.corefinity.com/api/corestack/sites/1042/node-runtime/apply-to \
  -H "Authorization: Bearer $COREFINITY_TOKEN" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{
    "parts": [
      "version",
      "packages"
    ],
    "targets": [
      1043
    ]
  }'
```

### PHP

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

$response = Http::withToken(env('COREFINITY_TOKEN'))
    ->acceptJson()
    ->post('https://manage.corefinity.com/api/corestack/sites/1042/node-runtime/apply-to', [
        'parts' => [
            'version',
            'packages',
        ],
        'targets' => [
            1043,
        ],
    ]);

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

### Node

```javascript
const res = await fetch('https://manage.corefinity.com/api/corestack/sites/1042/node-runtime/apply-to', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.COREFINITY_TOKEN}`,
    Accept: 'application/json',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    parts: [
      'version',
      'packages',
    ],
    targets: [
      1043,
    ],
  }),
});

// 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.post(
    "https://manage.corefinity.com/api/corestack/sites/1042/node-runtime/apply-to",
    headers={
        "Authorization": f"Bearer {os.environ['COREFINITY_TOKEN']}",
        "Accept": "application/json",
    },
    json={
        "parts": [
            "version",
            "packages",
        ],
        "targets": [
            1043,
        ],
    },
)

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

## Responses

### 200 One entry for each target, in the order asked.

```json
{
  "changes": [
    {
      "operation": {
        "applied_at": null,
        "can_retry": false,
        "cluster": {
          "id": 1017,
          "name": "Northwind UK 1"
        },
        "committed_at": "2026-11-09T21:35:28Z",
        "completed_at": null,
        "created_at": "2026-11-09T21:35:28Z",
        "environment": {
          "env_id": "rs-northwind-harbourandfinch-example-com--staging",
          "hostname": "staging-harbourandfinch-example-com.northwind.cfstack.example.net",
          "id": 1043,
          "name": "Staging",
          "role": "staging",
          "role_label": "Staging",
          "slug": "staging"
        },
        "error": null,
        "failure_reason": null,
        "from_version": null,
        "hot": false,
        "id": 5121,
        "install": null,
        "label": "Sent to the site",
        "notes": [],
        "parent_operation_id": null,
        "requested_by": {
          "id": 2012,
          "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": 1043
        },
        "status": "committed",
        "status_label": "Waiting for the platform",
        "step": "sent",
        "steps": [
          {
            "key": "saved",
            "label": "Saved",
            "state": "done"
          },
          {
            "key": "sent",
            "label": "Sent to the site",
            "state": "current"
          },
          {
            "key": "switched",
            "label": "Node.js switched",
            "state": "todo"
          },
          {
            "key": "checked",
            "label": "Checked",
            "state": "todo"
          }
        ],
        "subject": null,
        "summary": "Node.js configuration",
        "to_version": null,
        "type": "node_runtime",
        "type_label": "Node.js configuration"
      },
      "refused": null,
      "site_id": 1043,
      "warnings": []
    }
  ]
}
```

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

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

### 403 The token lacks the scope (`scope_required`, with the `scope` to use), or your company requires two-factor authentication and you have not set it up. For routes outside Managed Clusters.

```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 site is managed by another control panel, so it cannot be changed here.

```json
{
  "code": "managed_elsewhere",
  "message": "This site is managed by another control panel",
  "reason": "managed_elsewhere"
}
```

### 422 The copy is refused whole and nothing is applied. `invalid_arguments` names the refused field in `errors`; `copy_target_invalid` means a target is not another environment of this site; `confirm` means a target is production and `confirm_production` is not true.

```json
{
  "code": "confirm",
  "errors": {
    "confirm_production": [
      "Copying Node.js settings into production changes what it runs. Confirm to continue."
    ]
  },
  "message": "Copying Node.js settings into production changes what it runs. Confirm to continue.",
  "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 | `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 | `managed_elsewhere` | This site is read-only here. Change it in the control panel that manages it. |
| 422 | `confirm` | The action needs an explicit confirmation field. Ask the person, then send it. |
| 422 | `copy_target_invalid` | Node.js settings can only be copied to another environment of this site. |
| 429 | `rate_limited` | Wait for the seconds in `Retry-After`. |

## The same task elsewhere

- Guide: [Node.js configuration](https://docs.corefinity.com/guides/sites/software-and-services/node-js.md)
- MCP tool: [`corestack_node_runtime_copy`](https://docs.corefinity.com/mcp/tools/corestack_node_runtime_copy.md)
