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
keyIdstringRequiredparams{ 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
- authentication_required
- insufficient_role
- parameter_invalid
- rate_limit_exceeded
- recent_two_factor_required
- resource_missing
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();import os
import httpx
api = os.environ["PROVENANCE_API"]
step1 = httpx.post(f"{api}/v1/account/keys", headers={"Authorization": "Bearer prv_test_all_A1lP7vQ3bW9mK2sYd6cFjLh8gAe4tR5"}, json={
"name": "Old deploy script",
"product": "attest"
}).json()
key_id = step1["id"]
data = httpx.post(f"{api}/v1/account/keys/{key_id}/revoke", headers={"Authorization": "Bearer prv_test_all_A1lP7vQ3bW9mK2sYd6cFjLh8gAe4tR5"}, json={
"reason": "Found in a public repository"
}).json()