Upload a Mini Drama Video
Asynchronously uploads an episode video from a URL to your BytePlus space, or imports a video that already exists in BytePlus. A URL upload returns a job_id. Poll Query a Mini Drama Video with it to get the video's vid.
Important: Only a vid returned by this endpoint or by Query a Mini Drama Video can be used in an episode. A video ID that exists only in the BytePlus console can't be used.
Endpoint
HTTP URL |
|
HTTP method |
|
Scopes |
|
Content type |
|
Request
Headers
Field | Type | Description | Required | Example |
|
| The client access token of your mini app, prefixed with | Yes |
|
|
| The media type of the request body. | Yes |
|
Request body
Field | Type | Description | Required | Example |
|
| Required when | Conditional |
|
|
| The ID of a video that already exists in your BytePlus space. Pass this value to import the video without uploading it again. | No |
|
|
| Required when you upload by | Conditional |
|
|
| The name of the BytePlus space to upload the video to. | Yes |
|
|
| The ID of the BytePlus account to upload the video to. | Yes |
|
|
| The BytePlus region. Default: | No |
|
Note: For HLS (M3U8) videos, only unencrypted media playlists with TS segments are supported. Master playlists, fMP4 segments, and encrypted streams can fail during upload, review, transcoding, or playback.
Request example
curl --location 'https://open.tiktokapis.com/v2/sg/shortdrama/video/' \
--header 'Authorization: Bearer CLIENT_ACCESS_TOKEN' \
--header 'Content-Type: application/json' \
--data '{
"url": "https://example.com/episode-01.mp4",
"title": "episode_01",
"space_name": "SPACE_NAME",
"byteplus_account_id": "BYTEPLUS_ACCOUNT_ID"
}'Replace the following:
CLIENT_ACCESS_TOKEN: your mini app's client access token.SPACE_NAME: the name of your BytePlus space.BYTEPLUS_ACCOUNT_ID: the ID of the BytePlus account bound to your mini app.
Response
Response body
Field | Type | Description |
| The upload result. Omitted when the request fails. | |
| The error object. |
VideoUploadData
A URL upload returns only job_id. An import of an existing video returns only byteplus_vid. Neither returns byteplus_url.
Field | Type | Description | Example |
|
| The ID of the asynchronous upload task. Returned only for a URL upload. Use it to poll Query a Mini Drama Video. |
|
|
| The ID of the imported video. Returned only when you import an existing video. |
|
|
| The video playback URL. Not returned by this endpoint. |
|
ErrorStruct
Field | Type | Description |
|
| The error code. Omitted on success. |
|
| A human-readable description of the error. |
|
| The unique identifier for the request. Include this value when contacting support. |
Response example
{
"data": {
"job_id": "vod:job:1234567890",
"byteplus_vid": "",
"byteplus_url": ""
},
"error": {
"log_id": "202508010000000000000000000000000"
}
}Error codes
Error code | Description | Resolution |
| The service is temporarily unavailable. | Retry later. If the error persists, contact support with the |
| A required field is missing or a field is invalid. | Check the error message for the field, correct it, and retry. |
| The video URL is invalid. | Provide an accessible HTTP or HTTPS URL. |
| The video belongs to a different client key. | Use the matching client key or a different |
| The BytePlus account isn't authorized for this client key. | Connect the BytePlus account to your mini app on the Developer Portal. |
| HLS upload isn't enabled for this BytePlus account. | Contact the BytePlus team to enable HLS upload. |
| The video wasn't found in the requested BytePlus account, space, or region. | Verify the |
| The BytePlus space and region don't match the account bound to the client key. | Verify the space and region in the BytePlus console, then correct the request. |