# prov.mandate.grants.externalHandoff

prov.mandate.grants.externalHandoff in Node SDK. An external hand-off as the account reads it (pending, minted with the grant's id, or declined).

## Signature

```ts
prov.mandate.grants.externalHandoff(handoffId: string): Promise<ExternalHandoff>
```

## Parameters

- `handoffId` (string)

## Returns

`Promise<ExternalHandoff>`

## HTTP operation

[`GET /v1/mandate/external_handoffs/{id}`](https://provenanceauth.com/docs/api/grants.md#get-v1-mandate-external-handoffs-id): Retrieve an external hand-off

## Errors

- [`authentication_required`](https://provenanceauth.com/docs/platform/errors.md#authentication_required)
- [`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 step1 = 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",
    "purpose": "Book Maya's Lisbon trip",
    "constraints": {
      "max_amount": 1200,
      "budget_amount": 2400,
      "budget_window": "month",
      "currency": "USD",
      "expires_at": "2027-12-31T23:59:59Z"
    }
  }),
})).json();
const mandateId = step1.id;
const step2 = await (await fetch(`${process.env.PROVENANCE_API}/v1/mandate/grants/${mandateId}/delegate`, {
  method: "POST",
  headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", "Content-Type": "application/json" },
  body: JSON.stringify({
    "agent_session_id": "sess_valet_flights_1",
    "purpose": "Hold seat 14C on TP1351",
    "constraints": {
      "max_amount": 600,
      "budget_amount": 600
    },
    "receiver": {
      "kind": "key",
      "name": "SkyDesk Seats",
      "origin": "https://seats.skydesk.example"
    },
    "holder_key": {
      "kty": "EC",
      "crv": "P-256",
      "x": "NeVHu4qeD40iEEgSDcTm26Y0xApkjq41T6BuENVl0js",
      "y": "qS59-GAPcl0bJ-yYFvPJA3omsU9DJFedMw4rou5cXo8"
    }
  }),
})).json();
const handoffId = step2.id;
const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/mandate/external_handoffs/${handoffId}`, {
  headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5" },
})).json();
```

**Python**

```python
import os
import httpx

api = os.environ["PROVENANCE_API"]
step1 = httpx.post(f"{api}/v1/mandate/grants", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}, json={
    "device_id": "dev_00000000000000000000000000000001",
    "purpose": "Book Maya's Lisbon trip",
    "constraints": {
        "max_amount": 1200,
        "budget_amount": 2400,
        "budget_window": "month",
        "currency": "USD",
        "expires_at": "2027-12-31T23:59:59Z"
    }
}).json()
mandate_id = step1["id"]
step2 = httpx.post(f"{api}/v1/mandate/grants/{mandate_id}/delegate", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}, json={
    "agent_session_id": "sess_valet_flights_1",
    "purpose": "Hold seat 14C on TP1351",
    "constraints": {
        "max_amount": 600,
        "budget_amount": 600
    },
    "receiver": {
        "kind": "key",
        "name": "SkyDesk Seats",
        "origin": "https://seats.skydesk.example"
    },
    "holder_key": {
        "kty": "EC",
        "crv": "P-256",
        "x": "NeVHu4qeD40iEEgSDcTm26Y0xApkjq41T6BuENVl0js",
        "y": "qS59-GAPcl0bJ-yYFvPJA3omsU9DJFedMw4rou5cXo8"
    }
}).json()
handoff_id = step2["id"]
data = httpx.get(f"{api}/v1/mandate/external_handoffs/{handoff_id}", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}).json()
```
