API Reference

Cloud SQL provides the Cloud SQL Admin API, 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 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
addServerCa POST  /projects/project/instances/instance/addServerCa Add a new trusted Certificate Authority (CA) version for the specified instance. Required to prepare for a certificate rotation. If a CA version was previously added but never used in a certificate rotation, this operation replaces that version. There cannot be more than one CA version waiting to be rotated in.
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.
demoteMaster POST  /projects/project/instances/instance/demoteMaster Demotes the stand-alone instance to be a Cloud SQL read replica for an external database server.
export POST  /projects/project/instances/instance/export Exports data from a Cloud SQL instance to a Cloud Storage bucket as a SQL 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 SQL dump or CSV file in Cloud Storage.
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.
listServerCas GET  /projects/project/instances/instance/listServerCas Lists all of the trusted Certificate Authorities (CAs) for the specified instance. There can be up to three CAs listed: the CA that was used to sign the certificate that is currently in use, a CA that has been added but not yet used to sign a certificate, and a CA used to sign a certificate that has previously rotated out.
patch PATCH  /projects/project/instances/instance Updates settings of a Cloud SQL instance. . This method supports 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.
rotateServerCa POST  /projects/project/instances/instance/rotateServerCa Rotates the server certificate to one signed by the Certificate Authority (CA) version previously added with the addServerCA method.
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. For First Generation instances, the certificate remains valid until the instance is restarted.
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 machine types (tiers) for 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: name

Was this page helpful? Let us know how we did:

Send feedback about...

Cloud SQL for PostgreSQL