Update a product
Updates the product. If a product with the given ID/slug does not exist and
dont_create is not set, a new product will be created (upsert).
PUT
/products/{id}Authorization
AuthorizationBearer token (JWT) · headerrequiredPath parameters
idstringrequiredProduct ID or slug
Query parameters
dont_createbooleanWhen true, do not upsert a new product if the ID/slug is not found (404 instead).
Request body
requiredapplication/jsonshop_idintegerrequiredID of the shop (required on create)
namestringrequiredProduct name.
slugstringURL slug. Auto-generated from name if omitted.
statusstringdefault: "hidden"
Allowed:
visiblehiddenblockedclassstringProduct class. Defaults to `Product`.
default: "Product"
Allowed:
ProductProductBundleSubscriptionGiftCarddescriptionstringshort_descriptionstringdeliverablebooleanWhether the product requires physical delivery. Defaults to `true`. Set to `false` for digital goods, event tickets, subscriptions, etc. Returned as `is_deliverable` in responses.
tracks_stockbooleanWhether stock is tracked for this product's variants.
has_prices_per_variantbooleanRequired when variants have different prices. Must be `true` if any variant sets its own `regular_price`; the API returns 422 otherwise.
has_weights_per_variantbooleanWhether variants carry individual weights.
regular_priceintegerRegular price in cents, applied to all variants (for non-bundle products). Use per-variant `regular_price` inside `variants` when `has_prices_per_variant` is true.
sale_priceintegerSale price in cents, applied to all variants.
sale_price_starts_atstring<date-time>ISO 8601 datetime when the sale price activates.
sale_price_ends_atstring<date-time>ISO 8601 datetime when the sale price expires.
product_type_namestringProduct type name. Created automatically if it doesn't exist.
vendor_namestringVendor name. Created automatically if it doesn't exist.
tagsstring[]Tag names. Replaces all existing tags unless `_policies.keep_attributes` is set.
cart_quantity_multipleintegerEnforces cart quantities to be multiples of this value.
variant_optionsobjectNames for up to 3 variant option axes (e.g. "Color", "Size").
Show propertiesHide properties
option1stringoption2stringoption3stringvariantsVariantInput[]Variant definitions. By default, variants not present in the array are removed; set `_policies.keep_variants: true` to preserve them.
Show propertiesHide properties
Array of
VariantInputidintegerExisting variant ID. Required when updating a specific variant.
skustringoption1stringoption2stringoption3stringregular_priceintegerRegular price in cents. Required per-variant when `has_prices_per_variant` is true.
sale_priceintegerSale price in cents.
online_stockintegerAvailable online stock units.
weight_in_gramsintegerbarcode_numberstringstatusstringAllowed:
visiblehiddenavailable_if_no_stockbooleanAllow purchase even when stock reaches zero.
default: false
collectionsobject[]Collections to assign the product to. Pass `id` to reference an existing collection, or `title` to create/find by name. Replaces all existing collections unless `_policies.keep_collections: true`.
Show propertiesHide properties
Array of
objectidstringCollection ID
titlestringCollection title (used to find or create)
custom_attributesobject[]Custom meta-field attributes.
Show propertiesHide properties
Array of
objectnamestringvaluestringfield_typestringAllowed:
stringintsplit_stringtextfield_groupstringrequiredbooleandefault: false
filterablebooleandefault: true
volume_discount_idintegerAssigns an existing volume discount to this product.
relationsobject[]Related products (e.g. "goes well with"). Replaces all existing relations unless `_policies.keep_relations: true`.
Show propertiesHide properties
Array of
objectidstringRelation ID, when updating an existing relation.
namestringRelation name (e.g. "related", "upsell").
child_idstringRelated product ID or slug.
child_typestringcustom_variant_optionsobjectCustom variant option metadata (id/name/type) for up to 3 option axes, keyed by `option1`/`option2`/`option3`.
bundle_optionsobject[]Configurable bundle option groups (customer picks items from each group). Only applies to `class: ProductBundle`.
Show propertiesHide properties
Array of
objectidintegerBundle option ID, when updating.
namestringmin_countintegermax_countintegerdefault: 1
max_per_itemintegerbundle_itemsobject[]Show propertiesHide properties
Array of
objectidintegerBundle item ID, when updating.
product_idintegervariant_idintegerRequired unless `variant_sku` is given.
variant_skustringRequired unless `variant_id` is given.
unitsintegeradditional_priceintegerAdditional price in cents if this item is selected.
bundle_itemsobject[]Fixed bundle items (always included, no customer choice). Only applies to `class: ProductBundle`.
Show propertiesHide properties
Array of
objectidintegerBundle item ID, when updating.
product_idintegervariant_idintegerRequired unless `variant_sku` is given.
variant_skustringRequired unless `variant_id` is given.
unitsintegerdefault: 1
_policiesobjectControl update behaviour. All flags default to `false` (destructive replace). Set to `true` to preserve existing data when the corresponding field is not included in the request.
Show propertiesHide properties
keep_variantsbooleanKeep existing variants not listed in `variants`.
default: false
keep_collectionsbooleanKeep existing collection assignments not listed in `collections`.
default: false
keep_relationsbooleanKeep existing product relations not listed in `relations`.
default: false
keep_attributesbooleanKeep existing custom attributes not listed in `custom_attributes`.
default: false
ensure_uniquestringIf set, the product is not created when another product already has the same value for this field (returns 409 instead).
Allowed:
titleslugResponses
200Product updated
_linksHalLinksidintegernamestringProduct display name.
slugstringclass_namestringstatusstringAllowed:
visiblehiddendescriptionstringshort_descriptionstringis_bundlebooleanis_deliverablebooleanhas_optionsbooleantagsstring[]currency_codestringbundle_price_modestringAllowed:
pricesumbundle_discountnumberregular_pricenumberIn cents
pricenumberEffective price in cents
sale_pricenumberIn cents
sale_price_starts_atstring<date-time>sale_price_ends_atstring<date-time>has_multiple_pricesbooleandiscount_percentagenumbersafety_stockintegeravailablebooleanstockintegerCurrent stock
online_stockintegerall_stockintegerStock across all locations
vendorstringvariant_optionsobject[]Show propertiesHide properties
Array of
objectnamestringvaluestringglobal_tagsstring[]stocksobjectstocks_per_locationobjectcart_max_quantityintegercart_quantity_multipleintegerlist_pricesobject[]Show propertiesHide properties
Array of
objectprice_list_idintegerpricenumbercreated_onstring<date-time>updated_onstring<date-time>201Product created (upsert)
_linksHalLinksidintegernamestringProduct display name.
slugstringclass_namestringstatusstringAllowed:
visiblehiddendescriptionstringshort_descriptionstringis_bundlebooleanis_deliverablebooleanhas_optionsbooleantagsstring[]currency_codestringbundle_price_modestringAllowed:
pricesumbundle_discountnumberregular_pricenumberIn cents
pricenumberEffective price in cents
sale_pricenumberIn cents
sale_price_starts_atstring<date-time>sale_price_ends_atstring<date-time>has_multiple_pricesbooleandiscount_percentagenumbersafety_stockintegeravailablebooleanstockintegerCurrent stock
online_stockintegerall_stockintegerStock across all locations
vendorstringvariant_optionsobject[]Show propertiesHide properties
Array of
objectnamestringvaluestringglobal_tagsstring[]stocksobjectstocks_per_locationobjectcart_max_quantityintegercart_quantity_multipleintegerlist_pricesobject[]Show propertiesHide properties
Array of
objectprice_list_idintegerpricenumbercreated_onstring<date-time>updated_onstring<date-time>403Access denied
Request
curl -X PUT "https://api.onbolder.com/v2/products/string" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "Wireless Headphones Pro",
"regular_price": 12999,
"sale_price": 9999,
"status": "visible",
"description": "Updated premium wireless headphones.",
"tags": [
"electronics",
"audio",
"wireless"
]
}'const response = await fetch("https://api.onbolder.com/v2/products/string", {
method: "PUT",
headers: {
"Authorization": "Bearer YOUR_TOKEN",
"Content-Type": "application/json"
},
body: JSON.stringify({
"name": "Wireless Headphones Pro",
"regular_price": 12999,
"sale_price": 9999,
"status": "visible",
"description": "Updated premium wireless headphones.",
"tags": [
"electronics",
"audio",
"wireless"
]
})
});import requests
response = requests.put(
"https://api.onbolder.com/v2/products/string",
headers={
"Authorization": "Bearer YOUR_TOKEN",
"Content-Type": "application/json"
},
json={
"name": "Wireless Headphones Pro",
"regular_price": 12999,
"sale_price": 9999,
"status": "visible",
"description": "Updated premium wireless headphones.",
"tags": [
"electronics",
"audio",
"wireless"
]
},
)Response
{
"id": 101,
"name": "Wireless Headphones Pro",
"slug": "wireless-headphones-pro",
"status": "visible",
"price": 9999,
"regular_price": 12999,
"currency_code": "USD",
"_links": {
"self": {
"href": "https://api.onbolder.com/v2/products/101"
}
}
}{
"_links": {
"property1": {
"href": "string",
"templated": true,
"method": "get",
"title": "string",
"type": "string"
},
"property2": {
"href": "string",
"templated": true,
"method": "get",
"title": "string",
"type": "string"
}
},
"id": 0,
"name": "string",
"slug": "string",
"class_name": "string",
"status": "visible",
"description": "string",
"short_description": "string",
"is_bundle": true,
"is_deliverable": true,
"has_options": true,
"tags": [
"string"
],
"currency_code": "USD",
"bundle_price_mode": "price",
"bundle_discount": 0,
"regular_price": 0,
"price": 0,
"sale_price": 0,
"sale_price_starts_at": "2019-08-24T14:15:22Z",
"sale_price_ends_at": "2019-08-24T14:15:22Z",
"has_multiple_prices": true,
"discount_percentage": 0,
"safety_stock": 0,
"available": true,
"stock": 0,
"online_stock": 0,
"all_stock": 0,
"vendor": "string",
"variant_options": [
{
"name": "string",
"value": "string"
}
],
"global_tags": [
"string"
],
"stocks": {
"property1": 0,
"property2": 0
},
"stocks_per_location": {
"property1": 0,
"property2": 0
},
"cart_max_quantity": 0,
"cart_quantity_multiple": 0,
"list_prices": [
{
"price_list_id": 0,
"price": 0
}
],
"created_on": "2019-08-24T14:15:22Z",
"updated_on": "2019-08-24T14:15:22Z"
}Access denied