For the complete documentation index, see llms.txt. This page is also available as Markdown.

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.

Upload and attach a product image

post

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.

Authorizations
AuthorizationstringRequired

API Token authentication

Path parameters
store_idstringRequired

The ID of the store the product belongs to.

Example: store_01J8Z5F8W9K8M4A7B3C2D1E0FG
product_idstringRequired

The ID of the product to attach the image to.

Example: prod_01J8Z5F8W9K8M4A7B3C2D1E0FG
Body
image_urlstring · max: 2048Optional

Publicly 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.

Example: https://images.example.com/product.png
object_namestring · max: 1024Optional

Key returned by the upload-url endpoint. Provide this instead of image_url to attach an uploaded image.

Example: store_01J8Z5F8W9K8M4A7B3C2D1E0FG/01J8Z5F8W9K8M4A7B3C2D1E0FG
is_thumbnailboolean · nullableOptional

When 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.

Example: true
Responses
200

Success response

application/json
urlstringOptional

CDN URL of the uploaded image.

Example: https://cdn.example.com/store_01.../assets/01J8Z5F8W9K8M4A7B3C2D1E0FG.png
is_thumbnailbooleanOptional

Whether the image was set as the product's thumbnail (primary image).

Example: true
post/api/ecommerce/v1/stores/{store_id}/products/{product_id}/images
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?