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 = …) -> Any

Parameters

approval_idstrRequired
decisionstrRequired
reasonOptional[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_changes ends the request as changes_requested with requested_changes and note; the agent sends a new request with revises. One of approve, 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 from option_challenges. Deny declines every option.
requested_changesarray of objects
With request_changes: the fields to change, from the approval's change_form, as { field, to }. A note alone is allowed. On an ask about a proposal the field is price (or price:<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 reason and returned on verify as deny_reason. One of unrecognized, 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_muted with no notification.
reasonstring
The reason given or recorded.
biometric_challengestring
The challenge from POST /v1/mandate/biometric_challenges the 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

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();

Was this page helpful? Send us feedback

LLM? Read llms.txt.