---
title: "Promotes the store's next license signing key to sign new tokens and publishes a fresh next one, keeping the old key published for 365 days; with `retire_previous` every key that no longer signs leaves the published set at once, though software that embeds it trusts it until updated. With `current`, a rotation since answers `conflict`. A store with no keys gets its first set."
---

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

Path: Sherpo merchant API › customer

`POST /v1/stores/{store}/license_signing_keys/rotate`

## Authentication

- `bearer`, http, header `Authorization`, scopes: `customer:write`

## Path parameters

- `store` (`rotateLicenseSigningKeys.path.store`; string, required) — The store's id.

## Request body

_Optional._

- `current` (`rotateLicenseSigningKeys.current`; any of, optional) — The key that signs now, as you last read it, or null for a store with none; a rotation since answers `conflict` on `revision`, so a retry never rotates twice.
  - any of: `object`, `null`
- `retire_previous` (`rotateLicenseSigningKeys.retire_previous`; boolean, optional) — Drop every key that no longer signs from the published set at once, as after a leak; sets fetched from then on leave them out. Defaults to false.

## Example request

```json
{
  "current": {
    "id": "string"
  },
  "retire_previous": true
}
```

## Code samples

### cURL

```bash
curl --request POST \
  --url 'https://api.sherpo.io/merchant/v1/stores/<store>/license_signing_keys/rotate' \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "current": {
    "id": "string"
  },
  "retire_previous": true
}
'
```

### TypeScript

```typescript
const url = 'https://api.sherpo.io/merchant/v1/stores/<store>/license_signing_keys/rotate';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json', Authorization: 'Bearer <token>'},
  body: JSON.stringify({current: {id: 'string'}, retire_previous: true})
};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error(err));
```

### Python

```python
import requests

url = "https://api.sherpo.io/merchant/v1/stores/<store>/license_signing_keys/rotate"

payload = {
    "current": { "id": "string" },
    "retire_previous": True
}
headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer <token>"
}

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

print(response.text)
```

## Responses

### 200

Promotes the store's next license signing key to sign new tokens and publishes a fresh next one, keeping the old key published for 365 days; with `retire_previous` every key that no longer signs leaves the published set at once, though software that embeds it trusts it until updated. With `current`, a rotation since answers `conflict`. A store with no keys gets its first set.

#### Example

```json
{
  "keys": [
    {
      "kid": "string",
      "kty": "string",
      "crv": "string",
      "x": "string",
      "alg": "string",
      "use": "string",
      "status": "string",
      "created_at": "string",
      "expires_at": "string"
    }
  ]
}
```

- `keys` (`rotateLicenseSigningKeys.response.200.keys`; array<object>, required)
  - `kid` (`rotateLicenseSigningKeys.response.200.keys.kid`; string, required)
  - `kty` (`rotateLicenseSigningKeys.response.200.keys.kty`; string, required)
  - `crv` (`rotateLicenseSigningKeys.response.200.keys.crv`; string, required)
  - `x` (`rotateLicenseSigningKeys.response.200.keys.x`; string, required) — The raw 32-byte public key, base64url, as a JWK's `x`.
  - `alg` (`rotateLicenseSigningKeys.response.200.keys.alg`; string, required)
  - `use` (`rotateLicenseSigningKeys.response.200.keys.use`; string, required)
  - `status` (`rotateLicenseSigningKeys.response.200.keys.status`; string, required) — `current` signs new tokens; `next` signs once the keys rotate; `previous` signs nothing more and stays published while a token it signed may live.
  - `created_at` (`rotateLicenseSigningKeys.response.200.keys.created_at`; string, required)
  - `expires_at` (`rotateLicenseSigningKeys.response.200.keys.expires_at`; any of, required) — When it leaves the set, as the longest offline window after it stopped signing; null while it signs or waits to.
    - any of: `string`, `null`

### default

A problem; see https://api.sherpo.io/merchant/docs/errors.

#### Example

```json
{
  "type": "http://example.com",
  "title": "string",
  "status": 0,
  "detail": "string",
  "code": "string",
  "context": {},
  "reached_core": true,
  "core_answer": "string"
}
```

- `type` (`rotateLicenseSigningKeys.response.default.type`; string, required)
  - format `uri`
- `title` (`rotateLicenseSigningKeys.response.default.title`; string, required)
- `status` (`rotateLicenseSigningKeys.response.default.status`; integer, required)
- `detail` (`rotateLicenseSigningKeys.response.default.detail`; string, required)
- `code` (`rotateLicenseSigningKeys.response.default.code`; string, optional)
- `context` (`rotateLicenseSigningKeys.response.default.context`; object, optional)
- `reached_core` (`rotateLicenseSigningKeys.response.default.reached_core`; boolean, optional)
- `core_answer` (`rotateLicenseSigningKeys.response.default.core_answer`; string, optional)


Source: https://docs.sherpo.io/merchant-api/reference/rotate-license-signing-keys/index.md
