Skip to content

Create product (from template)

Use this endpoint to create product from template.

Read more about creating a template here

POST https://ecommerce.gelatoapis.com/v1/stores/{{storeId}}/products:create-from-template

Request example

$ curl -X POST "https://ecommerce.gelatoapis.com/v1/stores/{{storeId}}/products:create-from-template" \
    -H 'X-API-KEY: {{apiKey}}' \
    -H 'Content-Type: application/json' \
    -d '{
            "templateId": "c12a363e-0d4e-4d96-be4b-bf4138eb8743",
            "title": "Classic Unisex Crewneck T-shirt",
            "description": "<div><p>A classic unisex t-shirt that works well with any outfit. Made of a heavier cotton with a double-stitched neckline and sleeves.</p><p>- Rolled-forward shoulders for a better fit<br>- Stylish fitted sleeve<br>- Seamless double-needle collar<br>- Taped neck and shoulders for durability<br>- Tubular fit for minimal torque</p><p>This product is made on demand. No minimums.</p></div>",
            "isVisibleInTheOnlineStore": true,
            "salesChannels": [
                "web"
            ],
            "variants": [
                {
                    "templateVariantId": "83e30e31-0aee-4eca-8a8f-dceb2455cdc1",
                    "imagePlaceholders": [
                        {
                            "name": "ImageFront",
                            "fileUrl": "https://s3-eu-west-1.amazonaws.com/developers.gelato.com/product-examples/test_print_job_BX_4-4_hor_none.pdf"
                        }
                    ]
                },
                {
                    "templateVariantId": "d7c3241e-db88-40f1-9862-3d145b29dfef",
                    "imagePlaceholders": [
                        {
                            "name": "ImageFront",
                            "fileUrl": "https://s3-eu-west-1.amazonaws.com/developers.gelato.com/product-examples/test_print_job_BX_4-4_hor_none.pdf"
                        }
                    ]
                },
                {
                    "templateVariantId": "582fe1ea-7f4e-4507-9e3d-7f49a38aa2d7",
                    "imagePlaceholders": [
                        {
                            "name": "ImageFront",
                            "fileUrl": "https://s3-eu-west-1.amazonaws.com/developers.gelato.com/product-examples/test_print_job_BX_4-4_hor_none.pdf"
                        }
                    ]
                },
                {
                    "templateVariantId": "49f54e49-2ac5-466b-9938-473b1cc82a8b",
                    "imagePlaceholders": [
                        {
                            "name": "ImageFront",
                            "fileUrl": "https://s3-eu-west-1.amazonaws.com/developers.gelato.com/product-examples/test_print_job_BX_4-4_hor_none.pdf"
                        }
                    ]
                }
            ]
        }'

Response example

{
  "id": "2e856a12-2f83-4a1f-ac50-4d63c57bc233",
  "storeId": "6ada0d2f-73f4-41f4-af92-91911c22171d",
  "externalId": null,
  "title": "Classic Unisex Crewneck T-shirt",
  "description": "<div><p>A classic unisex t-shirt that works well with any outfit. Made of a heavier cotton with a double-stitched neckline and sleeves.</p><p>- Rolled-forward shoulders for a better fit<br>- Stylish fitted sleeve<br>- Seamless double-needle collar<br>- Taped neck and shoulders for durability<br>- Tubular fit for minimal torque</p><p>This product is made on demand. No minimums.</p></div>",
  "previewUrl": "https://gelato-api-test.s3.eu-west-1.amazonaws.com/ecommerce/store_product_image/448b66a9-b7bb-410f-a6ae-50ba2474fcf8/preview?X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIATQZMBOFCESNXH67O%2F20230613%2Feu-west-1%2Fs3%2Faws4_request&X-Amz-Date=20230613T123555Z&X-Amz-SignedHeaders=host&X-Amz-Expires=86400&X-Amz-Signature=d3a39af4fc89cf2e1c63d0292bf963fabfad77a370d5c76678bf55f81a35ff80",
  "status": "created",
  "publishedAt": "2023-06-14T11:02:47+0000", 
  "createdAt": "2023-06-13T11:02:47+0000",
  "updatedAt": "2023-06-13T11:02:47+0000"  
}

Request

Parameter Type Description
storeId (required) string Store id.
templateId (required) string Template id.
title (required) string Product title.
description (required) string Product description.
isVisibleInTheOnlineStore (optional) boolean Indicates whether the product is visible in the online store. By default - false.
salesChannels (optional) string[] Whether the product is published to the Point of Sale channel. Possible values: web, global. By default - web. web - The product isn't published to the Point of Sale channel. global - The product is published to the Point of Sale channel. We support it only for Shopify stores.
variants (optional) VariantObject[] Array of product template variants, each containing information about the variant placeholders which need to be updated. If you do not provide variants in the request, the product will be created with the template variants as is.

VariantObject

Parameter Type Description
templateVariantId (required) string Template Variant Id.
position (optional) number Variant position. By default - 0.
imagePlaceholders (optional) ImagePlaceholderObject[] Array of image placeholders which need to be updated.

ImagePlaceholderObject

Parameter Type Description
name (required) string Image placeholder name.
fileUrl (required) string Image placeholder file url. Supported file types: jpg, jpeg, png, pdf.

Response

Parameter Type Description
id (required) string Store product id.
storeId (required) string Store id.
externalId (optional) string Product id on external store.
title (required) string Product title.
description (required) string Product description.
previewUrl (required) string Product preview url.
status (required) string Product status. Possible values: created, publishing, active, publishing_error.
publishedAt (optional) string Date and time in ISO 8601 format when product was published.
createdAt (required) string Date and time in ISO 8601 format when product was created.
updatedAt (required) string Date and time in ISO 8601 format when product was updated.