> ## Documentation Index
> Fetch the complete documentation index at: https://docs.motioness.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Rotate keys

Rotate the proxy_key (which=proxy) or the signing_secret (which=signing). Returned once.

` POST /api/projects/{id}/keys/rotate `

Rotate the proxy key or signing secret

## Servers

- ` https://motioness.com ` — Production

## Authentication

The operation accepts these alternatives. Schemes within one alternative are required together.

### Alternative 1

- ` sessionCookie `: ` apiKey `

  - Credential: ` better-auth.session_token ` in ` cookie `

  - Session cookie set by /api/user/signin, /api/user/signup, or the OAuth callback. Required for all authenticated endpoints.

## Parameters

### ` id ` (path, required)

- ` value `: type ` string `

  - example: ` "abc123" `

  - minLength: ` 1 `

Example:

```json
"abc123"
```

### ` which ` (query, required)

- ` value `: type ` string `

  - enum: ` ["proxy","signing"] `

## Responses

### ` 200 ` — New key/secret (shown once)

Content type: ` application/json `

- ` value `: type ` unknown `

  - ` anyOf alternative 1 `: type ` object `

    - Required fields: ` proxy_key `

    - ` proxy_key `: type ` string `

  - ` anyOf alternative 2 `: type ` object `

    - Required fields: ` signing_secret `

    - ` signing_secret `: type ` string `

### ` 404 ` — Not found

Content type: ` application/json `

- ` value `: type ` object `

  - Required fields: ` error `

  - ` error `: type ` string `

## Request examples

### cURL

```curl
curl -X POST 'https://motioness.com/api/projects/abc123/keys/rotate?which=proxy'
```

### JavaScript

```javascript
const response = await fetch('https://motioness.com/api/projects/abc123/keys/rotate?which=proxy', {
  method: 'POST'
});

const data = await response.json();
console.log(data);
```

### Python

```python
import requests

response = requests.post('https://motioness.com/api/projects/abc123/keys/rotate?which=proxy')
print(response.json())
```