Skip to content

Replace a product

PUT
/api/v1/workspaces/{workspaceId}/products/{productId}
curl --request PUT \
--url https://api.crossmart.io/api/v1/workspaces/example/products/example \
--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, "id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "quantity": 1 } ] }'

Variants sent with an id are edited, new ones are added and missing ones are removed. Stock changes are written to the inventory ledger as adjustments.

workspaceId
required
string
productId
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
required
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
id

The variant to edit. Leave empty to add a new variant.

string format: uuid
quantity

Stock on hand; a change is logged as an adjustment. Leave it out to keep the variant’s current stock (a new variant then opens with none).

number
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"
}
]
}