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

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

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

Demotes the stand-alone instance to be a Cloud SQL read replica for an external database server.

## Path parameters

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

## Request body

- InstancesDemoteMasterRequest — Database demote primary instance request.
  - `demoteMasterContext` DemoteMasterContext — Database instance demote primary instance context.
    - `kind` string — This is always `sql#demoteMasterContext`.
    - `masterInstanceName` string — The name of the instance which will act as on-premises primary instance in the replication setup.
    - `replicaConfiguration` DemoteMasterConfiguration — Read-replica configuration for connecting to the on-premises primary instance.
      - `mysqlReplicaConfiguration` DemoteMasterMySqlReplicaConfiguration — Read-replica configuration specific to MySQL databases.
        - `username` string — The username for the replication connection.
        - `password` string — The password for the replication connection.
        - `caCertificate` string — PEM representation of the trusted CA's x509 certificate.
        - `kind` string — This is always `sql#demoteMasterMysqlReplicaConfiguration`.
        - `clientKey` string — PEM representation of the replica's private key. The corresponding public key is encoded in the client's certificate. The format of the replica's private key can be either PKCS #1 or PKCS #8.
        - `clientCertificate` string — PEM representation of the replica's x509 certificate.
      - `kind` string — This is always `sql#demoteMasterConfiguration`.
    - `skipReplicationSetup` boolean — Flag to skip replication setup on the instance.
    - `verifyGtidConsistency` boolean — Verify the GTID consistency for demote operation. Default value: `True`. Setting this flag to `false` enables you to bypass the GTID consistency check between on-premises primary instance and Cloud SQL instance during the demotion operation but also exposes you to the risk of future replication failures. Change the value only if you know the reason for the GTID divergence and are confident that doing so will not cause any replication issues.

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