Skip to content

Create a product with its variants

POST
/api/v1/workspaces/{workspaceId}/products
curl --request POST \
--url https://api.crossmart.io/api/v1/workspaces/example/products \
--header 'Content-Type: application/json' \
--data '{ "title": "example", "descriptionHtml": "example", "vendor": "example", "productType": "example", "tags": [ "example" ], "status": "DRAFT", "optionNames": [ "Size", "Color" ], "media": [ { "url": "https://cdn.example.com/mug.jpg", "altText": "example" } ], "handle": "example", "variants": [ { "sku": "example", "barcode": "example", "optionValues": [ "example" ], "price": "19.90", "compareAtPrice": "24.90", "cost": "40.00", "weightGrams": 1, "requiresShipping": true, "taxable": true, "outOfStockPolicy": "STOP_SELLING", "tracked": true, "quantity": 0 } ] }'
workspaceId
required
string
Media typeapplication/json
object
title
required
string
<= 255 characters
descriptionHtml
string
<= 65535 characters
vendor
string
productType
string
tags
Array<string>
status
string
Allowed values: DRAFT ACTIVE ARCHIVED
optionNames
Array<string>

Example

[
"Size",
"Color"
]
media
Array<object>
object
url
required
string

Example

https://cdn.example.com/mug.jpg
altText
string
handle

Unique in the workspace. Defaults to the slugified title, or to product-<random id> when the title has no Latin letters or digits (such as a Hebrew title).

string
<= 255 characters
variants
required
Array<object>
object
sku
string
<= 255 characters
barcode

GTIN, UPC, EAN or ISBN

string
optionValues

One value per product option, in order

Array<string>
price
required
string

Example

19.90
compareAtPrice
string

Example

24.90
cost

What you pay per unit. Used for pricing floors; never shown to buyers.

string

Example

40.00
weightGrams
number
requiresShipping
boolean
default: true
taxable
boolean
default: true
outOfStockPolicy
string
Allowed values: STOP_SELLING CONTINUE_SELLING
tracked

Track stock for this variant

boolean
default: true
quantity

Opening stock

number
0
Media typeapplication/json
object
id
required
string format: uuid
handle
required
string
title
required
string
descriptionHtml
required
string
vendor
required
string
nullable
productType
required
string
nullable
tags
required
Array<string>
status
required
string
Allowed values: DRAFT ACTIVE ARCHIVED
optionNames
required
Array<string>
variants
required
Array<object>
object
id
required
string format: uuid
position
required
number
sku
required
string
nullable
barcode
required

GTIN, UPC, EAN or ISBN

string
nullable
optionValues
required

One value per product option, in order

Array<string>
price
required

Decimal string in the workspace currency

string
compareAtPrice
required
string
nullable
cost
required

What you pay per unit; never shown to buyers

string
nullable
weightGrams
required
number
nullable
requiresShipping
required
boolean
taxable
required
boolean
outOfStockPolicy
required
string
Allowed values: STOP_SELLING CONTINUE_SELLING
tracked
required

Whether Crossmart tracks stock for this variant

boolean
available
required
number
media
required
Array<object>
object
id
required
string format: uuid
url
required
string
altText
required
string
nullable
position
required
number
createdAt
required
string format: date-time
updatedAt
required
string format: date-time

Example

{
"status": "DRAFT",
"optionNames": [
"Size",
"Color"
],
"variants": [
{
"price": "89.00",
"compareAtPrice": "99.00",
"cost": "40.00",
"outOfStockPolicy": "STOP_SELLING"
}
]
}