Publish a video to your TikTok profile
tiktok.tiktok.video.publish.initPublish a video directly to your own TikTok profile
- 价格
- free按供应商原价
- 成功率
- —暂无成功率数据暂无成功率数据
- 延迟 p50
- ——
- 最后验证
- —尚未验证
POSThttps://toolswitch.dev/v1/tools/tiktok.tiktok.video.publish.init预览- 可用平台额度调用
- 同步返回
- 读取公开数据
参数
needs the `post` capability (video.publish); a `draft` connection gets scope_not_authorized. Returns {data: {publish_id, upload_url}}. CHUNK RULES, which TikTok enforces strictly: a chunk is 5 MB to 64 MB, so a file <= 64 MB goes as ONE chunk of the whole size; larger files use 10 MB chunks with total_chunk_count = floor(size / chunk_size) and the LAST chunk carrying the remainder (it may exceed chunk_size). PUT each chunk straight to upload_url with plain curl or HTTP, NOT through treg: the URL carries its own permission and expires after 1 hour. Send Content-Type: video/mp4 (or video/quicktime, video/webm) and Content-Range: bytes start-end/total, e.g. curl -X PUT -H 'Content-Type: video/mp4' -H 'Content-Range: bytes 0-1304736/1304737' --data-binary @clip.mp4 "$UPLOAD_URL" — chunked PUTs answer 206, the last 201. Then poll tiktok.publish.status; publishing is not done when the upload finishes. UNTIL TIKTOK AUDITS TREG'S APP, this route is REFUSED (unaudited_client_can_only_post_to_private_accounts) unless privacy_level is SELF_ONLY and the creator's account is private; for any post others should see, use tiktok.tiktok.video.inbox.init instead
这个工具没有参数,详见供应商文档 ↗ 供应商文档
代码示例
将 $TOOLSWITCH_KEY 替换为你在控制台创建的密钥。
curl -X POST 'https://toolswitch.dev/v1/tools/tiktok.tiktok.video.publish.init' \
-H "X-Toolswitch-Key: $TOOLSWITCH_KEY"import os
import requests
response = requests.request(
"POST",
"https://toolswitch.dev/v1/tools/tiktok.tiktok.video.publish.init",
headers={"X-Toolswitch-Key": os.environ["TOOLSWITCH_KEY"]},
)
response.raise_for_status()
print(response.text)const response = await fetch("https://toolswitch.dev/v1/tools/tiktok.tiktok.video.publish.init", {
method: "POST",
headers: {
"X-Toolswitch-Key": process.env.TOOLSWITCH_KEY ?? "",
},
});
if (!response.ok) throw new Error(`Request failed: ${response.status}`);
console.log(await response.text());网关接口为预览版,地址与鉴权方式可能调整。 示例参数仅为样例数据。 调用按 free 计费,已含服务费。