> This page is for API.

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.eon.io/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.eon.io/_mcp/server.

# Rotate API Client Secret

POST https://%7Baccount-domain%7D.console.eon.io/api/v1/api-credentials/{clientId}/rotate

Replaces the client secret for the specified API client credentials.

This method can be used to rotate a secret for the API credentials specified in the request body.
To replace the client secret for the access key passed in the `Authorization` header, you can also use [Rotate Current API Client Secret].

Once replaced, the old client secret can't be used to authenticate or obtain new tokens.
However, access tokens that were issued before the rotation remain valid until they expire.
This means there is an effective grace period of up to 12 hours where previously issued access tokens continue to work, even though the client secret used to obtain them has been rotated.

[Rotate Current API Client Secret]: ./rotate-current-api-client-secret


Reference: https://docs.eon.io/api/api-reference/auth/rotate-api-client-secret

## Authentication

- `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer <token>`, where token is your auth token.

## Request

### Path parameters

- `clientId` (string, required) — API client ID.

## Response

### 200

Client secret rotated.

- `clientId` (string, required) — API client ID.
- `clientSecret` (string, required) — API client secret.

## Errors

### 404 Not Found Error

API credentials weren't found.

- `any`

## Examples

**Response**

```json
{
  "clientId": "yaeiq73af5cbxibLiu22yw2t5ezeozxu5itv43uw2tyn3xpqprta",
  "clientSecret": "eon_sample620a571c00caf772b8e1b69de703792ba12c9eadef689725e0489324a093a64b4459ffecbaaa441c377950628b6b9042af728056d1d060b8f5d5sample"
}
```

**SDK Code**

```python
import requests

url = "https://{account-domain}.console.eon.io/api/v1/api-credentials/yaeiq73af5cbxibLiu22yw2t5ezeozxu5itv43uw2tyn3xpqprta/rotate"

headers = {"Authorization": "Bearer <token>"}

response = requests.post(url, headers=headers)

print(response.json())
```

```javascript
const url = 'https://{account-domain}.console.eon.io/api/v1/api-credentials/yaeiq73af5cbxibLiu22yw2t5ezeozxu5itv43uw2tyn3xpqprta/rotate';
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://{account-domain}.console.eon.io/api/v1/api-credentials/yaeiq73af5cbxibLiu22yw2t5ezeozxu5itv43uw2tyn3xpqprta/rotate")
  .header("Authorization", "Bearer <token>")
  .asString();
```