---
title: "Replace a site's extra domains"
url: https://docs.corefinity.com/api/reference/domains/replace-site-domains
type: endpoint
last_updated: 2026-11-13
feature: domains
related:
  - https://docs.corefinity.com/guides/sites/go-live/add-a-domain.md
  - https://docs.corefinity.com/mcp/tools/corestack_domains_update.md
---
# Replace a site's extra domains

Replaces the list of extra domains and sets whether search engines are asked not to index the site. Send the
`version` you last read; a save that changes something answers the operation to follow.

```http
PUT /api/corestack/sites/{site}/domains
```

- 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 deletes 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

- `aliases` (array of strings or objects, required): The complete list of extra domains to keep, each once and never the main domain. A plain hostname redirects to the primary; the object form chooses a redirect or a storefront. A site has at most 10 hostnames in total.
  - `base_url` (boolean): Choose this address for the store's base URLs, at most one address per website or store view.
  - `host` (string, required)
  - `serve` (string): Defaults to redirect. A Shopware storefront serves its sales channel; a Magento 2 storefront uses `store`. One of `redirect`, `storefront`.
  - `store` (object or any or null): Magento 2 storefront aliases only. Required for a new storefront alias; omitted on an existing storefront alias, its mapping is kept. Null shows the default store. A redirect cannot carry a store choice.
- `noindex` (boolean, required): True to ask search engines not to index the site.
- `point_base_urls` (array of strings): Magento 2 only. Optional hosts whose stores' base URLs are moved here, even from another host. Each must be the primary address or a storefront alias with a Magento store, with at most one address per website or store view.
- `version` (integer, required): The `version` you last read.

## Request

### curl

```bash
curl -X PUT https://manage.corefinity.com/api/corestack/sites/1042/domains \
  -H "Authorization: Bearer $COREFINITY_TOKEN" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{
    "aliases": [
      "www.harbourandfinch.example.com",
      "shop.harbourandfinch.example.com"
    ],
    "noindex": false,
    "version": 4
  }'
```

### PHP

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

$response = Http::withToken(env('COREFINITY_TOKEN'))
    ->acceptJson()
    ->put('https://manage.corefinity.com/api/corestack/sites/1042/domains', [
        'aliases' => [
            'www.harbourandfinch.example.com',
            'shop.harbourandfinch.example.com',
        ],
        'noindex' => false,
        'version' => 4,
    ]);

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

### Node

