> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ariacompute.cn/llms.txt
> Use this file to discover all available pages before exploring further.

# Aria Compute 账户链接

> 获取已链接的 Aria Compute（serve）账户公开信息，或重新同步 API 密钥元数据。

ROUTER 可以链接一个 Aria Compute（serve）账户，用于跨产品鉴权和计量。本页两个接口分别读取链接状态和重新同步密钥元数据。

<Warning>
  两个接口都要求已登录（`gate_if_users`），未登录时返回未认证错误。
</Warning>

## 获取链接账户

```http theme={null}
GET /v1/router/serve/account
```

返回当前链接的 serve 账户公开信息。

## 重新同步账户

```http theme={null}
POST /v1/router/serve/account/sync
```

用本地存储的 serve API 密钥（优先）或短期链接令牌，重新拉取 serve 侧的密钥列表，并据此更新本地公开信息。如果 serve 返回 `401/403`，或者已存密钥的前缀不在返回列表里，就把这个密钥标记为已删除/已吊销，仪表盘随之更新，ROUTER 也不再用它鉴权。网络错误或超时则保持原状态。

## 响应

两个接口均返回 `ServeAccountPublic`：

<ResponseField name="linked" type="boolean">
  是否已链接 serve 用户。
</ResponseField>

<ResponseField name="site" type="string | null">
  链接的站点标识。
</ResponseField>

<ResponseField name="site_url" type="string | null">
  serve 站点 URL。
</ResponseField>

<ResponseField name="gateway_url" type="string | null">
  serve 网关 URL。
</ResponseField>

<ResponseField name="user" type="object | null">
  链接的 serve 用户信息（含 id、name、email 等）。
</ResponseField>

<ResponseField name="linked_at" type="string | null">
  链接时间（ISO 8601）。
</ResponseField>

<ResponseField name="api_key_name" type="string | null">
  链接密钥名称。
</ResponseField>

<ResponseField name="api_key_prefix" type="string | null">
  链接密钥前缀（用于展示）。
</ResponseField>

<ResponseField name="api_key_configured" type="boolean">
  本地是否存有非空密钥。
</ResponseField>

<ResponseField name="api_key_deleted" type="boolean">
  这个密钥是否已在 serve 侧被删除/吊销。
</ResponseField>

<ResponseField name="status" type="string">
  链接状态，例如 `linked`、`key only, not linked`、`api key deleted on serve`、`not linked`。
</ResponseField>

## 示例

```bash theme={null}
curl -s https://router.example.com/v1/router/serve/account \
  -H "Authorization: Bearer <api-key>"
```

```json theme={null}
{
  "linked": true,
  "site": "cn",
  "site_url": "https://ariacompute.cn",
  "gateway_url": "https://gw.ariacompute.cn",
  "user": { "id": "u_1", "name": "alice", "email": "alice@example.com" },
  "linked_at": "2026-01-02T03:04:05Z",
  "api_key_name": "router-link",
  "api_key_prefix": "sk-bf-abc1",
  "api_key_configured": true,
  "api_key_deleted": false,
  "status": "linked"
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.