# lg_gateway_keys_rotate: Rotate an inference API key

Rotate an inference key's secret: shown in this answer only; the old secret stops at once. The key keeps its limits and what it has spent.

- **Changes data:** yes
- **Credential scope:** `gateway:write` (an API key's scopes, or what you allowed when connecting with OAuth)
- **Assistant level:** an assistant at Full; a lower level is refused

## Inputs

| Field | Type | Required | Notes |
|---|---|---|---|
| `id` | string | yes |  |

## Example MCP call

A `tools/call` request to `https://manage.restolayer.com/mcp`:

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "lg_gateway_keys_rotate",
    "arguments": {
      "id": "gk_01jabcdefghjkmnpqrstvwxyz0"
    }
  }
}
```

## Example REST call

The same thing over REST (`POST /v1/gateway-keys/:id/rotate`):

```bash
curl -s -X POST "https://manage.restolayer.com/v1/gateway-keys/gk_01jabcdefghjkmnpqrstvwxyz0/rotate" \
  -H "Authorization: Bearer $LG_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'
```

All tools: [MCP tools](https://www.restolayer.com/docs/mcp/tools). Connecting: [connect your assistant](https://www.restolayer.com/docs/connect).
