Skip to content
On this page

Create Product ​

Create a new product in your store.

Endpoint ​

POST /api/products/create

Request Body ​

FieldTypeRequiredDescription
namestringYesProduct name
referencestringYesProduct reference
descriptionstringNoProduct description
modelstringNoProduct model
htmlstringNoProduct HTML description
sourcestringNoProduct source
bookingPropsobjectNoBooking properties
digitalConfigobjectNoDigital config
productTypestringNoPHYSICAL, DIGITAL, BOOKING
typestringNosimple, variable, etc.
tagsarrayNoProduct tags
seoobjectNoSEO info
statusstringNoDRAFT, PUBLISH, TRASH
collectionsarrayNoCollections
priceobjectNoPricing info
quantityobjectNoStock info
outStockobjectNoOut of stock settings
sizesobjectNoSize info
supplierobjectNoSupplier info
brandobjectNoBrand info
shippingobjectNoShipping info
imagesarrayNoProduct images
filesarrayNoProduct files
optionsarrayNoProduct options
variantsarrayNoProduct variants
translatesarrayNoTranslations
currenciesarrayNoCurrency info

Product Type Values

  • PHYSICAL: Physical product
  • DIGITAL: Digital product (use digitalConfig)
  • BOOKING: Booking product (use bookingProps)

Options Property (for type: variable)

When type is set to variable, use the options property to define product variations (e.g., color, size).

Example:

json
"options": [
  {
    "name": "Color",
    "style": "COLOR",
    "values": [
      { "value1": "Red" },
      { "value1": "Blue" }
    ]
  }
]

Example ​

json
{
  "name": "T-shirt",
  "reference": "TSHIRT-001",
  "description": "A cool t-shirt",
  "model": "TSHIRT",
  "html": "<p>Best T-shirt</p>",
  "productType": "PHYSICAL",
  "type": "simple",
  "tags": ["clothing", "summer"],
  "seo": {
    "title": "T-shirt",
    "description": "A cool t-shirt",
    "hide": false,
    "googleCategory": "Apparel",
    "keywords": ["t-shirt", "clothing"]
  },
  "status": "PUBLISH",
  "price": {
    "buyingPrice": 10,
    "salePrice": 20,
    "comparePrice": 25
  },
  "quantity": {
    "instock": 100,
    "unit": "pcs",
    "increment": 1
  },
  "images": [
    {
      "src": "https://cdn.example.com/tshirt.jpg",
      "title": "T-shirt"
    }
  ],
 
  "translates": [
    {
      "language": "fr",
      "properties": [
        { "name": "title", "value": "T-shirt" }
      ]
    }
  ],
  "currencies": [
    {
      "currency": "USD",
      "properties": [
        { "name": "price", "value": 20 }
      ]
    }
  ]
}

bookingProps object ​

json
{
  "firstAddresses": [
    {
      "city": { "_id": "string", "name": "string" },
      "province": { "_id": "string", "name": "string" },
      "country": { "_id": "string", "name": "string", "code": "string", "dialCode": "string" },
      "location": {}
    }
  ],
  "pickCountries": ["string"],
  "pickProvinces": ["string"],
  "pickCites": ["string"],
  "guest": { "hasGuest": true, "min": 1, "max": 10 },
  "extraInfo": [
    { "_id": "string", "name": "string", "icon": "string", "Number": "string" }
  ],
  "priceBy": "string",
}

digitalConfig object ​

json
{
  "viaEmail": true,
  "downloadable": true,
  "emailSettings": {
    "autoSend": true,
    "subject": "Your digital product",
    "body": "Thank you for your purchase.",
    "sendbyStatus": ["PAID"]
  },
  "downloadSetting": {
    "fileId": "string",
    "name": "Downloadable File"
  }
}

Response ​

json
{
  "status": "success",
  "data": {
    "_id": "string",
    "name": "T-shirt",
    "slug": "t-shirt",
    ...
  }
}

Released under the MIT License.