# prov.mandate.grants.setHolderBinding

prov.mandate.grants.setHolderBinding in Node SDK. `required` (grants to your own agent carry `holderKey`) or `not_required` (an outside agent may get a bearer hand-off).

## Signature

```ts
prov.mandate.grants.setHolderBinding(agentId: string, holderBinding: "required" | "not_required"): Promise<HolderBinding>
```

## Parameters

- `agentId` (string)
- `holderBinding` ("required" | "not_required")

## Returns

`Promise<HolderBinding>`

## HTTP operation

[`PUT /v1/mandate/holder_bindings/{agent_id}`](https://provenanceauth.com/docs/api/grants.md#put-v1-mandate-holder-bindings-agent-id): Set an agent's holder binding

## 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/holder_bindings/agt_01M7Z71YM4GVGFZ5D6PQQE0VZN`, {
  method: "PUT",
  headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", "Content-Type": "application/json" },
  body: JSON.stringify({ "holder_binding": "required" }),
})).json();
```

**Python**

```python
import os
import httpx

api = os.environ["PROVENANCE_API"]
data = httpx.put(f"{api}/v1/mandate/holder_bindings/agt_01M7Z71YM4GVGFZ5D6PQQE0VZN", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}, json={
    "holder_binding": "required"
}).json()
```
