Skip to content

Create a Product

Endpoint: https://api.youcan.shop/products

Method: POST

Required Scopes

  • edit-products

Parameters

Param NameParam TypeDescriptionRequired
namestringProduct nameyes
descriptionstringProduct descriptionno
visibilityboolIs product visible for customersno
track_inventoryboolShould the inventory be tracked?no
inventoryintProduct stockno
skustringProduct SKU in case it has no variantsno
has_variantsboolProduct contain variants?yes
pricefloatProduct priceyes
compare_at_pricefloatProduct compare priceno
cost_pricefloatProduct cost priceno
variant_optionsarrayList of product variant options.no
categoriesstring[]List of categories IDs to attach to productno
variantsarrayList of product variants.no
vendorsarray OR string[]List of tags/vendors to assign to product.no
imagesarrayList of product images.no

Variant Options

Ex: [{"name": "Size", "type": 4, "values": ["M", "L"]}]

Variants

Param NameParam TypeDescriptionRequired
variationsobjectKey, value pair of select variation. Ex: {"Color": "Red", "Size": "M"}yes
pricefloatVariant price. Default to product price.no
weightfloatVariant weight.no
skustringVariant SKU.no
barcodestringVariant barcode.no
inventoryintVariant inventory.no
imagestringVariant image path if any.no

Images

Param NameParam TypeDescriptionRequired
namestringImage path or full URLyes
orderintCan be used to specify the images order in listingno
typeint1=image OR 2=external video link (ex: YouTube, Vimeo, etc)yes

Response

[201] Created

json
 {
    "id": "dbf8a5a4-4bf9-11ea-ade4-0697b8fb7323",
     "name": "Amazing watch for you",
     "slug": "amazing-smartwatch",
     "public_url": "https://maroc.youcan.shop/products/amazing-smartwatch",
     "thumbnail": "https://cdn.ycan.shop/stores/maroc/products/FyRohvIKye2sbq6MzOf1KAnGiYB1Xt5vRZ7m4xzD_md.jpeg",
     "description": "very long descriiption",
     "price": 100,
     "compare_at_price": 203,
     "cost_price": null,
     "visibility": true,
     "has_variants": true,
     "variants_count": 1,
     "variant_options": [
         {
             "name": "Design",
             "type": 6,
             "values": [
                 "upload-zone"
             ]
         }
     ],
     "inventory": 0,
     "track_inventory": true,
     "you_save_amount": 103,
     "meta": {
         "title": "Amazing smartwatch",
         "description": "Smart Watch, Fitness Tracker with Heart Rate Monitor, Activity Tracker with 1.3\" Touch Screen, IP68 Waterproof Pedometer Smartwatch with Sleep Monitor",
         "images": []
     },
     "created_at": "2020-02-10T11:38:29+00:00",
     "updated_at": "2020-06-02T12:31:35+00:00",
     "deleted_at": false,
     "images": [
         {
             "id": "ca6ee0a7-eb6e-4d75-8f44-bf08cd64258c",
             "name": "stores/maroc/products/FyRohvIKye2sbq6MzOf1KAnGiYB1Xt5vRZ7m4xzD.jpeg",
             "type": 1,
             "url": "https://cdn.ycan.shop/stores/maroc/products/FyRohvIKye2sbq6MzOf1KAnGiYB1Xt5vRZ7m4xzD.jpeg",
             "order": 1,
             "variations": {
                 "original": "https://cdn.ycan.shop/stores/maroc/products/FyRohvIKye2sbq6MzOf1KAnGiYB1Xt5vRZ7m4xzD.jpeg",
                 "sm": "https://cdn.ycan.shop/stores/maroc/products/FyRohvIKye2sbq6MzOf1KAnGiYB1Xt5vRZ7m4xzD_sm.jpeg",
                 "md": "https://cdn.ycan.shop/stores/maroc/products/FyRohvIKye2sbq6MzOf1KAnGiYB1Xt5vRZ7m4xzD_md.jpeg",
                 "lg": "https://cdn.ycan.shop/stores/maroc/products/FyRohvIKye2sbq6MzOf1KAnGiYB1Xt5vRZ7m4xzD_lg.jpeg"
             }
         },
         {
             "id": "e154633a-2784-4366-97ac-7ff561326b4a",
             "name": "stores/maroc/products/M7jAkVcg4QhWD0htcvIT7mWm0Mpo7OqxWSRFaJpv.jpeg",
             "type": 1,
             "url": "https://cdn.ycan.shop/stores/maroc/products/M7jAkVcg4QhWD0htcvIT7mWm0Mpo7OqxWSRFaJpv.jpeg",
             "order": 2,
             "variations": {
                 "original": "https://cdn.ycan.shop/stores/maroc/products/M7jAkVcg4QhWD0htcvIT7mWm0Mpo7OqxWSRFaJpv.jpeg",
                 "sm": "https://cdn.ycan.shop/stores/maroc/products/M7jAkVcg4QhWD0htcvIT7mWm0Mpo7OqxWSRFaJpv_sm.jpeg",
                 "md": "https://cdn.ycan.shop/stores/maroc/products/M7jAkVcg4QhWD0htcvIT7mWm0Mpo7OqxWSRFaJpv_md.jpeg",
                 "lg": "https://cdn.ycan.shop/stores/maroc/products/M7jAkVcg4QhWD0htcvIT7mWm0Mpo7OqxWSRFaJpv_lg.jpeg"
             }
         },
         {
             "id": "814eacc7-72ec-4744-8736-ca38337e31bf",
             "name": "stores/maroc/products/azcMFaHxrsc9rWqPVhNH1bzK06evi0JimoA2Qh51.jpeg",
             "type": 1,
             "url": "https://cdn.ycan.shop/stores/maroc/products/azcMFaHxrsc9rWqPVhNH1bzK06evi0JimoA2Qh51.jpeg",
             "order": 3,
             "variations": {
                 "original": "https://cdn.ycan.shop/stores/maroc/products/azcMFaHxrsc9rWqPVhNH1bzK06evi0JimoA2Qh51.jpeg",
                 "sm": "https://cdn.ycan.shop/stores/maroc/products/azcMFaHxrsc9rWqPVhNH1bzK06evi0JimoA2Qh51_sm.jpeg",
                 "md": "https://cdn.ycan.shop/stores/maroc/products/azcMFaHxrsc9rWqPVhNH1bzK06evi0JimoA2Qh51_md.jpeg",
                 "lg": "https://cdn.ycan.shop/stores/maroc/products/azcMFaHxrsc9rWqPVhNH1bzK06evi0JimoA2Qh51_lg.jpeg"
             }
         }
     ]
 }