Upload and attach a product image
Fetch a raster image (JPEG, PNG, GIF or WebP, max 15MB) from a URL and attach it to a product in a single call.
Fetch a raster image (JPEG, PNG, GIF or WebP, max 15MB) from a URL and attach it to a product in a single call. The image is virus-scanned and validated by content, then stored on the CDN. Set is_thumbnail to make it the product's primary image.
API Token authentication
The ID of the store the product belongs to.
store_01J8Z5F8W9K8M4A7B3C2D1E0FGThe ID of the product to attach the image to.
prod_01J8Z5F8W9K8M4A7B3C2D1E0FGPublicly reachable URL of the raster image (JPEG, PNG, GIF or WebP), maximum 15MB. The image is fetched, virus-scanned and validated by content, then stored on the CDN. SVG is not accepted. Provide either this or object_name.
https://images.example.com/product.pngKey returned by the upload-url endpoint. Provide this instead of image_url to attach an uploaded image.
store_01J8Z5F8W9K8M4A7B3C2D1E0FG/01J8Z5F8W9K8M4A7B3C2D1E0FGWhen true, the image becomes the product's thumbnail (primary image). When omitted, it becomes the thumbnail only if the product does not have one yet.
trueSuccess response
CDN URL of the uploaded image.
https://cdn.example.com/store_01.../assets/01J8Z5F8W9K8M4A7B3C2D1E0FG.pngWhether the image was set as the product's thumbnail (primary image).
trueUnauthenticated response
Validation error response
Error response
POST /api/ecommerce/v1/stores/{store_id}/products/{product_id}/images HTTP/1.1
Host: developers.hostinger.com
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 150
{
"image_url": "https://images.example.com/product.png",
"object_name": "store_01J8Z5F8W9K8M4A7B3C2D1E0FG/01J8Z5F8W9K8M4A7B3C2D1E0FG",
"is_thumbnail": true
}{
"url": "https://cdn.example.com/store_01.../assets/01J8Z5F8W9K8M4A7B3C2D1E0FG.png",
"is_thumbnail": true
}Last updated
Was this helpful?