> ## 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.

# Tổng quan Tài liệu API

> URL cơ sở, xác thực, phân trang và hợp đồng lỗi cho REST API AgentWallex.

## URL Cơ sở

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

<Note>
  Sử dụng URL sandbox cho phát triển và thử nghiệm. Chỉ chuyển sang production khi bạn sẵn sàng giao dịch với quỹ thực.
</Note>

## Xác thực

Tất cả yêu cầu API phải bao gồm một trong các header xác thực sau:

| Phương thức | Header          | Ví dụ                                 |
| ----------- | --------------- | ------------------------------------- |
| 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..."
```

Xem [Xác thực](/vi/introduction/authentication) để biết chi tiết đầy đủ về cách lấy và quản lý thông tin xác thực.

## Phân trang

Tất cả endpoint danh sách hỗ trợ phân trang với các tham số truy vấn sau:

| Tham số     | Mặc định | Tối đa | Mô tả                   |
| ----------- | -------- | ------ | ----------------------- |
| `page_num`  | 1        | --     | Số trang (bắt đầu từ 1) |
| `page_size` | 20       | 100    | Số mục trên mỗi trang   |

Định dạng phản hồi:

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

## Hợp đồng Lỗi

Tất cả lỗi tuân theo định dạng nhất quán:

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

### Các Loại Lỗi

| Loại                    | Mã HTTP | Mô tả                                      |
| ----------------------- | ------- | ------------------------------------------ |
| `invalid_request_error` | 400     | Nội dung yêu cầu hoặc tham số không hợp lệ |
| `authentication_error`  | 401     | Thiếu hoặc thông tin xác thực không hợp lệ |
| `authorization_error`   | 403     | Không đủ quyền                             |
| `not_found_error`       | 404     | Tài nguyên không tồn tại                   |
| `rate_limit_error`      | 429     | Vượt quá giới hạn tốc độ                   |
| `internal_error`        | 500     | Lỗi phía server                            |

Xem [Xử lý Lỗi](/vi/guides/error-handling) để biết hướng dẫn chi tiết về cách xử lý lỗi.

## Các Mục API

<CardGroup cols={2}>
  <Card title="Tác nhân" icon="robot" href="/vi/api-reference/agents-create">
    Tạo và quản lý ví tác nhân AI.
  </Card>

  <Card title="Giao dịch" icon="arrow-right-arrow-left" href="/vi/api-reference/transactions-create">
    Gửi thanh toán và truy vấn lịch sử giao dịch.
  </Card>

  <Card title="Chính sách" icon="shield-check" href="/vi/api-reference/policies">
    Cấu hình giới hạn chi tiêu và kiểm soát truy cập.
  </Card>

  <Card title="Webhook" icon="bell" href="/vi/api-reference/webhooks">
    Đăng ký và quản lý endpoint webhook.
  </Card>

  <Card title="x402 Pay" icon="credit-card" href="/vi/api-reference/x402-pay">
    Kích hoạt thương lượng thanh toán nhỏ x402.
  </Card>

  <Card title="Phiên x402" icon="clock" href="/vi/api-reference/x402-sessions">
    Quản lý ngân sách phiên x402.
  </Card>
</CardGroup>
