# Database imports

Copy a planned PostgreSQL or MySQL database into one of your Pantech databases, once or with low-downtime replication.

Source: https://docs.pantechdynamics.com/api/database-imports

Create the destination database first, with the same engine as the source. Then start an import from a plan's `database` item. The Pantech Migrate agent in your network reads the source with a login that stays on it, checks it against the destination, and reports what to fix in `readiness`. `dump` copies once; `replicate` (PostgreSQL only) keeps applying changes until you cut over. Every table is counted and sampled on both sides before the import completes. See [importing databases](https://docs.pantechdynamics.com/move/databases).

Endpoints:

- `POST /public/v1/migrations/{migration_id}/database-imports`: Import a database from a plan
- `GET /public/v1/database-imports`: List database imports
- `GET /public/v1/database-imports/{import_id}`: Get a database import
- `POST /public/v1/database-imports/{import_id}/readiness`: Check readiness again
- `POST /public/v1/database-imports/{import_id}/cutover`: Cut over or finish an import
- `POST /public/v1/database-imports/{import_id}/cancel`: Cancel an import
- `POST /public/v1/database-imports/{import_id}/revoke-access`: Remove an import's access

## The database import object



- `id` (string, required)
- `migration_id` (string, required)
- `item_key` (string, required)
- `destination_database_id` (string, required)
- `target_database` (string, required)
- `mode` (string, required): One of `dump`, `replicate`.
- `source_ref` (string, required)
- `engine` (string, required): The source's engine family. One of `postgres`, `mysql`, `mariadb`.
- `status` (string, required): One of `awaiting_agent`, `preflight`, `ready`, `blocked`, `copying`, `replicating`, `cutting_over`, `verifying`, `verifying_failed`, `completed`, `cancelling`, `cancelled`, `failed`.
- `failure` (DatabaseImportFailure, required): Why the import stopped; null while it has not.
  - `code` (string, required): `statement_refused`, `chunk_invalid`, `access_revoked`, `destination_unavailable`, or one the agent reported: `source_unreachable`, `source_auth_failed`, `source_permission_denied`, `source_not_configured`, `dump_tool_missing`, `source_changed`, `internal`.
  - `message` (string, required)
- `cutover_requested` (boolean, required)
- `cancel_requested` (boolean, required)
- `readiness_requested` (boolean, required): A new pre-flight was asked for and the agent has not run it yet.
- `access_revoked` (boolean, required): The import login and its loopback-only access were removed from the destination.
- `agent_connected` (boolean, required): A Migrate agent holds this import now.
- `lag_bytes` (integer or null, required): Replication lag in bytes of source WAL not yet applied; null in a dump or before replication starts.
- `position` (string or null, required): The last applied source position (replicate only).
- `readiness` (DatabaseImportReadiness, required): The latest pre-flight; null until the agent ran one.
  - `checked_at` (string, required)
  - `blocked` (boolean, required): A blocking issue stops the import until it is fixed and readiness is checked again.
  - `issues` (array of DatabaseImportIssue, required)
    - `code` (string, required): For example `source_version_newer`, `extension_unavailable`, `size_exceeds_storage`, `size_not_measured`, `table_without_primary_key`, `replication_check_failed`, `mode_not_available`, `target_not_empty`, `destination_not_ready`, `destination_not_supported`.
    - `blocking` (boolean, required)
    - `message` (string, required)
    - `fix` (string or null, required): A copy-paste fix for the source's provider (an RDS parameter group setting, a Cloud SQL flag, an Azure server parameter, SQL).
    - `subject` (string or null, required): What the issue is about (an extension, tables, a check).
  - `source` (DatabaseImportSource, required): What the Migrate agent measured on the source. Numbers it could not measure are null, never estimated.
    - `engine` (string, required)
    - `version` (string or null, required)
    - `provider` (string or null, required): `aws_rds`, `gcp_cloudsql`, `azure`, `digitalocean` or `self_hosted`, as the agent detected it.
    - `database` (string or null, required)
    - `size_bytes` (integer or null, required)
    - `extensions` (array of string, required)
    - `table_count` (integer, required)
- `destination` (DatabaseImportDestination, required): What your Pantech database reported over the import's own connection; null in a list. Numbers are null until measured.
  - `access_state` (string, required): The import login's state on the destination. One of `not_prepared`, `requested`, `active`, `revoking`, `revoked`, `failed`.
  - `measured` (boolean, required)
  - `engine` (string or null, required)
  - `server_version` (string or null, required)
  - `disk_available_bytes` (integer or null, required)
  - `disk_total_bytes` (integer or null, required)
  - `target_tables` (integer or null, required): Tables already in the target database; an import needs an empty one.
  - `trusted_extensions` (array of string, required)
