Migration notice for Share Video API (Video Kit for Web)
TikTok is making some changes to our developer APIs to improve user privacy based on data localization best practices. As a result of these changes, we are deprecating our Share Video API (Video Kit with Web) by September 10, 2023. To continue supporting video uploads using APIs, we are launching our new Content Posting API.
This document provides a migration path to our new API and describes our enhancements for user privacy.
Timeline
Share Video API will stop working on September 10th, 2023! Please migrate to our new Content Posting API as soon as possible using the instructions below.
- April 27, 2023: All new apps registered on TikTok for Developers must use the new Content Posting API.
- June 10, 2023: Developers must migrate their existing app integrations to use Content Posting API. API calls to legacy Share Video API are not guaranteed to succeed.
- September 10, 2023: End of life for Share Video API. All API calls will be rejected.
Update (June 9, 2023): To provide more time for developers to migrate, end of life for Share Video API has been moved from June 16, 2023 to September 10, 2023. However, video uploads and API calls are still not guaranteed to succeed from the previously communicated date of June 10, 2023. We recommend you migrate to Content Posting API as soon as possible.
New Concepts
TikTok's Content Posting API supports new capabilities including downloading videos from developer owned URLs and automatic creation of a post on the creator's behalf. To keep this migration seamless for your existing product and integration scenario, we have focused this guide on the equivalent mode for Share Video API: Uploading videos to the TikTok's user's account without creating a post.
For details on other modes, consult the Content Posting API documentation.
Migrating to Content Posting API
Note: Uploading videos via Content Posting API requires the video.upload
scope. If you were previously using our Share Video API, you would have already been approved for this scope.
Share Video Endpoint → Content Posting Endpoint
The Content Posting API is located at a different endpoint than our old Share Video API.
- Old Share Video endpoint:
https://open-api.tiktok.com/share/video/upload/
- Equivalent Content Posting API endpoint:
https://open.tiktokapis.com/v2/post/publish/inbox/video/init/
Share Video Request → Content Posting Request
Our old Share Video API was invoked using a POST
request containing the creator's access token and open ID in the query parameters and the video file in the request body as form-data. With cURL, this looks like:
curl --location 'open-api.tiktok.com/share/video/upload/?open_id={open-id}&access_token={access-token}' \
--form 'video=@"/path/to/file.mp4"'
For reference, see our old Share Video API documentation.
Our new Content Posting API requires two-step upload. First, invoke our API endpoint using a POST
request with the creator's access token in the request header (not as query parameters):
curl --location 'https://open.tiktokapis.com/v2/post/publish/inbox/video/init/' \
--header 'Authorization: Bearer {access-token}' \
--header 'Content-Type: application/json; charset=utf-8' \
--data '{
"source_info": {
"source": "FILE_UPLOAD",
"video_size": 30567100,
"chunk_size" : 30567100,
"total_chunk_count": 1
}
}'
Set the source
attribute to FILE_UPLOAD
. Content Posting API supports uploading larger files using chunks, but this concept can be ignored for the purpose of this migration as files uploaded via the older Share Video API were limited to 64MB and can fit into a single chunk file. Simply set the video_size
and chunk_size
to your video file's size and set total_chunk_count
to 1.
Note: The open_id
is no longer required.
Next, extract the upload_url
from the data
struct of the successful response:
{
"data": {
"publish_id": "v_inbox_file~v2.123456789",
"upload_url": "https://open-upload.tiktokapis.com/video/?upload_id=67890&upload_token=Xza123"
},
"error": {
"code": "ok",
"message": "",
"log_id": "2022101122484420000000000000"
}
}
Using a PUT
request, upload the file to the provided upload_url
:
curl --location --request PUT 'https://open-upload.tiktokapis.com/video/?upload_id=67890&upload_token=Xza123' \
--header 'Content-Range: bytes 0-30567099/30567100' \
--header 'Content-Type: video/mp4' \
--data '@/path/to/file/example.mp4'
For detailed schemas and more information about transferring files, see Uploading media with our Content Posting API.
Share Video Webhooks → Content Posting Webhooks
Finally, remember to handle webhook events for the Content Posting API to be notified of video status.
- Webhook event type changes:
video.upload.failed
→post.publish.failed
video.publish.complete
→post.publish.complete
- Webhook event field change:
share_id
→publish_id
Why is this migration happening?
Based on TikTok's commitment to protecting user data, we are making several upgrades to our systems to enhance user privacy. These include storing data in regional data centers closest to the users and minimizing cross-regional data flows to the greatest extent possible while still enabling global interoperability for the TikTok for Developers community.
These enhancements are available in our new Content Posting API.
Need additional support?
Please contact us if you have any more questions or need additional help with this migration.