---
title: "POST /v1/projects/{project}/instances/{instance}/import"
method: POST
path: "/v1/projects/{project}/instances/{instance}/import"
tags: ["instances"]
---

# POST /v1/projects/{project}/instances/{instance}/import

`POST /v1/projects/{project}/instances/{instance}/import`

Imports data into a Cloud SQL instance from a SQL dump or CSV file in Cloud Storage.

## Path parameters

- `project` string, required
- `instance` string, required

## Request body

- InstancesImportRequest — Database instance import request.
  - `importContext` ImportContext — Database instance import context.
    - `sqlImportOptions` object — Optional. Options for importing data from SQL statements.
      - `threads` integer — Optional. The number of threads to use for parallel import.
      - `postgresImportOptions` object — Optional. Options for importing from a Cloud SQL for PostgreSQL instance.
        - `clean` boolean — Optional. The --clean flag for the pg_restore utility. This flag applies only if you enabled Cloud SQL to import files in parallel.
        - `ifExists` boolean — Optional. The --if-exists flag for the pg_restore utility. This flag applies only if you enabled Cloud SQL to import files in parallel.
      - `parallel` boolean — Optional. Whether or not the import should be parallel.
    - `database` string — The target database for the import. If `fileType` is `SQL`, this field is required only if the import file does not specify a database, and is overridden by any database specification in the import file. For entire instance parallel import operations, the database is overridden by the database name stored in subdirectory name. If `fileType` is `CSV`, one database must be specified.
    - `fileType` 'SQL_FILE_TYPE_UNSPECIFIED' | 'SQL' | 'CSV' | 'BAK' | 'TDE' — The file type for the specified uri.\`SQL`: The file contains SQL statements. \`CSV`: The file contains CSV data.
    - `uri` string — Path to the import file in Cloud Storage, in the form `gs://bucketName/fileName`. Compressed gzip files (.gz) are supported when `fileType` is `SQL`. The instance must have write permissions to the bucket and read access to the file.
    - `csvImportOptions` object — Options for importing data as CSV.
      - `fieldsTerminatedBy` string — Specifies the character that separates columns within each row (line) of the file.
      - `escapeCharacter` string — Specifies the character that should appear before a data character that needs to be escaped.
      - `columns` string[] — The columns to which CSV data is imported. If not specified, all columns of the database table are loaded with CSV data.
      - `linesTerminatedBy` string — This is used to separate lines. If a line does not contain all fields, the rest of the columns are set to their default values.
      - `table` string — The table to which CSV data is imported.
      - `quoteCharacter` string — Specifies the quoting character to be used when a data value is quoted.
    - `kind` string — This is always `sql#importContext`.
    - `tdeImportOptions` object — Optional. Import parameters specific to SQL Server TDE certificates
      - `certificatePath` string — Required. Path to the TDE certificate public key in the form gs://bucketName/fileName. The instance must have read access to the file. Applicable only for SQL Server instances.
      - `privateKeyPath` string — Required. Path to the TDE certificate private key in the form gs://bucketName/fileName. The instance must have read access to the file. Applicable only for SQL Server instances.
      - `privateKeyPassword` string — Required. Password that encrypts the private key.
      - `name` string — Required. Certificate name. Applicable only for SQL Server instances.
    - `importUser` string — The PostgreSQL user for this import operation. PostgreSQL instances only.
    - `bakImportOptions` object — Import parameters specific to SQL Server .BAK files
      - `encryptionOptions` object
        - `certPath` string — Path to the Certificate (.cer) in Cloud Storage, in the form `gs://bucketName/fileName`. The instance must have write permissions to the bucket and read access to the file.
        - `keepEncrypted` boolean — Optional. Whether the imported file remains encrypted.
        - `pvkPath` string — Path to the Certificate Private Key (.pvk) in Cloud Storage, in the form `gs://bucketName/fileName`. The instance must have write permissions to the bucket and read access to the file.
        - `pvkPassword` string — Password that encrypts the private key
      - `stopAt` string, google-datetime — Optional. The timestamp when the import should stop. This timestamp is in the [RFC 3339](https://tools.ietf.org/html/rfc3339) format (for example, `2023-10-01T16:19:00.094`). This field is equivalent to the STOPAT keyword and applies to Cloud SQL for SQL Server only.
      - `striped` boolean — Whether or not the backup set being restored is striped. Applies only to Cloud SQL for SQL Server.
      - `noRecovery` boolean — Whether or not the backup importing will restore database with NORECOVERY option. Applies only to Cloud SQL for SQL Server.
      - `recoveryOnly` boolean — Whether or not the backup importing request will just bring database online without downloading Bak content only one of "no_recovery" and "recovery_only" can be true otherwise error will return. Applies only to Cloud SQL for SQL Server.
      - `bakType` 'BAK_TYPE_UNSPECIFIED' | 'FULL' | 'DIFF' | 'TLOG' — Type of the bak content, FULL or DIFF
      - `stopAtMark` string — Optional. The marked transaction where the import should stop. This field is equivalent to the STOPATMARK keyword and applies to Cloud SQL for SQL Server only.

## Response `200`

Successful response

---

[API](https://skmtc.net/google/apis/sqladmin.md) · [All operations](https://skmtc.net/google/apis/sqladmin/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/google/sqladmin/versions/e9eef8a2afcd/schema)