- `tables` (array of DatabaseImportTable, required): Per-table progress; null in a list.
  - `schema` (string or null, required)
  - `name` (string, required)
  - `has_primary_key` (boolean, required)
  - `status` (string, required): One of `pending`, `copying`, `copied`, `verified`, `verify_failed`.
  - `pages_copied` (integer, required)
  - `rows_copied` (integer, required)
  - `bytes_copied` (integer, required)
  - `verification` (DatabaseImportVerification, required): The table's comparison; null until it was verified.
    - `source_rows` (integer, required)
    - `destination_rows` (integer, required)
    - `samples_checked` (integer, required): Key ranges whose rows were checksummed on both sides.
    - `mismatched_samples` (integer, required)
    - `passed` (boolean, required)
  - `updated_at` (string, required)
- `charged` (boolean, required): Always false: moving data is free. The destination database bills as usual.
- `version` (integer, required)
- `created_at` (string, required)
- `updated_at` (string, required)
- `finished_at` (string or null, required)
## Import a database from a plan

```http
POST /public/v1/migrations/{migration_id}/database-imports
```

Starts moving one of the plan's databases into one of your Pantech databases, through the Migrate agent running in your network. The agent reads the source with credentials that stay on it; Pantech never receives them. It checks the source against the destination first (versions, extensions, size, primary keys, replication settings) and reports what to fix. `dump` copies once: stop writes to the source first. `replicate` (PostgreSQL) keeps following changes until you cut over. The move is free; the destination bills as usual. At most 3 imports in progress per organization and one per database. Owners and admins only, who must also be allowed to change the destination database.

Scope: `write`. Send an `Idempotency-Key` header.

Path parameters:

- `migration_id`

Body:

- `item_key` (string, required): The plan item's key: one of the migration's `database` items.
- `destination_database_id` (string, required): One of your Pantech databases with the same engine as the source. Create it first: it bills as usual; the move itself is free.
- `target_database` (string): The database to create and fill on the destination; it must be empty. Defaults to the source's name, made a valid name: 1 to 63 lowercase letters, digits and underscores, starting with a letter.
- `mode` (string): `dump` copies once (stop writes to the source first). `replicate` keeps following the source's changes until you cut over (PostgreSQL sources only). One of `dump`, `replicate`.
- `source_ref` (string, required): The source's name in your Migrate agent's configuration, 1 to 64 of letters, digits, `.`, `_` and `-`. Its address and login stay on the agent and are never sent to Pantech.

Example:

```sh
curl -X POST "https://api.pantechdynamics.com/public/v1/migrations/mig_06gk3x9tq7m2v8r4y1c5d0zp8w/database-imports" \
  -H "Authorization: Bearer $PANTECH_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "item_key": "item-key",
    "destination_database_id": "db_06gk3x9tq7m2v8r4y1c5d0zp8w",
    "source_ref": "source-ref"
  }'
```

Response `201`:

```json
{
  "id": "dbi_06gk3x9tq7m2v8r4y1c5d0zp8w",
  "migration_id": "mig_06gk3x9tq7m2v8r4y1c5d0zp8w",
  "item_key": "item-key",
  "destination_database_id": "db_06gk3x9tq7m2v8r4y1c5d0zp8w",
  "target_database": "target-database",
  "mode": "dump",
  "source_ref": "source-ref",
  "engine": "postgres",
  "status": "awaiting_agent",
  "failure": {
    "code": "starter",
    "message": "message"
  },
  "cutover_requested": true,
  "cancel_requested": true,
  "readiness_requested": true,
  "access_revoked": true,
  "agent_connected": true,
  "lag_bytes": 1,
  "position": "position",
  "readiness": {
    "checked_at": "2026-10-03T09:30:00Z",
    "blocked": true,
    "issues": [
      {
        "code": "starter",
        "blocking": true,
        "message": "message",
        "fix": "fix",
        "subject": "subject"
      }
    ],
    "source": {
      "engine": "postgresql",
      "version": "version",
      "provider": "provider",
      "database": "database",
      "size_bytes": 1610612736,
      "extensions": [
        "extensions"
      ],
      "table_count": 1
    }
  },
  "destination": {
    "access_state": "not_prepared",
    "measured": true,
    "engine": "postgresql",
    "server_version": "server-version",
    "disk_available_bytes": 1,
    "disk_total_bytes": 1,
    "target_tables": 1,
    "trusted_extensions": [
      "trusted-extensions"
    ]
  },
  "tables": [
    {
      "schema": "schema",
      "name": "web-1",
      "has_primary_key": true,
      "status": "pending",
      "pages_copied": 1,
      "rows_copied": 1,
      "bytes_copied": 1,
      "verification": {
        "source_rows": 1,
        "destination_rows": 1,
        "samples_checked": 1,
        "mismatched_samples": 1,
        "passed": true
      },
      "updated_at": "2026-10-03T09:30:00Z"
    }
  ],
  "charged": true,
  "version": 1,
  "created_at": "2026-10-03T09:30:00Z",
  "updated_at": "2026-10-03T09:30:00Z",
  "finished_at": "2026-10-03T09:30:00Z"
}
```

