Tài Liệu Cung Cấp API

Sử dụng API Token của bạn để tự động hóa việc lưu video Douyin & TikTok vào ứng dụng từ xa.

🔑 Xác thực: Truyền API Token của bạn nằm trong Header gửi đi là Authorization: Bearer <your_token>.
Lấy Token của bạn tại trang Bảng Điều Khiển Quản Lý.
🔄 Luồng xếp hàng (Queue): Tất cả endpoint đều trả về 1 mã jobId. Bạn dùng mã này và liên tục poll gọi hàm GET /api/job/:jobId cho tới khi statecompleted (hoàn tất) hoặc failed (lỗi).

💰 Bảng Phí Credits

Endpoint Credits / request Mô tả
POST /api/video/parse 10 Parse thông tin video
POST /api/video/download 10 Lấy link tải video
POST /api/channel/videos 20 Lấy danh sách video kênh
POST /api/channel/download 20 Batch download video kênh
🎵 TIKTOK ENDPOINTS
POST /api/tiktok/video/parse 10 Parse thông tin video TikTok
POST /api/tiktok/video/download 10 Lấy link tải video TikTok
POST /api/tiktok/channel/videos 20 Lấy danh sách video kênh TikTok
POST /api/tiktok/channel/download 20 Batch download video kênh TikTok

Video Endpoints

POST /api/video/parse 🔒 Auth 💰 10 credits
Parse a Douyin video URL. Returns a jobId to poll for video info.
curl -X POST https://thq-solution-tools.io.vn/api/video/parse \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"url": "https://v.douyin.com/xxxxx"}'
✅ Response
{
  "success": true,
  "data": {
    "jobId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "message": "Job queued. Poll GET /api/job/:jobId for result."
  }
}
POST /api/video/download 🔒 Auth 💰 10 credits
Queue a video download job. Poll the jobId to get the download URL.
curl -X POST https://thq-solution-tools.io.vn/api/video/download \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"url": "https://v.douyin.com/xxxxx"}'
✅ Response
{
  "success": true,
  "data": {
    "jobId": "f7e6d5c4-b3a2-1098-7654-321fedcba098",
    "message": "Job queued. Poll GET /api/job/:jobId for download URL."
  }
}

Channel Endpoints

POST /api/channel/videos 🔒 Auth 💰 20 credits
Get a list of videos from a Douyin user/channel profile. Sorted by newest first. Supports date filtering with since parameter.
curl -X POST https://thq-solution-tools.io.vn/api/channel/videos \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"url": "https://www.douyin.com/user/xxxxx", "count": 20, "since": "today"}'
📌 Tham số since (tùy chọn): Chỉ lấy video đăng từ ngày này trở đi.
  • "today" — Chỉ video hôm nay
  • "yesterday" — Từ hôm qua
  • "2026-04-01" — Từ ngày cụ thể
  • Không truyền — Lấy tất cả
✅ Response
{
  "success": true,
  "data": {
    "jobId": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
    "message": "Job queued. Poll GET /api/job/:jobId for result."
  }
}
POST /api/channel/download 🔒 Auth 💰 20 credits
Start a batch download of videos from a channel. Returns a task ID for tracking.
curl -X POST https://thq-solution-tools.io.vn/api/channel/download \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"url": "https://www.douyin.com/user/xxxxx", "count": 10}'
✅ Response
{
  "success": true,
  "data": {
    "taskId": "c3d4e5f6-a7b8-9012-cdef-234567890123",
    "status": "started",
    "total": 10
  }
}

Job Polling

GET /api/job/:jobId 🔓 No auth
Poll a queued job for its status and result. Keep polling until state is completed or failed.
curl https://thq-solution-tools.io.vn/api/job/a1b2c3d4-e5f6-7890-abcd-ef1234567890
⏳ Waiting / Active
{
  "success": true,
  "data": {
    "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "state": "active",
    "data": { "type": "video.parse", "url": "https://v.douyin.com/xxxxx" }
  }
}
✅ Completed
{
  "success": true,
  "data": {
    "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "state": "completed",
    "result": {
      "video_id": "7328xxxxx",
      "title": "Video title here",
      "author": { "nickname": "username", "uid": "...", "sec_uid": "..." },
      "cover_url": "https://p3-sign.douyinpic.com/...",
      "download_url": "https://www.douyin.com/aweme/...",
      "duration": 15,
      "create_time": "2026-04-02T10:00:00.000Z",
      "statistics": { "likes": 1000, "comments": 50, "shares": 10 }
    }
  }
}
❌ Failed
{
  "success": true,
  "data": {
    "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "state": "failed",
    "error": "Could not extract video ID from URL"
  }
}

Error Responses

401 Unauthorized
{
  "success": false,
  "error": "Unauthorized: Missing or invalid token format. Use \"Bearer <token>\""
}
402 Insufficient Credits
{
  "success": false,
  "error": "Payment Required: Insufficient credits. You need 10 credits, but have 0."
}
403 Account Banned
{
  "success": false,
  "error": "Forbidden: Your account has been banned. Contact admin."
}

Health Check

GET /api/health 🔓 No auth
Check if the API server is running.
curl https://thq-solution-tools.io.vn/api/health
✅ Response
{
  "success": true,
  "status": "ok",
  "timestamp": "2026-03-30T09:00:00.000Z"
}

🎵 TikTok Video Endpoints

POST /api/tiktok/video/parse 🔒 Auth 💰 10 credits
Parse a TikTok video URL. Returns a jobId to poll for video info.
curl -X POST https://thq-solution-tools.io.vn/api/tiktok/video/parse \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"url": "https://www.tiktok.com/@username/video/7328xxxxx"}'
✅ Response
{
  "success": true,
  "data": {
    "jobId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "message": "Job queued. Poll GET /api/job/:jobId for result."
  }
}
POST /api/tiktok/video/download 🔒 Auth 💰 10 credits
Queue a TikTok video download job. Poll the jobId to get the download URL.
curl -X POST https://thq-solution-tools.io.vn/api/tiktok/video/download \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"url": "https://vm.tiktok.com/xxxxx"}'
✅ Response
{
  "success": true,
  "data": {
    "jobId": "f7e6d5c4-b3a2-1098-7654-321fedcba098",
    "message": "Job queued. Poll GET /api/job/:jobId for download URL."
  }
}

🎵 TikTok Channel Endpoints

POST /api/tiktok/channel/videos 🔒 Auth 💰 20 credits
Get a list of videos from a TikTok user/channel profile. Supports date filtering with since parameter.
curl -X POST https://thq-solution-tools.io.vn/api/tiktok/channel/videos \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"url": "https://www.tiktok.com/@username", "count": 20, "since": "today"}'
📌 Tham số since (tùy chọn): Chỉ lấy video đăng từ ngày này trở đi.
  • "today" — Chỉ video hôm nay
  • "yesterday" — Từ hôm qua
  • "2026-04-01" — Từ ngày cụ thể
  • Không truyền — Lấy tất cả
✅ Response
{
  "success": true,
  "data": {
    "jobId": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
    "message": "Job queued. Poll GET /api/job/:jobId for result."
  }
}
POST /api/tiktok/channel/download 🔒 Auth 💰 20 credits
Start a batch download of videos from a TikTok channel. Returns a task ID for tracking.
curl -X POST https://thq-solution-tools.io.vn/api/tiktok/channel/download \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"url": "https://www.tiktok.com/@username", "count": 10}'
✅ Response
{
  "success": true,
  "data": {
    "taskId": "c3d4e5f6-a7b8-9012-cdef-234567890123",
    "status": "started",
    "total": 10
  }
}