# migration()

Canonical URL: https://developers.iagenify.com/sdk/ref/domain/migration/
Language: en

`domain.migration() → Promise<Plan>`

Would pointing the registrar at us right now break anything? It compares three views of the domain and answers plainly. Free, and it changes nothing.

Status: free · writes nothing · read it before you advise

```javascript
const plan = await domain.migration();

if (!plan.safeToSwitch) {
  console.log("would break:", plan.risks.join(", "));
  await domain.records.import();
}
```

## Returns {#returns}

```javascript
{
  servedBy: ["…", "…"],          // who serves the domain right now
  nameservers: ["…", "…"],       // what to set at the registrar
  safeToSwitch: false,
  counts: { found: 23, inZone: 0, missing: 15, opaque: 8 },
  missing: [{ type, name, content, reason }],   // live elsewhere, absent here
  opaque:  [{ type, name, content, reason }],   // a proxy address: the origin is invisible
  unseen:  [{ type, name, reason }],            // seen by querying, not by the search
  risks: ["mail in service", "DKIM signature", "a live site"],
  alreadyServed: false,
}
```

## Three views, compared {#three-views}

- What the search found at the current host.
- What the domain answers when it is queried directly.
- What our zone already holds.

A record present in either of the first two and absent from the third is a thing that would stop.

## missing and opaque are not the same, and that is the point {#opaque}

> **An opaque record must not be copied**
>
> Behind a proxy, what you see from outside is the proxy's address, not the origin. Copying it would point the domain at a service that has never heard of it. They are listed separately, and import() skips them.

`opaque` is counted once per name, not per address: the same name behind a proxy answers different addresses depending on who asks.

## risks is the sentence to show {#risks}

Mail in service, a DKIM signature, a live site — in those words. It is what a customer needs to read before being told to change anything.

## alreadyServed {#already}

True when the switch is already done. The question no longer applies, and nothing here is a warning.

- [records.import()](/sdk/ref/domain/records/import): Copying what was found.
- [check()](/sdk/ref/domain/check): After the switch.

```python
plan = domain.migration()

if not plan["safeToSwitch"]:
    print("would break:", ", ".join(plan["risks"]))
    domain.records.import_zone()
```

```python
{
    "servedBy": ["…", "…"],          # who serves the domain right now
    "nameservers": ["…", "…"],       # what to set at the registrar
    "safeToSwitch": False,
    "counts": {"found": 23, "inZone": 0, "missing": 15, "opaque": 8},
    "missing": [{"type": ..., "name": ..., "content": ..., "reason": ...}],   # live elsewhere, absent here
    "opaque": [{"type": ..., "name": ..., "content": ..., "reason": ...}],    # a proxy address: the origin is invisible
    "unseen": [{"type": ..., "name": ..., "reason": ...}],                    # seen by querying, not by the search
    "risks": ["mail in service", "DKIM signature", "a live site"],
    "alreadyServed": False,
}
```
