Update a product (PATCH)
AI agents: read /llms.txt; add .md to any page URL. This page as Markdown: /reference/products/v1-products-update-patch.md. Index of every page and the rules for every call: /llms.txt. Guides and concepts in one file: /llms-full.txt. OpenAPI: /openapi.json.
PATCH/
Updates a product. A custom variant product's size_data and color_data follow its variants and are not taken here; rename a size or color through variant/rename_options. A variant's own price, weight and vendor are changed with Update a variant.
Use PUT: it checks the fields, and needs type (send the product's type; a product's type never changes). PATCH takes the same body but checks nothing.
Business rules
- Send
vendor_idon every update: leaving it out, or sending an empty string, clears the product's vendor. - Send prices as a whole number of thousandths:
12500is 12.50. - Existing sales order lines keep the price they were sold at.
- Other fields sent as
nullare dropped, as if left out (forvendor_idthat means the vendor is cleared, as above). Send an empty string to blank a text field.
Path parameters
Your team slug, shown as Team ID next to your API key in Profile.
- Example
your-team
- Example
The product's id (
idfrom List products). A hash id from an earlier answer; unique keys and document numbers (such asPO0042) don't work here.- Example
EDhVUaC6jbLbed
- Example
Request body
application/json, required.
Required on
PUT:simpleorvariant. It is not compared with the product and never changes it.- One of:
"simple","variant"
- One of:
barcodestringThe product's barcode. Saved as sent.
brandstringThe product's brand.
default_priceintegerSend a whole number of thousandths:
12500is 12.50.descriptionstringA description of the product.
dimension_xnumberdimension_ynumberdimension_znumberprice_datamap of objectsPrices for pricing groups, keyed by pricing group id:
{"<pricing group id>": {"price": 11000}}. A line priced with that group uses this price instead ofdefault_price. Send a whole number of thousandths:11000is 11.00.Fields of each item (1)
Send a whole number of thousandths:
11000is 11.00.
supplier_idstringThe supplier's code for the product.
taxablebooleanWhether sales tax applies to it.
titlestringRequired on create. The product name shown on orders.
vendor_idstringThe vendor you buy it from.
weightnumberThe product's weight. Simple products only.
Response
200Successful response.
One of, picked by
type:Simple product
simple- Always
"simple"
- Always
The selling price. Null when not set. Thousandths, an older encoding:
12500is 12.50. Usually a whole number; an amount finer than a thousandth comes back as a number with a fraction (1234.5is 1.2345), or as a string ("1234.5") when you sendX-Yoprint-Decimal-Format: exact-v1. See Money and quantities.barcodestring | nullbrandstring | nullcolor_dataarray of anydeleted_atstring (date-time) | nulldeleted_byobject | nullWho did it, as
{id, name}; null when on sale or nobody was recorded.descriptionstring | nullenablebooleanphased_out_atstring (date-time) | nullphased_out_byobject | nullWho did it, as
{id, name}; null when on sale or nobody was recorded.price_dataobject | arrayPrices for pricing groups, as saved: keyed by the pricing group's internal number (not its hash id), each
{"price": <thousandths>}. An empty list[]when there are none.size_dataarray of anysupplier_idstring | nulltaxablebooleantrack_inventorybooleanvariant_countnullvendor_idstring | nullweightnumber | string | null
Variant product
variant- Always
"variant"
- Always
- One of:
"size","color","size_color"
- One of:
brandstring | nulldefault_priceinteger | number | string | nullNot used for variant products: each variant has its own. Null when not set. Thousandths, an older encoding:
12500is 12.50. Usually a whole number; an amount finer than a thousandth comes back as a number with a fraction (1234.5is 1.2345), or as a string ("1234.5") when you sendX-Yoprint-Decimal-Format: exact-v1. See Money and quantities.descriptionstring | nullenablebooleansupplier_idstring | nulltaxablebooleanvendor_idstring | null
Errors
401The API key is missing or wrong (
unauthenticated).403You are not allowed to do this.
api_access_not_in_plan: your team's plan doesn't include API access (Pro and above, with an active subscription or trial), so every request answers this until the team upgrades. When your role lacks the permission the operation needs, the body is only{"message": "Insufficient Permission"}. Other refusals use the error envelope, withunauthorizedoruser_is_not_authorized.- When
- Your role cannot update products. This 403 has a short body,
{"message": "Insufficient Permission"}, with nosuccessorerror. - Fix
- Ask a team owner to set Manage Products to "Users CAN view, update and create products".
404Not found.
page_not_found: the team slug is unknown, you are not a member of the team, or an id in the path is not one of this team's.code: null, with a message that starts "No query results for": there is no record with that id.- When
- No live product with this id.
error.codeis null anderror.messagenames the record type. - Fix
- Restore a deleted product first.
500A business rule refused the request (see the operation's errors), or something failed inside YoPrint. Refusals use the error envelope with a code such as
action_not_allowed; an unexpected failure answers{"message": "Server Error"}. Repeating a refusal gets the same answer; after an unexpected failure, read the record back before you retry a change.- When
default_priceis not a whole number of thousandths.- Fix
- Send a whole number:
13500for 13.50.
Related
- POSTRename sizes and colors of a product
/v1/ api/ store/ {team_slug}/ product/ {hash_id}/ variant/ rename_options - PUTUpdate a variant
/v1/ api/ store/ {team_slug}/ product/ {hash_id}/ variant/ {id}
