---
title: "POST /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/regenerateKey"
method: POST
path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/regenerateKey"
tags: ["CognitiveServicesAccounts"]
---

# POST /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/regenerateKey

`POST /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/regenerateKey`

## Request

- Base URL: `https://management.azure.com`
- URL: `https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/regenerateKey`
- Auth: OAuth 2
  - Implicit: `https://login.microsoftonline.com/common/oauth2/authorize`
  - Scopes: `user_impersonation`

Regenerates the specified account key for the specified Cognitive Services account.

## Path parameters

- `subscriptionId` string, required
- `resourceGroupName` string, required
- `accountName` string, required

## Query parameters

- `api-version` string, required

## Request body

- RegenerateKeyParameters: Regenerate key parameters.
  - `keyName` 'Key1' | 'Key2', required: key name to generate (Key1|Key2)

## Response `200`

Azure operation completed successfully.

- ApiKeys: The access keys for the cognitive services account.
  - `key1` string: Gets the value of key 1.
  - `key2` string: Gets the value of key 2.

## Other responses

- `default`: An unexpected error response.

## Changes

- **2026-07-13** (2016-02-01-preview) `d0eb21b3d2a7`: 3 breaking
  - added the new path request parameter `resourceGroupName`
  - added the new path request parameter `subscriptionId`
  - added the new required `query` request parameter `api-version`
- **2026-07-13** (2016-02-01-preview) `10ba71accb6e`: 3 breaking, 1 info
  - added the new path request parameter `resourceGroupName`
  - added the new path request parameter `subscriptionId`
  - added the new required `query` request parameter `api-version`
  - api operation id `Accounts_RegenerateKey` removed and replaced with `CognitiveServicesAccounts_RegenerateKey`
- **2026-07-13** (2016-02-01-preview) `a945a4b99f00`: 3 warning, 1 info
  - deleted the `path` request parameter `resourceGroupName`
  - deleted the `path` request parameter `subscriptionId`
  - deleted the `query` request parameter `api-version`
  - api operation id `CognitiveServicesAccounts_RegenerateKey` removed and replaced with `Accounts_RegenerateKey`
- **2017-12-28** (2016-02-01-preview) `9fddc284caf8`: 3 breaking, 1 info
  - added the new path request parameter `resourceGroupName`
  - added the new path request parameter `subscriptionId`
  - added the new required `query` request parameter `api-version`
  - api operation id `Accounts_RegenerateKey` removed and replaced with `CognitiveServicesAccounts_RegenerateKey`

[Operation history](https://skmtc.dev/azure/apis/cognitiveservices-microsoft-cognitiveservices/changes/subscriptions/:subscriptionId/resourceGroups/:resourceGroupName/providers/Microsoft.CognitiveServices/accounts/:accountName/regenerateKey/post.md)

---

[API](https://skmtc.dev/azure/apis/cognitiveservices-microsoft-cognitiveservices.md) - [All operations](https://skmtc.dev/azure/apis/cognitiveservices-microsoft-cognitiveservices/llms.txt) - [OpenAPI document](https://skmtc.dev/azure/apis/cognitiveservices-microsoft-cognitiveservices/revisions/d0eb21b3d2a7?raw)
