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

# REST API

> Burokku REST API v1：基礎 URL、驗證、回答格式，以及每個端點的參考文件。

```text theme={null}
https://api.burokku.app/v1
```

REST API 擁有和[連接器](https://docs.burokku.app/zh-Hant/ai-apps/overview.md)相同的九個操作，輸入和回答也都相同。你可以在自己的指令碼、伺服器和應用程式中使用它。

## 驗證

以 Bearer 權杖的形式傳送 [API 金鑰](https://docs.burokku.app/zh-Hant/developers/authentication.md)，或為 `https://api.burokku.app/v1` 簽發的 [OAuth 存取權杖](https://docs.burokku.app/zh-Hant/developers/authentication.md)。為連接器簽發的權杖會被拒絕，並傳回 `401`。

```bash theme={null}
curl https://api.burokku.app/v1/holdings?symbol=ETH \
  -H "Authorization: Bearer $BUROKKU_API_KEY"
```

API 不讀取任何 Cookie。它會回應來自任何來源的 CORS 請求（不含憑證），所以這些頁面上的 Playground 可以用你的金鑰呼叫它。在你自己的應用程式中，請把金鑰放在伺服器上。

## 請求

* **讀取**使用 `GET`，輸入以查詢參數傳送。
* **兩個寫入操作**使用 `POST`，搭配 JSON 本文（`Content-Type: application/json`）。
* 執行任何動作之前都會先檢查輸入。不正確的輸入會得到 `400` 和 `bad-input`，並列出每個欄位。
* **錯誤**的格式是 `{"error": {"code", "message"}}`，訊息會使用 `Accept-Language` 要求的語言，否則使用英文。

## 回答

* **JSON** 格式，金額以美元表示（`*_usd`），百分比以數字表示（`12.5` 代表 12.5%）。
* **`currency`** 是你帳戶的幣別及每 1 美元的換算單位，用來換算這些數字。
* **`read_at`** 是數字的讀取時間；當 Burokku 正在回答背後重新讀取你的帳戶時，**`refreshing`** 為 true。
* **帳戶和提醒附有穩定的不透明 ID**（`id`、`account_id`），地址也會完整提供。把帳戶的 ID 當作 `account` 傳入，即可依該帳戶篩選。

## 端點

| 方法和路徑 | 操作 |
| - | - |
| `GET /v1/portfolio` | [資產組合摘要](https://docs.burokku.app/zh-Hant/developers/mcp.md#portfolio_summary) |
| `GET /v1/holdings` | [持倉](https://docs.burokku.app/zh-Hant/developers/mcp.md#holdings) |
| `GET /v1/positions` | [倉位](https://docs.burokku.app/zh-Hant/developers/mcp.md#positions) |
| `GET /v1/risk/liquidation` | [清算風險](https://docs.burokku.app/zh-Hant/developers/mcp.md#liquidation_risk) |
| `GET /v1/pnl` | [損益](https://docs.burokku.app/zh-Hant/developers/mcp.md#pnl) |
| `GET /v1/activity` | [活動紀錄](https://docs.burokku.app/zh-Hant/developers/mcp.md#activity) |
| `GET /v1/alerts` | [提醒](https://docs.burokku.app/zh-Hant/developers/mcp.md#list_alerts) |
| `POST /v1/alerts` | [建立價格提醒](https://docs.burokku.app/zh-Hant/developers/mcp.md#create_price_alert) |
| `POST /v1/accounts/watch` | [觀察地址](https://docs.burokku.app/zh-Hant/developers/mcp.md#add_watch_address) |

每個端點在本節都有一個頁面，附上完整的結構描述和 Playground。OpenAPI 3.1 文件是 [`openapi.json`](https://docs.burokku.app/openapi.json)。

速率限制、錯誤代碼、分頁和版本控制，請參閱[限制與錯誤](https://docs.burokku.app/zh-Hant/developers/limits-and-errors.md)。


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