SDK reference · Python SDK
prov.account.rotate_key
prov.account.rotate_key in Python SDK.
Signature
prov.account.rotate_key(key_id: Optional[str] = …) -> AnyParameters
key_idOptional[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 (
key_…), orcurrentfor the API key making the call.
Returns
Any The new API key. It's shown only once.
HTTP operation
POST /v1/account/keys/{id}/rotate_secret: Rotate an API key
Errors
- authentication_required
- parameter_invalid
- parameter_missing
- profile_required
- rate_limit_exceeded
- recent_two_factor_required
Example
const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/account/keys/current/rotate_secret`, {
method: "POST",
headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5" },
})).json();import os
import httpx
api = os.environ["PROVENANCE_API"]
data = httpx.post(f"{api}/v1/account/keys/current/rotate_secret", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}).json()