# prov.mandate.grants.create

prov.mandate.grants.create in Python SDK.

## Signature

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

## Parameters

- `**body` (Any, optional)

## Returns

`Any`

## HTTP operation

[`POST /v1/mandate/grants`](https://provenanceauth.com/docs/api/grants.md#post-v1-mandate-grants): Grant a mandate

## Errors

- [`authentication_required`](https://provenanceauth.com/docs/platform/errors.md#authentication_required)
- [`insufficient_scope`](https://provenanceauth.com/docs/platform/errors.md#insufficient_scope)
- [`invalid_json`](https://provenanceauth.com/docs/platform/errors.md#invalid_json)
- [`parameter_invalid`](https://provenanceauth.com/docs/platform/errors.md#parameter_invalid)
- [`parameter_missing`](https://provenanceauth.com/docs/platform/errors.md#parameter_missing)
- [`rate_limit_exceeded`](https://provenanceauth.com/docs/platform/errors.md#rate_limit_exceeded)
- [`usage_limit_reached`](https://provenanceauth.com/docs/platform/errors.md#usage_limit_reached)

## Example

**Node**

```ts
const data = 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",
    "purpose": "Pay Brindlecote Supplies invoices this year",
    "constraints": {
      "max_amount": 400,
      "budget_amount": 500,
      "budget_window": "day",
      "allowed_action_types": [
        "payment"
      ],
      "allowed_counterparties": [
        "acct_brindlecote_supplies"
      ],
      "expires_at": "2027-12-31T23:59:59Z"
    },
    "holder_key": {
      "kty": "EC",
      "crv": "P-256",
      "x": "NeVHu4qeD40iEEgSDcTm26Y0xApkjq41T6BuENVl0js",
      "y": "qS59-GAPcl0bJ-yYFvPJA3omsU9DJFedMw4rou5cXo8"
    }
  }),
})).json();
```

**Python**

```python
import os
import httpx

api = os.environ["PROVENANCE_API"]
data = 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",
    "purpose": "Pay Brindlecote Supplies invoices this year",
    "constraints": {
        "max_amount": 400,
        "budget_amount": 500,
        "budget_window": "day",
        "allowed_action_types": [
            "payment"
        ],
        "allowed_counterparties": [
            "acct_brindlecote_supplies"
        ],
        "expires_at": "2027-12-31T23:59:59Z"
    },
    "holder_key": {
        "kty": "EC",
        "crv": "P-256",
        "x": "NeVHu4qeD40iEEgSDcTm26Y0xApkjq41T6BuENVl0js",
        "y": "qS59-GAPcl0bJ-yYFvPJA3omsU9DJFedMw4rou5cXo8"
    }
}).json()
```
