hosting

POST /v1/sites/{siteId}/migrations

Migrate a site in from another host.

所有 hosting 端点

所有开发者文档

身份验证

请将 API 密钥作为 bearer 令牌发送。该密钥必须具有 hosting.import.manage 权限;缺少该权限的密钥将被拒绝并返回 403 状态码,而非 404。

此端点不需要组织 ID。您的密钥已用于识别其所属的组织,且响应范围也仅限于该组织。

免费试用

将尖括号中的内容替换为您自己的值,并将键占位符替换为您仪表板中的一个键。

curl -X POST https://api.zinndigital.com/v1/sites/{siteId}/migrations \
  -H "Authorization: Bearer zdk_live_…" \
  -H "Content-Type: application/json" \
  -d '{ "source": <MigrationSource>, "host": <string>, "username": <string>, "ownership_attested": <boolean> }'

已登录?您仪表板中的 API 控制台会自动填入您真实的组织 ID 和您自己的密钥,并针对实时 API 运行请求,以便您查看实际的响应。 在 API 控制台中打开此端点

详细信息

Probes the source, records the job and its per-item rows, then starts a durable workflow that resumes rather than restarts — a 5,000-file or 40-mailbox job survives a worker being replaced, which matters because a restart would mean a second full read of a stranger's live server. Returns 202 with the new job state, never a bare acknowledgement. Refused up front, while the customer still has their old account, if the source cannot give us the mail they asked for (source_cannot_migrate_mail) or if any mailbox has no password (mailbox_passwords_required, with the count in the detail rows) — a migration that moves a website and silently loses the mailboxes is worse for the customer than no migration at all. Other refusals are 422 with a machine code; a site that already has a migration running is 409; a site mid-move between our own fleet workers is also 409. If the workflow service or the secret store is unavailable the answer is 503 and no job is written — an acceptance we cannot honour would leave the customer watching a progress bar for ever. Requires hosting.import.manage.

参数

名称类型必填内容简介
siteId (path)UuidSite ID (UUIDv7).
Idempotency-Key (header)stringClient-generated key that makes an unsafe request replay-safe: the server stores the first response and returns it verbatim for repeats.

请求正文

名称类型必填内容简介
sourceMigrationSourceThe kind of hosting the site is being pulled from. ⛔ plesk is offered so the refusal can be specific and actionable, not because it is supported: pleskbackup is reachable…
hoststringThe server's public hostname, e.g. server123.yourhost.com. Must resolve to a public address — a private or link-local target is refused with source_host_not_public at the door…
usernamestringThe login for the source panel or account.
portinteger0 means the source driver's default for that panel.
passwordstring
private_keystringAn SSH private key in PEM form, for an ssh source.
api_tokenstring
include_mailboolean⚖️ Defaults to true, and a source that cannot deliver mailboxes is refused rather than silently migrated without them — a migration that moves a website and loses the mail is…
mailbox_passwordsobjectaddress -> password, for every mailbox being moved. Required up front rather than discovered mid-sync: most panels will not hand over a mailbox without its own password, and…
ownership_attestedboolean⚠️ The customer's assertion that this estate is theirs to move, recorded because it cannot be reconstructed afterwards. Required — the job is refused without it — but it is…
replace_confirmationstringThe target site's own domain, typed back by the customer. Required only when the target site already holds a website — migrating onto it replaces its files and database.…

响应

名称类型必填内容简介
idUuidUUIDv7 identifier — sortable by creation time (docs/02 §8).
site_idUuidUUIDv7 identifier — sortable by creation time (docs/02 §8).
sourceMigrationSourceThe kind of hosting the site is being pulled from. ⛔ plesk is offered so the refusal can be specific and actionable, not because it is supported: pleskbackup is reachable…
statusSiteMigrationStatusauthenticating, inventorying and transferring are separate states rather than one running because they fail for opposite reasons and the customer's next action differs: a…
status_reasonstringA machine code the dashboard renders through its own catalogue — never an English sentence composed by the engine, which could be shown to none of the other 57 locales.
include_mailboolean
source_hoststringThe hostname the estate is being pulled from. Host only: no port, no username, and never a secret.
files_totalinteger
files_doneinteger
databases_totalinteger
databases_doneinteger
mailboxes_totalinteger
mailboxes_doneinteger
items_failedinteger⛔ Counted separately from the *_done fields, never folded into them. "We could not get it" reported as "done" makes the completion report a lie.
bytes_transferredinteger
warningsstring[]Machine warning codes the dashboard localises.
mail_synced_atstringWhen the mail delta last ran. null and a timestamp are different states, and the cutover control reads this to tell them apart.
dns_records_capturedintegerHow many records were read off the source's zone and will be published on cutover. ⛔ Counted separately from dns_records_unsupported, never as one total: "we captured 14…
dns_records_unsupportedintegerReal records the source holds that our DNS editor cannot express (an SSHFP, a TLSA, an MX with no preference). Stored and listed on the detail endpoint rather than dropped —…
dns_captured_atstringWhen the source's zone was read. null means never attempted, which is NOT the same as attempted-and-the-panel-holds-no-zone; only the first is worth retrying.
verified_atstringWhen the migrated site was last fetched over HTTP and compared with the source. null means the destination has never been looked at.
verification_codestringA machine code the dashboard localises. Empty means the destination is serving the site as well as the source was. ⛔ The migration's own counters cannot answer this: they travel…
destination_statusintegerThe HTTP status the migrated site returned, fetched at its origin address with a Host: header — before cutover the customer's domain still resolves to the OLD host, so asking…
source_statusintegerThe HTTP status the source returned. ⭐ Reported beside destination_status because the interesting failure is the PAIR: a destination 200 against a source 500 means we faithfully…
replaces_existingbooleanWhether this migration landed on a site that already held a website. Stamped when the job is created and never recomputed: after the apply step the site is occupied…
safety_backup_statestring<not_needed, pending, taken, unsupported, failed>What became of the backup taken immediately before the apply step replaced the site. ⛔ Five values rather than a boolean: "there is no safety backup" is one rendered sentence…
safety_backup_idstringThe SiteBackup id, or "". ⛔ Still reported after the archive has been pruned by retention, so a rollback can say "that archive has expired" rather than looking like a…
rolled_back_atstringWhen the customer put the site back. Set once — restoring the pre-migration archive over a site that is already the pre-migration archive can only lose work done since.
rollbackMigrationRollbackWhether this migration can be put back, and — when it cannot — why not. ⛔⛔ reason travels with available, always. Six different facts render as the same absent button…
started_atstring
finished_atstring
created_atstring

此端点可能返回的错误

401 · 403 · 404 · 409 · 422 · 429 · 503