SDK reference · Python SDK
prov.webhooks.rotate_secret
prov.webhooks.rotate_secret in Python SDK.
Signature
prov.webhooks.rotate_secret(endpoint_id: str) -> AnyParameters
endpoint_idstrRequired
Request fields
Idempotency-Keystringheader- Retry a create safely: the same key + request returns the stored response (24 h, per caller).
idstringpathRequired- The object's ID.
previous_secret_expires_ininteger- Seconds the replaced secret keeps signing beside the new one (up to 24 hours). Leave it out to stop the old secret now.
Returns
Any The endpoint with a new secret. It's shown only once.
HTTP operation
POST /v1/webhook_endpoints/{id}/rotate_secret: Rotate a webhook secret
Errors
Example
const step1 = await (await fetch(`${process.env.PROVENANCE_API}/v1/webhook_endpoints`, {
method: "POST",
headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", "Content-Type": "application/json" },
body: JSON.stringify({
"url": "http://localhost:4242/webhooks",
"event_types": [
"mandate.approval.approved"
]
}),
})).json();
const endpointId = step1.id;
const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/webhook_endpoints/${endpointId}/rotate_secret`, {
method: "POST",
headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", "Content-Type": "application/json" },
body: JSON.stringify({ "previous_secret_expires_in": 86400 }),
})).json();import os
import httpx
api = os.environ["PROVENANCE_API"]
step1 = httpx.post(f"{api}/v1/webhook_endpoints", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}, json={
"url": "http://localhost:4242/webhooks",
"event_types": [
"mandate.approval.approved"
]
}).json()
endpoint_id = step1["id"]
data = httpx.post(f"{api}/v1/webhook_endpoints/{endpoint_id}/rotate_secret", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}, json={
"previous_secret_expires_in": 86400
}).json()