---
type: api
title: Rotate the Cloud Connected cluster API Key
description: Rotate the API key used to manage this Cloud Connected cluster.
url: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/cloud-connect/operation/operation-rotateclusterapikey
resource: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/cloud-connect/operation/operation-rotateclusterapikey
products:
  - Elastic Cloud Hosted
---

# Rotate the Cloud Connected cluster API Key

- Server: `https://api.elastic-cloud.com`

## Paths

- `POST` `/api/v1/cloud-connected/clusters/{id}/apikey/_rotate`

- [Api key auth](/elastic/docs-builder/docs/4371/api/doc/cloud-connect/authentication#apikey)

## Description

Rotate the API key used to manage this Cloud Connected cluster.
A new key is returned, and the previous key is revoked after 7 days or when `_revoke-pending` is called.

## Responses

#### `200`

The new API Key for the Cloud Connected service

`application/json`

- `key` (string)
  The API Key to manage the Cloud Connected cluster.
#### `401`

Unauthorized

`application/json`

- `errors` ([] ErrorResponse)
  - `message` (string)
    A human-readable message of the error.
  - `code` (string)
    An identifier for this type of error.
#### `403`

Forbidden

`application/json`

- `errors` ([] ErrorResponse)
  - `message` (string)
    A human-readable message of the error.
  - `code` (string)
    An identifier for this type of error.
#### `404`

Not Found

`application/json`

- `errors` ([] ErrorResponse)
  - `message` (string)
    A human-readable message of the error.
  - `code` (string)
    An identifier for this type of error.
## Code Examples

#### Console

```console
POST /api/v1/cloud-connected/clusters/{id}/apikey/_rotate
```

#### curl

```curl
curl -X POST "https://api.elastic-cloud.com/api/v1/cloud-connected/clusters/{id}/apikey/_rotate"
```

