Backups

POST /v1/projects/{projectsId}/backups

Changed on

Creates a backup for a Cloud SQL instance. This API can be used only to create on-demand backups.

Request

  • Base URL
    https://sqladmin.googleapis.com
  • Auth
    • OAuth 2 and OAuth 2
      Implicithttps://accounts.google.com/o/oauth2/auth
      Scopeshttps://www.googleapis.com/auth/cloud-platform
      Authorization codehttps://accounts.google.com/o/oauth2/auth
      Token URLhttps://accounts.google.com/o/oauth2/token
      Scopeshttps://www.googleapis.com/auth/cloud-platform
    • or OAuth 2 and OAuth 2
      Implicithttps://accounts.google.com/o/oauth2/auth
      Scopeshttps://www.googleapis.com/auth/sqlservice.admin
      Authorization codehttps://accounts.google.com/o/oauth2/auth
      Token URLhttps://accounts.google.com/o/oauth2/token
      Scopeshttps://www.googleapis.com/auth/sqlservice.admin

Path parameters

projectsId, string required

Query parameters

$.xgafv, '1' | '2'

V1 error format.

access_token, string

OAuth access token.

alt, 'json' | 'media' | 'proto'

Data format for response.

callback, string

JSONP

fields, string

Selector specifying which fields to include in a partial response.

key, string

API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.

oauth_token, string

OAuth 2.0 token for the current user.

prettyPrint, boolean

Returns response with indentations and line breaks.

quotaUser, string

Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.

uploadType, string

Legacy upload protocol for media (e.g. "media", "multipart").

upload_protocol, string

Upload protocol for media (e.g. "raw", "multipart").

Request body

Backup required

A backup resource.

backupInterval, Interval

Represents a time interval, encoded as a Timestamp start (inclusive) and a Timestamp end (exclusive). The start must be less than or equal to the end. When the start equals the end, the interval is empty (matches no time). When both start and end are unspecified, the interval matches any time.

backupKind, 'SQL_BACKUP_KIND_UNSPECIFIED' | 'SNAPSHOT' | 'PHYSICAL'

Output only. Specifies the kind of backup, PHYSICAL or DEFAULT_SNAPSHOT.

backupRun, string

Output only. The mapping to backup run resource used for IAM validations.

databaseVersion, 'SQL_DATABASE_VERSION_UNSPECIFIED' | 'MYSQL_5_1' | 'MYSQL_5_5' | 'MYSQL_5_6' | 'MYSQL_5_7' | 'MYSQL_8_0' | 'MYSQL_8_0_18' | 'MYSQL_8_0_26' | 'MYSQL_8_0_27' | 'MYSQL_8_0_28' | 'MYSQL_8_0_29' | 'MYSQL_8_0_30' | 'MYSQL_8_0_31' | 'MYSQL_8_0_32' | 'MYSQL_8_0_33' | 'MYSQL_8_0_34' | 'MYSQL_8_0_35' | 'MYSQL_8_0_36' | 'MYSQL_8_0_37' | 'MYSQL_8_0_39' | 'MYSQL_8_0_40' | 'MYSQL_8_0_41' | 'MYSQL_8_0_42' | 'MYSQL_8_0_43' | 'MYSQL_8_0_44' | 'MYSQL_8_0_45' | 'MYSQL_8_0_46' | 'MYSQL_8_4' | 'MYSQL_9_7' | 'SQLSERVER_2017_STANDARD' | 'SQLSERVER_2017_ENTERPRISE' | 'SQLSERVER_2017_EXPRESS' | 'SQLSERVER_2017_WEB' | 'POSTGRES_9_6' | 'POSTGRES_10' | 'POSTGRES_11' | 'POSTGRES_12' | 'POSTGRES_13' | 'POSTGRES_14' | 'POSTGRES_15' | 'POSTGRES_16' | 'POSTGRES_17' | 'POSTGRES_18' | 'POSTGRES_19' | 'POSTGRES_20' | 'SQLSERVER_2019_STANDARD' | 'SQLSERVER_2019_ENTERPRISE' | 'SQLSERVER_2019_EXPRESS' | 'SQLSERVER_2019_WEB' | 'SQLSERVER_2022_STANDARD' | 'SQLSERVER_2022_ENTERPRISE' | 'SQLSERVER_2022_EXPRESS' | 'SQLSERVER_2022_WEB' | 'SQLSERVER_2025_STANDARD' | 'SQLSERVER_2025_ENTERPRISE' | 'SQLSERVER_2025_EXPRESS'

