Revoke a fleet API key
const url = 'https://example.com/api/nss/keys/example/revoke';const options = {method: 'POST', headers: {'X-Ssoossh-Key-Secret': '<X-Ssoossh-Key-Secret>'}};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://example.com/api/nss/keys/example/revoke \ --header 'X-Ssoossh-Key-Secret: <X-Ssoossh-Key-Secret>'Ends the key for good: neither secret is accepted again. The fleet key admin role, admins, SOC, or the key’s group. Already revoked is a 409.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Key id
Responses
Section titled “Responses”The revoked key
object
object
CreatedBy is the creator’s users.id, and CreatedByUsername their username, empty when the account is gone.
CurrentGeneration is 1 at creation and grows by one per rotation.
ExpiresAt is when the key stops being accepted, set at creation and renewed by each rotation; absent for a key that never expires.
GroupName is the group whose members manage this key, empty for none.
ID is “nss_” and 8 base32 characters, what hosts send as X-Ssoossh-Key-Id. Fixed for the key’s life.
KeySourceAlertAt is when the key source alert (nss.key_source_alert) last fired for the key: more source addresses in one day than the limit. Absent unless it fired in the last 7 days.
LastUsedAt is the last lookup any host made with the key, from the retained usage, so up to a minute behind; absent for a key no host has used.
MissRateAlertAt is when the miss rate alert (nss.miss_alert_rate) last fired for the key: many lookups for names the directory does not hold. Absent unless it fired in the last 7 days.
NotificationEmail is where the key’s mail goes, empty for nowhere.
Permissions is what the caller may do with this key, decided by the server so the UI never reimplements the role matrix. A revoked key carries view alone.
PreviousExpiresAt is when the previous secret stops being accepted, absent when there is no previous secret.
RevokedAt, RevokedBy (a users.id) and RevokedByUsername record a revocation, absent while the key is live.
RotatedAt is the last rotation, absent for a key never rotated.
Status is derived from the revocation and expiry.
Example
{ "data": { "permissions": [ "view" ], "status": "active" }}No valid session
object
Data is always null on an error response.
Error is a human-readable message. Branch on the HTTP status rather than this string; it is for humans and logs.
ErrorCode is a machine-readable error classifier. One of the error_code constants from internal/apitypes; use this to decide whether to retry or branch on the failure mode.
Example
{ "error": "certificate request \"9f1c…\" not found", "error_code": "not_found"}The caller may view the key but not revoke it
object
Data is always null on an error response.
Error is a human-readable message. Branch on the HTTP status rather than this string; it is for humans and logs.
ErrorCode is a machine-readable error classifier. One of the error_code constants from internal/apitypes; use this to decide whether to retry or branch on the failure mode.
Example
{ "error": "certificate request \"9f1c…\" not found", "error_code": "not_found"}No such key the caller may view, or nss_disabled
object
Data is always null on an error response.
Error is a human-readable message. Branch on the HTTP status rather than this string; it is for humans and logs.
ErrorCode is a machine-readable error classifier. One of the error_code constants from internal/apitypes; use this to decide whether to retry or branch on the failure mode.
Example
{ "error": "certificate request \"9f1c…\" not found", "error_code": "not_found"}The key is already revoked
object
Data is always null on an error response.
Error is a human-readable message. Branch on the HTTP status rather than this string; it is for humans and logs.
ErrorCode is a machine-readable error classifier. One of the error_code constants from internal/apitypes; use this to decide whether to retry or branch on the failure mode.
Example
{ "error": "certificate request \"9f1c…\" not found", "error_code": "not_found"}