🚀 Tài liệu API Thuê Sim OTP

Tài liệu tích hợp API dành cho khách hàng sử dụng dịch vụ thuê sim tại thilyquan.xyz

🔑 Xác thực

Tất cả API đều cần api_key để sử dụng.
API key Chưa đăng nhập
Bạn chưa đăng nhập. Vui lòng đăng nhập tài khoản để xem api_key của mình.

📋 1. Lấy danh sách dịch vụ

GET /api_thuesim/services.php
Tham số:
Ví dụ tất cả dịch vụ:
https://thilyquan.xyz/api_thuesim/services.php?api_key=YOUR_API_KEY
Ví dụ sim Việt Nam:
https://thilyquan.xyz/api_thuesim/services.php?api_key=YOUR_API_KEY&country=vn
Ví dụ sim Lào:
https://thilyquan.xyz/api_thuesim/services.php?api_key=YOUR_API_KEY&country=la
Response mẫu:
{ "success": true, "message": "OK", "data": { "count": 1, "items": [ { "service_id": 78, "name": "Facebook", "country": "vn", "price": 1600, "status": "active" } ] } }

💰 2. Kiểm tra số dư

GET /api_thuesim/balance.php
Ví dụ:
https://thilyquan.xyz/api_thuesim/balance.php?api_key=YOUR_API_KEY
Response mẫu:
{ "success": true, "message": "OK", "data": { "user_id": 1, "username": "demo", "balance": 100000 } }

📲 3. Tạo đơn thuê sim

POST /api_thuesim/add.php
Tham số:
Ví dụ CURL:
curl -X POST "https://thilyquan.xyz/api_thuesim/add.php" -d "api_key=YOUR_API_KEY" -d "service_id=78" -d "country=vn"
Response mẫu:
{ "success": true, "message": "Tạo đơn thành công", "data": { "order_id": 1234, "request_id": "512104214", "service_id": 78, "service_name": "Facebook", "country": "vn", "price": 1600, "phone": "03xxxxxxxx", "status": "pending" } }

📩 4. Kiểm tra OTP / trạng thái đơn

GET /api_thuesim/status.php
Tham số:
Ví dụ theo order_id:
https://thilyquan.xyz/api_thuesim/status.php?api_key=YOUR_API_KEY&order_id=1234
Ví dụ theo request_id:
https://thilyquan.xyz/api_thuesim/status.php?api_key=YOUR_API_KEY&request_id=512104214
Ví dụ theo trans_id (giống lịch sử web):
https://thilyquan.xyz/api_thuesim/status.php?api_key=YOUR_API_KEY&trans_id=TSIM1773899527609
Response mẫu:
{ "success": true, "message": "OK", "data": { "order_id": 1234, "trans_id": "TSIM1773899527609", "request_id": "512104214", "service_id": 78, "service_name": "Facebook", "country": "vn", "price": 1600, "phone": "03xxxxxxxx", "code": "123456", "status": "ok", "created_at": "2025-10-11 17:47:47", "updated_at": "2025-10-11 17:49:03" } }
👉 trans_id là mã đơn hiển thị trong lịch sử đơn hàng trên web.
👉 Nên dùng trans_id để đối chiếu và hỗ trợ khách hàng.

📦 5. Lịch sử đơn

GET /api_thuesim/orders.php
Tham số:
Ví dụ:
https://thilyquan.xyz/api_thuesim/orders.php?api_key=YOUR_API_KEY&page=1&limit=20
Response mẫu:
{ "success": true, "message": "OK", "data": { "items": [ { "order_id": 1234, "request_id": "512104214", "service_name": "Facebook", "country": "vn", "price": 1600, "phone": "03xxxxxxxx", "code": "123456", "status": "ok", "created_at": "2025-10-11 17:47:47", "updated_at": "2025-10-11 17:49:03" } ], "pagination": { "page": 1, "limit": 20, "total": 1 } } }

⚠️ Lỗi thường gặp