---
title: "Move a site onto the runtime"
url: https://docs.corefinity.com/api/reference/runtime/adopt-runtime
type: endpoint
last_updated: 2026-11-13
feature: php-runtime
related:
  - https://docs.corefinity.com/guides/sites/software-and-services/php-version.md
  - https://docs.corefinity.com/mcp/tools/corestack_runtime_adopt.md
---
# Move a site onto the runtime

Moves the site onto the runtime, at once or in the site's window. The runtime summary says whether it can
(`adoption.can_adopt_now`, `adoption.can_adopt_tonight`). A site that cannot move is refused `409` with the
reason and its `adoption` state.

```http
POST /api/corestack/sites/{site}/runtime/adopt
```

- 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 has not been cleared for the console. 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

- `apply` (string): `now` (the default) or `tonight`; `window` means `tonight` while maintenance windows are on for your company. One of `now`, `tonight`, `window`. Defaults to `now`.

## Request

### curl

```bash
curl -X POST https://manage.corefinity.com/api/corestack/sites/1042/runtime/adopt \
  -H "Authorization: Bearer $COREFINITY_TOKEN" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{
    "apply": "now"
  }'
```

### PHP

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

$response = Http::withToken(env('COREFINITY_TOKEN'))
    ->acceptJson()
    ->post('https://manage.corefinity.com/api/corestack/sites/1042/runtime/adopt', [
        'apply' => 'now',
    ]);

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

### Node

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

// 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/runtime/adopt",
    headers={
        "Authorization": f"Bearer {os.environ['COREFINITY_TOKEN']}",
        "Accept": "application/json",
    },
    json={
        "apply": "now",
    },
)

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

## Responses

### 201 The move started (`operation`), or was queued for the site's window (`queued`).

```json
{
  "adoption": {
    "adopt_now_refusal": null,
    "adopted": false,
    "can_adopt_now": true,
    "can_adopt_tonight": false,
    "in_progress": false,
    "planned_for": null,
    "queued_for": "2026-11-04",
    "revision": null
  },
  "item_id": 5120,
  "operation": null,
  "queued": true,
  "window_date": "2026-11-04"
}
```

### 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 cannot move onto the runtime now. `reason` says why and `adoption` is the site's state. Also `managed_elsewhere`, without `adoption`, for a site managed by another control panel. Reasons include `already_adopted`, `adoption_in_progress`, `runtime_not_adopted` (sites cannot be moved yet), `batch_window` (the move can only be made in the site's window, or other maintenance is already queued: send `apply` `tonight`), `change_pending`, `canary_pending` and `removed`.

```json
{
  "adoption": {
    "adopt_now_refusal": null,
    "adopted": true,
    "can_adopt_now": false,
    "can_adopt_tonight": false,
    "in_progress": false,
    "planned_for": null,
    "queued_for": null,
    "revision": "v1"
  },
  "code": "already_adopted",
  "message": "Instant changes are already on for this environment.",
  "reason": "already_adopted"
}
```

### 422 `apply` is not `now` or `tonight` (`invalid`), or it is `tonight` while queuing for the window is switched off (`feature_off`).

```json
{
  "code": "invalid",
  "errors": {
    "apply": [
      "The selected apply is invalid."
    ]
  },
  "field": "apply",
  "message": "The selected apply is invalid.",
  "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
}
```

## 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 | `already_adopted` | Instant changes are already on for this environment. |
| 422 | `invalid` | Fix the field named in `field`; `errors` says why. |
| 422 | `feature_off` | This feature is not on for your organisation yet. |
| 429 | `rate_limited` | Wait for the seconds in `Retry-After`. |

## The same task elsewhere

- Guide: [Change PHP version](https://docs.corefinity.com/guides/sites/software-and-services/php-version.md)
- MCP tool: [`corestack_runtime_adopt`](https://docs.corefinity.com/mcp/tools/corestack_runtime_adopt.md)
