Skip to content

Optimize Images

POST
/product/202404/images/optimize

Optimize images used in your TikTok Shop by changing the background to white. This is especially useful for images displayed in the product image gallery as it enhances product visibility. Note:

  • The images to be optimized must first be uploaded to TikTok Shop through the Upload Product Image API. You will not be able to optimize any images that are not hosted by TikTok Shop.
  • Images that were previously optimized will not be processed again.
  • The optimization is processed asynchronously and typically completes within a few seconds. If no stored optimization result exists, optimize_status is PROCESSING, indicating that optimization is underway. If a stored final result already exists, the API may return it immediately. When optimize_status is PROCESSING, call the API again after a few seconds to get the final optimization status.
shop_cipher
required
string

Identifies the shop. Obtain it from the Get Authorized Shops API.

Media typeapplication/json
object
images

The list of images to be optimized. Use the Upload Product Image API to upload the images first and obtain the corresponding image URIs. Max count: 200

Array<object>
<= 200 items
object
uri

The URI of the image. Retrieve the URI from the Upload Product Image API.

string
optimization_mode

The optimization type. Possible values:

  • WHITE_BACKGROUND: Change the background to white.
Array<string>
Allowed values: WHITE_BACKGROUND
Example
{
"images": [
{
"uri": "tos-maliva-i-o3syd03w52-us/53b55d6e8cdf1f315affa7e70b45707d",
"optimization_mode": [
"WHITE_BACKGROUND"
]
}
]
}

Success

Media typeapplication/json
object
code

Status code; 0 means success.

integer format: int64
message

Success or failure message.

string
request_id

Request log ID.

string
data
object
images

The list of images to be optimized.

Array<object>
object
height

The height of the original image, in pixels.

integer format: int64
width

The width of the original image, in pixels.

integer format: int64
original_uri

The original URI of the image to be optimized.

string
original_url

The original URL of the image to be optimized.

string
optimized_uri

The URI of the image after optimization. Pass this value when creating or editing a product to associate the image with the product.

Applicable only if optimize_statusis SUCCESS.

string
optimized_url

The URL of the image after optimization. Use this URL in product descriptions by embedding it within an HTML <img> tag.

Applicable only if optimize_statusis SUCCESS.

string
optimize_status

The optimization status. Possible values:

  • SUCCESS: The image has been successfully optimized.
  • IGNORE: The image already has a white background, so no optimization was applied.
  • PROCESSING: The optimization is in progress, and typically completes within a few seconds. Call this API again to obtain the final optimization status.
string
Allowed values: SUCCESS IGNORE PROCESSING
Example
{
"code": 0,
"data": {
"images": [
{
"height": 600,
"width": 600,
"original_uri": "tos-maliva-i-o3syd03w52-us/53b55d6e8cdf1f315affa7e70b45707d",
"original_url": "https://p16-graph-va.ibyteimg.com/tos-maliva-i-1por3rr4fy-us/v2/53b55d6e8cdf1f315affa7e70b45707d~tplv-1por3rr4fy-image.webp",
"optimized_uri": "tos-maliva-i-o3syd03w52-us/0266127022264e54ad2f639f5e0fb5e6",
"optimized_url": "https://p16-graph-va.ibyteimg.com/tos-maliva-i-1por3rr4fy-us/v2/0266127022264e54ad2f639f5e0fb5e6~tplv-1por3rr4fy-image.webp",
"optimize_status": "SUCCESS"
}
]
},
"message": "Success",
"request_id": "202203070749000101890810281E8C70B7"
}