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

# API 參考概覽

> AgentWallex REST API 的基礎 URL、身份驗證、分頁和錯誤規範。

## 基礎 URL

```
Sandbox:    https://api-sandbox.agentwallex.com/api/v1
Production: https://api.agentwallex.com/api/v1
```

<Note>
  開發和測試請使用 sandbox URL。僅在準備好使用真實資金進行交易時才切換至 production。
</Note>

## 身份驗證

所有 API 請求必須包含以下其中一個身份驗證標頭：

| 方式         | 標頭              | 範例                                    |
| ---------- | --------------- | ------------------------------------- |
| API Key    | `X-API-Key`     | `X-API-Key: awx_your_api_key`         |
| JWT Bearer | `Authorization` | `Authorization: Bearer eyJhbGciOi...` |

```bash theme={null}
# API key authentication
curl -X GET https://api.agentwallex.com/api/v1/agents \
  -H "X-API-Key: awx_your_api_key"

# JWT authentication
curl -X GET https://api.agentwallex.com/api/v1/agents \
  -H "Authorization: Bearer eyJhbGciOi..."
```

請參閱[身份驗證](/zh-Hant/introduction/authentication)了解取得和管理憑證的完整詳情。

## 分頁

所有列表端點都支援以下查詢參數的分頁：

| 參數          | 預設值 | 最大值 | 說明         |
| ----------- | --- | --- | ---------- |
| `page_num`  | 1   | --  | 頁碼（從 1 開始） |
| `page_size` | 20  | 100 | 每頁項目數      |

回應格式：

```json theme={null}
{
  "data": [],
  "total": 42,
  "has_more": true
}
```

## 錯誤規範

所有錯誤遵循一致的格式：

```json theme={null}
{
  "code": "invalid_request",
  "type": "invalid_request_error",
  "message": "human readable error description"
}
```

### 錯誤類型

| 類型                      | HTTP 狀態碼 | 說明         |
| ----------------------- | -------- | ---------- |
| `invalid_request_error` | 400      | 無效的請求主體或參數 |
| `authentication_error`  | 401      | 缺少或無效的憑證   |
| `authorization_error`   | 403      | 權限不足       |
| `not_found_error`       | 404      | 資源不存在      |
| `rate_limit_error`      | 429      | 超過速率限制     |
| `internal_error`        | 500      | 伺服器端錯誤     |

請參閱[錯誤處理](/zh-Hant/guides/error-handling)了解處理錯誤的詳細指引。

## API 區段

<CardGroup cols={2}>
  <Card title="代理" icon="robot" href="/zh-Hant/api-reference/agents-create">
    建立和管理 AI 代理錢包。
  </Card>

  <Card title="交易" icon="arrow-right-arrow-left" href="/zh-Hant/api-reference/transactions-create">
    發送付款和查詢交易歷史。
  </Card>

  <Card title="策略" icon="shield-check" href="/zh-Hant/api-reference/policies">
    配置支出限額和存取控制。
  </Card>

  <Card title="Webhooks" icon="bell" href="/zh-Hant/api-reference/webhooks">
    註冊和管理 webhook 端點。
  </Card>

  <Card title="x402 Pay" icon="credit-card" href="/zh-Hant/api-reference/x402-pay">
    觸發 x402 微型支付協商。
  </Card>

  <Card title="x402 Sessions" icon="clock" href="/zh-Hant/api-reference/x402-sessions">
    管理 x402 工作階段預算。
  </Card>
</CardGroup>
