---
title: "Override the validity of an identity"
method: POST
path: "/v1/nhi/identities/{identity_id}/validity"
tags: ["NHI Identities"]
---

# Override the validity of an identity

`POST /v1/nhi/identities/{identity_id}/validity`

## Request

- Base URL: `https://api.gitguardian.com`
- URL: `https://api.gitguardian.com/v1/nhi/identities/{identity_id}/validity`
- Auth: HTTP bearer

Set the validity of the secret an identity holds with your own check result.

The override applies to every copy of the secret. It stays until you remove it:
the checks that ggscout sends and the validity checks of GitGuardian do not change it.
A new copy of the same secret gets the override too.
A rotated secret is a different value, so the override does not apply to it.

Incidents keep their own validity. To override the validity of an incident,
use [Override the validity of a secret](#operation/set-secret-validity-override).

The workspace must have NHI governance activation.
The API token must have the Manager access level or above, or be a service account token.

## Path parameters

- `identity_id` integer, required

## Request body

- object
  - `validity` 'valid' | 'invalid' | 'failed_to_check', required

## Response `200`

The override was set.

- object
  - `identity_id` integer, required
  - `validity` 'valid' | 'invalid' | 'failed_to_check' | 'no_checker' | 'unknown', nullable, required: The validity of the identity, the override included. `null` when the identity holds no secret.
  - `validity_override` 'valid' | 'invalid' | 'failed_to_check' | 'null', nullable, required: The validity override, or `null` when no override is set.

## Other responses

- `400`: Invalid validity, or the identity holds no secret.
- `401`: Invalid API key
- `403`: Permission denied
- `404`: Identity not found
- `503`: API under maintenance

## Changes

- **2026-11-02** `5829df7b9045`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/gitguardian/apis/gitguardian-api/changes/v1/nhi/identities/:identity_id/validity/post.md)

---

[API](https://skmtc.dev/gitguardian/apis/gitguardian-api.md) - [All operations](https://skmtc.dev/gitguardian/apis/gitguardian-api/llms.txt) - [OpenAPI document](https://skmtc.dev/gitguardian/apis/gitguardian-api/revisions/5829df7b9045?raw)
