- [HTTP request](https://docs.cloud.google.com/sql/docs/postgres/admin-api/rest/v1beta4/instances/rotateServerCa#body.HTTP_TEMPLATE)
- [Path parameters](https://docs.cloud.google.com/sql/docs/postgres/admin-api/rest/v1beta4/instances/rotateServerCa#body.PATH_PARAMETERS)
- [Request body](https://docs.cloud.google.com/sql/docs/postgres/admin-api/rest/v1beta4/instances/rotateServerCa#body.request_body)
- [Response body](https://docs.cloud.google.com/sql/docs/postgres/admin-api/rest/v1beta4/instances/rotateServerCa#body.response_body)
- [Authorization scopes](https://docs.cloud.google.com/sql/docs/postgres/admin-api/rest/v1beta4/instances/rotateServerCa#body.aspect)
- [InstancesRotateServerCaRequest](https://docs.cloud.google.com/sql/docs/postgres/admin-api/rest/v1beta4/instances/rotateServerCa#InstancesRotateServerCaRequest)
  - [JSON representation](https://docs.cloud.google.com/sql/docs/postgres/admin-api/rest/v1beta4/instances/rotateServerCa#InstancesRotateServerCaRequest.SCHEMA_REPRESENTATION)
- [RotateServerCaContext](https://docs.cloud.google.com/sql/docs/postgres/admin-api/rest/v1beta4/instances/rotateServerCa#RotateServerCaContext)
  - [JSON representation](https://docs.cloud.google.com/sql/docs/postgres/admin-api/rest/v1beta4/instances/rotateServerCa#RotateServerCaContext.SCHEMA_REPRESENTATION)
- [Examples](https://docs.cloud.google.com/sql/docs/postgres/admin-api/rest/v1beta4/instances/rotateServerCa#examples)
- [Try it!](https://docs.cloud.google.com/sql/docs/postgres/admin-api/rest/v1beta4/instances/rotateServerCa#try-it)

Rotates the server certificate to one signed by the Certificate Authority (CA) version previously added with the addServerCA method. For instances that have enabled Certificate Authority Service (CAS) based server CA, use instances.RotateServerCertificate to rotate the server certificate.

### HTTP request

`POST https://sqladmin.googleapis.com/sql/v1beta4/projects/{project}/instances/{instance}/rotateServerCa`

The URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.

### Path parameters

| Parameters ||
|---|---|
| `project` | `string` Project ID of the project that contains the instance. |
| `instance` | `string` Cloud SQL instance ID. This does not include the project ID. |

### Request body

The request body contains an instance of `https://docs.cloud.google.com/sql/docs/postgres/admin-api/rest/v1beta4/instances/rotateServerCa#InstancesRotateServerCaRequest`.

### Response body

If successful, the response body contains an instance of `https://docs.cloud.google.com/sql/docs/postgres/admin-api/rest/v1beta4/operations#Operation`.

### Authorization scopes

Requires one of the following OAuth scopes:

- `https://www.googleapis.com/auth/cloudsql`
- `
  https://www.googleapis.com/auth/cloud-platform`
- `
  https://www.googleapis.com/auth/sqlservice.admin`

For more information, see the [Authentication Overview](https://docs.cloud.google.com/docs/authentication#authorization-gcp).

## InstancesRotateServerCaRequest

Rotate Server CA request.

| JSON representation |
|---|
| ``` { "rotateServerCaContext": { object (`https://docs.cloud.google.com/sql/docs/postgres/admin-api/rest/v1beta4/instances/rotateServerCa#RotateServerCaContext`) } } ``` |

| Fields ||
|---|---|
| `rotateServerCaContext` | ``object (`https://docs.cloud.google.com/sql/docs/postgres/admin-api/rest/v1beta4/instances/rotateServerCa#RotateServerCaContext`)`` Contains details about the rotate server CA operation. |

## RotateServerCaContext

Instance rotate server CA context.

| JSON representation |
|---|
| ``` { "kind": string, "nextVersion": string } ``` |

| Fields ||
|---|---|
| `kind` | `string` This is always `sql#rotateServerCaContext`. |
| `nextVersion` | `string` The fingerprint of the next version to be rotated to. If left unspecified, will be rotated to the most recently added server CA version. |