API Reference

Google Cloud SQL provides a REST API for administering your instances programmatically.

Resource types

  1. BackupRuns
  2. Databases
  3. Flags
  4. Instances
  5. Operations
  6. SslCerts
  7. Tiers
  8. Users

BackupRuns

For BackupRuns Resource details, see the resource representation page.

Method HTTP request Description
URIs relative to https://www.googleapis.com/sql/v1beta4, unless otherwise noted
delete DELETE  /projects/project/instances/instance/backupRuns/id Deletes the backup taken by a backup run.
get GET  /projects/project/instances/instance/backupRuns/id Retrieves a resource containing information about a backup run.
insert POST  /projects/project/instances/instance/backupRuns Creates a new backup run on demand. This method is applicable only to Second Generation instances.
list GET  /projects/project/instances/instance/backupRuns Lists all backup runs associated with a given instance and configuration in the reverse chronological order of the backup initiation time.

Databases

For Databases Resource details, see the resource representation page.

Method HTTP request Description
URIs relative to https://www.googleapis.com/sql/v1beta4, unless otherwise noted
delete DELETE  /projects/project/instances/instance/databases/database Deletes a database from a Cloud SQL instance.
get GET  /projects/project/instances/instance/databases/database Retrieves a resource containing information about a database inside a Cloud SQL instance.
insert POST  /projects/project/instances/instance/databases Creates a new database inside a Cloud SQL instance.
list GET  /projects/project/instances/instance/databases Lists databases in the specified Cloud SQL instance.
patch PATCH  /projects/project/instances/instance/databases/database Updates a resource containing information about a database inside a Cloud SQL instance using patch semantics.
update PUT  /projects/project/instances/instance/databases/database Updates a resource containing information about a database inside a Cloud SQL instance.

Flags

For Flags Resource details, see the resource representation page.

Method HTTP request Description
URIs relative to https://www.googleapis.com/sql/v1beta4, unless otherwise noted
list GET  /flags List all available database flags for Google Cloud SQL instances.

Instances

For Instances Resource details, see the resource representation page.

Method HTTP request Description
URIs relative to https://www.googleapis.com/sql/v1beta4, unless otherwise noted
clone POST  /projects/project/instances/instance/clone Creates a Cloud SQL instance as a clone of the source instance.
delete DELETE  /projects/project/instances/instance Deletes a Cloud SQL instance.
export POST  /projects/project/instances/instance/export Exports data from a Cloud SQL instance to a Google Cloud Storage bucket as a MySQL dump or CSV file.
failover POST  /projects/project/instances/instance/failover Failover the instance to its failover replica instance.
get GET  /projects/project/instances/instance Retrieves a resource containing information about a Cloud SQL instance.
import POST  /projects/project/instances/instance/import Imports data into a Cloud SQL instance from a MySQL dump or CSV file in a Google Cloud Storage bucket.
insert POST  /projects/project/instances Creates a new Cloud SQL instance.
list GET  /projects/project/instances Lists instances under a given project in alphabetical order by instance name.
patch PATCH  /projects/project/instances/instance Updates settings of a Cloud SQL instance using patch semantics.
promoteReplica POST  /projects/project/instances/instance/promoteReplica Promotes the read replica instance to be a stand-alone Cloud SQL instance.
resetSslConfig POST  /projects/project/instances/instance/resetSslConfig Deletes all client certificates and generates a new server SSL certificate for the instance.
restart POST  /projects/project/instances/instance/restart Restarts a Cloud SQL instance.
restoreBackup POST  /projects/project/instances/instance/restoreBackup Restores a backup of a Cloud SQL instance.
startReplica POST  /projects/project/instances/instance/startReplica Starts the replication in the read replica instance.
stopReplica POST  /projects/project/instances/instance/stopReplica Stops the replication in the read replica instance.
truncateLog POST  /projects/project/instances/instance/truncateLog Truncate MySQL general and slow query log tables
update PUT  /projects/project/instances/instance Updates settings of a Cloud SQL instance.

Operations

For Operations Resource details, see the resource representation page.

Method HTTP request Description
URIs relative to https://www.googleapis.com/sql/v1beta4, unless otherwise noted
get GET  /projects/project/operations/operation Retrieves an instance operation that has been performed on an instance.
list GET  /projects/project/operations Lists all instance operations that have been performed on the given Cloud SQL instance in the reverse chronological order of the start time.

Required query parameters: instance

SslCerts

For SslCerts Resource details, see the resource representation page.

Method HTTP request Description
URIs relative to https://www.googleapis.com/sql/v1beta4, unless otherwise noted
createEphemeral POST  /projects/project/instances/instance/createEphemeral Generates a short-lived X509 certificate containing the provided public key and signed by a private key specific to the target instance. Users may use the certificate to authenticate as themselves when connecting to the database.
delete DELETE  /projects/project/instances/instance/sslCerts/sha1Fingerprint Deletes the SSL certificate.
get GET  /projects/project/instances/instance/sslCerts/sha1Fingerprint Retrieves a particular SSL certificate. Does not include the private key (required for usage). The private key must be saved from the response to initial creation.
insert POST  /projects/project/instances/instance/sslCerts Creates an SSL certificate and returns it along with the private key and server certificate authority.
list GET  /projects/project/instances/instance/sslCerts Lists all of the current SSL certificates for the instance.

Tiers

For Tiers Resource details, see the resource representation page.

Method HTTP request Description
URIs relative to https://www.googleapis.com/sql/v1beta4, unless otherwise noted
list GET  /projects/project/tiers Lists all available service tiers for Google Cloud SQL, for example. db-n1-standard-1. For related information, see Pricing.

Users

For Users Resource details, see the resource representation page.

Method HTTP request Description
URIs relative to https://www.googleapis.com/sql/v1beta4, unless otherwise noted
delete DELETE  /projects/project/instances/instance/users Deletes a user from a Cloud SQL instance.

Required query parameters: host, name

insert POST  /projects/project/instances/instance/users Creates a new user in a Cloud SQL instance.
list GET  /projects/project/instances/instance/users Lists users in the specified Cloud SQL instance.
update PUT  /projects/project/instances/instance/users Updates an existing user in a Cloud SQL instance.

Required query parameters: host, name

Monitor your resources on the go

Get the Google Cloud Console app to help you manage your projects.

Send feedback about...

Cloud SQL for PostgreSQL