---
title: "Update a site's Magento store mapping"
url: https://docs.corefinity.com/api/reference/domains/update-site-magento-store-mapping
type: endpoint
last_updated: 2026-11-13
feature: magento-stores
related:
  - https://docs.corefinity.com/guides/sites/go-live/magento-stores.md
  - https://docs.corefinity.com/mcp/tools/corestack_site_magento_store_mapping_update.md
---
# Update a site's Magento store mapping

Changes which store an existing served address shows, without adding or removing domains. Omitted choices stay as they are; null removes an explicit choice, and point_base_urls explicitly moves the selected stores' base URLs even from another host.

```http
PUT /api/corestack/sites/{site}/magento/store-mapping
```

- 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

- `default` (object or any or null): Omitted keeps the choice; null returns to Magento's default.
- `domains_version` (integer, required): The domains_version from the stores read.
- `hosts` (object): A partial mapping of served hostnames to store choices. Omitted hosts keep their choices; null uses the default without removing the domain or making it redirect.
- `nginx_version` (integer, required): The nginx_version from the stores read.
- `point_base_urls` (array of strings): Explicitly move these stores' base URLs here, including values on another host. Ask the person first.

## Request

### curl

```bash
curl -X PUT https://manage.corefinity.com/api/corestack/sites/1042/magento/store-mapping \
  -H "Authorization: Bearer $COREFINITY_TOKEN" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{
    "domains_version": 0,
    "nginx_version": 0
  }'
```

### PHP

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

$response = Http::withToken(env('COREFINITY_TOKEN'))
    ->acceptJson()
    ->put('https://manage.corefinity.com/api/corestack/sites/1042/magento/store-mapping', [
        'domains_version' => 0,
        'nginx_version' => 0,
    ]);

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

### Node

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

// 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/magento/store-mapping",
    headers={
        "Authorization": f"Bearer {os.environ['COREFINITY_TOKEN']}",
        "Accept": "application/json",
    },
    json={
        "domains_version": 0,
        "nginx_version": 0,
    },
)

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

## Responses

### 200 Nothing differed. No operation was started; the stores are returned again.

```json
{
  "operation": null,
  "stores": {
    "default_hosts": [
      "shop.example.com"
    ],
    "default_store": null,
    "domains_version": 0,
    "nginx_version": 0,
    "read_at": "2026-11-11T12:00:00Z",
    "store_hosts": [],
    "warnings": [],
    "websites": []
  }
}
```

### 201 Follow the magento_stores_change operation until the store mapping and store addresses finish.

```json
{
  "operation": {
    "completed_at": null,
    "created_at": "2026-11-11T12:00:00Z",
    "error": null,
    "id": 901,
    "scope": "site",
    "status": "pending",
    "status_label": "Saving change",
    "steps": [
      {
        "key": "checked",
        "label": "Stores checked",
        "state": "done"
      },
      {
        "key": "store_mapping",
        "label": "Store mapping saved",
        "state": "current"
      },
      {
        "key": "store_base_urls",
        "label": "Store addresses updated",
        "state": "todo"
      }
    ],
    "type": "magento_stores_change",
    "type_label": "Magento stores change"
  }
}
```

### 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 site is missing or not yours to see, the feature is unavailable (`feature_off`), or this is not Magento 2 (`not_magento`).

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

### 409 The site cannot take the change or read now. A write may answer managed_elsewhere, stale, busy, deleted, provisioning, removed, restore_running or store_hosts; a read may answer not_running, command_running or exec_unresolved. An edited store mapping answers store_mapping_unreadable. Read both versions again after stale.

```json
{
  "code": "stale",
  "message": "This site changed in the meantime. Reload.",
  "reason": "stale"
}
```

### 422 A store choice is missing or unusable, the host does not serve this site, or the Nginx settings need attention. Invalid arguments answer invalid with errors; a service refusal may name field. Nothing was started.

```json
{
  "code": "domains_locked",
  "message": "This site's domains are managed by staff. Contact support.",
  "reason": "domains_locked"
}
```

### 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 Magento's stores could not be read (`stores_unreadable`). Try again in a moment.

```json
{
  "code": "stores_unreadable",
  "message": "Magento's stores could not be read. Try again in a moment.",
  "reason": "stores_unreadable"
}
```

### 503 Corefinity has switched commands on sites off for the moment (`switched_off`). Try again later.

```json
{
  "code": "switched_off",
  "message": "Site commands are switched off at the moment",
  "reason": "switched_off"
}
```

## 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. |
| 404 | `not_magento` | Only a Magento 2 site has Magento stores. Choose a Magento 2 site. |
| 409 | `stale` | What you read has changed since you read it. Read it again, then send the change with its new version or quote. |
| 409 | `store_hosts` | This site serves extra Magento stores on their own addresses. Ask Corefinity support to change its domains. |
| 409 | `store_mapping_unreadable` | The store mapping in this site's nginx rules has been edited by hand. Remove the edit in the Nginx tab, or ask Corefinity support. |
| 422 | `domains_locked` | The site's domains cannot be changed at the moment. Read the message: take the site live first, or wait for the change in progress. |
| 422 | `feature_off` | This feature is not on for your organisation yet. |
| 422 | `invalid` | Fix the field named in `field`; `errors` says why. |
| 422 | `nginx_invalid` | These nginx rules cannot be saved: fix the errors shown. |
| 422 | `nginx_rules_locked` | Corefinity has locked this environment's nginx rules. Contact support to change them. |
| 422 | `nginx_rules_not_adopted` | This site's nginx rules need a one-off update before a store can be mapped. Save them once in the Nginx tab. |
| 422 | `store_code_format` | Magento store codes with capital letters cannot be used for an address yet. Rename the code in Magento to lower case. |
| 422 | `store_host_not_served` | This address does not show its own store on this site yet. Add it as an alias that shows a store first. |
| 422 | `store_inactive` | The store view, or the website's default store view, is switched off in Magento. Switch it on first, or choose another. |
| 422 | `store_mapping_foreign` | Your nginx rules already set the Magento store outside the Control Panel's store mapping. Remove that from the Nginx tab first. |
| 422 | `store_unknown` | Magento has no website or store view with that code. Read the current stores and choose one of their codes. |
| 429 | `rate_limited` | Wait for the seconds in `Retry-After`. |
| 502 | `stores_unreadable` | Magento's stores could not be read. Try again in a moment. |
| 503 | `switched_off` | Corefinity has switched this action off for the moment. Try again later. |

## The same task elsewhere

- Guide: [Magento stores on separate domains](https://docs.corefinity.com/guides/sites/go-live/magento-stores.md)
- MCP tool: [`corestack_site_magento_store_mapping_update`](https://docs.corefinity.com/mcp/tools/corestack_site_magento_store_mapping_update.md)
