NVMe Việt Nam / API Documentation - HCI VPS API
Đăng nhập Đăng ký
Thông báo hệ thống Mới
Hệ thống Cloud VPS NVMe Việt Nam hoạt động ổn định 24/7 tại xvpsvn.com.

HCI VPS API Documentation

Tài liệu API đầy đủ cho việc tích hợp hệ thống VPS white-label

Base URL: https://hci.mtdvps.com/api/hci

Giới thiệu

HCI VPS API là RESTful API cho phép đại lý tích hợp dịch vụ VPS vào hệ thống của mình. API hỗ trợ đầy đủ các thao tác: xem sản phẩm, tạo đơn hàng, quản lý VPS và theo dõi số dư.

Format: Tất cả request và response đều sử dụng JSON.
Encoding: UTF-8
Rate Limit: 100 requests/phút (mặc định)

Xác thực

Mọi request đều cần API Key được gửi qua header.

API Key

Thêm header X-API-Key: HCI_your_api_key vào mọi request.

Request Header
X-API-Key: HCI_your_api_key Content-Type: application/json

Mã lỗi

API sử dụng các HTTP status code chuẩn để thông báo kết quả.

Code Ý nghĩa Mô tả
200 Success Request thành công
201 Created Tạo mới thành công (order, etc.)
400 Bad Request Thiếu hoặc sai tham số
401 Unauthorized API Key không hợp lệ hoặc hết hạn
402 Payment Required Số dư không đủ
403 Forbidden Không có quyền truy cập
404 Not Found Không tìm thấy resource
429 Too Many Requests Vượt quá rate limit
500 Server Error Lỗi server, vui lòng thử lại

Agency

GET /agency/profile

Lấy thông tin chi tiết tài khoản đại lý.

Response
{ "success": true, "code": 200, "data": { "agency_id": 1, "company_name": "Công ty ABC", "contact_name": "Nguyễn Văn A", "email": "[email protected]", "balance": 5000000, "discount_percent": 10, "stats": { "total_orders": 50, "active_orders": 35, "total_spent": 15000000 } } }
GET /agency/balance

Lấy thông tin số dư và lịch sử giao dịch gần đây.

Response
{ "success": true, "data": { "balance": 5000000, "credit_limit": 2000000, "available_credit": 7000000, "currency": "VND", "recent_transactions": [...] } }

Products

GET /products

Lấy danh sách tất cả sản phẩm VPS có sẵn, với giá đã áp dụng chiết khấu.

Query Parameters

Parameter Type Description
type string Loại sản phẩm: vps_vn, vps_nn, proxy, all (default: all)
Response
{ "success": true, "data": { "products": [ { "id": 1, "h2_product_id": "VPS-VN-1", "name": "VPS Việt Nam - Basic", "specs": { "cpu": 1, "ram": "1GB", "storage": "20GB SSD" }, "location": "Hà Nội", "original_price": 99000, "agency_price": 89100, "discount_percent": 10 } ], "total": 5 } }
GET /products/os

Lấy danh sách hệ điều hành có sẵn cho VPS.

Response
{ "success": true, "data": [ { "id": "ubuntu-22.04", "name": "Ubuntu 22.04 LTS" }, { "id": "centos-7", "name": "CentOS 7" }, { "id": "windows-2022", "name": "Windows Server 2022" } ] }

Orders

POST /order/create

Tạo đơn hàng VPS Việt Nam mới. Số tiền sẽ tự động trừ từ số dư đại lý.

Request Body

Parameter Type Required Description
product_id string|int Yes ID sản phẩm (từ /products)
os string Yes ID hệ điều hành (từ /products/os)
billing_cycle string No monthly, quarterly, yearly (default: monthly)
quantity int No Số lượng (default: 1)
external_order_id string No ID đơn hàng từ hệ thống của bạn
customer_email string No Email khách hàng cuối
Request
{ "product_id": "VPS-VN-2", "os": "ubuntu-22.04", "billing_cycle": "monthly", "external_order_id": "MY_ORDER_123", "customer_email": "[email protected]" }
Response (201 Created)
{ "success": true, "code": 201, "message": "Order created successfully", "data": { "order_id": 12345, "external_order_id": "MY_ORDER_123", "status": "active", "total_amount": 179100, "new_balance": 4820900, "vps_info": { "ip": "103.xxx.xxx.xxx", "username": "root", "password": "xxxxxxxxxx", "hostname": "vps-12345.hci.vn" }, "expires_at": "2026-02-08 22:00:00" } }

VPS Control

POST /vps/action

Thực hiện hành động trên VPS: start, stop, restart.

Request Body

Parameter Type Required Description
order_id int Yes ID đơn hàng VPS
action string Yes start, stop, hoặc restart
Request
{ "order_id": 12345, "action": "restart" }
Response
{ "success": true, "data": { "order_id": 12345, "action": "restart", "status": "completed", "message": "VPS restart command sent successfully" } }
POST /vps/reinstall

Cài đặt lại hệ điều hành cho VPS. Mọi dữ liệu sẽ bị xóa!

Request Body

Parameter Type Required Description
order_id int Yes ID đơn hàng VPS
os string Yes ID hệ điều hành mới
Response
{ "success": true, "data": { "order_id": 12345, "new_os": "centos-7", "status": "processing", "message": "VPS reinstall initiated", "new_credentials": { "username": "root", "password": "new_password_xxx" } } }