---
title: "Credentials and rotation"
description: "Read the credential inventory, record a revocation, register credential material, rotate it in staged and validated steps, and destroy old versions."
keywords: ["NHI credentials", "credential standing", "credential rotation", "register credential material", "secret versions", "revoke credential", "rotation stages"]
---

NHI Security holds two different things under the word credential, and almost everything on this page depends on which one you are looking at.

| | Discovered credential | Registered material |
|---|---|---|
| What it is | Metadata a connector observed at a provider: an access key ID, a certificate, a token | A secret you handed to NHI Security, such as the values a connector authenticates with |
| How it arrives | A [synchronization](/nhi-security/discovery) | `POST /api/v1/credentials/material` |
| Is the secret stored | No. NHI Security has no copy of it | Yes, encrypted, in versions |
| Can it be rotated here | No. Rotate it where it was issued | Yes, through the rotation route |
| Marked in the console | No badge | **Stored here** |

In a real inventory nearly every row is a discovered credential. Which connectors produce them is listed per connector in [Connectors](/nhi-security/connectors).

No route returns secret values, for any credential, to any role. The API reports the handle a secret is stored under, its version number and the **names** of the values it carries, and nothing else.

Routes on this page are written as the API declares them. The console reaches the same routes under its own base path, so inside TRUSTIVAN the address begins `/nhi/api/v1/`.

## Permissions

| Permission | Allows | Roles that hold it |
|---|---|---|
| `credential:read` | The Credentials and Rotation screens, credential detail, evidence, rotation history | Every role |
| `credential:manage` | Registering material | Organization Admin, Security Admin |
| `credential:rotate` | Starting a rotation | Organization Admin, Security Admin |
| `credential:revoke` | Recording a revocation, destroying a superseded version | Organization Admin, Security Admin |

