Tài Liệu Kết Nối API v2
v2.0 • Standard APIChuẩn kết nối JSON / Form-URL-Encoded cho Bot, Website và Child Panel (Reseller).
Lấy danh sách dịch vụ
Trả về danh sách dịch vụ đang hoạt động kèm giá niêm yết trên 1.000 đơn vị (đã tự động tính chiết khấu VIP / Custom Rate). Dữ liệu cache 30 giây theo từng tài khoản.
| Tham số | Kiểu | Mô tả |
|---|---|---|
| key * | string | API Key cá nhân |
| action * | string | Giá trị: services |
Tạo đơn hàng mới
Tạo đơn hàng và trừ tiền tự động theo công thức (rate × quantity × runs) / 1000. Chọn loại dịch vụ bên dưới để xem tham số tương ứng:
| Tham số | Kiểu | Mô tả |
|---|---|---|
| service * | int | Mã ID dịch vụ |
| link * | string | URL bài viết / video / trang đích |
| quantity * | int | Số lượng cần đặt (trong khoảng min – max) |
| runs | int | Số đợt chạy (2 – 100, tùy chọn với Web Traffic) |
| interval | int | Phút giữa các đợt (1 – 10080, mặc định 60) |
| Ghi chú | — | Không cần quantity. Hệ thống tính giá cố định theo gói. |
| comments * | string | Mỗi bình luận 1 dòng (\n). Tự đếm số dòng làm quantity. |
| hashtag * | string | Hashtag hoặc từ khóa tìm kiếm (VD: #smmpanel). |
| usernames / hashtags | string | Dùng usernames (custom list), thêm hashtags hoặc username (user followers). |
| username * | string | Username của người viết bình luận cần tăng like. |
| answer_number * | int | Số thứ tự phương án bình chọn (≥ 1). |
| keywords * | string | Danh sách từ khóa SEO, mỗi dòng 1 từ khóa (\n). |
| country * | string | Mã hoặc tên quốc gia (VD: VN, US, United States). |
| device * | int | 1 Desktop, 2 Android, 3 iOS, 4 Mixed Mobile, 5 Mixed All. |
| type_of_traffic * | int | 1 Google Keyword, 2 Custom Referrer, 3 Blank Referrer. |
| google_keyword / referring_url | string | Bắt buộc google_keyword nếu type=1, hoặc referring_url nếu type=2. |
| username, posts * | string / int | Username theo dõi và số bài đăng mới (≥ 1). |
| min, max, delay, expiry | int / date | Số lượng mỗi bài, độ trễ (phút), hạn (d/m/Y). |
| quantity * | int | Số xu cần nạp — bắt buộc là bội số của 100 (VD: 100, 200, 500, 1000). |
| tiktok_account_id / link * | int / string | Gửi tiktok_account_id (đã liên kết qua tiktok_qr_generate / tiktok_add_cookie) HOẶC truyền thẳng chuỗi Cookie TikTok vào trường link. |
| Actions hỗ trợ QR | action | tiktok_qr_generate → tiktok_qr_status (session_id) hoặc tiktok_add_cookie (cookie). |
Kiểm tra trạng thái đơn hàng
Hỗ trợ tra cứu 1 đơn (order) hoặc tối đa 100 đơn trong 1 lần gọi (orders cách nhau bằng dấu phẩy) để tối ưu Rate Limit.
| Tham số | Kiểu | Mô tả |
|---|---|---|
| order | int | Mã ID của 1 đơn hàng cần kiểm tra. |
| orders | string | Danh sách ID cách nhau bằng dấu phẩy (VD: 23501,23502). |
Tạo yêu cầu bảo hành (Refill)
Chỉ áp dụng cho dịch vụ có refill: true và đơn hàng đang ở trạng thái Completed.
| Tham số | Kiểu | Mô tả |
|---|---|---|
| action * | string | Giá trị: refill |
| order * | int | ID đơn hàng cần bảo hành. |
Kiểm tra trạng thái bảo hành
Tra cứu tiến độ xử lý của yêu cầu bảo hành dựa theo mã refill nhận được từ action refill.
| Tham số | Kiểu | Mô tả |
|---|---|---|
| action * | string | Giá trị: refill_status |
| refill * | int | Mã ID yêu cầu bảo hành. |
Hủy đơn hàng & Hoàn tiền
Hủy 1 hoặc tối đa 100 đơn hàng cùng lúc. Chỉ các đơn ở trạng thái Pending mới hủy được và tự động hoàn tiền 100% về ví ngay lập tức.
| Tham số | Kiểu | Mô tả |
|---|---|---|
| action * | string | Giá trị: cancel |
| orders / order * | string | 1 ID hoặc danh sách ID cách nhau bằng dấu phẩy (tối đa 100). |
Kiểm tra số dư tài khoản
Trả về số dư ví khả dụng hiện tại của tài khoản theo đơn vị tiền tệ gốc (USD).
| Tham số | Kiểu | Mô tả |
|---|---|---|
| key * | string | API Key cá nhân |
| action * | string | Giá trị: balance |
[
{
"service": 101,
"name": "Instagram Real Followers [HQ]",
"type": "Default",
"category": "Instagram Followers",
"rate": "0.8500",
"min": 100,
"max": 50000,
"refill": true,
"cancel": true,
"dripfeed": true
}
]
// Thành công:
{ "order": 23501 }
// Khi không đủ số dư:
{ "error": "Not enough funds on balance" }
// Tra cứu 1 đơn (order=23501):
{
"charge": "0.8500",
"start_count": 1240,
"status": "In progress",
"remains": 350,
"currency": "USD"
}
{
"refill": 512
}
{
"status": "Completed"
}
[
{ "order": 23501, "cancel": 1 },
{ "order": 23502, "cancel": { "error": "Order cannot be canceled at this stage" } }
]
{
"balance": "100.8429",
"currency": "USD"
}
Trạng thái đơn hàng (status)
Trạng thái bảo hành (refill_status)
Tích hợp Nạp Xu TikTok cho SMM Panel đối tác (type: tiktok_coin)
Các máy chủ Nạp Xu TikTok được phân phối dưới dạng dịch vụ SMM có type = "tiktok_coin" (đơn giá tính trên 1.000 xu, số lượng đặt phải là bội số của 100). Panel đối tác có thể chọn 1 trong 2 cách kết nối:
link)
Dành cho mọi SMM Panel không cần sửa code: chỉ cần gửi action=add như đơn SMM thường, truyền chuỗi Cookie TikTok vào link và số xu (bội số 100) vào quantity.
POST https://vnsocial.site/api/v2
{
"key": "YOUR_API_KEY",
"action": "add",
"service": 1001,
"link": "sessionid=abc123...; tt_csrf_token=...",
"quantity": 500
}
// Response: { "order": 12345 }
Gọi tiktok_qr_generate → hiển thị ảnh QR / nút Mở TikTok cho khách → poll tiktok_qr_status tới khi status = "done" để nhận tiktok_account_id → gửi đơn với action=add kèm tiktok_account_id.
// 1. Tạo QR: action=tiktok_qr_generate
// -> { "session_id": "...", "qr_image": "data:...", "open_app_url": "..." }
// 2. Kiểm tra QR: action=tiktok_qr_status & session_id=...
// -> { "status": "done", "account": { "tiktok_account_id": 7, "username": "user1" } }
// 3. Đặt đơn: action=add & service=1001 & tiktok_account_id=7 & quantity=500
// -> { "order": 12345 }
Bảng Mã Lỗi Thường Gặp
Mọi lỗi trả về theo định dạng {"error": "..."}.
| HTTP | Thông báo lỗi | Cách khắc phục |
|---|---|---|
| 400 | API key is required / Incorrect request | Kiểm tra lại tham số key và action. |
| 401 | Invalid or inactive API key | API Key sai, đã được tạo mới hoặc tài khoản bị khóa. |
| 403 | IP address [...] is not whitelisted | Thêm IP server vào mục IP Whitelist trong Hồ sơ. |
| 422 | Nội dung bình luận / liên kết vi phạm quy định... | Nội dung bị bộ lọc kiểm duyệt chặn, vui lòng chỉnh sửa sạch. |
| 429 | Rate limit exceeded / IP locked | Giảm tần suất dưới 120 req/phút, gom đơn bằng orders. |
| 200 | Not enough funds on balance | Số dư ví không đủ, vui lòng nạp thêm tiền. |
| 200 | Duplicate order detected... | Trùng đơn trong 60 giây. Chờ 1 phút hoặc kiểm tra retry. |
Danh sách 13 Loại dịch vụ (type) hỗ trợ trên API v2
Giá trị trường type trả về từ action=services và các tham số bắt buộc khi gọi action=add.
| Loại dịch vụ (type) | Tham số bắt buộc khi tạo đơn (action=add) |
|---|---|
| Default | service, link, quantity (tùy chọn: runs, interval) |
| Package | service, link |
| Custom Comments | service, link, comments |
| Custom Comments Package | service, link, comments |
| Mentions Hashtag | service, link, quantity, hashtag |
| Mentions with Hashtags | service, link, quantity, usernames, hashtags |
| Mentions Custom List | service, link, usernames |
| Mentions User Followers | service, link, quantity, username |
| Comment Likes | service, link, quantity, username |
| Poll | service, link, quantity, answer_number |
| SEO | service, link, quantity, keywords |
| Web Traffic | service, link, quantity, country, device, type_of_traffic, google_keyword / referring_url |
| Subscriptions | service, username, posts, min, max (tùy chọn: delay, expiry) |
| Nạp Xu TikTok (tiktok_coin) | service, quantity (bội số 100), tiktok_account_id hoặc link (Cookie TikTok) |
Rate Limit: 120 requests / phút
Giới hạn áp dụng theo từng tài khoản API. Khi vượt ngưỡng sẽ trả về HTTP 429. Hãy dùng orders để kiểm tra cùng lúc tối đa 100 đơn.
IP Whitelist (Bảo vệ API Key)
Cho phép giới hạn chỉ IP máy chủ của bạn được phép gọi API trong mục Hồ sơ. Mọi IP khác sẽ bị chặn với HTTP 403 kể cả khi lộ Key.
Chống trùng đơn hàng (60 giây)
Hệ thống tự động từ chối nếu cùng 1 tài khoản gửi trùng service, link và quantity trong vòng 60 giây, giúp tránh mất tiền oan khi mạng chập chờn.
Chống Brute-Force & Cache 30s
Gửi sai API Key nhiều lần liên tiếp sẽ tự động khóa IP tạm thời. Endpoint services được cache 30 giây riêng theo tài khoản để đảm bảo tốc độ phản hồi nhanh nhất.
<?php
class SmmApiClient {
public function __construct(
private string $apiUrl = 'https://vnsocial.site/api/v2',
private string $apiKey = 'YOUR_API_KEY'
) {}
public function services(): array { return $this->request(['action' => 'services']); }
public function balance(): array { return $this->request(['action' => 'balance']); }
public function order(array $data): array { return $this->request(array_merge(['action' => 'add'], $data)); }
public function status(int $orderId): array { return $this->request(['action' => 'status', 'order' => $orderId]); }
public function multiStatus(array $ids): array { return $this->request(['action' => 'status', 'orders' => implode(',', $ids)]); }
public function refill(int $orderId): array { return $this->request(['action' => 'refill', 'order' => $orderId]); }
public function refillStatus(int $refillId): array { return $this->request(['action' => 'refill_status', 'refill' => $refillId]); }
public function cancel(array $ids): array { return $this->request(['action' => 'cancel', 'orders' => implode(',', $ids)]); }
private function request(array $payload): array {
$ch = curl_init($this->apiUrl);
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_TIMEOUT => 30,
CURLOPT_POSTFIELDS => http_build_query(array_merge(['key' => $this->apiKey], $payload)),
]);
$result = curl_exec($ch);
curl_close($ch);
return json_decode($result ?: '{}', true) ?? [];
}
}
import requests
class SmmApiClient:
def __init__(self, api_url="https://vnsocial.site/api/v2", api_key="YOUR_API_KEY"):
self.api_url = api_url
self.api_key = api_key
def _post(self, **params):
res = requests.post(self.api_url, data={"key": self.api_key, **params}, timeout=30)
return res.json()
def services(self): return self._post(action="services")
def balance(self): return self._post(action="balance")
def add_order(self, service, link, quantity, **extra):
return self._post(action="add", service=service, link=link, quantity=quantity, **extra)
def status(self, order_id): return self._post(action="status", order=order_id)
def multi_status(self, ids): return self._post(action="status", orders=",".join(map(str, ids)))
def refill(self, order_id): return self._post(action="refill", order=order_id)
def refill_status(self, refill_id): return self._post(action="refill_status", refill=refill_id)
def cancel(self, ids): return self._post(action="cancel", orders=",".join(map(str, ids)))

