# Get link

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

> Reads one linked account.

`GET /v1/link/{id}`

> [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/{id}`    |
| **Method**    | `GET`                                  |
| **Operation** | `get_link_by_id`                       |
| **Auth**      | `Authorization: Bearer $HANZO_API_KEY` |

Reads one linked account.

It answers a single link — its device, provider, account, plan, how it bills,
its status and its latest usage snapshot. An id that does not exist, or
belongs to another user or org, is the same 404: the scope is a bound
predicate on the read, so a wrong id and a foreign id are indistinguishable
and neither confirms the other's existence. The static paths on this
collection — route, usage, devices — register before this one and win
first-match, so a link whose id collided with one of those words could not be
addressed here.

## Request

1 field.

| Field | In   | Type   | Required | Description                              |
| ----- | ---- | ------ | -------- | ---------------------------------------- |
| `id`  | path | string | yes      | ID is the link to act on, from the path. |

## Response

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

`200` body — 15 fields.

| Field       | In   | Type   | Always | Description                                                                                                                                          |
| ----------- | ---- | ------ | ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
| `account`   | body | string | —      | Account is the provider-side account identifier, when the collector knows it.                                                                        |
| `billing`   | body | string | —      | Billing is how this account's inference bills — plan (the user's own subscription, metered here for visibility only) or commerce (the gateway path). |
| `createdAt` | body | string | —      | CreatedAt is when the link was first registered, RFC 3339 UTC.                                                                                       |
| `host`      | body | string | —      | Host is the machine's human hostname label, from its most recent report.                                                                             |
| `id`        | body | string | —      | ID is the link's opaque handle ("link\_" + 32 hex chars).                                                                                            |
| `kind`      | body | string | —      | Kind is how the account authenticates: subscription or apikey.                                                                                       |
| `lastSeen`  | body | string | —      | LastSeen is when the account last reported, RFC 3339 UTC.                                                                                            |
| `machine`   | body | string | —      | Machine is the stable machine identifier the collector reports.                                                                                      |
| `os`        | body | string | —      | OS is the machine's operating system label.                                                                                                          |
| `plan`      | body | string | —      | Plan is the provider plan label (e.g. "Claude Max").                                                                                                 |
| `provider`  | body | string | —      | Provider is the AI provider this account belongs to (claude, openai, hanzo…).                                                                        |
| `status`    | body | string | —      | Status is linked or revoked.                                                                                                                         |
| `updatedAt` | body | string | —      | UpdatedAt is when the link was last refreshed, RFC 3339 UTC.                                                                                         |
| `usage`     | body | any    | —      | Usage is the last good usage snapshot, clamped and re-serialized to known fields at ingest.                                                          |
| `user`      | body | string | —      | User is the owning subject — the validated caller who registered the link.                                                                           |

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

## Examples

**CLI**

```bash
hanzo auth link get <id>
```

**SDK**

**.ts**

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

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

**.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_by_id(id='id')
```

**.go**

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

resp, _, err := client.LinkAPI.GetLinkById(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_by_id(&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).getLinkById();
```

**HTTP**

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

**MCP**

Tool `link`, op `get_link_by_id` — 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_by_id",
           "input": {
             "id": "<id>"
           }
         }
       }
     }'
```

---

[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)
