Skip to main content
A hosting control plane can let an owner move an instance to their own server. The move needs two things from the hosted instance: a database export and a one-time reveal of the instance’s MESH_AGENT_MASTER_KEY. The key is never included in the export. Save it in a password manager.

Key handoff

The runtime serves GET /internal/portability/status and POST /internal/portability/key only when MESH_PORTABILITY_TOKEN_SHA256, MESH_INSTANCE_ID and a master key are configured. Otherwise both paths return 404. Each request must send Authorization: Bearer <token>, where the token’s SHA-256 matches MESH_PORTABILITY_TOKEN_SHA256, and an X-Mesh-Instance-ID header matching MESH_INSTANCE_ID. This credential is separate from the management token. Browser sessions, operator API tokens and the management token cannot use these paths.
  • status returns the protocol version, the instance ID and the master key’s fingerprint.
  • key returns the master key itself.
Responses are marked uncacheable. The control plane should record the owner’s one-time reveal in its own database before calling key, so a lost response cannot be retried, and must never log the response body. Escrow or operator recovery is a separate process from disclosing the key to the owner.

What the export covers

An export should contain a consistent SQL snapshot of PostgreSQL, its checksum, the exact image digest the instance ran, and restore instructions. Temporal workflow history, external workspaces, object stores, connector-hosted files and provider accounts are not in PostgreSQL and must be replaced or migrated separately.

Restore and adopt

Restore into a new database using the pinned image, then run mesh verify-secrets with your saved master key. With the restored server stopped, and with DATABASE_URL and MESH_AGENT_MASTER_KEY set, run:
The password file contains the new local owner password (12 to 72 bytes); delete it after saving that password securely. The command refuses to run when MESH_INSTANCE_ID is set or MESH_AUTH_MODE is anything other than local. It checks every encrypted secret against the key before writing anything, then:
  • disables every previous operator and every agent;
  • deletes sessions, invitations and external sign-in identities, and revokes API tokens;
  • removes AI inference keys the control plane supplied, keeping a provider the owner configured themselves;
  • leaves the instance stopped, with a reason saying it is a restored copy;
  • creates or resets the local owner account and records the adoption in the activity log.
Historical attribution is kept.

Cut over

Before resuming, configure your own services: AI inference, a Temporal connection (the restored database still records the hosted one), execution environments, web providers, PUBLIC_URL, connector webhooks and OAuth registrations. Never copy hosted exchange or management credentials. Then re-enable agents one at a time and resume the instance in Settings → Security. You can take a rehearsal export while the hosted instance runs. For the final cutover, stop hosted processing (Settings → Security, or a stop the control plane applies), take a final snapshot, restore and verify it, then deliberately resume only the self-hosted copy. While an instance is stopped, Formation rotates no external credential: the Slack app configuration token and expiring MCP OAuth tokens are left as they are, so a snapshot taken after the stop carries refresh tokens the restored copy can still use. A snapshot taken while the hosted instance runs may not, because Slack spends the configuration refresh token on every rotation. Downloading an export does not stop the hosted instance. Key rotation requires keeping the old key for exports taken before it. A SQL dump does not undo messages already sent or other external actions.