Errors:

- `401`: `UNAUTHENTICATED`: the request has no API key, or the key is mistyped, revoked or expired, or its creator has left the organization. Send `Authorization: Bearer PAN_…` with a valid key; create one in the console under Organization › API keys.
- `403`: `INSUFFICIENT_SCOPE`: the API key lacks the scope this endpoint needs (`read` for GET, `write` for changes; an AI app's key also needs `delete` for a destructive call). Use a key with that scope, or reconnect the AI app with "Manage and delete" access.
`FORBIDDEN`: the member who created the key may not do this in the organization. Use a key created by an owner or admin.
`AI_APPS_DISABLED`: the organization has turned AI app access off, and this request was made with an AI app's key or sent by Pantech's MCP server (`Pantech-Client: mcp/…`). An owner can turn it on in the console under Organization › AI apps.
- `404`: `MIGRATION_NOT_FOUND`: no migration with this id exists in your organization.
- `409`: `DATABASE_IMPORT_DESTINATION_IN_USE`: the database already has an import in progress. `DATABASE_IMPORT_ITEM_NOT_IMPORTABLE`: the item is excluded or its engine is not offered. `IDEMPOTENCY_CONFLICT`: the key was used for a different request.
- `422`: `VALIDATION_FAILED`: `item_key` names no item (`UNKNOWN_ITEM`) or not a database (`NOT_A_DATABASE`); `destination_database_id` names no database (`DATABASE_NOT_FOUND`) or one with another engine (`ENGINE_MISMATCH`); or `source_ref`, `target_database` or `mode` is invalid.
- `429`: `RATE_LIMITED`: this API key, verified user or organization used its request budget for the current window, or this address exceeded an IP/failed-auth limit. Wait `Retry-After` seconds, then retry. For authenticated quota denials, `RateLimit-Scope` identifies the denying quota and `RateLimit-Reset` reports its remaining window in seconds.
- `503`: `MIGRATE_UNAVAILABLE`: Pantech Migrate is not available on this deployment yet. Try again later.
`DATABASE_IMPORT_UNAVAILABLE`: your Pantech database could not be reached right now. Try again in a minute.
`SERVICE_UNAVAILABLE`: request quota storage is unavailable. Wait a few seconds, then retry.
## List database imports

```http
GET /public/v1/database-imports
```

Your organization's database imports, newest first, without their tables.

Scope: `read`.

Example:

```sh
curl "https://api.pantechdynamics.com/public/v1/database-imports" \
  -H "Authorization: Bearer $PANTECH_API_KEY"
```

Response `200`:

```json
{
  "data": [
    {
      "id": "dbi_06gk3x9tq7m2v8r4y1c5d0zp8w",
      "migration_id": "mig_06gk3x9tq7m2v8r4y1c5d0zp8w",
      "item_key": "item-key",
      "destination_database_id": "db_06gk3x9tq7m2v8r4y1c5d0zp8w",
      "target_database": "target-database",
      "mode": "dump",
      "source_ref": "source-ref",
      "engine": "postgres",
      "status": "awaiting_agent",
      "failure": {
        "code": "starter",
        "message": "message"
      },
      "cutover_requested": true,
      "cancel_requested": true,
      "readiness_requested": true,
      "access_revoked": true,
      "agent_connected": true,
      "lag_bytes": 1,
      "position": "position",
      "readiness": {
        "checked_at": "2026-10-03T09:30:00Z",
        "blocked": true,
        "issues": [
          {
            "code": "starter",
            "blocking": true,
            "message": "message",
            "fix": "fix",
            "subject": "subject"
          }
        ],
        "source": {
          "engine": "postgresql",
          "version": "version",
          "provider": "provider",
          "database": "database",
          "size_bytes": 1610612736,
          "extensions": [
            "extensions"
          ],
          "table_count": 1
        }
      },
      "destination": {
        "access_state": "not_prepared",
        "measured": true,
        "engine": "postgresql",
        "server_version": "server-version",
        "disk_available_bytes": 1,
        "disk_total_bytes": 1,
        "target_tables": 1,
        "trusted_extensions": [
          "trusted-extensions"
        ]
      },
      "tables": [
        {
          "schema": "schema",
          "name": "web-1",
          "has_primary_key": true,
          "status": "pending",
          "pages_copied": 1,
          "rows_copied": 1,
          "bytes_copied": 1,
          "verification": {
            "source_rows": 1,
            "destination_rows": 1,
            "samples_checked": 1,
            "mismatched_samples": 1,
            "passed": true
          },
          "updated_at": "2026-10-03T09:30:00Z"
        }
      ],
      "charged": true,
      "version": 1,
      "created_at": "2026-10-03T09:30:00Z",
      "updated_at": "2026-10-03T09:30:00Z",
      "finished_at": "2026-10-03T09:30:00Z"
    }
  ],
  "next_cursor": null
}
```

Errors:

- `401`: `UNAUTHENTICATED`: the request has no API key, or the key is mistyped, revoked or expired, or its creator has left the organization. Send `Authorization: Bearer PAN_…` with a valid key; create one in the console under Organization › API keys.
- `403`: `INSUFFICIENT_SCOPE`: the API key lacks the scope this endpoint needs (`read` for GET, `write` for changes; an AI app's key also needs `delete` for a destructive call). Use a key with that scope, or reconnect the AI app with "Manage and delete" access.
`FORBIDDEN`: the member who created the key may not do this in the organization. Use a key created by an owner or admin.
`AI_APPS_DISABLED`: the organization has turned AI app access off, and this request was made with an AI app's key or sent by Pantech's MCP server (`Pantech-Client: mcp/…`). An owner can turn it on in the console under Organization › AI apps.
- `429`: `RATE_LIMITED`: this API key, verified user or organization used its request budget for the current window, or this address exceeded an IP/failed-auth limit. Wait `Retry-After` seconds, then retry. For authenticated quota denials, `RateLimit-Scope` identifies the denying quota and `RateLimit-Reset` reports its remaining window in seconds.
- `503`: `MIGRATE_UNAVAILABLE`: Pantech Migrate is not available on this deployment yet. Try again later.
`DATABASE_IMPORT_UNAVAILABLE`: your Pantech database could not be reached right now. Try again in a minute.
`SERVICE_UNAVAILABLE`: request quota storage is unavailable. Wait a few seconds, then retry.
## Get a database import

```http
GET /public/v1/database-imports/{import_id}
```

An import with its readiness report, per-table progress and verification, and what the destination reported about itself. Values that were not measured are null.

Scope: `read`.

Path parameters:

- `import_id`

Example:

```sh
curl "https://api.pantechdynamics.com/public/v1/database-imports/dbi_06gk3x9tq7m2v8r4y1c5d0zp8w" \
  -H "Authorization: Bearer $PANTECH_API_KEY"
```

Response `200`:

```json
{
  "id": "dbi_06gk3x9tq7m2v8r4y1c5d0zp8w",
  "migration_id": "mig_06gk3x9tq7m2v8r4y1c5d0zp8w",
  "item_key": "item-key",
  "destination_database_id": "db_06gk3x9tq7m2v8r4y1c5d0zp8w",
  "target_database": "target-database",
  "mode": "dump",
  "source_ref": "source-ref",
  "engine": "postgres",
  "status": "awaiting_agent",
  "failure": {
    "code": "starter",
    "message": "message"
  },
  "cutover_requested": true,
  "cancel_requested": true,
  "readiness_requested": true,
  "access_revoked": true,
  "agent_connected": true,
  "lag_bytes": 1,
  "position": "position",
  "readiness": {
    "checked_at": "2026-10-03T09:30:00Z",
    "blocked": true,
    "issues": [
      {
        "code": "starter",
        "blocking": true,
        "message": "message",
        "fix": "fix",
        "subject": "subject"
      }
    ],
    "source": {
      "engine": "postgresql",
      "version": "version",
      "provider": "provider",
      "database": "database",
      "size_bytes": 1610612736,
      "extensions": [
        "extensions"
      ],
      "table_count": 1
    }
  },
  "destination": {
    "access_state": "not_prepared",
    "measured": true,
    "engine": "postgresql",
    "server_version": "server-version",
    "disk_available_bytes": 1,
    "disk_total_bytes": 1,
    "target_tables": 1,
    "trusted_extensions": [
      "trusted-extensions"
    ]
  },
  "tables": [
    {
      "schema": "schema",
      "name": "web-1",
      "has_primary_key": true,
      "status": "pending",
      "pages_copied": 1,
      "rows_copied": 1,
      "bytes_copied": 1,
      "verification": {
        "source_rows": 1,
        "destination_rows": 1,
        "samples_checked": 1,
        "mismatched_samples": 1,
        "passed": true
      },
      "updated_at": "2026-10-03T09:30:00Z"
    }
  ],
  "charged": true,
  "version": 1,
  "created_at": "2026-10-03T09:30:00Z",
  "updated_at": "2026-10-03T09:30:00Z",
  "finished_at": "2026-10-03T09:30:00Z"
}
```

Errors:

- `401`: `UNAUTHENTICATED`: the request has no API key, or the key is mistyped, revoked or expired, or its creator has left the organization. Send `Authorization: Bearer PAN_…` with a valid key; create one in the console under Organization › API keys.
- `403`: `INSUFFICIENT_SCOPE`: the API key lacks the scope this endpoint needs (`read` for GET, `write` for changes; an AI app's key also needs `delete` for a destructive call). Use a key with that scope, or reconnect the AI app with "Manage and delete" access.
`FORBIDDEN`: the member who created the key may not do this in the organization. Use a key created by an owner or admin.
`AI_APPS_DISABLED`: the organization has turned AI app access off, and this request was made with an AI app's key or sent by Pantech's MCP server (`Pantech-Client: mcp/…`). An owner can turn it on in the console under Organization › AI apps.
- `404`: `DATABASE_IMPORT_NOT_FOUND`: no database import with this id exists in your organization.
- `429`: `RATE_LIMITED`: this API key, verified user or organization used its request budget for the current window, or this address exceeded an IP/failed-auth limit. Wait `Retry-After` seconds, then retry. For authenticated quota denials, `RateLimit-Scope` identifies the denying quota and `RateLimit-Reset` reports its remaining window in seconds.
- `503`: `MIGRATE_UNAVAILABLE`: Pantech Migrate is not available on this deployment yet. Try again later.
`DATABASE_IMPORT_UNAVAILABLE`: your Pantech database could not be reached right now. Try again in a minute.
`SERVICE_UNAVAILABLE`: request quota storage is unavailable. Wait a few seconds, then retry.
## Check readiness again

```http
POST /public/v1/database-imports/{import_id}/readiness
```

Asks the agent to run the pre-flight again, for example after fixing what it reported. Allowed before the copy starts.

Scope: `write`. Send an `Idempotency-Key` header.

Path parameters:

- `import_id`

Example:

```sh
curl -X POST "https://api.pantechdynamics.com/public/v1/database-imports/dbi_06gk3x9tq7m2v8r4y1c5d0zp8w/readiness" \
  -H "Authorization: Bearer $PANTECH_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)"
```

Response `202`:

```json
{
  "id": "dbi_06gk3x9tq7m2v8r4y1c5d0zp8w",
  "migration_id": "mig_06gk3x9tq7m2v8r4y1c5d0zp8w",
  "item_key": "item-key",
  "destination_database_id": "db_06gk3x9tq7m2v8r4y1c5d0zp8w",
  "target_database": "target-database",
  "mode": "dump",
  "source_ref": "source-ref",
  "engine": "postgres",
  "status": "awaiting_agent",
  "failure": {
    "code": "starter",
    "message": "message"
  },
  "cutover_requested": true,
  "cancel_requested": true,
  "readiness_requested": true,
  "access_revoked": true,
  "agent_connected": true,
  "lag_bytes": 1,
  "position": "position",
  "readiness": {
    "checked_at": "2026-10-03T09:30:00Z",
    "blocked": true,
    "issues": [
      {
        "code": "starter",
        "blocking": true,
        "message": "message",
        "fix": "fix",
        "subject": "subject"
      }
    ],
    "source": {
      "engine": "postgresql",
      "version": "version",
      "provider": "provider",
      "database": "database",
      "size_bytes": 1610612736,
      "extensions": [
        "extensions"
      ],
      "table_count": 1
    }
  },
  "destination": {
    "access_state": "not_prepared",
    "measured": true,
    "engine": "postgresql",
    "server_version": "server-version",
    "disk_available_bytes": 1,
    "disk_total_bytes": 1,
    "target_tables": 1,
    "trusted_extensions": [
      "trusted-extensions"
    ]
  },
  "tables": [
    {
      "schema": "schema",
      "name": "web-1",
      "has_primary_key": true,
      "status": "pending",
      "pages_copied": 1,
      "rows_copied": 1,
      "bytes_copied": 1,
      "verification": {
        "source_rows": 1,
        "destination_rows": 1,
        "samples_checked": 1,
        "mismatched_samples": 1,
        "passed": true
      },
      "updated_at": "2026-10-03T09:30:00Z"
    }
  ],
  "charged": true,
  "version": 1,
  "created_at": "2026-10-03T09:30:00Z",
  "updated_at": "2026-10-03T09:30:00Z",
  "finished_at": "2026-10-03T09:30:00Z"
}
```

Errors:

- `401`: `UNAUTHENTICATED`: the request has no API key, or the key is mistyped, revoked or expired, or its creator has left the organization. Send `Authorization: Bearer PAN_…` with a valid key; create one in the console under Organization › API keys.
- `403`: `INSUFFICIENT_SCOPE`: the API key lacks the scope this endpoint needs (`read` for GET, `write` for changes; an AI app's key also needs `delete` for a destructive call). Use a key with that scope, or reconnect the AI app with "Manage and delete" access.
`FORBIDDEN`: the member who created the key may not do this in the organization. Use a key created by an owner or admin.
`AI_APPS_DISABLED`: the organization has turned AI app access off, and this request was made with an AI app's key or sent by Pantech's MCP server (`Pantech-Client: mcp/…`). An owner can turn it on in the console under Organization › AI apps.
- `404`: `DATABASE_IMPORT_NOT_FOUND`: no database import with this id exists in your organization.
- `409`: `DATABASE_IMPORT_INVALID_STATE`, `DATABASE_IMPORT_FINISHED` or `DATABASE_IMPORT_NOT_COPIED`: the import cannot do this now. `CONFLICT`: it changed at the same time; retry.
- `429`: `RATE_LIMITED`: this API key, verified user or organization used its request budget for the current window, or this address exceeded an IP/failed-auth limit. Wait `Retry-After` seconds, then retry. For authenticated quota denials, `RateLimit-Scope` identifies the denying quota and `RateLimit-Reset` reports its remaining window in seconds.
- `503`: `MIGRATE_UNAVAILABLE`: Pantech Migrate is not available on this deployment yet. Try again later.
`DATABASE_IMPORT_UNAVAILABLE`: your Pantech database could not be reached right now. Try again in a minute.
`SERVICE_UNAVAILABLE`: request quota storage is unavailable. Wait a few seconds, then retry.
## Cut over or finish an import

```http
POST /public/v1/database-imports/{import_id}/cutover
```

Finishes the import. For `dump`, once every table is copied: the agent sets sequences and verifies every table. For `replicate`, stop writes to the source first: the agent applies the remaining changes until there is no lag, verifies, then the import login is removed and the replication slot dropped.

Scope: `write`. Send an `Idempotency-Key` header.

Path parameters:

- `import_id`

Example:

```sh
curl -X POST "https://api.pantechdynamics.com/public/v1/database-imports/dbi_06gk3x9tq7m2v8r4y1c5d0zp8w/cutover" \
  -H "Authorization: Bearer $PANTECH_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)"
```

Response `202`:

```json
{
  "id": "dbi_06gk3x9tq7m2v8r4y1c5d0zp8w",
  "migration_id": "mig_06gk3x9tq7m2v8r4y1c5d0zp8w",
  "item_key": "item-key",
  "destination_database_id": "db_06gk3x9tq7m2v8r4y1c5d0zp8w",
  "target_database": "target-database",
  "mode": "dump",
  "source_ref": "source-ref",
  "engine": "postgres",
  "status": "awaiting_agent",
  "failure": {
    "code": "starter",
    "message": "message"
  },
  "cutover_requested": true,
  "cancel_requested": true,
  "readiness_requested": true,
  "access_revoked": true,
  "agent_connected": true,
  "lag_bytes": 1,
  "position": "position",
  "readiness": {
    "checked_at": "2026-10-03T09:30:00Z",
    "blocked": true,
    "issues": [
      {
        "code": "starter",
        "blocking": true,
        "message": "message",
        "fix": "fix",
        "subject": "subject"
      }
    ],
    "source": {
      "engine": "postgresql",
      "version": "version",
      "provider": "provider",
      "database": "database",
      "size_bytes": 1610612736,
      "extensions": [
        "extensions"
      ],
      "table_count": 1
    }
  },
  "destination": {
    "access_state": "not_prepared",
    "measured": true,
    "engine": "postgresql",
    "server_version": "server-version",
    "disk_available_bytes": 1,
    "disk_total_bytes": 1,
    "target_tables": 1,
    "trusted_extensions": [
      "trusted-extensions"
    ]
  },
  "tables": [
    {
      "schema": "schema",
      "name": "web-1",
      "has_primary_key": true,
      "status": "pending",
      "pages_copied": 1,
      "rows_copied": 1,
      "bytes_copied": 1,
      "verification": {
        "source_rows": 1,
        "destination_rows": 1,
        "samples_checked": 1,
        "mismatched_samples": 1,
        "passed": true
      },
      "updated_at": "2026-10-03T09:30:00Z"
    }
  ],
  "charged": true,
  "version": 1,
  "created_at": "2026-10-03T09:30:00Z",
  "updated_at": "2026-10-03T09:30:00Z",
  "finished_at": "2026-10-03T09:30:00Z"
}
```

Errors:

- `401`: `UNAUTHENTICATED`: the request has no API key, or the key is mistyped, revoked or expired, or its creator has left the organization. Send `Authorization: Bearer PAN_…` with a valid key; create one in the console under Organization › API keys.
- `403`: `INSUFFICIENT_SCOPE`: the API key lacks the scope this endpoint needs (`read` for GET, `write` for changes; an AI app's key also needs `delete` for a destructive call). Use a key with that scope, or reconnect the AI app with "Manage and delete" access.
`FORBIDDEN`: the member who created the key may not do this in the organization. Use a key created by an owner or admin.
`AI_APPS_DISABLED`: the organization has turned AI app access off, and this request was made with an AI app's key or sent by Pantech's MCP server (`Pantech-Client: mcp/…`). An owner can turn it on in the console under Organization › AI apps.
- `404`: `DATABASE_IMPORT_NOT_FOUND`: no database import with this id exists in your organization.
- `409`: `DATABASE_IMPORT_INVALID_STATE`, `DATABASE_IMPORT_FINISHED` or `DATABASE_IMPORT_NOT_COPIED`: the import cannot do this now. `CONFLICT`: it changed at the same time; retry.
- `429`: `RATE_LIMITED`: this API key, verified user or organization used its request budget for the current window, or this address exceeded an IP/failed-auth limit. Wait `Retry-After` seconds, then retry. For authenticated quota denials, `RateLimit-Scope` identifies the denying quota and `RateLimit-Reset` reports its remaining window in seconds.
- `503`: `MIGRATE_UNAVAILABLE`: Pantech Migrate is not available on this deployment yet. Try again later.
`DATABASE_IMPORT_UNAVAILABLE`: your Pantech database could not be reached right now. Try again in a minute.
`SERVICE_UNAVAILABLE`: request quota storage is unavailable. Wait a few seconds, then retry.
## Cancel an import

```http
POST /public/v1/database-imports/{import_id}/cancel
```

Stops the import and removes its access to your Pantech database. What was already copied stays. The agent drops its replication slot and publication on the source.

Scope: `write`. Send an `Idempotency-Key` header.

Path parameters:

- `import_id`

Example:

```sh
curl -X POST "https://api.pantechdynamics.com/public/v1/database-imports/dbi_06gk3x9tq7m2v8r4y1c5d0zp8w/cancel" \
  -H "Authorization: Bearer $PANTECH_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)"
```

Response `200`:

```json
{
  "id": "dbi_06gk3x9tq7m2v8r4y1c5d0zp8w",
  "migration_id": "mig_06gk3x9tq7m2v8r4y1c5d0zp8w",
  "item_key": "item-key",
  "destination_database_id": "db_06gk3x9tq7m2v8r4y1c5d0zp8w",
  "target_database": "target-database",
  "mode": "dump",
  "source_ref": "source-ref",
  "engine": "postgres",
  "status": "awaiting_agent",
  "failure": {
    "code": "starter",
    "message": "message"
  },
  "cutover_requested": true,
  "cancel_requested": true,
  "readiness_requested": true,
  "access_revoked": true,
  "agent_connected": true,
  "lag_bytes": 1,
  "position": "position",
  "readiness": {
    "checked_at": "2026-10-03T09:30:00Z",
    "blocked": true,
    "issues": [
      {
        "code": "starter",
        "blocking": true,
        "message": "message",
        "fix": "fix",
        "subject": "subject"
      }
    ],
    "source": {
      "engine": "postgresql",
      "version": "version",
      "provider": "provider",
      "database": "database",
      "size_bytes": 1610612736,
      "extensions": [
        "extensions"
      ],
      "table_count": 1
    }
  },
  "destination": {
    "access_state": "not_prepared",
    "measured": true,
    "engine": "postgresql",
    "server_version": "server-version",
    "disk_available_bytes": 1,
    "disk_total_bytes": 1,
    "target_tables": 1,
    "trusted_extensions": [
      "trusted-extensions"
    ]
  },
  "tables": [
    {
      "schema": "schema",
      "name": "web-1",
      "has_primary_key": true,
      "status": "pending",
      "pages_copied": 1,
      "rows_copied": 1,
      "bytes_copied": 1,
      "verification": {
        "source_rows": 1,
        "destination_rows": 1,
        "samples_checked": 1,
        "mismatched_samples": 1,
        "passed": true
      },
      "updated_at": "2026-10-03T09:30:00Z"
    }
  ],
  "charged": true,
  "version": 1,
  "created_at": "2026-10-03T09:30:00Z",
  "updated_at": "2026-10-03T09:30:00Z",
  "finished_at": "2026-10-03T09:30:00Z"
}
```

Errors:

- `401`: `UNAUTHENTICATED`: the request has no API key, or the key is mistyped, revoked or expired, or its creator has left the organization. Send `Authorization: Bearer PAN_…` with a valid key; create one in the console under Organization › API keys.
- `403`: `INSUFFICIENT_SCOPE`: the API key lacks the scope this endpoint needs (`read` for GET, `write` for changes; an AI app's key also needs `delete` for a destructive call). Use a key with that scope, or reconnect the AI app with "Manage and delete" access.
`FORBIDDEN`: the member who created the key may not do this in the organization. Use a key created by an owner or admin.
`AI_APPS_DISABLED`: the organization has turned AI app access off, and this request was made with an AI app's key or sent by Pantech's MCP server (`Pantech-Client: mcp/…`). An owner can turn it on in the console under Organization › AI apps.
- `404`: `DATABASE_IMPORT_NOT_FOUND`: no database import with this id exists in your organization.
- `409`: `DATABASE_IMPORT_INVALID_STATE`, `DATABASE_IMPORT_FINISHED` or `DATABASE_IMPORT_NOT_COPIED`: the import cannot do this now. `CONFLICT`: it changed at the same time; retry.
- `429`: `RATE_LIMITED`: this API key, verified user or organization used its request budget for the current window, or this address exceeded an IP/failed-auth limit. Wait `Retry-After` seconds, then retry. For authenticated quota denials, `RateLimit-Scope` identifies the denying quota and `RateLimit-Reset` reports its remaining window in seconds.
- `503`: `MIGRATE_UNAVAILABLE`: Pantech Migrate is not available on this deployment yet. Try again later.
`DATABASE_IMPORT_UNAVAILABLE`: your Pantech database could not be reached right now. Try again in a minute.
`SERVICE_UNAVAILABLE`: request quota storage is unavailable. Wait a few seconds, then retry.
## Remove an import's access

```http
POST /public/v1/database-imports/{import_id}/revoke-access
```

Removes the import login and its loopback-only access from your Pantech database now and keeps the data. An import still copying stops.

Scope: `write`. Send an `Idempotency-Key` header.

Path parameters:

- `import_id`

Example:

```sh
curl -X POST "https://api.pantechdynamics.com/public/v1/database-imports/dbi_06gk3x9tq7m2v8r4y1c5d0zp8w/revoke-access" \
  -H "Authorization: Bearer $PANTECH_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)"
```

Response `200`:

```json
{
  "id": "dbi_06gk3x9tq7m2v8r4y1c5d0zp8w",
  "migration_id": "mig_06gk3x9tq7m2v8r4y1c5d0zp8w",
  "item_key": "item-key",
  "destination_database_id": "db_06gk3x9tq7m2v8r4y1c5d0zp8w",
  "target_database": "target-database",
  "mode": "dump",
  "source_ref": "source-ref",
  "engine": "postgres",
  "status": "awaiting_agent",
  "failure": {
    "code": "starter",
    "message": "message"
  },
  "cutover_requested": true,
  "cancel_requested": true,
  "readiness_requested": true,
  "access_revoked": true,
  "agent_connected": true,
  "lag_bytes": 1,
  "position": "position",
  "readiness": {
    "checked_at": "2026-10-03T09:30:00Z",
    "blocked": true,
    "issues": [
      {
        "code": "starter",
        "blocking": true,
        "message": "message",
        "fix": "fix",
        "subject": "subject"
      }
    ],
    "source": {
      "engine": "postgresql",
      "version": "version",
      "provider": "provider",
      "database": "database",
      "size_bytes": 1610612736,
      "extensions": [
        "extensions"
      ],
      "table_count": 1
    }
  },
  "destination": {
    "access_state": "not_prepared",
    "measured": true,
    "engine": "postgresql",
    "server_version": "server-version",
    "disk_available_bytes": 1,
    "disk_total_bytes": 1,
    "target_tables": 1,
    "trusted_extensions": [
      "trusted-extensions"
    ]
  },
  "tables": [
    {
      "schema": "schema",
      "name": "web-1",
      "has_primary_key": true,
      "status": "pending",
      "pages_copied": 1,
      "rows_copied": 1,
      "bytes_copied": 1,
      "verification": {
        "source_rows": 1,
        "destination_rows": 1,
        "samples_checked": 1,
        "mismatched_samples": 1,
        "passed": true
      },
      "updated_at": "2026-10-03T09:30:00Z"
    }
  ],
  "charged": true,
  "version": 1,
  "created_at": "2026-10-03T09:30:00Z",
  "updated_at": "2026-10-03T09:30:00Z",
  "finished_at": "2026-10-03T09:30:00Z"
}
```

Errors:

- `401`: `UNAUTHENTICATED`: the request has no API key, or the key is mistyped, revoked or expired, or its creator has left the organization. Send `Authorization: Bearer PAN_…` with a valid key; create one in the console under Organization › API keys.
- `403`: `INSUFFICIENT_SCOPE`: the API key lacks the scope this endpoint needs (`read` for GET, `write` for changes; an AI app's key also needs `delete` for a destructive call). Use a key with that scope, or reconnect the AI app with "Manage and delete" access.
`FORBIDDEN`: the member who created the key may not do this in the organization. Use a key created by an owner or admin.
`AI_APPS_DISABLED`: the organization has turned AI app access off, and this request was made with an AI app's key or sent by Pantech's MCP server (`Pantech-Client: mcp/…`). An owner can turn it on in the console under Organization › AI apps.
- `404`: `DATABASE_IMPORT_NOT_FOUND`: no database import with this id exists in your organization.
- `409`: `DATABASE_IMPORT_INVALID_STATE`, `DATABASE_IMPORT_FINISHED` or `DATABASE_IMPORT_NOT_COPIED`: the import cannot do this now. `CONFLICT`: it changed at the same time; retry.
- `429`: `RATE_LIMITED`: this API key, verified user or organization used its request budget for the current window, or this address exceeded an IP/failed-auth limit. Wait `Retry-After` seconds, then retry. For authenticated quota denials, `RateLimit-Scope` identifies the denying quota and `RateLimit-Reset` reports its remaining window in seconds.
- `503`: `MIGRATE_UNAVAILABLE`: Pantech Migrate is not available on this deployment yet. Try again later.
`DATABASE_IMPORT_UNAVAILABLE`: your Pantech database could not be reached right now. Try again in a minute.
`SERVICE_UNAVAILABLE`: request quota storage is unavailable. Wait a few seconds, then retry.
