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

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

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

Exports data from a Cloud SQL instance to a Cloud Storage bucket as a SQL dump or CSV file.

## Path parameters

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

## Request body

- InstancesExportRequest — Database instance export request.
  - `exportContext` ExportContext — Database instance export context.
    - `kind` string — This is always `sql#exportContext`.
    - `tdeExportOptions` object — Optional. Export parameters specific to SQL Server TDE certificates
      - `name` string — Required. Certificate name. Applicable only for SQL Server instances.
      - `certificatePath` string — Required. Path to the TDE certificate public key in the form gs://bucketName/fileName. The instance must have write access to the bucket. 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 write access to the location. Applicable only for SQL Server instances.
      - `privateKeyPassword` string — Required. Password that encrypts the private key.
    - `offload` boolean — Whether to perform a serverless export.
    - `sqlExportOptions` object — Options for exporting data as SQL statements.
      - `threads` integer — Optional. The number of threads to use for parallel export.
      - `tables` string[] — Tables to export, or that were exported, from the specified database. If you specify tables, specify one and only one database. For PostgreSQL instances, you can specify only one table.
      - `parallel` boolean — Optional. Whether or not the export should be parallel.
      - `postgresExportOptions` object — Options for exporting from a Cloud SQL for PostgreSQL instance.
        - `clean` boolean — Optional. Use this option to include DROP <object> SQL statements. Use these statements to delete database objects before running the import operation.
        - `ifExists` boolean — Optional. Option to include an IF EXISTS SQL statement with each DROP statement produced by clean.
      - `mysqlExportOptions` object — Options for exporting from MySQL.
        - `masterData` integer — Option to include SQL statement required to set up replication. If set to `1`, the dump file includes a CHANGE MASTER TO statement with the binary log coordinates, and --set-gtid-purged is set to ON. If set to `2`, the CHANGE MASTER TO statement is written as a SQL comment and has no effect. If set to any value other than `1`, --set-gtid-purged is set to OFF.
      - `schemaOnly` boolean — Export only schemas.
    - `bakExportOptions` object — Options for exporting BAK files (SQL Server-only)
      - `bakType` 'BAK_TYPE_UNSPECIFIED' | 'FULL' | 'DIFF' | 'TLOG' — Type of this bak file will be export, FULL or DIFF, SQL Server only
      - `striped` boolean — Whether or not the export should be striped.
      - `exportLogEndTime` string, google-datetime — Optional. The end timestamp when transaction log will be included in the export operation. [RFC 3339](https://tools.ietf.org/html/rfc3339) format (for example, `2023-10-01T16:19:00.094`) in UTC. When omitted, all available logs until current time will be included. Only applied to Cloud SQL for SQL Server.
      - `stripeCount` integer — Option for specifying how many stripes to use for the export. If blank, and the value of the striped field is true, the number of stripes is automatically chosen.
      - `copyOnly` boolean — Deprecated: copy_only is deprecated. Use differential_base instead
      - `exportLogStartTime` string, google-datetime — Optional. The begin timestamp when transaction log will be included in the export operation. [RFC 3339](https://tools.ietf.org/html/rfc3339) format (for example, `2023-10-01T16:19:00.094`) in UTC. When omitted, all available logs from the beginning of retention period will be included. Only applied to Cloud SQL for SQL Server.
      - `differentialBase` boolean — Whether or not the backup can be used as a differential base copy_only backup can not be served as differential base
    - `databases` string[] — Databases to be exported. `MySQL instances:` If `fileType` is `SQL` and no database is specified, all databases are exported, except for the `mysql` system database. If `fileType` is `CSV`, you can specify one database, either by using this property or by using the `csvExportOptions.selectQuery` property, which takes precedence over this property. `PostgreSQL instances:` If you don't specify a database by name, all user databases in the instance are exported. This excludes system databases and Cloud SQL databases used to manage internal operations. Exporting all user databases is only available for directory-formatted parallel export. If `fileType` is `CSV`, this database must match the one specified in the `csvExportOptions.selectQuery` property. `SQL Server instances:` You must specify one database to be exported, and the `fileType` must be `BAK`.
    - `fileType` 'SQL_FILE_TYPE_UNSPECIFIED' | 'SQL' | 'CSV' | 'BAK' | 'TDE' — The file type for the specified uri.
    - `uri` string — The path to the file in Google Cloud Storage where the export will be stored. The URI is in the form `gs://bucketName/fileName`. If the file already exists, the request succeeds, but the operation fails. If `fileType` is `SQL` and the filename ends with .gz, the contents are compressed.
    - `csvExportOptions` object — Options for exporting data as CSV. `MySQL` and `PostgreSQL` instances only.
      - `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.
      - `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.
      - `selectQuery` string — The select query used to extract the data.
      - `quoteCharacter` string — Specifies the quoting character to be used when a data value is quoted.

## 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)
