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

# 驗證方式

> Traseq management APIs 與 Public Agent API 的驗證模型。

Traseq 目前有兩種主要驗證模型。

## Management APIs 使用 JWT

已登入使用者在管理工作空間資源時，應使用 JWT。

```http theme={null}
Authorization: Bearer <supabase_jwt>
```

這適用於像是以下端點：

* `POST /workspaces/:workspaceId/api-keys`
* `GET /workspaces/:workspaceId/api-keys`
* `DELETE /workspaces/:workspaceId/api-keys/:apiKeyId`

## Public Agent API 使用 API key

外部整合與 AI agent 存取 Public Agent API 時，應使用 API key。

建議 header：

```http theme={null}
x-api-key: trsq_live_<keyId>_<secret>
```

替代方式：

```http theme={null}
Authorization: Bearer trsq_live_<keyId>_<secret>
```

## 給 agents 的建議規則

先呼叫 `GET /public/v1/workspace`，確認：

* workspace context
* 可用 scopes
* 有效 role
* 方案限制

## 操作建議

* JWT 只用在已登入的管理流程。
* API key 用在 server-to-server integration 與 AI agent。
* 明文 API key 只會在建立當下顯示一次，必須當作 secret 保存。
