SDK reference · Node SDK

prov.account.revokeKey

prov.account.revokeKey in Node SDK. Revoke a key with no replacement (a leaked or unused key).

Signature

prov.account.revokeKey(keyId: string, params?: { reason?: string }): Promise<RevokedKey>

Parameters

keyIdstringRequired
params{ reason?: string }

Request fields

Idempotency-Keystringheader
Retry a create safely: the same key + request returns the stored response (24 h, per caller).
idstringpathRequired
The key's id, from the key list.
reasonstring
Why, for the security log and the webhook event.

Returns

Promise<RevokedKey> The revoked key. No secret is returned.

HTTP operation

POST /v1/account/keys/{id}/revoke: Revoke an API key

Errors

Example

const step1 = await (await fetch(`${process.env.PROVENANCE_API}/v1/account/keys`, {
  method: "POST",
  headers: { Authorization: "Bearer prv_test_all_A1lP7vQ3bW9mK2sYd6cFjLh8gAe4tR5", "Content-Type": "application/json" },
  body: JSON.stringify({ "name": "Old deploy script", "product": "attest" }),
})).json();
const keyId = step1.id;
const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/account/keys/${keyId}/revoke`, {
  method: "POST",
  headers: { Authorization: "Bearer prv_test_all_A1lP7vQ3bW9mK2sYd6cFjLh8gAe4tR5", "Content-Type": "application/json" },
  body: JSON.stringify({ "reason": "Found in a public repository" }),
})).json();

Was this page helpful? Send us feedback

LLM? Read llms.txt.