Tiếng Việt
TikTok API Reference
Các API chuyên dụng cho việc xuất bản video, khai thác Creator data, âm thanh bản quyền và TikTok Shop.
1. Xuất Bản Video Lên TikTok
POST /api/tiktok/upload
Xuất bản một video lên tài khoản TikTok đã kết nối. Chi phí: 5 Credits.
Headers:
Content-Type: application/jsonX-API-Key: tk_live_...
Request Body:
json
{
"videoUrl": "https://cdn.example.com/videos/summer-fashion.mp4",
"caption": "Mẹo phối đồ công sở siêu xinh! #fashion #ootd",
"targetChannel": "Kênh Thời Trang Hottrend",
"privacyLevel": 0,
"allowComment": true,
"allowDuet": true,
"allowStitch": true,
"soundId": "7189283746591028374",
"productAnchors": [
{
"type": 5,
"keyword": "Áo Sơ Mi Lụa Hàn Quốc",
"content": {
"product_id": "1729482910392817"
}
}
]
}Response (200 OK):
json
{
"success": true,
"itemId": "7419827391823719283",
"shareUrl": "https://www.tiktok.com/@thoitrang_hot/video/7419827391823719283",
"status": "PUBLISHED",
"creditDeducted": 5,
"remainingBalance": 45
}2. Crawl Danh Sách Video Của Creator
GET /api/tiktok/user/posts
Quét danh sách các video đã xuất bản của một tài khoản TikTok bất kỳ kèm thống kê tương tác và link video gốc không dính logo watermark. Chi phí: 1 Credit.
Query Parameters:
username(String, Tùy chọn): Username/handle TikTok (vd:"lamine.yamal"hoặc"@lamine.yamal").profileUrl(String, Tùy chọn): Đường dẫn profile hoặc short link.userId(String, Tùy chọn): ID số của user TikTok.secUid(String, Tùy chọn): ChuỗisecUid64 ký tự.count(Number, Mặc định: 35, Tối đa: 50): Số video mỗi lần lấy.cursor(String/Number, Mặc định: 0): Con trỏ trang tiếp theo.proxyUrl(String, Tùy chọn): Proxy tùy chỉnh.
Response (200 OK):
json
{
"success": true,
"itemList": [
{
"id": "7419827361528172819",
"desc": "Bộ sưu tập thể thao năng động mùa hè 🔥 #fashion #sport #fyp",
"createTime": 1727182900,
"downloadNoWatermarkUrl": "https://api.stackvid.dev/api/tiktok/download?url=7419827361528172819",
"video": {
"width": 1080,
"height": 1920,
"format": "mp4",
"size": 18500200,
"videoID": "v14044g50000dan5qe7og65mk26sen3g",
"bitrates": [
{
"gearName": "adapt_lowest_1080_1",
"qualityType": 2,
"bitrate": 1951034,
"fps": 60,
"codecType": "h265_hvc1",
"format": "mp4",
"width": 1080,
"height": 1920,
"size": 18500200,
"playUrl": "https://v16-webapp-prime.tiktok.com/video/tos/..."
}
]
},
"music": {
"id": "7182938475619283746",
"title": "See Tình (Remix)",
"duration": 45,
"isCommerceMusic": true,
"original": false,
"isCopyrighted": true
},
"products": [
{
"productId": "1731402508560140405",
"title": "Áo Thun Thể Thao Nam Chạy Bộ Co Giãn 4 Chiều",
"keyword": "Áo Thun Thể Thao",
"coverUrl": "https://p16-oec-va.ibyteimg.com/tos-maliva-i-oec22/1731402508560140405.jpeg"
}
]
}
],
"cursor": "1727092817000",
"hasMore": true
}2b. Lấy Thông Tin Profile Creator / User
GET /api/tiktok/user/profile
Trích xuất thông tin hồ sơ chi tiết của Creator/User TikTok bất kỳ (ảnh đại diện nhiều kích thước, tiểu sử bio, số lượng follower, số lượt thích, số video đã đăng, tick xanh verified, TikTok Shop seller status, secUid). Chi phí: 1 Credit.
Query Parameters:
username(String, Tùy chọn): Username/handle TikTok (vd:"lamine.yamal"hoặc"@lamine.yamal").profileUrl(String, Tùy chọn): Đường dẫn profile hoặc short link (vd:"https://www.tiktok.com/@lamine.yamal").userId(String, Tùy chọn): ID số của user TikTok.secUid(String, Tùy chọn): ChuỗisecUid64 ký tự.proxyUrl(String, Tùy chọn): Proxy tùy chỉnh.
Response (200 OK):
json
{
"success": true,
"user": {
"id": "7251849182371928374",
"uniqueId": "lamine.yamal",
"nickname": "Lamine Yamal",
"avatarThumb": "https://p16-common-sign.tiktokcdn.com/tos-alisg-avt-0068/77bb53f891028f660af4c375e534d60c~tplv-tiktokx-cropcenter:100:100.jpeg?...",
"avatarMedium": "https://p19-common-sign.tiktokcdn.com/tos-alisg-avt-0068/77bb53f891028f660af4c375e534d60c~tplv-tiktokx-cropcenter:720:720.jpeg?...",
"avatarLarger": "https://p16-common-sign.tiktokcdn.com/tos-alisg-avt-0068/77bb53f891028f660af4c375e534d60c~tplv-tiktokx-cropcenter:1080:1080.jpeg?...",
"signature": "FC Barcelona & Spain 🇪🇸⚽️",
"verified": true,
"secUid": "MS4wLjABAAAAN8lpi9aJjiPSF_8CrejiLzUvsPfS-vhZ1V6KHGxgAe67kK1og6cyET8dq-LkgKdc",
"privateAccount": false,
"ttSeller": false,
"followingVisibility": 1,
"followerCount": 25400000,
"followingCount": 42,
"heartCount": 280500000,
"videoCount": 58,
"diggCount": 0,
"friendCount": 0
}
}3. Tìm Kiếm Nhạc Bản Quyền
POST /api/tiktok/music/search
Tìm kiếm nhạc trending trên TikTok theo từ khóa. Chi phí: 1 Credit.
Request Body:
json
{
"keyword": "remix trending",
"cursor": 0,
"count": 10,
"onlyCommerce": true
}keyword(String, Bắt buộc): Từ khóa tìm kiếm âm thanh/bài hát.cursor(Number, Tùy chọn): Cursor phân trang (mặc định: 0).count(Number, Tùy chọn): Số kết quả (mặc định: 20, tối đa: 50).onlyCommerce(Boolean, Tùy chọn): Lọc chỉ lấy bài nhạc có bản quyền thương mại (isCommerceMusic: true) dành riêng cho video gắn giỏ hàng TikTok Shop để tránh bị mute âm thanh.
Response (200 OK):
json
{
"music_list": [
{
"id": "7189283746591028374",
"title": "See Tình (Remix)",
"author": "Hoàng Thùy Linh",
"duration": 60,
"play_url": "https://sf16-ies-music.tiktokcdn.com/...",
"user_count": 894000,
"isCommerceMusic": true
}
],
"has_more": true,
"cursor": 10
}4. Lấy Danh Sách Sản Phẩm TikTok Shop Showcase
POST /api/tiktok/showcase/products
Lấy danh mục sản phẩm Showcase sẵn sàng để gắn vào video. Chi phí: 1 Credit.
Request Body:
json
{
"count": 10,
"offset": 0,
"targetChannel": "Kênh Thời Trang Hottrend"
}count(Number, Tùy chọn): Số sản phẩm cần lấy (mặc định: 10, tối đa: 50).offset(Number, Tùy chọn): Vị trí bắt đầu phân trang (mặc định: 0).targetChannel(String, Tùy chọn): Tên kênh sở hữu gian hàng Showcase (mặc định dùng Kênh Mặc Định).
Response (200 OK):
json
{
"success": true,
"message": "Get Products In Showcase successfully",
"total": 45,
"products": [
{
"product_id": "1729482910392817",
"title": "Áo Sơ Mi Lụa Hàn Quốc Cao Cấp",
"cover": "https://p16-oec-va.ibyteimg.com/tos-maliva-i-oec22/1729482910392817.jpeg",
"price": "299000"
}
]
}5. Tải Trực Tiếp Video MP4 Không Watermark
GET /api/tiktok/download
Bóc tách và stream trực tiếp tệp nhị phân video HD không dính logo watermark hoặc ID người đăng dưới dạng file đính kèm (attachment). Chi phí: 1 Credit.
Query Parameters:
url(String, Bắt buộc): URL video TikTok, link rút gọn di động (vt.tiktok.com), hoặc mã ID bài viết (ví dụ:"7419827361528172819").
Headers:
X-API-Key: ***
Response (200 OK):
Trả về luồng nhị phân video trực tiếp:
Content-Type: video/mp4Content-Disposition: attachment; filename="{id}.mp4"Content-Length: <kích thước file byte>
bash
curl -X GET "https://api.stackvid.dev/api/tiktok/download?url=7419827361528172819" \
-H "X-API-Key: tk_live_YOUR_API_KEY" \
--output "tiktok-clean.mp4"6. Gửi Tin Nhắn TikTok Chat (Direct Message)
POST /api/tiktok/chat/send
Gửi tin nhắn văn bản trực tiếp vào một cuộc hội thoại TikTok. Chi phí: 500 Credits (500 VNĐ / tin).
Headers:
Content-Type: application/jsonAuthorization: Bearer <jwt-token>hoặc `X-API-Key: ***
Request Body:
json
{
"conversationId": "0:1:7242178829468435462:7248907244315444229",
"conversationShortId": "7692450584246747398",
"text": "Xin chào! StackVid có thể hỗ trợ gì cho bạn?",
"conversationType": 1
}conversationId(String, Bắt buộc): ID cuộc hội thoại TikTok.conversationShortId(String, Bắt buộc): Short ID cuộc hội thoại.text(String, Bắt buộc): Nội dung tin nhắn văn bản cần gửi.conversationType(Number, Tùy chọn): Loại hội thoại (mặc định:1- chat trực tiếp 1-1).channelId(String, Tùy chọn): Chỉ định kênh TikTok gửi tin (mặc định dùng Kênh Mặc Định).
Response (200 OK):
json
{
"success": true,
"serverMessageId": "7692666338627651092",
"clientMessageId": "75eb10ac-5c5d-4823-84d5-1050741a9f81",
"status": 0,
"message": "Message sent successfully"
}bash
curl -X POST "https://api.stackvid.dev/api/tiktok/chat/send" \
-H "Authorization: Bearer YOUR_JWT_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"conversationId": "0:1:7242178829468435462:7248907244315444229",
"conversationShortId": "7692450584246747398",
"text": "Xin chào!"
}'