SDK reference · Node SDK
prov.mandate.grants.revoke
prov.mandate.grants.revoke in Node SDK. Revoke a mandate (idempotent).
Signature
prov.mandate.grants.revoke(mandateId: string): Promise<Grant>Parameters
mandateIdstringRequired
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.
reasonstringRequired- The reason given or recorded.
Returns
Promise<Grant> The object, now revoked.
HTTP operation
POST /v1/mandate/grants/{id}/revoke: Revoke a mandate
Errors
- authentication_required
- invalid_json
- parameter_invalid
- parameter_missing
- rate_limit_exceeded
- resource_missing
Example
const step1 = await (await fetch(`${process.env.PROVENANCE_API}/v1/mandate/grants`, {
method: "POST",
headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", "Content-Type": "application/json" },
body: JSON.stringify({
"device_id": "dev_00000000000000000000000000000001",
"agent_session_id": "sess_buyer_1",
"constraints": {
"max_amount": 400,
"expires_at": "2027-12-31T23:59:59Z"
}
}),
})).json();
const mandateId = step1.id;
const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/mandate/grants/${mandateId}/revoke`, {
method: "POST",
headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", "Content-Type": "application/json" },
body: JSON.stringify({ "reason": "supplier contract ended" }),
})).json();import os
import httpx
api = os.environ["PROVENANCE_API"]
step1 = httpx.post(f"{api}/v1/mandate/grants", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}, json={
"device_id": "dev_00000000000000000000000000000001",
"agent_session_id": "sess_buyer_1",
"constraints": {
"max_amount": 400,
"expires_at": "2027-12-31T23:59:59Z"
}
}).json()
grant_id = step1["id"]
data = httpx.post(f"{api}/v1/mandate/grants/{grant_id}/revoke", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}, json={
"reason": "supplier contract ended"
}).json()