---
title: "Update a site's MariaDB version"
url: https://docs.corefinity.com/api/reference/runtime/update-mariadb-version
type: endpoint
last_updated: 2026-11-13
feature: php-runtime
related:
  - https://docs.corefinity.com/guides/sites/software-and-services/php-version.md
---
# Update a site's MariaDB version

Moves the site's database to the next MariaDB version. MariaDB moves forward only, one version at a time.
Answers the operation that makes the change.

```http
PUT /api/corestack/sites/{site}/mariadb-version
```

- 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): When a change that needs a maintenance window is applied. `now` applies it at once. `tonight` queues it for the site's next window. `window` means the same as `tonight`. An endpoint that takes `window` only while maintenance windows are on for your company says so, and refuses it `422` on `apply` otherwise. One of `now`, `tonight`, `window`. Defaults to `now`.
- `to` (string, required): The MariaDB version to move to, as major and minor.

## Request

### curl

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

### PHP

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

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

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

### Node

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

// 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/mariadb-version",
    headers={
        "Authorization": f"Bearer {os.environ['COREFINITY_TOKEN']}",
        "Accept": "application/json",
    },
    json={
        "to": "11.8",
    },
)

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

## Responses

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

```json
{
  "committed_at": "2026-11-09T21:35:25+00:00",
  "completed_at": null,
  "created_at": "2026-11-09T21:35:25+00:00",
  "error": null,
  "from_version": "11.4",
  "id": 5121,
  "requested_by": {
    "id": 2012,
    "name": "Daniel Reyes"
  },
  "status": "committed",
  "status_label": "Waiting for the platform",
  "steps": [
    {
      "key": "saved",
      "state": "done"
    },
    {
      "key": "applied",
      "state": "current"
    },
    {
      "key": "restarted",
      "state": "todo"
    },
    {
      "key": "healthy",
      "state": "todo"
    }
  ],
  "to_version": "11.8",
  "type": "mariadb_version",
  "type_label": "MariaDB version"
}
```

### 202 The change was sent and its outcome is still being established: the operation is `pending`. Follow it by its `id`; it settles as saved or as failed within a few minutes. Do not send the change again meanwhile.

```json
{
  "committed_at": null,
  "completed_at": null,
  "created_at": "2026-11-09T21:35:25+00:00",
  "error": null,
  "from_version": "11.4",
  "id": 5121,
  "requested_by": {
    "id": 2012,
    "name": "Daniel Reyes"
  },
  "status": "pending",
  "status_label": "Saving change",
  "steps": [
    {
      "key": "saved",
      "state": "current"
    },
    {
      "key": "applied",
      "state": "todo"
    },
    {
      "key": "restarted",
      "state": "todo"
    },
    {
      "key": "healthy",
      "state": "todo"
    }
  ],
  "to_version": "11.8",
  "type": "mariadb_version",
  "type_label": "MariaDB version"
}
```

### 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), your company requires two-factor authentication and you have not set it up, or your account has no company that can use Managed Clusters, for example because the company was closed (`company_unavailable` or `company_not_enabled`, whichever the route checks first). For Managed Clusters routes; any other route uses `ForbiddenScopeOrTwoFactor`.

```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 change cannot be made now. `reason` says why, such as `busy` (another change to the site is running), `stale` (the site's version changed in the meantime: read it again), `change_pending`, `snapshot_running`, `restore_running`, `image_not_offered` (the version is not available at the moment: nothing was changed), `cluster_paused`, `removed`, `conflict` or `managed_elsewhere`. A site that cannot be changed from the Control Panel at all answers a `message` with no `reason`.

```json
{
  "code": "busy",
  "message": "Another change to this site is in progress. Wait for it to finish.",
  "reason": "busy"
}
```

### 422 A field is missing or wrong (`invalid`; `acknowledge` is not accepted here); `apply` `tonight` while queuing for the window is switched off (`feature_off`); the version is not the next one (`invalid` on `to`); or the site cannot change version at the moment (`temporarily_unavailable`, `busy`, `not_available` or `removed`: the message says why).

```json
{
  "code": "invalid",
  "errors": {
    "to": [
      "Upgrade one LTS release at a time"
    ]
  },
  "field": "to",
  "message": "Upgrade one LTS release at a time",
  "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
}
```

### 502 The platform did not save the change. Nothing was changed; the body carries a `message` and no `reason`.

```json
{
  "message": "The change could not be saved. Contact support."
}
```

## 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 |  | Check the id. You see only what your account can reach. |
| 409 | `busy` | Another operation is running on the site. Wait for it to finish. |
| 409 | `managed_elsewhere` | This site is read-only here. Change it in the control panel that manages it. |
| 422 | `invalid` | Fix the field named in `field`; `errors` says why. |
| 422 | `temporarily_unavailable` | The Control Panel could not answer just now. Nothing was started; try again shortly. |
| 422 | `feature_off` | This feature is not on for your organisation yet. |
| 429 | `rate_limited` | Wait for the seconds in `Retry-After`. |
| 502 |  | Read the message; it says what happened. |

## The same task elsewhere

- Guide: [Change PHP version](https://docs.corefinity.com/guides/sites/software-and-services/php-version.md)
