Gets the failover order across your linked accounts.
Gets the failover order across your linked accounts.
GET /v1/link/route
| 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 | RoutePlan | ok |
200 body — 25 fields.
| Field | In | Type | Always | Description |
|---|---|---|---|---|
candidates | body | 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 | — | 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 | 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 | — | 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.
Examples
hanzo links routeimport { Configuration, LinkApi } from 'hanzoai';
const api = new LinkApi(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data } = await api.getLinkRoute();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()cfg := cloud.NewConfiguration()
cfg.AddDefaultHeader("Authorization", "Bearer "+os.Getenv("HANZO_API_KEY"))
client := cloud.NewAPIClient(cfg)
resp, _, err := client.LinkAPI.GetLinkRoute(context.Background()).Execute()
if err != nil {
return err
}use hanzo_cloud::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?;import ai.hanzo.cloud.ApiClient;
import ai.hanzo.cloud.api.LinkApi;
ApiClient client = new ApiClient();
client.setRequestInterceptor(b -> b.header("Authorization", "Bearer " + System.getenv("HANZO_API_KEY")));
var result = new LinkApi(client).getLinkRoute();The method above is the one at the current release of the document. [email protected] (npm) and [email protected] (PyPI) were generated from an earlier release, where this operation carried a different id, so it spells the method differently — regenerating the clients is what makes the two agree. SDKs →
curl https://api.hanzo.ai/v1/link/route \
-H "Authorization: Bearer $HANZO_API_KEY"Tool link, op get_link_route — POST the JSON-RPC envelope to https://api.hanzo.ai/v1/mcp.
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": {}
}
}
}'How is this guide?