Create or replace a store product
Create a product in your store, or replace it, by your own ID — with variants and stock.
PUT
{BASE_URL}/store/products/:externalIdThe first PUT of an externalId creates the product as a draft (201); later ones replace it
(200). Send the whole product — except stock, which you may leave out to keep the counts as
they are. Requires the REGISTRATION scope; a Technology Provider also needs the Store module. See
Sync your listings.
Body
namestringrequired- 1–120 characters.
priceintegerrequired- Whole taka, 0–10,000,000.
categorystringrequired- 1–60 characters.
descriptionstring | nulloptional- Up to 2,000 characters.
imagestring | nulloptional- A URL from
POST /media. linkobject | nulloptional{ url }— your own page for the product,https.guidesobject[]optional- Up to 20
{ type, detail }, for example{ "type": "Material", "detail": "Cotton" }. variantsobject[]optional- Up to 10 sections
{ name, options[] }, each with 2–20 different options. Section names must differ. stockobject[]optional- Leave out to keep the counts;
[]to stop counting. Otherwise up to 200 rows{ options, stock, price?, sku? }, replacing every count. stock[].optionsobjectoptional- One option per variant section,
{ "Size": "M", "Colour": "White" }. Leave out for a product with no variants. stock[].stockintegerrequired- How many you have, 0–1,000,000.
stock[].priceinteger | nulloptional- This combination's own price in whole taka, when it differs.
stock[].skustring | nulloptional- Your SKU, up to 64 characters.
A combination with no stock row is not counted and never sells out. Once any row is counted, a combination without one counts as zero.
Response
dryRunbooleanrequiredtruefor a sandbox key: nothing was saved.createdbooleanrequired- Whether this
PUTcreated the product. dataobjectrequired- The product: every body field, plus
externalId,id,publishedandupdatedAt.stocklists every combination, withstock: nullfor one not counted, or isnullwhen the product is not counted at all.
Errors#
| Status | Code | When |
|---|---|---|
400 | unknown_field, <field>_required, <field>_invalid, <field>_too_long, <field>_too_many | A field is missing or wrong. details.field names it. |
400 | variants_too_few_options, variants_option_repeated, variants_name_repeated | A variant section breaks a rule. |
400 | stock_combination_invalid, stock_combination_duplicate, stock_invalid | A stock row names a combination the product does not have, names one twice, or has a bad count. |
400 | image_not_imported | image is not a URL from POST /media. |
403 | provider_module_not_allowed | A Technology Provider without the Store module. |
409 | store_not_set_up | You have no store yet. |
409 | resource_busy | Another request is creating this externalId. Retry. |
cURL
curl -X PUT "$LOCALOY_BASE_URL/store/products/pj-001" \
-H "Authorization: Bearer $LOCALOY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Cotton panjabi",
"price": 2200,
"category": "Clothing",
"guides": [{ "type": "Material", "detail": "Cotton" }],
"variants": [
{ "name": "Size", "options": ["M", "L"] },
{ "name": "Colour", "options": ["White", "Blue"] }
],
"stock": [
{ "options": { "Size": "M", "Colour": "White" }, "stock": 4, "sku": "PJ-M-W" },
{ "options": { "Size": "L", "Colour": "Blue" }, "stock": 0, "price": 2400 }
]
}'Response · 201
{
"success": true,
"message": "Product created as a draft — publish it to show it to customers",
"dryRun": false,
"created": true,
"data": {
"externalId": "pj-001",
"id": "cm4pr0duct0000000000001",
"name": "Cotton panjabi",
"price": 2200,
"category": "Clothing",
"description": null,
"image": null,
"link": null,
"guides": [{ "type": "Material", "detail": "Cotton" }],
"variants": [
{ "name": "Size", "options": ["M", "L"] },
{ "name": "Colour", "options": ["White", "Blue"] }
],
"stock": [
{ "options": { "Size": "M", "Colour": "White" }, "stock": 4, "price": null, "sku": "PJ-M-W" },
{ "options": { "Size": "M", "Colour": "Blue" }, "stock": null, "price": null, "sku": null },
{ "options": { "Size": "L", "Colour": "White" }, "stock": null, "price": null, "sku": null },
{ "options": { "Size": "L", "Colour": "Blue" }, "stock": 0, "price": 2400, "sku": null }
],
"published": false,
"updatedAt": "2026-11-10T09:30:00.000Z"
}
}