Images

Create a Product Variant Image

POST /catalog/products/{product_id}/variants/{variant_id}/image

Request

Creates a Variant Image.

Only one image can be explicitly associated with a Variant. If the Variant already has an associated image, overwrites the existing Variant Image.

The image displays on the storefront when the Variant is selected.

Required Fields

  • image_file: Form posts. Files larger than 1 MB are not accepted
  • image_url: Any publicly available URL

Authentication

  • X-Auth-Token in header

Parameters

  • store_hash in path - string
  • Accept in header with default of application/json - string
    required
    The MIME type of the response body.
  • product_id in path - integer
    required

    The ID of the Product to which the resource belongs. Product variant metafield endpoints that have the product_id in the request path are successful as long as the parameter is not empty. The product_id segment is there only for path consistency.

  • variant_id in path - integer
    required

    ID of the variant on a product, or on an associated Price List Record.

Body

object | application/json
An object containing a publicly accessible image URL, or a form post that contains an image file.
  • image_url
    string

    A public URL for a GIF, JPEG, or PNG image. Limit of 8MB per file.

Body

object | multipart/form-data
An object containing a publicly accessible image URL, or a form post that contains an image file.
  • image_url
    string

    A public URL for a GIF, JPEG, or PNG image. Limit of 8MB per file.

example

{
"image_url": "string"
}

Response

image_url is returned for both image_file and image_url.

Body

object | application/json

Image Response returns for:

  • Create Variant Image
  • Create Modifier Image
  • Create Category Image
  • Create Brand Image
  • data
    object

    An object containing a publicly accessible image URL, or a form post that contains an image file.
  • meta
    object

    Response metadata.

example

{
"data": {
"image_url": "https://cdn8.bigcommerce.com/s-id30h7ohwf/product_images/attribute_rule_images/85_source_1536863430.png"
},
"meta": {}
}
Did you find what you were looking for?