```javascript
const res = await fetch('https://manage.corefinity.com/api/corestack/sites/1042/domains', {
  method: 'PUT',
  headers: {
    Authorization: `Bearer ${process.env.COREFINITY_TOKEN}`,
    Accept: 'application/json',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    aliases: [
      'www.harbourandfinch.example.com',
      'shop.harbourandfinch.example.com',
    ],
    noindex: false,
    version: 4,
  }),
});

// 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/domains",
    headers={
        "Authorization": f"Bearer {os.environ['COREFINITY_TOKEN']}",
        "Accept": "application/json",
    },
    json={
        "aliases": [
            "www.harbourandfinch.example.com",
            "shop.harbourandfinch.example.com",
        ],
        "noindex": False,
        "version": 4,
    },
)

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

## Responses

### 200 Nothing differs from what is saved, so nothing started. `operation` is null.

```json
{
  "domains": {
    "advice": null,
    "apply": {
      "applied_at": "2026-11-02T14:37:55Z",
      "error": null,
      "operation": null,
      "state": "applied",
      "state_label": "Applied"
    },
    "canonical_url": "https://harbourandfinch.example.com",
    "cloudflare": {
      "connected": false,
      "zone": null
    },
    "hosts": [
      {
        "cloudflare_zone": null,
        "dns_answers": [
          {
            "type": "A",
            "value": "203.0.113.10"
          }
        ],
        "dns_checked_at": "2026-11-06T09:16:05Z",
        "dns_detail": null,
        "dns_state": "points_here",
        "dns_state_since": "2026-11-01T10:14:03Z",
        "expected_ip": "203.0.113.10",
        "host": "harbourandfinch.example.com",
        "noindex": false,
        "redirects_to": null,
        "role": "primary",
        "tls": {
          "checked_at": "2026-11-06T09:14:41Z",
          "issuer": "Let's Encrypt",
          "not_after": "2026-12-08T05:41:17Z",
          "reason": null,
          "state": "ready"
        }
      },
      {
        "cloudflare_zone": null,
        "dns_answers": [
          {
            "type": "A",
            "value": "203.0.113.10"
          }
        ],
        "dns_checked_at": "2026-11-06T09:16:05Z",
        "dns_detail": null,
        "dns_state": "points_here",
        "dns_state_since": "2026-11-01T10:14:03Z",
        "expected_ip": "203.0.113.10",
        "host": "www.harbourandfinch.example.com",
        "noindex": false,
        "redirects_to": "harbourandfinch.example.com",
        "role": "alias",
        "tls": {
          "checked_at": "2026-11-06T09:14:41Z",
          "issuer": "Let's Encrypt",
          "not_after": "2026-12-08T05:41:17Z",
          "reason": null,
          "state": "ready"
        }
      }
    ],
    "ingress_ip": "203.0.113.10",
    "limits": {
      "hosts_max": 10
    },
    "locked_reason": null,
    "mode": "production",
    "noindex": false,
    "noindex_source": "flags",
    "primary": "harbourandfinch.example.com",
    "url_change": {
      "can_change": {
        "available": true,
        "reason": null
      },
      "in_flight": null
    },
    "version": 4,
    "www": "bare"
  },
  "operation": null
}
```

### 201 The change started. Follow `operation.id`.

```json
{
  "domains": {
    "advice": null,
    "apply": {
      "applied_at": "2026-11-02T14:37:55Z",
      "error": null,
      "operation": {
        "id": 77162,
        "scope": "site",
        "status": "committed",
        "status_label": "Waiting for the platform",
        "summary": "Alias added: shop.harbourandfinch.example.com",
        "to_version": null,
        "type": "domains_change",
        "type_label": "Domains"
      },
      "state": "applying",
      "state_label": "Applying"
    },
    "canonical_url": "https://harbourandfinch.example.com",
    "cloudflare": {
      "connected": false,
      "zone": null
    },
    "hosts": [
      {
        "cloudflare_zone": null,
        "dns_answers": [
          {
            "type": "A",
            "value": "203.0.113.10"
          }
        ],
        "dns_checked_at": "2026-11-06T09:16:05Z",
        "dns_detail": null,
        "dns_state": "points_here",
        "dns_state_since": "2026-11-01T10:14:03Z",
        "expected_ip": "203.0.113.10",
        "host": "harbourandfinch.example.com",
        "noindex": false,
        "redirects_to": null,
        "role": "primary",
        "tls": {
          "checked_at": "2026-11-06T09:14:41Z",
          "issuer": "Let's Encrypt",
          "not_after": "2026-12-08T05:41:17Z",
          "reason": null,
          "state": "ready"
        }
      },
      {
        "cloudflare_zone": null,
        "dns_answers": [
          {
            "type": "A",
            "value": "203.0.113.10"
          }
        ],
        "dns_checked_at": "2026-11-06T09:16:05Z",
        "dns_detail": null,
        "dns_state": "points_here",
        "dns_state_since": "2026-11-01T10:14:03Z",
        "expected_ip": "203.0.113.10",
        "host": "www.harbourandfinch.example.com",
        "noindex": false,
        "redirects_to": "harbourandfinch.example.com",
        "role": "alias",
        "tls": {
          "checked_at": "2026-11-06T09:14:41Z",
          "issuer": "Let's Encrypt",
          "not_after": "2026-12-08T05:41:17Z",
          "reason": null,
          "state": "ready"
        }
      },
      {
        "cloudflare_zone": null,
        "dns_answers": [
          {
            "type": "A",
            "value": "203.0.113.10"
          }
        ],
        "dns_checked_at": "2026-11-06T09:16:05Z",
        "dns_detail": null,
        "dns_state": "points_here",
        "dns_state_since": "2026-11-06T09:16:05Z",
        "expected_ip": "203.0.113.10",
        "host": "shop.harbourandfinch.example.com",
        "noindex": false,
        "redirects_to": "harbourandfinch.example.com",
        "role": "alias",
        "tls": {
          "checked_at": null,
          "issuer": null,
          "not_after": null,
          "reason": null,
          "state": "pending"
        }
      }
    ],
    "ingress_ip": "203.0.113.10",
    "limits": {
      "hosts_max": 10
    },
    "locked_reason": null,
    "mode": "production",
    "noindex": false,
    "noindex_source": "flags",
    "primary": "harbourandfinch.example.com",
    "url_change": {
      "can_change": {
        "available": false,
        "reason": "Another change to this site is in progress. Wait for it to finish."
      },
      "in_flight": null
    },
    "version": 5,
    "www": "bare"
  },
  "operation": {
    "applied_at": null,
    "can_retry": false,
    "cluster": {
      "id": 1017,
      "name": "Northwind UK 1"
    },
    "committed_at": "2026-11-06T09:17:15Z",
    "completed_at": null,
    "created_at": "2026-11-06T09:17:12Z",
    "environment": {
      "env_id": "rs-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": null,
    "hot": false,
    "id": 77162,
    "label": "Picked up by the platform",
    "notes": [],
    "parent_operation_id": null,
    "requested_by": {
      "id": 5021,
      "name": "Eleanor Finch"
    },
    "result": null,
    "result_state": "none",
    "retried_by_operation_id": null,
    "retries_operation_id": null,
    "retry_requires": null,
    "scope": "site",
    "site": {
      "domain": "harbourandfinch.example.com",
      "id": 1042
    },
    "status": "committed",
    "status_label": "Waiting for the platform",
    "step": "applied",
    "steps": [
      {
        "key": "saved",
        "label": "Saved",
        "state": "done"
      },
      {
        "key": "applied",
        "label": "Picked up by the platform",
        "state": "current"
      },
      {
        "key": "restarted",
        "label": "Change applied",
        "state": "todo"
      },
      {
        "key": "healthy",
        "label": "Healthy",
        "state": "todo"
      }
    ],
    "summary": "Alias added: shop.harbourandfinch.example.com",
    "to_version": null,
    "type": "domains_change",
    "type_label": "Domains"
  }
}
```

### 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 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 save cannot start: `stale` (the domains changed since your read), `busy` or `restore_running` (another change is running), `deleted`, `removed`, `provisioning`, `preview_only` (no domain attached yet), `maintenance` (the maintenance page is on), `store_hosts` or `managed_elsewhere`.

```json
{
  "code": "maintenance",
  "message": "Switch the maintenance page off before changing the site's hosts",
  "reason": "maintenance"
}
```

### 422 A field is missing or wrong (`invalid`, with `field` and `errors`), an extra domain is used by another site (`host_taken`), or the site's domains are locked (`domains_locked`).

```json
{
  "code": "invalid",
  "errors": {
    "aliases.1": [
      "Each host may appear once"
    ]
  },
  "field": "aliases.1",
  "message": "Each host may appear once",
  "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 | `maintenance` | The site is in maintenance mode, which blocks this. Switch maintenance mode off first. |
| 409 | `managed_elsewhere` | This site is read-only here. Change it in the control panel that manages it. |
| 409 | `preview_only` | The environment has no domain attached yet. Attach one first. |
| 409 | `stale` | What you read has changed since you read it. Read it again, then send the change with its new version or quote. |
| 422 | `invalid` | Fix the field named in `field`; `errors` says why. |
| 422 | `store_required` | This address needs a Magento store choice. Choose the Magento website or store view this address shows. |
| 429 | `rate_limited` | Wait for the seconds in `Retry-After`. |

## The same task elsewhere

- Guide: [Add a domain](https://docs.corefinity.com/guides/sites/go-live/add-a-domain.md)
- MCP tool: [`corestack_domains_update`](https://docs.corefinity.com/mcp/tools/corestack_domains_update.md)
