---
type: api
title: Rotate a Cloud Connected service API Key
description: Rotate the API key used by a Cloud Connected service for this cluster.
url: https://www.elastic.co/elastic/docs-builder/docs/4641/api/doc/cloud-connect/operation/operation-rotateserviceapikey
resource: https://www.elastic.co/elastic/docs-builder/docs/4641/api/doc/cloud-connect/operation/operation-rotateserviceapikey
products:
  - Elastic Cloud Hosted
---

# Rotate a Cloud Connected service API Key

Authentication: required

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

## Paths

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

#### Path parameters

- `id` (string · pattern: ^[a-z0-9]{32}$) — required
  The ID of the Cloud Connected cluster
- `service` (enum) — required
  The name of the Cloud Connected service
  Values: `eis`

## Description

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

## Header parameters

- `If-Match` (string) — optional
  ETag value fetched in a previous GET cluster request. Used to prevent simultaneous updates

## Responses

#### `200`

The new API Key for the Cloud Connected service

`application/json`

- `key` (string)
  An API Key that can be used to interact with a Cloud Connected Service
#### `401`

Unauthorized

`application/json`

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

Forbidden

`application/json`

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

Not Found

`application/json`

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

#### curl

```curl
curl -X POST "https://api.elastic-cloud.com/api/v1/cloud-connected/clusters/${ID}/apikey/eis/_rotate" \
  -H "Authorization: ApiKey ${API_KEY}"
```

## Response examples

#### 200

`application/json`

Generated from the API spec. Values are representative. Unions use the first variant; deeply nested or large bodies may omit fields.

```json
{
  "key": "VXNlci1JRDoxMjM0NTY3ODkwYWJjZGVmMTIzNDU2Nzg5MGFiY2RlZg=="
}
```

#### 401

`application/json`

Generated from the API spec. Values are representative. Unions use the first variant; deeply nested or large bodies may omit fields.

```json
{
  "errors": [
    {
      "message": "Explicative error message",
      "code": "code.error"
    }
  ]
}
```

#### 403

`application/json`

Generated from the API spec. Values are representative. Unions use the first variant; deeply nested or large bodies may omit fields.

```json
{
  "errors": [
    {
      "message": "Explicative error message",
      "code": "code.error"
    }
  ]
}
```

#### 404

`application/json`

Generated from the API spec. Values are representative. Unions use the first variant; deeply nested or large bodies may omit fields.

```json
{
  "errors": [
    {
      "message": "Explicative error message",
      "code": "code.error"
    }
  ]
}
```

