# prov.mandate.grants

prov.mandate.grants in the Python SDK: 30 methods. The mandate.grants methods.

## Methods

### [create](https://provenanceauth.com/docs/sdks/python/mandate-grants/create.md)

```python
prov.mandate.grants.create(**body: Any = …) -> Any
```

Calls `POST /v1/mandate/grants`.

### [list](https://provenanceauth.com/docs/sdks/python/mandate-grants/list.md)

```python
prov.mandate.grants.list(**query: Any = …) -> Any
```

Calls `GET /v1/mandate/grants`.

### [get](https://provenanceauth.com/docs/sdks/python/mandate-grants/get.md)

```python
prov.mandate.grants.get(mandate_id: str) -> Any
```

Calls `GET /v1/mandate/grants/{id}`.

### [spend](https://provenanceauth.com/docs/sdks/python/mandate-grants/spend.md)

```python
prov.mandate.grants.spend(mandate_id: str, include_descendants: Optional[bool] = …, limit: Optional[int] = …, cursor: Optional[str] = …) -> Any
```

What the mandate spent, newest first (one entry per debit, with what caused it).

Calls `GET /v1/mandate/grants/{id}/spend`.

### [spend_summary](https://provenanceauth.com/docs/sdks/python/mandate-grants/spend-summary.md)

```python
prov.mandate.grants.spend_summary(group_by: Optional[str] = …, window: Optional[str] = …, currency: Optional[str] = …) -> Any
```

What your agents spent under their grants in a window, per day and per group: by `category` of spend (the default) or by `agent`.

Calls `GET /v1/mandate/spend_summary`.

### [usual_spend](https://provenanceauth.com/docs/sdks/python/mandate-grants/usual-spend.md)

```python
prov.mandate.grants.usual_spend(mandate_id: str) -> Any
```

The usual spend of the person who gave this grant, per category of spend: the median of their purchases over the last 90 days and whether it is a `baseline` (five or more).

Calls `GET /v1/mandate/grants/{id}/usual_spend`.

### [over_limit_settings](https://provenanceauth.com/docs/sdks/python/mandate-grants/over-limit-settings.md)

```python
prov.mandate.grants.over_limit_settings() -> Any
```

The account's over-limit settings: what each lock does when a purchase goes past it.

Calls `GET /v1/mandate/settings/delegation`.

### [limits](https://provenanceauth.com/docs/sdks/python/mandate-grants/limits.md)

```python
prov.mandate.grants.limits() -> Any
```

Slice 11: the account's mandate limits over 's fields (the built-in ones, `is_default`, until one is published).

Calls `GET /v1/mandate/settings/limits`.

### [set_limits](https://provenanceauth.com/docs/sdks/python/mandate-grants/set-limits.md)

```python
prov.mandate.grants.set_limits(document: dict, note: Optional[str] = …) -> Any
```

Slice 11: save the mandate limits as a new live version (a key with the `mandate` scope).

Calls `PUT /v1/mandate/settings/limits`.

### [limit_versions](https://provenanceauth.com/docs/sdks/python/mandate-grants/limit-versions.md)

```python
prov.mandate.grants.limit_versions(draft_group: Optional[str] = …, limit: Optional[int] = …, cursor: Optional[str] = …) -> Any
```

Slice 11: the mandate limits' versions, newest first (a sandbox draft group's drafts with `draft_group`).

Calls `GET /v1/mandate/settings/limits/versions`.

### [limit_version](https://provenanceauth.com/docs/sdks/python/mandate-grants/limit-version.md)

```python
prov.mandate.grants.limit_version(version: int) -> Any
```

Slice 11: one version of the mandate limits, with its document.

Calls `GET /v1/mandate/settings/limits/versions/{version}`.

### [publish_limits](https://provenanceauth.com/docs/sdks/python/mandate-grants/publish-limits.md)

```python
prov.mandate.grants.publish_limits(version: int) -> Any
```