Inside TRUSTIVAN the Security Admin role is unreachable, so the three write permissions belong to Owners and Admins only. A Member or Viewer can read everything on these screens and change nothing. See [Limitations](/nhi-security/limitations#people-roles-and-offboarding).

## The Credentials screen

**Secrets → Credentials** lists every credential in your organization, discovered and registered together. `GET /api/v1/credentials` is the route behind it.

| Column | Shows |
|---|---|
| Credential | The display name and the provider's identifier, such as an access key ID. For registered material the identifier is the handle |
| Identity | The identity this credential authenticates, linked |
| Type | One of `static_secret`, `access_key`, `api_key`, `access_token`, `refresh_token`, `oauth_client_secret`, `ssh_key`, `certificate`, `signing_key`, `password`, `federated_trust`, `workload_federation`, `unknown`, plus **Stored here** when NHI Security holds the material |
| Standing | See the table below |
| Age | Time since the creation time the provider reported, or since registered material was first registered. Blank when no creation time was reported. The rotation threshold is measured separately, from the last recorded rotation when there is one |
| Expires | The provider's expiry date, blank when there is none |
| Source | The provider and the connector |
| Last used | A time, **Never** when the provider reports usage and has recorded none, or **Not reported** when the provider does not report usage at all |

You can filter by name prefix or exact provider identifier, type, stored state, provider, and whether the material is stored here. The API also accepts `identityId`, `connectorId`, `presence` and `needingAttention=true`, which keeps only credentials that are expiring, expired or past the rotation age.

**Standing** is computed each time you read it, from the stored state and the clock, in this order of precedence:

| Standing | Console label | When |
|---|---|---|
| `revoked` | Revoked | Someone recorded it revoked, or a complete, successful synchronization no longer returned it |
| `rotating` | Rotating | The stored state is `rotating`. Nothing in NHI Security sets that state today; a rotation's progress lives on the rotation record instead |
| `expired` | Expired | The provider reports it expired, or its expiry has passed |
| `expiring` | Expiring soon | Its expiry is within 14 days |
| `unknown` | State unknown | The provider would not say whether it works |
| `discovered` | Not assessed | It is disabled at the provider, or it has no creation time and no expiry, so no age can be measured |
| `rotation_required` | Past rotation age | Long-lived material last rotated, or created, 90 days ago or more. `federated_trust` and `workload_federation` are never past rotation age |
| `active` | Active | Assessed, and none of the above |

The filter labelled **State** works on the stored state (`active`, `inactive`, `expired`, `revoked`, `compromised`, `rotating`, `unknown`), which is what a provider reported or a person recorded, not on the standing.

### Credential detail

Choosing a row opens the credential. The page has these panels:

- **Standing**: the standing, what the provider reports, last use, expiry, last rotation and revocation time.
- **Material**: for registered material, the handle, the live version and the names of the values it carries. For a discovered credential, a statement that NHI Security has no copy, and why rotation is unavailable.
- **Findings**, **Exposures** and **Activity**: what policies concluded about this credential, where a source reported its material, and what was observed being done with it. Each needs its own read permission. See [Activity, synchronizations and exposures](/nhi-security/activity-and-exposures).
- **Rotations**: every rotation attempted, the stage each reached, and whether the connector had already been switched.
- **Evidence**: the observations behind the record, from `GET /api/v1/credentials/{credentialId}/evidence`. Entries are added on discovery, on a change, and when a person acts.

## The summary, and an empty inventory

`GET /api/v1/credentials/summary` returns `total`, `byStanding`, `byType`, `usageNotReported`, `ageNotReported`, `materialHeldByPlatform`, `hasCompletedSync` and `lastCompletedSyncAt`.

`hasCompletedSync` is the field to read first. When it is `false`, no synchronization has completed for your organization and every count is meaningless. The console then says **No credential has been observed yet** instead of showing an empty table, and the Rotation screen says **Nothing has been assessed yet**. When a synchronization has completed and returned no credentials, the console says **No credentials were found**: either nothing authenticates with long-lived material, or the connector cannot read it.

## Record a revocation

<Steps>
  <Step title="Open the credential">
    Go to **Secrets → Credentials** and choose the credential.
  </Step>
  <Step title="Record it">
    Choose **Record as revoked**, read the confirmation, and confirm. The button needs `credential:revoke`.
  </Step>
</Steps>

The route is `POST /api/v1/credentials/{credentialId}/revocation`, with no body. It sets the stored state to `revoked`, writes an audit record, and answers `409` when the credential is already revoked.

<Warning>
This is a record in NHI Security. For a discovered credential it revokes nothing at the provider, and the credential keeps working until someone disables it where it was issued. For registered material it does not destroy the stored secret either. A later synchronization never moves a credential out of `revoked`.
</Warning>

## Register credential material

Registering hands NHI Security a secret to hold, usually the values a connector authenticates with, and creates a credential record for it so that it can be rotated later. The console has no screen for this route.

```http
POST /api/v1/credentials/material
Content-Type: application/json

{
  "identityId": "5f0c7f0e-2f4b-4a53-9d0a-8f6f0b1c2d3e",
  "connectorId": "c1a4e2d7-6b1f-4c59-8a35-2e7d9f0a4b6c",
  "handle": "acme-aws-prod",
  "displayName": "Acme production AWS connector key",
  "type": "access_key",
  "values": {
    "accessKeyId": "<access key id>",
    "secretAccessKey": "<secret access key>"
  }
}
```

| Field | Rule |
|---|---|
| `identityId` | An identity already in your inventory. An unknown one is refused with `400` and nothing is stored |
| `connectorId` | The connector that uses this material. An unknown one is `404` |
| `handle` | The name the secret is stored under: 2 to 64 characters, lowercase letters, digits, dot, dash or underscore, starting and ending with a letter or digit. A connector finds its material by this name, so use the connector's credentials reference |
| `displayName` | 1 to 200 characters |
| `type` | One of the credential types listed above |
| `values` | A flat map of value name to string. At most 32 values and 64 KB in total. Names must be the ones the connector expects, listed per connector in [Connectors](/nhi-security/connectors) |

What happens:

- The values are encrypted before they are stored. Each version gets its own AES-256-GCM data key, wrapped under a key derived for your organization from the deployment's key-encryption key. That key lives in deployment configuration, not in the database, and each ciphertext is bound to your organization, the handle and the version number. Replacing the deployment's key is an operator task, described in [Configuration](/nhi-security/configuration).
- The secret is written as a new **version** and becomes the current one immediately. Registering the same handle for the same connector again writes the next version, updates the same credential record, and leaves the earlier version stored and superseded.
- The response is the credential record. It carries `secretHandle`, `secretVersion` and `secretFieldNames`, and no values.
- The audit trail records who registered which handle, version and value names. It never records a value.

A refused write answers `400` and names the reason: `handle_malformed` (the handle is shaped like a secret), `handle_defined_in_configuration` (your deployment's configuration already defines this handle, and a stored version must never shadow it), `store_is_read_only` (your deployment keeps secrets in configuration only), `field_name_malformed`, `too_many_fields`, `material_too_large` or `value_not_a_string`.

<Note>
A connector's first credential cannot be registered this way, because the route needs an identity and identities only arrive by discovery. `POST /api/v1/connectors/credential` exists for that case: it stores values under a handle and creates no credential record, so that material does not appear on the Credentials screen and has no rotation history. See [Credentials references](/nhi-security/connectors#credentials-references).
</Note>

## Rotate registered material

A rotation replaces the stored secret with new values that **you** supply. NHI Security does not create a key at the provider and does not revoke one there. You create the replacement at the provider, hand it over, and disable the old one at the provider afterwards.

```http
POST /api/v1/credentials/{credentialId}/rotations
Content-Type: application/json

{
  "values": {
    "accessKeyId": "<new access key id>",
    "secretAccessKey": "<new secret access key>"
  }
}
```

The request waits while the rotation walks its stages, and each stage is committed as it is reached, so an interrupted rotation leaves a record of how far it got.

| Stage | What happened |
|---|---|
| `requested` | The rotation record was opened |
| `authorized` | The permission and organization checks passed |
| `preparing` | The rotation is about to write |
| `new_secret_created` | The new values were stored as a new version. Nothing resolves to it yet |
| `provider_validated` | The connector's health check ran with the new version and came back `healthy`. Any other health, including `degraded`, rolls the rotation back |
| `reference_updated` | The new version became current. Connectors using this handle now resolve to it |
| `old_secret_revoked` | The previous stored version was destroyed. This is NHI Security's copy, not the credential at the provider |
| `completed` | The credential's last rotation time is set and nothing is left to do |

Three further stages describe what went wrong:

| Stage | Meaning | What is left behind |
|---|---|---|
| `rolling_back`, then `rolled_back` | The provider did not accept the new values, so the new version was destroyed | Nothing changed. The connector still uses the version it did before |
| `failed`, before `reference_updated` | The new values were refused, or the switch did not happen | The connector still uses the old version. A new version may have been written; it is not in use, and you can destroy it |
| `failed`, after `reference_updated` | The new version is live and the old stored version could not be destroyed | The connector works with the new values. Destroy the old version yourself, as described below |

A failure after the switch is never rolled back automatically. Read `referenceHasMoved` on the rotation first: it says whether the connector had already been switched when the rotation stopped. `failedAtStage` and `failureReason` say where and why. A rolled-back rotation carries its reason in the `steps` of the rotation detail, with the provider's answer sanitised.

A rotation that rolled back or failed is still answered with a success status and the rotation record, because the request was carried out and the record is what you need. Error statuses mean the rotation never started:

| Status | Meaning |
|---|---|
| `404` | No such credential, or its connector no longer exists |
| `409` | A rotation is already in flight for this credential |
| `422` `material_not_held` | A discovered credential. Rotate it where it was issued |
| `422` `credential_not_active` | The credential is recorded as revoked or compromised |
| `422` `connector_not_collecting` | The connector is not enabled, so the new values could not be checked against the provider |

On the credential itself, `rotatable` and `rotationUnavailableReason` report only the first two of those reasons. The rotation route checks the rest.

## Read rotation history

- `GET /api/v1/credentials/{credentialId}/rotations` lists every rotation attempted for the credential, 25 per page by default and 100 at most.
- `GET /api/v1/credentials/{credentialId}/rotations/{rotationId}` returns one rotation with `steps`: each stage it reached, when, and a sentence describing it.

Both need `credential:read`. The same history is on the credential's **Rotations** panel. The [audit trail](/nhi-security/governance-and-audit) records the request, authorization, start, validation and outcome of each rotation against the credential.

## Destroy a superseded version

```http
DELETE /api/v1/credentials/{credentialId}/material?version=1
```

This destroys one stored version that is no longer current: the leftover of a rotation that failed after the switch, or of a second registration. The encrypted material is erased and the row stays, recording when the version was created and destroyed and by whom. It needs `credential:revoke`.

It refuses the current version with `409`, because a handle with no live version is a connector that fails at its next synchronization. An already destroyed version is `409`, an unknown version is `404`, and a discovered credential is `422`.

## The Rotation screen

**Secrets → Rotation** is a read-only queue of credentials that need replacing: those whose standing is `expired`, `expiring` or `rotation_required`, ordered by expiry date. Four tiles count **Expired**, **Expiring soon**, **Past rotation age** and **Age unknown**.

The column **Can this platform replace it** answers the question that decides your next step. It reads **Yes** only for registered material that is still active. For everything else it gives the reason, and for a discovered credential that reason is always the same: rotate it where it was issued.

The screen starts nothing. Rotation is started through the API.

## What this does not do

- It does not change anything at a provider. Recording a revocation, rotating and destroying all act on NHI Security's own records and its own store.
- It does not generate secrets. A rotation uses the values you send.
- It does not schedule rotations, and the 90-day and 14-day thresholds are fixed for the whole deployment.
- It does not show, export or search stored values.

## Next steps

<Columns cols={2}>
  <Card title="Connectors" icon="plug" href="/nhi-security/connectors">
    The value names each connector expects, and how a credentials reference resolves.
  </Card>
  <Card title="Activity, synchronizations and exposures" icon="eye-off" href="/nhi-security/activity-and-exposures">
    Where a credential's material was reported exposed, and what was done with it.
  </Card>
  <Card title="Findings and risk" icon="triangle-alert" href="/nhi-security/findings-and-risk">
    The rotation and expiry policies, and how their thresholds are tuned.
  </Card>
  <Card title="Configuration" icon="sliders-horizontal" href="/nhi-security/configuration">
    The deployment's encryption key and where secrets are kept.
  </Card>
</Columns>
