SDK reference · Python SDK
prov.mandate.approvals.respond
prov.mandate.approvals.respond in Python SDK.
Signature
prov.mandate.approvals.respond(approval_id: str, decision: str, reason: Optional[str] = …, **extra: Any = …) -> AnyParameters
approval_idstrRequireddecisionstrRequiredreasonOptional[str]**extraAny
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.
decisionenumRequired- The decision.
request_changesends the request aschanges_requestedwithrequested_changesandnote; the agent sends a new request withrevises. One ofapprove,decline,deny,request_changes. option_indexinteger- On a choose-one request: the option to approve (required with
approve). With a passkey check, the assertion answers that option's challenge fromoption_challenges. Deny declines every option. requested_changesarray of objects- With
request_changes: the fields to change, from the approval'schange_form, as{ field, to }. A note alone is allowed. On an ask about a proposal the field isprice(orprice:<index>), as in[{ field: price, to: 610 }].Show child attributes
fieldstringRequired- The field from the form.
tostringRequired- The value asked for.
notestring- With
request_changes: the person's note (links and phone numbers are removed). decline_reasonenum- With a deny: the reason the person picked, stored as the approval's
reasonand returned on verify asdeny_reason. One ofunrecognized,wrong_amount,not_now,off_task. mute_originboolean- With a decline of a checkout step-up: don't ask this person again for this store's origin. Later step-ups from it answer
approval_mutedwith no notification. reasonstring- The reason given or recorded.
biometric_challengestring- The challenge from
POST /v1/mandate/biometric_challengesthe assertion signs. biometric_assertionobject- The passkey assertion over the challenge.
Show child attributes
authenticator_datastring- The base64url authenticatorData from the passkey assertion.
client_data_jsonstring- The base64url clientDataJSON from the passkey ceremony.
signaturestring- The base64url signature from the passkey assertion.
Returns
Any The approval, now decided.
HTTP operation
POST /v1/mandate/approvals/{id}/respond: Respond to an approval
Errors
- approval_already_decided
- approval_biometric_required
- approval_not_routed_to_you
- approval_routed_to_approver
- authentication_required
- insufficient_role
- invalid_json
- parameter_invalid
- parameter_missing
- pending_change_failed
- rate_limit_exceeded
- resource_missing
- usage_limit_reached
Example
const step1 = await (await fetch(`${process.env.PROVENANCE_API}/v1/mandate/policies`, {
method: "PUT",
headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", "Content-Type": "application/json" },
body: JSON.stringify({
"note": "wires need a person",
"document": {
"rules": [
{
"id": "wire-needs-approval",
"when": [
{
"fact": "action_type",
"op": "eq",
"value": "wire"
}
],
"require": {
"approval": true
}
}
]
}
}),
})).json();
const step2 = await (await fetch(`${process.env.PROVENANCE_API}/v1/mandate/intents`, {
method: "POST",
headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", "Content-Type": "application/json" },
body: JSON.stringify({
"action_description": "Wire $12,000 to Acme Corp for PO-7781",
"agent_session_id": "sess_treasury_1",
"device_id": "dev_00000000000000000000000000000001"
}),
})).json();
const intentToken = step2.intent_token;
const step3 = await (await fetch(`${process.env.PROVENANCE_API}/v1/mandate/assessments`, {
method: "POST",
headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", "Content-Type": "application/json" },
body: JSON.stringify({
"intent_token": intentToken,
"action_description": "Wire $12,000 to Acme Corp for PO-7781",
"context": {
"action_type": "wire"
}
}),
})).json();
const approvalId = step3.approval_id;
const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/mandate/approvals/${approvalId}/respond`, {
method: "POST",
headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", "Content-Type": "application/json" },
body: JSON.stringify({ "decision": "approve" }),
})).json();import os
import httpx
api = os.environ["PROVENANCE_API"]
step1 = httpx.put(f"{api}/v1/mandate/policies", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}, json={
"note": "wires need a person",
"document": {
"rules": [
{
"id": "wire-needs-approval",
"when": [
{
"fact": "action_type",
"op": "eq",
"value": "wire"
}
],
"require": {
"approval": True
}
}
]
}
}).json()
step2 = httpx.post(f"{api}/v1/mandate/intents", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}, json={
"action_description": "Wire $12,000 to Acme Corp for PO-7781",
"agent_session_id": "sess_treasury_1",
"device_id": "dev_00000000000000000000000000000001"
}).json()
intent_token = step2["intent_token"]
step3 = httpx.post(f"{api}/v1/mandate/assessments", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}, json={
"intent_token": intent_token,
"action_description": "Wire $12,000 to Acme Corp for PO-7781",
"context": {
"action_type": "wire"
}
}).json()
approval_id = step3["approval_id"]
data = httpx.post(f"{api}/v1/mandate/approvals/{approval_id}/respond", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}, json={
"decision": "approve"
}).json()