SDK reference · Python SDK

prov.account.revoke_key

prov.account.revoke_key in Python SDK. Revoke a key with no replacement (owners and admins).

Signature

prov.account.revoke_key(key_id: str, reason: Optional[str] = …) -> Any

Parameters

key_idstrRequired
reasonOptional[str]

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

Any 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.