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

# rotateApiKey

> Gives an API key a new secret; its scopes and APIs stay. Returns the new secret, the only time you can read it.



**mutation** `rotateApiKey(input: RotateApiKeyInput!): RotateApiKeyPayload!`

## Arguments

**`input`**: `RotateApiKeyInput!` (required)

## Returns

`RotateApiKeyPayload!`

**`apiKeyWithSecret`**: `ApiKeyWithSecret`

---

**`errors`**: `[RotateApiKeyError!]`

## Examples

```graphql Mutation
mutation RotateApiKey($input: RotateApiKeyInput!) {
  rotateApiKey(input: $input) {
    apiKeyWithSecret {
      id
      key
    }
    errors {
      __typename
      ... on GraphQlError {
        code
        details {
          __typename
        }
        message
      }
    }
  }
}
```

```json Variables
{
  "input": {
    "keyId": "string"
  }
}
```

```json Response
{
  "data": {
    "rotateApiKey": {
      "apiKeyWithSecret": {
        "id": "string",
        "key": "string"
      },
      "errors": [
        {
          "__typename": "GraphQlError",
          "code": "string",
          "details": [
            {
              "__typename": "KeyValuePairOfStringAndString"
            }
          ],
          "message": "string"
        }
      ]
    }
  }
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.