# List route

URL: https://docs.hanzo.ai/docs/openapi/link/get-link-route

> Gets the failover order across your linked accounts.

`GET /v1/link/route`

> [Link →](https://docs.hanzo.ai/docs/openapi/link) · [All API references →](https://docs.hanzo.ai/docs/openapi) · [Get started →](https://docs.hanzo.ai/docs/guides)

|               |                                        |
| ------------- | -------------------------------------- |
| **Address**   | `https://api.hanzo.ai/v1/link/route`   |
| **Method**    | `GET`                                  |
| **Operation** | `get_link_route`                       |
| **Auth**      | `Authorization: Bearer $HANZO_API_KEY` |

Gets the failover order across your linked accounts.

It answers an ordered redundancy plan over the caller's LINKED (not revoked)
accounts: each candidate with its remaining rate-limit headroom, whether it is
routable right now, how it BILLS (plan or commerce), and a reason when it is
not — plus the primary to try first. It is what lets a router fail over from
one subscription to another and fall back to the metered API as the
always-available backstop, knowing the cost consequence before it dials.

It is POLICY, not execution: the plan is computed purely from the usage
snapshots already in the registry, never by probing a provider, so it is a
total function of the links and costs nothing to ask for. Actually dialing,
detecting a live 429 and advancing to the next candidate belongs to the
caller. A link with no snapshot counts as full headroom.

## Request

`GET /v1/link/route` takes no parameters and no body — the credential is the whole request.

## Response

| Status    | Body            | Meaning |
| --------- | --------------- | ------- |
| `200`     | link.RoutePlan  | ok      |
| `default` | problem-details | refused |

`200` body — 25 fields.

| Field                      | In   | Type                   | Always | Description                                                                                                                           |
| -------------------------- | ---- | ---------------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------- |
| `candidates`               | body | link.RouteCandidate\[] | —      | Candidates is every linked account in preference order: subscriptions first, then metered api-key accounts as the backstop.           |
| `candidates[].account`     | body | string                 | —      | Account is the provider-side account identifier.                                                                                      |
| `candidates[].available`   | body | boolean                | —      | Available reports whether the candidate is routable right now.                                                                        |
| `candidates[].billing`     | body | string                 | —      | Billing is the cost consequence of dialing this candidate: plan (the user's own subscription) or commerce (the metered gateway path). |
| `candidates[].headroomPct` | body | number (double)        | —      | HeadroomPct is the remaining rate-limit capacity, 0..100.                                                                             |
| `candidates[].host`        | body | string                 | —      | Host is that machine's hostname label.                                                                                                |
| `candidates[].kind`        | body | string                 | —      | Kind is how the account authenticates: subscription or apikey.                                                                        |
| `candidates[].linkId`      | body | string                 | —      | LinkID is the underlying link's opaque handle.                                                                                        |
| `candidates[].machine`     | body | string                 | —      | Machine is the machine the account is signed in on.                                                                                   |
| `candidates[].plan`        | body | string                 | —      | Plan is the provider plan label the account is on.                                                                                    |
| `candidates[].provider`    | body | string                 | —      | Provider is the AI provider the candidate account belongs to.                                                                         |
| `candidates[].reason`      | body | string                 | —      | Reason says why the candidate is not routable, when Available is false.                                                               |
| `generatedAt`              | body | string                 | —      | GeneratedAt is when the plan was computed, RFC 3339 UTC.                                                                              |
| `primary`                  | body | link.RouteCandidate    | —      |                                                                                                                                       |
| `primary.account`          | body | string                 | —      | Account is the provider-side account identifier.                                                                                      |
| `primary.available`        | body | boolean                | —      | Available reports whether the candidate is routable right now.                                                                        |
| `primary.billing`          | body | string                 | —      | Billing is the cost consequence of dialing this candidate: plan (the user's own subscription) or commerce (the metered gateway path). |
| `primary.headroomPct`      | body | number (double)        | —      | HeadroomPct is the remaining rate-limit capacity, 0..100.                                                                             |
| `primary.host`             | body | string                 | —      | Host is that machine's hostname label.                                                                                                |
| `primary.kind`             | body | string                 | —      | Kind is how the account authenticates: subscription or apikey.                                                                        |
| `primary.linkId`           | body | string                 | —      | LinkID is the underlying link's opaque handle.                                                                                        |
| `primary.machine`          | body | string                 | —      | Machine is the machine the account is signed in on.                                                                                   |
| `primary.plan`             | body | string                 | —      | Plan is the provider plan label the account is on.                                                                                    |
| `primary.provider`         | body | string                 | —      | Provider is the AI provider the candidate account belongs to.                                                                         |
| `primary.reason`           | body | string                 | —      | Reason says why the candidate is not routable, when Available is false.                                                               |

Failure carries the platform error shape — see [Errors](https://docs.hanzo.ai/docs/errors).

## Examples

**CLI**

```bash
hanzo auth link route
```

**SDK**

**.ts**

```ts
import { Configuration, LinkApi } from 'hanzoai';

const api = new LinkApi(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data } = await api.getLinkRoute();
```

**.py**

```python
from hanzoai.cloud import ApiClient, Configuration
from hanzoai.cloud.api import LinkApi

client = ApiClient(Configuration(access_token=os.environ["HANZO_API_KEY"]))
result = LinkApi(client).get_link_route()
```

**.go**

```go
cfg := hanzoai.NewConfiguration()
cfg.AddDefaultHeader("Authorization", "Bearer "+os.Getenv("HANZO_API_KEY"))
client := hanzoai.NewAPIClient(cfg)

resp, _, err := client.LinkAPI.GetLinkRoute(context.Background()).Execute()
if err != nil {
	return err
}
```

**.rs**

```rust
use hanzo_client::apis::{configuration::Configuration, link_api};

let mut cfg = Configuration::new();
cfg.bearer_access_token = std::env::var("HANZO_API_KEY").ok();

let result = link_api::get_link_route(&cfg, Default::default()).await?;
```

**.java**

```java
import ai.hanzo.cloud.ApiClient;
import ai.hanzo.cloud.api.LinkApi;

ApiClient client = new ApiClient();
client.setBearerToken(System.getenv("HANZO_API_KEY"));

var result = new LinkApi(client).getLinkRoute();
```

**HTTP**

```bash
curl https://api.hanzo.ai/v1/link/route \
  -H "Authorization: Bearer $HANZO_API_KEY"
```

**MCP**

Tool `link`, op `get_link_route` — POST the JSON-RPC envelope to `https://api.hanzo.ai/v1/mcp`.

```bash
curl -X POST https://api.hanzo.ai/v1/mcp \
  -H "Authorization: Bearer $HANZO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
       "jsonrpc": "2.0",
       "id": 1,
       "method": "tools/call",
       "params": {
         "name": "link",
         "arguments": {
           "op": "get_link_route",
           "input": {}
         }
       }
     }'
```

---

[Link API](https://docs.hanzo.ai/docs/openapi/link) · [All Hanzo APIs](https://docs.hanzo.ai/docs/openapi) · [Interactive reference](https://docs.hanzo.ai/docs/openapi/reference)
