# 串接你的應用程式

把應用程式接上 Blockchain Atlantis 只需幾個步驟。

{% stepper %}
{% step %}

#### 取得 base URL 與 API key

向客戶經理取得正式 base URL，向管理員取得一把 API key。
{% endstep %}

{% step %}

#### 在每個請求帶上 key

於 HTTP header 加入 `X-API-Key: ak_live_…`。建議將 key 存於環境變數或密鑰管理服務。
{% endstep %}

{% step %}

#### 解析統一信封

成功讀 `data`／`meta`，失敗讀 `error.code`。以 `code` 做程式判斷，`message` 僅供顯示。
{% endstep %}

{% step %}

#### 處理計費與限流

讀 `X-Credit-Remaining` 掌握餘額；對 `429` 遵守 `Retry-After`，對 `5xx` 採退避重試。
{% endstep %}

{% step %}

#### 設定即時通知（選用）

需要鏈上事件即時通知時，建立 [Webhook 訂閱](https://api.atlantis.example/docs)或使用 WebSocket 串流。
{% endstep %}
{% endstepper %}

## 小提醒

* 自帶 `X-Request-Id` 可串接你自己的追蹤系統；不帶則由系統產生。
* 將不同用途的整合各用一把 key，方便個別控管與撤銷。

遇到問題？見[請求失敗怎麼辦](/help-center/zheng-he-yu-yi-nan-pai-jie/troubleshooting-failed-requests.md)。


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.blockchainsecurity.asia/help-center/zheng-he-yu-yi-nan-pai-jie/connecting-your-application.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
