# Rotate an identity secret

```http
POST https://trydimmi.com/api/v1/identity-secrets/{secret}/rotations
```

## Authorization

Send an API token as `Authorization: Bearer <token>`.
The token needs: `settings:write`.

## Path parameters

- `secret` (string, required): Id of the identity verification secret, starting with isk_, such as isk_01jx2m8k4t. Find it with GET /identity-secrets.

## Body

- `public_key` (string): The new public key as PEM text, required for RS256, ES256 and EdDSA secrets.

## Response 201 (Created)

- `data` (object, required)
  - `algorithm` (string, required): The signing algorithm identity tokens are checked with: HS256 (shared secret), RS256, ES256 or EdDSA (public key or key set).
  - `audience` (string | null, required): An extra aud value accepted on tokens checked with this secret. Null when none is set.
  - `created_at` (string, required): When it was created, as an RFC 3339 time, such as 2026-01-31T09:00:00Z.
  - `fingerprint` (string, required): A short mark to tell secrets apart: the last 4 characters of a shared secret, or 16 hex characters for a public key or key set.
  - `id` (string, required): The id of this record. Send it wherever an endpoint asks for this record; never use its name or title in its place.
  - `issuer` (string | null, required): For a key set only: the issuer tokens must carry. Null otherwise or when it is read off the key set's address.
  - `jwks_error` (string | null, required): For a key set only: why the last fetch of the provider's keys failed. Null when it worked or the secret is not a key set.
  - `jwks_fetched_at` (string | null, required): For a key set only: when the provider's keys were last fetched. Null when the secret is not a key set.
  - `jwks_url` (string | null, required): For a key set only: the address the provider's public keys are fetched from. Null for a shared secret or a single public key.
  - `kid` (string, required): The value a token's kid header names this secret by; it equals the secret's id (starting with isk_). Empty for a key set, whose tokens carry the provider's key ids.
  - `last_used_at` (string | null, required): When a token was last checked with this secret. Null when it has never been used.
  - `name` (string, required): The name the team gave the secret.
  - `object` (string, required): The kind of record this is, the same for every record of its kind, such as article.
  - `retires_at` (string | null, required): When a retiring secret stops working. Null unless status is retiring.
  - `revoked_at` (string | null, required): When the secret was revoked. Null unless status is revoked.
  - `secret` (string): The shared secret itself, shown only in this one answer; store it now. Absent for a public key or key set.
  - `source` (string, required): What the secret verifies tokens with: shared_secret, public_key or jwks (a provider's key set).
  - `status` (string, required): Where the secret stands: active, retiring (still works until retires_at) or revoked.
- `meta` (object, required)
  - `env_var` (string, required): The environment variable your server should keep the secret in: DIMMI_IDENTITY_SECRET.
  - `kid_env_var` (string, required): The environment variable your server should keep the secret's kid in: DIMMI_IDENTITY_KID.
  - `secret_shown_once` (boolean, required): True when this answer carries a shared secret that will never be shown again; false when there was none to show.

## Response default (Error)

- `code` (string, required): Stable code for programs to tell errors apart, such as validation_failed or internal_error.
- `errors` (object): Each rejected field mapped to its messages. Only present when the input was invalid.
- `message` (string, required): What went wrong, in words safe to show a person.

## Example request

```bash
curl --request POST \
  --url 'https://trydimmi.com/api/v1/identity-secrets/{secret}/rotations' \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "public_key": "<string>"
}'
```

## Example response

```json
{
  "data": {
    "algorithm": "<string>",
    "audience": "<string>",
    "created_at": "2026-11-01T09:30:00Z",
    "fingerprint": "<string>",
    "id": "<string>",
    "issuer": "<string>",
    "jwks_error": "<string>",
    "jwks_fetched_at": "2026-11-01T09:30:00Z",
    "jwks_url": "<string>",
    "kid": "<string>",
    "last_used_at": "2026-11-01T09:30:00Z",
    "name": "<string>",
    "object": "<string>",
    "retires_at": "2026-11-01T09:30:00Z",
    "revoked_at": "2026-11-01T09:30:00Z",
    "secret": "<string>",
    "source": "<string>",
    "status": "<string>"
  },
  "meta": {
    "env_var": "<string>",
    "kid_env_var": "<string>",
    "secret_shown_once": true
  }
}
```

---

Index of all dimmi docs: https://trydimmi.com/llms.txt (full text: https://trydimmi.com/llms-full.txt)
