API

Data transfer

Export, review, and import installation or project data.

Team-mode migration

Move a single-user instance into team mode along one of three paths, or reverse it. All four routes require org admin/owner and refuse (409) unless teamMode === "single_user". See the cloud connect / migration guide.

Preflight and start (Path A — your own server) share a body:

POST /api/system/migration/start

Prop

Type

  • POST /api/system/migration/start-cloud — Path B, migrate to GramCode Cloud. Body: { allowNonEmptyTarget?: boolean }.
  • POST /api/system/migration/start-tunnel — Path C, expose via an edge tunnel. Body: { slug: string } (required).
  • POST /api/system/migration/switch-back — reverse any of them. Body: { abandonRemote?: boolean }.

Switch-back cuts teammates off

Reversing to single-user mode revokes teammate access. The remote keeps a copy for a 30-day grace period so you can recover if you change your mind.

Instance and project data transfer

Export the entire instance or a dependency-complete selection of projects and environments. These routes require instance administrator access (requireInstanceAdmin() plus a handler-level check). A workspace owner role alone does not grant access to instance credentials.

POST /api/system/data-transfer/export

Prop

Type

POST /api/system/data-transfer/import

Prop

Type

Project imports remap ownership to the active request workspace. They omit instance accounts/settings, reuse matching server connections, and skip existing projects by default. Overwrite replaces the selected projects, including removing destination-only records in the selected categories and clearing credentials that were cleared at the source. Categories excluded from the import are retained. Shared dependencies are kept unless overwriteDependencies is explicitly enabled. Source local hosts require an explicit serverMappings entry (local for a project without a server row). Cloud projects require the same connected cloud account. A project archive cannot be used with wipe.

Use the chunk-upload endpoints for large files. After uploading, POST { selection } to the session's preview endpoint. It returns projects, servers, availableServers, row counts, rowsRemoved, warnings, and blockers without consuming the upload. POST { mode, passphrase, selection } to /api/system/data-transfer/import/session/:sessionId/finalize/stream to apply. Validation is repeated inside the import transaction. A failed review or password attempt retains the uploaded chunks.

New instance and project exports use envelope version 4 and contain unencrypted JSON, including environment values, SSH keys, tokens, deployment snapshots, and inline Compose configuration. No password is required; a passphrase supplied by an older export client is ignored. Set includeSecrets: false explicitly to omit credentials. Imports still accept versions 1–3, including legacy password-protected files, and encrypt restored credentials with the destination instance's key. New archives with tables or fields the destination cannot store are rejected before any data changes; update the destination instead of losing those fields. Volume data, source folders, and host TLS files remain on their server.

In project imports, loopback server connections require explicit mapping. Backup policies that point at source-local storage or a changed backup host are disabled until the operator verifies the destination storage. Direct transfer supports whole-instance exports; project selections use the file review and import endpoints.

Import limits & errors

The import body is capped at 500 MB (413 PAYLOAD_TOO_LARGE above it). A malformed file or a wrong or missing password for a legacy sealed archive returns 400. Project dependency/mapping conflicts return 409 PROJECT_IMPORT_REQUIRES_REVIEW; whole-instance merge collisions return 409 PK_COLLISION. Select project scope and explicit overwrite options to resolve project conflicts. A concurrent migration/import returns 503 BUSY.

Operations

SDK and CLI

Remote client.instance.previewExport, exportData and importData use the existing instance-admin handlers. An organization-bound or scoped credential cannot export other workspaces by omitting its organization. The SDK does not retry an import whose response is lost.

const preview = await client.instance.previewExport();
const archive = await client.instance.exportData();
// Store privately: current exports include plaintext credentials.
const result = await destination.instance.importData({ file: archive, mode: "merge" });

Import requires an explicit mode in the SDK. selection supports project IDs, conflict choices, server mappings and included resources. Database rows and secret envelopes are opaque to the client; the controller owns archive validation and restoration.

Use openship system data-transfer for JSON exports/imports. Direct-transfer pairing and chunk upload remain the dashboard's recovery protocol. Legacy instance team-mode migration calls retain the API's capability restrictions; migrations is the separate workload move/copy API.

OperationSDKREST API
Team-migration readiness check (read-only).instance.preflightMigration(input)
Remote client
POST /api/system/migration/preflight
settings:admin · Self-hosted
Migrate single-user → your own remote server.instance.migrateToServer(input)
Remote client
POST /api/system/migration/start
settings:admin · Self-hosted
Migrate → GramCode Cloud.instance.migrateToCloud(input?)
Remote client
POST /api/system/migration/start-cloud
settings:admin · Self-hosted
Expose this instance via an edge tunnel.instance.exposeTunnel(input)
Remote client
POST /api/system/migration/start-tunnel
settings:admin · Self-hosted
Reverse a migration back to single-user.instance.switchBack(input?)
Remote client
POST /api/system/migration/switch-back
settings:admin · Self-hosted
Preview a project selection and its dependencies (instance administrator).instance.previewExport(input?)
Remote client
POST /api/system/data-transfer/preview
settings:admin · Self-hosted
Export the instance or selected projects (instance administrator).instance.exportData(input?)
Remote client
POST /api/system/data-transfer/export
settings:admin · Self-hosted
Import an export file, ≤500 MB, with scope and conflict options (instance administrator).instance.importData(input)
Remote client
POST /api/system/data-transfer/import
settings:admin · Self-hosted
Receive one chunk of an authorized direct transfer.HTTP onlyPUT /api/system/data-transfer/direct/chunk/:sessionId/:index
Handler authentication · Self-hosted
Finalize a received direct transfer and stream progress.HTTP onlyPOST /api/system/data-transfer/direct/chunk/:sessionId/finalize/stream
Handler authentication · Self-hosted
Keep a direct chunk-transfer session alive.HTTP onlyPOST /api/system/data-transfer/direct/chunk/:sessionId/heartbeat
Handler authentication · Self-hosted
Open a direct chunk-transfer upload.HTTP onlyPOST /api/system/data-transfer/direct/chunk/init
Handler authentication · Self-hosted
Receive a direct instance transfer.HTTP onlyPOST /api/system/data-transfer/direct/receive
Handler authentication · Self-hosted
Send an instance to an authorized destination.HTTP onlyPOST /api/system/data-transfer/direct/send
settings:admin · Self-hosted
Send an instance and stream transfer progress.HTTP onlyPOST /api/system/data-transfer/direct/send/stream
settings:admin · Self-hosted
Create a direct-transfer session.HTTP onlyPOST /api/system/data-transfer/direct/session
settings:admin · Self-hosted
Open a chunked file-import session.HTTP onlyPOST /api/system/data-transfer/import/session
settings:admin · Self-hosted
Upload one file-import chunk.HTTP onlyPUT /api/system/data-transfer/import/session/:sessionId/chunk/:index
settings:admin · Self-hosted
Apply a reviewed file import and stream progress.HTTP onlyPOST /api/system/data-transfer/import/session/:sessionId/finalize/stream
settings:admin · Self-hosted
Preview an uploaded file's selection, conflicts, and server mappings.HTTP onlyPOST /api/system/data-transfer/import/session/:sessionId/preview
settings:admin · Self-hosted
List exportable projects and instance row counts (instance administrator).HTTP onlyGET /api/system/data-transfer/preview
settings:admin · Self-hosted

On this page