Output only. The database version of the instance of at the time this backup was made.

description, string

The description of this backup.

error, OperationError

Database instance operation error.

expiryTime, string google-datetime

Backup expiration time. A UTC timestamp of when this backup expired.

instance, string

The name of the source database instance.

instanceDeletionTime, string google-datetime

Optional. Output only. Timestamp in UTC of when the instance associated with this backup is deleted.

instanceSettings, DatabaseInstance

A Cloud SQL instance resource.

kind, string

Output only. This is always sql#backup.

kmsKey, string

Output only. This output contains the encryption configuration for a backup and the resource name of the KMS key for disk encryption.

kmsKeyVersion, string

Output only. This output contains the encryption status for a backup and the version of the KMS key that's used to encrypt the Cloud SQL instance.

location, string

The storage location of the backups. The location can be multi-regional.

maxChargeableBytes, string int64

Output only. The maximum chargeable bytes for the backup.

name, string

Output only. The resource name of the backup. Format: projects/{project}/backups/{backup}.

satisfiesPzi, boolean

Output only. This status indicates whether the backup satisfies PZI. The status is reserved for future use.

satisfiesPzs, boolean

Output only. This status indicates whether the backup satisfies PZS. The status is reserved for future use.

selfLink, string

Output only. The URI of this resource.

state, 'SQL_BACKUP_STATE_UNSPECIFIED' | 'ENQUEUED' | 'RUNNING' | 'FAILED' | 'SUCCESSFUL' | 'DELETING' | 'DELETION_FAILED'

Output only. The status of this backup.

timeZone, string

Output only. This output contains a backup time zone. If a Cloud SQL for SQL Server instance has a different time zone from the backup's time zone, then the restore to the instance doesn't happen.

ttlDays, string int64

Input only. The time-to-live (TTL) interval for this resource (in days). For example: ttlDays:7, means 7 days from the current time. The expiration time can't exceed 365 days from the time that the backup is created.

type, 'SQL_BACKUP_TYPE_UNSPECIFIED' | 'AUTOMATED' | 'ON_DEMAND' | 'FINAL'

Output only. The type of this backup. The type can be "AUTOMATED", "ON_DEMAND" or “FINAL”.

Response

Successful response

Operation required

An Operation resource. For successful operations that return an Operation resource, only the fields relevant to the operation are populated in the resource.

acquireSsrsLeaseContext, AcquireSsrsLeaseContext

Acquire SSRS lease context.

apiWarning, ApiWarning

An Admin API warning message.

backupContext, BackupContext

Backup context.

endTime, string google-datetime

The time this operation finished in UTC timezone in RFC 3339 format, for example 2012-11-15T16:19:00.094Z.

error, OperationErrors

Database instance operation errors list wrapper.

exportContext, ExportContext

Database instance export context.

importContext, ImportContext

Database instance import context.

insertTime, string google-datetime

The time this operation was enqueued in UTC timezone in RFC 3339 format, for example 2012-11-15T16:19:00.094Z.

kind, string

This is always sql#operation.

name, string

An identifier that uniquely identifies the operation. You can use this identifier to retrieve the Operations resource that has information about the operation.

