Create Product
Create a new product in your store.
Endpoint
POST /api/products/createRequest Body
| Field | Type | Required | Description |
|---|---|---|---|
| name | string | Yes | Product name |
| reference | string | Yes | Product reference |
| description | string | No | Product description |
| model | string | No | Product model |
| html | string | No | Product HTML description |
| source | string | No | Product source |
| bookingProps | object | No | Booking properties |
| digitalConfig | object | No | Digital config |
| productType | string | No | PHYSICAL, DIGITAL, BOOKING |
| type | string | No | simple, variable, etc. |
| tags | array | No | Product tags |
| seo | object | No | SEO info |
| status | string | No | DRAFT, PUBLISH, TRASH |
| collections | array | No | Collections |
| price | object | No | Pricing info |
| quantity | object | No | Stock info |
| outStock | object | No | Out of stock settings |
| sizes | object | No | Size info |
| supplier | object | No | Supplier info |
| brand | object | No | Brand info |
| shipping | object | No | Shipping info |
| images | array | No | Product images |
| files | array | No | Product files |
| options | array | No | Product options |
| variants | array | No | Product variants |
| translates | array | No | Translations |
| currencies | array | No | Currency 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",
...
}
}