Slice 11: make a waiting draft of the mandate limits live (a rules embed session's, say).

Calls `POST /v1/mandate/settings/limits/versions/{version}/publish`.

### [set_over_limit_settings](https://provenanceauth.com/docs/sdks/python/mandate-grants/set-over-limit-settings.md)

```python
prov.mandate.grants.set_over_limit_settings(over_limit: Optional[dict] = …, require_same_person: Optional[bool] = …, at_verify: Optional[str] = …, require_holder_proof: Optional[bool] = …, external: Optional[str] = …, external_online_above: Optional[float] = …) -> Any
```

Change the settings for the locks given (an admin key); a grant's own `over_limit` still comes first.

Calls `PUT /v1/mandate/settings/delegation`.

### [hand_off](https://provenanceauth.com/docs/sdks/python/mandate-grants/hand-off.md)

```python
prov.mandate.grants.hand_off(mandate_id: str, receiver: dict, holder_key: dict, agent_session_id: str, purpose: str, purpose_tags: Optional[list] = …, constraints: Optional[dict] = …, max_depth: Optional[int] = …, run_id: Optional[str] = …, budget: Optional[dict] = …, offline_checks: Optional[str] = …, handoff_id: Optional[str] = …) -> Any
```

Hand a narrower grant to an agent outside the account, bound to its key (`holder_key`, its P-256 public JWK).

Calls `POST /v1/mandate/grants/{id}/delegate`.

### [external_handoff](https://provenanceauth.com/docs/sdks/python/mandate-grants/external-handoff.md)

```python
prov.mandate.grants.external_handoff(handoff_id: str) -> Any
```

An external hand-off as the account reads it (pending, minted with the grant's id, or declined).

Calls `GET /v1/mandate/external_handoffs/{id}`.

### [list_incoming_grants](https://provenanceauth.com/docs/sdks/python/mandate-grants/list-incoming-grants.md)

```python
prov.mandate.grants.list_incoming_grants(agent_id: Optional[str] = …, limit: Optional[int] = …, cursor: Optional[str] = …) -> Any
```

Grants other accounts handed to your registered agents, newest first (`agent_id` narrows to one agent).

Calls `GET /v1/mandate/incoming_grants`.

### [incoming_grant](https://provenanceauth.com/docs/sdks/python/mandate-grants/incoming-grant.md)

```python
prov.mandate.grants.incoming_grant(incoming_grant_id: str) -> Any
```

One incoming grant, with the grant's live status (the grant itself stays the other account's).

Calls `GET /v1/mandate/incoming_grants/{id}`.

### [list_trusted_agents](https://provenanceauth.com/docs/sdks/python/mandate-grants/list-trusted-agents.md)

```python
prov.mandate.grants.list_trusted_agents(limit: Optional[int] = …, cursor: Optional[str] = …) -> Any
```

The company's trusted outside agents.

Calls `GET /v1/mandate/trusted_agents`.

### [add_trusted_agent](https://provenanceauth.com/docs/sdks/python/mandate-grants/add-trusted-agent.md)

```python
prov.mandate.grants.add_trusted_agent(receiver: dict, max_amount: Optional[float] = …, budget_amount: Optional[float] = …) -> Any
```

Add a trusted outside agent (an admin key): `{"kind": "provenance_agent", "agent_id":...}` or `{"kind": "key", "name":..., "origin": "https://...", "holder_key": <P-256 public JWK>}`, with optional caps.

Calls `POST /v1/mandate/trusted_agents`.

### [remove_trusted_agent](https://provenanceauth.com/docs/sdks/python/mandate-grants/remove-trusted-agent.md)

```python
prov.mandate.grants.remove_trusted_agent(trusted_agent_id: str) -> Any
```

Take an agent off the company's list (an admin key).

Calls `DELETE /v1/mandate/trusted_agents/{id}`.

### [list_holder_bindings](https://provenanceauth.com/docs/sdks/python/mandate-grants/list-holder-bindings.md)

```python
prov.mandate.grants.list_holder_bindings(limit: Optional[int] = …, cursor: Optional[str] = …) -> Any
```

The company's per-agent holder-binding settings.

Calls `GET /v1/mandate/holder_bindings`.

### [set_holder_binding](https://provenanceauth.com/docs/sdks/python/mandate-grants/set-holder-binding.md)

```python
prov.mandate.grants.set_holder_binding(agent_id: str, holder_binding: str) -> Any
```

`required` (grants to your own agent carry `holder_key`) or `not_required` (an outside agent may get a bearer hand-off).

Calls `PUT /v1/mandate/holder_bindings/{agent_id}`.

### [clear_holder_binding](https://provenanceauth.com/docs/sdks/python/mandate-grants/clear-holder-binding.md)

```python
prov.mandate.grants.clear_holder_binding(agent_id: str) -> Any
```

Put an agent back on the default holder binding.

Calls `DELETE /v1/mandate/holder_bindings/{agent_id}`.

### [revoke](https://provenanceauth.com/docs/sdks/python/mandate-grants/revoke.md)

```python
prov.mandate.grants.revoke(mandate_id: str, reason: Optional[str] = …) -> Any
```

Calls `POST /v1/mandate/grants/{id}/revoke`.

### [delegate](https://provenanceauth.com/docs/sdks/python/mandate-grants/delegate.md)

```python
prov.mandate.grants.delegate(mandate_id: str, agent_session_id: str, purpose: str, purpose_tags: Optional[list] = …, agent_id: Optional[str] = …, constraints: Optional[dict] = …, max_depth: Optional[int] = …, run_id: Optional[str] = …, budget: Optional[dict] = …, limits_version: Optional[int] = …, draft_group: Optional[str] = …) -> Any
```

Mint a narrower child mandate for a subagent (omitted constraints inherit the parent's).

Calls `POST /v1/mandate/grants/{id}/delegate`.

### [delegate_as_holder](https://provenanceauth.com/docs/sdks/python/mandate-grants/delegate-as-holder.md)

```python
prov.mandate.grants.delegate_as_holder(mandate_id: str, parent_token: str, private_jwk: Mapping[str, Any], directory_url: str, agent_session_id: str, purpose: str, purpose_tags: Optional[list] = …, agent_id: Optional[str] = …, constraints: Optional[dict] = …, max_depth: Optional[int] = …, run_id: Optional[str] = …, budget: Optional[dict] = …, keyid: Optional[str] = …) -> Any
```

Delegate as the agent that holds the mandate, with no account key (holder proof).

Calls `POST /v1/mandate/grants/{id}/delegate`.

### [propose](https://provenanceauth.com/docs/sdks/python/mandate-grants/propose.md)

```python
prov.mandate.grants.propose(mandate_id: str, children: list, supersedes: Optional[str] = …, expires_in: Optional[int] = …, notify: Optional[bool] = …, limits_version: Optional[int] = …, draft_group: Optional[str] = …, approver: Optional[dict] = …) -> Any
```

Propose a delegation structure under a mandate you hold.

Calls `POST /v1/mandate/grants/{id}/delegation_proposals`.

### [propose_as_holder](https://provenanceauth.com/docs/sdks/python/mandate-grants/propose-as-holder.md)

```python
prov.mandate.grants.propose_as_holder(mandate_id: str, parent_token: str, private_jwk: Mapping[str, Any], directory_url: str, children: list, supersedes: Optional[str] = …, expires_in: Optional[int] = …, notify: Optional[bool] = …, keyid: Optional[str] = …) -> Any
```

`propose` as the agent that holds the mandate, with no account key (holder proof, as `delegate_as_holder`).

Calls `POST /v1/mandate/grants/{id}/delegation_proposals`.

### [get_proposal](https://provenanceauth.com/docs/sdks/python/mandate-grants/get-proposal.md)

```python
prov.mandate.grants.get_proposal(proposal_id: str) -> Any
```

A proposal, with the approved structure, the person's edits and the minted children (their tokens to an API key), and `approval_context`: how the person decided, None while pending.

Calls `GET /v1/mandate/delegation_proposals/{id}`.

### [list_proposals](https://provenanceauth.com/docs/sdks/python/mandate-grants/list-proposals.md)

```python
prov.mandate.grants.list_proposals(status: Optional[str] = …, parent_grant_id: Optional[str] = …, limit: Optional[int] = …, cursor: Optional[str] = …) -> Any
```

This account's proposals, newest first.

Calls `GET /v1/mandate/delegation_proposals`.