operationType, 'SQL_OPERATION_TYPE_UNSPECIFIED' | 'IMPORT' | 'EXPORT' | 'CREATE' | 'UPDATE' | 'DELETE' | 'RESTART' | 'BACKUP' | 'SNAPSHOT' | 'BACKUP_VOLUME' | 'DELETE_VOLUME' | 'RESTORE_VOLUME' | 'INJECT_USER' | 'CLONE' | 'STOP_REPLICA' | 'START_REPLICA' | 'PROMOTE_REPLICA' | 'CREATE_REPLICA' | 'CREATE_USER' | 'DELETE_USER' | 'UPDATE_USER' | 'CREATE_DATABASE' | 'DELETE_DATABASE' | 'UPDATE_DATABASE' | 'FAILOVER' | 'DELETE_BACKUP' | 'RECREATE_REPLICA' | 'TRUNCATE_LOG' | 'DEMOTE_MASTER' | 'MAINTENANCE' | 'ENABLE_PRIVATE_IP' | 'DEFER_MAINTENANCE' | 'CREATE_CLONE' | 'RESCHEDULE_MAINTENANCE' | 'START_EXTERNAL_SYNC' | 'LOG_CLEANUP' | 'AUTO_RESTART' | 'REENCRYPT' | 'SWITCHOVER' | 'UPDATE_BACKUP' | 'ACQUIRE_SSRS_LEASE' | 'RELEASE_SSRS_LEASE' | 'RECONFIGURE_OLD_PRIMARY' | 'CLUSTER_MAINTENANCE' | 'SELF_SERVICE_MAINTENANCE' | 'SWITCHOVER_TO_REPLICA' | 'MAJOR_VERSION_UPGRADE' | 'ADVANCED_BACKUP' | 'MANAGE_BACKUP' | 'ENHANCED_BACKUP' | 'REPAIR_READ_POOL' | 'CREATE_READ_POOL' | 'PRE_CHECK_MAJOR_VERSION_UPGRADE' | 'SETUP_MIGRATION' | 'CREATE_BLUE_GREEN_DEPLOYMENT' | 'SWITCHOVER_BLUE_GREEN_DEPLOYMENT' | 'DELETE_BLUE_GREEN_DEPLOYMENT' | 'RECONCILE_NETWORKING'

The type of the operation. Valid values are: * CREATE * DELETE * UPDATE * RESTART * IMPORT * EXPORT * BACKUP_VOLUME * RESTORE_VOLUME * CREATE_USER * DELETE_USER * CREATE_DATABASE * DELETE_DATABASE

preCheckMajorVersionUpgradeContext, PreCheckMajorVersionUpgradeContext

Pre-check major version upgrade context.

selfLink, string

The URI of this resource.

startTime, string google-datetime

The time this operation actually started in UTC timezone in RFC 3339 format, for example 2012-11-15T16:19:00.094Z.

startWorkloadCaptureContext, StartWorkloadCaptureContext

The context for the StartWorkloadCapture operation, which contains details to start recording the workload (SQL queries) on a Cloud SQL instance.

startWorkloadReplayContext, StartWorkloadReplayContext

The context for the StartWorkloadReplay operation, which contains details about starting the execution of a captured workload (recorded read and write SQL queries) on a replay instance (the Cloud SQL instance where the recorded SQL queries are executed).

status, 'SQL_OPERATION_STATUS_UNSPECIFIED' | 'PENDING' | 'RUNNING' | 'DONE'

The status of an operation.

stopWorkloadCaptureContext, StopWorkloadCaptureContext

The context for the StopWorkloadCapture operation, which contains details to stop recording the workload (SQL queries) on a Cloud SQL instance.

stopWorkloadReplayContext, StopWorkloadReplayContext

The context for the StopWorkloadReplay operation, which represents an operation that stops an active workload replay on a target Cloud SQL replay instance.

subOperationType, SqlSubOperationType

The sub operation type based on the operation type.

targetId, string

Name of the resource on which this operation runs.

targetLink, string
targetProject, string

The project ID of the target instance related to this operation.

user, string

The email address of the user who initiated this operation.

Changes

    • info

      the security scope https://www.googleapis.com/auth/cloud-platform was added to the endpoint's security scheme Oauth2

    • info

      the security scope https://www.googleapis.com/auth/cloud-platform was added to the endpoint's security scheme Oauth2c

    • info

      the security scope https://www.googleapis.com/auth/sqlservice.admin was removed from the endpoint's security scheme Oauth2

    1 more change in this revision