# prov.mandate.grants.addTrustedAgent

prov.mandate.grants.addTrustedAgent in Node SDK. Add a trusted outside agent (an admin key).

## Signature

```ts
prov.mandate.grants.addTrustedAgent(params: AddTrustedAgentParams): Promise<TrustedAgent>
```

## Parameters

- `params` (AddTrustedAgentParams)

## Returns

`Promise<TrustedAgent>`

## HTTP operation

[`POST /v1/mandate/trusted_agents`](https://provenanceauth.com/docs/api/grants.md#post-v1-mandate-trusted-agents): Add a trusted outside agent

## Errors

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

## Example

**Node**

```ts
const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/mandate/trusted_agents`, {
  method: "POST",
  headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", "Content-Type": "application/json" },
  body: JSON.stringify({
    "receiver": {
      "kind": "key",
      "name": "SkyDesk Seats",
      "origin": "https://seats.skydesk.example",
      "holder_key": {
        "kty": "EC",
        "crv": "P-256",
        "x": "NeVHu4qeD40iEEgSDcTm26Y0xApkjq41T6BuENVl0js",
        "y": "qS59-GAPcl0bJ-yYFvPJA3omsU9DJFedMw4rou5cXo8"
      }
    },
    "max_amount": 600
  }),
})).json();
```

**Python**

```python
import os
import httpx

api = os.environ["PROVENANCE_API"]
data = httpx.post(f"{api}/v1/mandate/trusted_agents", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}, json={
    "receiver": {
        "kind": "key",
        "name": "SkyDesk Seats",
        "origin": "https://seats.skydesk.example",
        "holder_key": {
            "kty": "EC",
            "crv": "P-256",
            "x": "NeVHu4qeD40iEEgSDcTm26Y0xApkjq41T6BuENVl0js",
            "y": "qS59-GAPcl0bJ-yYFvPJA3omsU9DJFedMw4rou5cXo8"
        }
    },
    "max_amount": 600
}).json()
```
