API Platform
Tích hợp hệ thống mua tài khoản số và đọc email OTP tự động vào phần mềm của bạn chỉ với vài dòng code. Toàn bộ API dùng định dạng JSON, giao thức HTTPS.
http://localhost:8888Tất cả endpoint đều trả về JSON. Xác thực qua header
Authorization: Bearer <api_key> hoặc field api_key trong body.
Đăng nhập bằng username/password. Phản hồi trả về api_key dùng để xác thực toàn bộ các endpoint sau.
| Tên | Kiểu | Bắt buộc | Mô tả |
|---|---|---|---|
| username | string | required | Tên đăng nhập đã đăng ký |
| password | string | required | Mật khẩu |
import requests
res = requests.post("http://localhost:8888/api/auth/login", json={
"username": "your_username",
"password": "your_password"
})
data = res.json()
api_key = data["api_key"]
print("API Key:", api_key)
{"api_key": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"}{"detail": "Invalid username or password"}Trả về thông tin tài khoản hiện tại: username, họ tên, và số dư ví.
res = requests.get("http://localhost:8888/api/auth/me",
headers={"Authorization": f"Bearer {api_key}"}
)
print(res.json())
{"username": "khach123", "fullname": "Nguyễn Văn A", "balance": 150000}
Trả về toàn bộ danh sách sản phẩm đang bán kèm tên danh mục, giá, số lượng còn hàng và mã danh mục dùng để mua hàng.
res = requests.get("http://localhost:8888/api/products")
products = res.json()
for p in products:
print(p["category_name"], p["name"], p["price"], p["stock"], p["category_code"])
[
{
"id": 1,
"name": "Gmail Cổ 2010",
"description": "Gmail tạo trước 2010, đã xác minh",
"price": 5000,
"stock": 42,
"category_name": "Tài Khoản Mạng Xã Hội",
"category_code": "gmail_old",
"category_icon": "gmail"
}
]
Mua ngay 1 tài khoản từ danh mục chỉ định. Hệ thống trừ tiền và trả về nội dung tài khoản (email|password|...) trong phản hồi. Mỗi lần gọi mua 1 tài khoản.
| Tên | Kiểu | Bắt buộc | Mô tả |
|---|---|---|---|
| api_key | string | required | API Key của bạn |
| product_id | integer | required | ID của sản phẩm cụ thể cần mua (lấy từ /api/products). |
| quantity | integer | optional | Số lượng cần mua (mặc định: 1) |
res = requests.post("http://localhost:8888/api/buy", json={
"api_key": api_key,
"product_id": 3, # Mua sản phẩm cụ thể (lấy từ /api/products)
"quantity": 1 # Số lượng mua
})
data = res.json()
account_content = data["data"] # "email|password|token|..."
print("Tài khoản:", account_content)
{
"status": "success",
"data": "example@outlook.com|P@ssword123|eyJhbGci...|client_id_xxx",
"balance": 145000,
"sold_at": "2026-06-10T06:30:00.000000"
}{"detail": "Insufficient balance"} // Số dư không đủ
{"detail": "Out of stock"} // Hết hàng
{"detail": "Category not found"} // Sai mã danh mục
{"detail": "Invalid API Key"} // API Key sai
data có định dạng email|password|refresh_token|client_id. Cần lưu lại email để hoàn tiền hoặc đọc email sau.
Hoàn tiền và trả lại tài khoản nếu gọi trong vòng 5 phút sau khi mua, với điều kiện hòm thư của tài khoản chưa nhận được bất kỳ mã xác minh/OTP nào kể từ lúc mua. Nếu phát hiện có thư chứa mã xác minh, hệ thống sẽ coi là tài khoản đã sử dụng và từ chối hoàn tiền.
| Tên | Kiểu | Bắt buộc | Mô tả |
|---|---|---|---|
| api_key | string | required | API Key của bạn |
| string | required | Email của tài khoản vừa mua (phần trước dấu | trong data) |
email = data["data"].split("|")[0] # lấy email từ kết quả mua
res = requests.post("http://localhost:8888/api/refund", json={
"api_key": api_key,
"email": email
})
print(res.json())
{"status": "success", "message": "Refunded successfully", "balance": 150000}
{"detail": "Refund period expired (max 5 minutes)"}
Đưa danh sách tài khoản vào kho hàng của một sản phẩm cụ thể thông qua product_id. Yêu cầu api_key hợp lệ. Hệ thống tự động lọc trùng lặp và cập nhật số lượng tồn kho trên web ngay lập tức.
| Tên | Kiểu | Bắt buộc | Mô tả |
|---|---|---|---|
| api_key | string | required | Token xác thực của bạn |
| product_id | integer | required | ID của sản phẩm cần thêm kho (lấy từ /api/products) |
| accounts | string | required | Danh sách tài khoản, mỗi dòng một tài khoản (định dạng: email|pass|token|client_id) |
import requests
api_key = "your_token_here"
accounts_text = """email1@outlook.com|pass1|refresh_token1|client_id1
email2@outlook.com|pass2|refresh_token2|client_id2"""
res = requests.post("http://localhost:8888/api/stocks/upload", json={
"api_key": api_key,
"product_id": 1, # ID sản phẩm cụ thể
"accounts": accounts_text
})
print(res.json())
{
"status": "success",
"product_id": 1,
"product_name": "Hotmail outlook trust ive 6-12 tháng",
"added": 2,
"skipped_duplicates": 0,
"total_stock": 102
}
skipped_duplicates cho biết số lượng bị bỏ qua.
Đọc 10 email mới nhất trong hộp thư đến của tài khoản Outlook/Hotmail đã mua. Hệ thống tự lấy Access Token qua OAuth2 (Refresh Token), tìm email theo từ khóa và trích xuất mã OTP (6–8 chữ số).
| Tên | Kiểu | Bắt buộc | Mô tả |
|---|---|---|---|
| api_key | string | required | API Key của bạn |
| string | required | Email của tài khoản đã mua | |
| keyword | string | required | Từ khóa tìm trong tiêu đề / nội dung email (vd: "Microsoft", "verification", "OTP") |
res = requests.post("http://localhost:8888/api/read_email", json={
"api_key": api_key,
"email": "example@outlook.com",
"keyword": "Microsoft account" # tìm email chứa chuỗi này
})
data = res.json()
if data["status"] == "success":
print("OTP:", data["code"])
print("Tiêu đề:", data["full_subject"])
else:
print("Chưa có email:", data["message"])
{
"status": "success",
"code": "847291",
"full_subject": "Microsoft account security code",
"body_preview": "Your Microsoft account security code is 847291..."
}{"status": "pending", "message": "No matching email found"}{"detail": "Account not found or not owned by you"}
{"detail": "Account format does not support reading email via OAuth2"}
{"detail": "Failed to get access token from Microsoft. Token might be expired."}
status == "success".
import time
for _ in range(15): # thử tối đa 15 lần
r = requests.post(...).json()
if r.get("status") == "success":
print("OTP:", r["code"]); break
time.sleep(3) # chờ 3 giây
Trả về danh sách tất cả tài khoản đã mua, kèm nội dung tài khoản và thời gian mua.
| Tên | Kiểu | Bắt buộc | Mô tả |
|---|---|---|---|
| api_key | string | required | API Key |
res = requests.get("http://localhost:8888/api/user/history",
params={"api_key": api_key}
)
history = res.json()
for item in history:
print(item["content"], item["sold_at"])
[
{
"id": 10,
"product_name": "Gmail Cổ 2010",
"category": "Tài Khoản Mạng Xã Hội",
"content": "abc@outlook.com|P@ss|token|client_id",
"sold_at": "2026-06-10T05:00:00"
}
]
Trả về lịch sử toàn bộ giao dịch: nạp tiền, mua hàng, hoàn tiền – kèm số tiền thay đổi và thời gian.
| Tên | Kiểu | Bắt buộc | Mô tả |
|---|---|---|---|
| api_key | string | required | API Key |
res = requests.get("http://localhost:8888/api/user/transactions",
params={"api_key": api_key}
)
for tx in res.json():
sign = "+" if tx["amount"] > 0 else ""
print(f"{tx['type']:10} {sign}{tx['amount']:,}đ {tx['created_at']}")
[
{"id":5, "type":"TOPUP", "amount":100000, "description":"Nạp tiền SePay", "created_at":"..."},
{"id":6, "type":"PURCHASE", "amount":-5000, "description":"Mua Gmail Cổ", "created_at":"..."},
{"id":7, "type":"REFUND", "amount":5000, "description":"Hoàn tiền ...", "created_at":"..."}
]
| Method | Endpoint | Xác thực | Mô tả |
|---|---|---|---|
| GET | /api/products | Không | Danh sách sản phẩm & giá |
| POST | /api/auth/login | Không | Đăng nhập · lấy api_key |
| GET | /api/auth/me | Bearer | Thông tin tài khoản & số dư |
| POST | /api/buy | api_key body | Mua 1 tài khoản |
| POST | /api/refund | api_key body | Hoàn tiền (≤5 phút) |
| POST | /api/stocks/upload | api_key body | Úp tài khoản vào kho hàng |
| POST | /api/read_email | api_key body | Đọc email · tìm OTP |
| GET | /api/user/history | api_key query | Lịch sử tài khoản đã mua |
| GET | /api/user/transactions | api_key query | Lịch sử giao dịch |