Update a single variant
const url = 'https://api.emite.cr/v1/tenants/example/items/example/variants/example';const options = { method: 'PATCH', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"code":"IMP-350-UNI","variantName":"Cerveza Imperial 350ml — Unidad","unitOfMeasure":"Unid","unitOfMeasureCommercial":"Caja x12","prices":[{"currency":"AED","unitPrice":950}],"packSize":12,"innerUnitOfMeasure":"Unid","commercialCodes":[{"tipo":"01","codigo":"SKU-IMP-350"}],"barcode":"7441001234567","isDefault":true,"isActive":true,"sortOrder":0}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request PATCH \ --url https://api.emite.cr/v1/tenants/example/items/example/variants/example \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "code": "IMP-350-UNI", "variantName": "Cerveza Imperial 350ml — Unidad", "unitOfMeasure": "Unid", "unitOfMeasureCommercial": "Caja x12", "prices": [ { "currency": "AED", "unitPrice": 950 } ], "packSize": 12, "innerUnitOfMeasure": "Unid", "commercialCodes": [ { "tipo": "01", "codigo": "SKU-IMP-350" } ], "barcode": "7441001234567", "isDefault": true, "isActive": true, "sortOrder": 0 }'prices replaces the whole set — except currencies currently DISABLED on the tenant: they are not editable anywhere, so omitting them preserves their dormant rows untouched (they revive on re-enable). Only absent enabled currencies are removed. Sending a price in a disabled currency is rejected with CURRENCY_NOT_ENABLED. The other fields change only when sent.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Tenant UUID.
Item UUID.
Variant UUID.
Request Bodyrequired
Section titled “Request Bodyrequired”object
New SKU, 1–50 characters, unique among the company's variants (409 when another one has it).
Example
IMP-350-UNIName of this format or presentation, up to 120 characters. null removes it.
Example
Cerveza Imperial 350ml — UnidadUnit the variant is sold in, a symbol of Hacienda's unit catalog (UnidadMedidaType; case-sensitive), e.g. Unid, Kg, L, h or Sp.
Example
UnidFree-text commercial name of the package, up to 20 characters (catalog only). null removes it.
Example
Caja x12Replaces the variant's prices: the currencies sent are created or updated, enabled currencies left out are removed, and prices in currencies the company has disabled are kept as they are (they return when the currency is enabled again). Refused on a surtido, whose prices come from its components (422 SURTIDO_PRICE_DERIVED).
object
Currency of the price (ISO 4217). It must be one of the company's enabled currencies (400 CURRENCY_NOT_ENABLED), and appear only once per variant (400 VARIANT_PRICE_DUPLICATE_CURRENCY).
Example
CRCPrice of one unit in that currency, before discounts and taxes, up to 5 decimals: the unit price an invoice in that currency uses (<PrecioUnitario> of a line, <PrecioUnitarioSurtido> of a surtido component). A price is never derived from another currency with an exchange rate.
Example
950How many inner units the variant holds, greater than 0 with up to 3 decimals. Both or neither with innerUnitOfMeasure; null removes it.
Example
12Unit of the inner units packSize counts, a symbol of the same catalog as unitOfMeasure. Both or neither with packSize; null removes it.
Example
UnidReplaces the variant's commercial codes (up to 5; catalog only, the API does not add them to invoices). null removes them.
object
Who assigned the code (<CodigoComercial><Tipo>, Anexo nota 12):
01: the seller's product code.02: the buyer's product code.03: code assigned by the manufacturer (industrial or importer), such as a GTIN.04: internal-use code.99: other.
Example
01The code itself, 1–20 characters (<CodigoComercial><Codigo>).
Example
SKU-IMP-350Barcode (GTIN, EAN or UPC), up to 50 characters. null removes it.
Example
7441001234567true makes this variant the item's default and demotes the previous one.
Example
truefalse pauses the variant, true resumes it. The default variant cannot be paused (422): make another one the default first.
Example
truePosition among the item's variants, ascending.
Example
0Responses
Section titled “Responses”The variant after the update.
object
Id of the variant — the {variantId} of the variant routes.
Id of the item it belongs to.
The variant's SKU, unique among the company's variants.
Name of this format or presentation; null when it has none.
Unit the variant is sold in, a symbol of Hacienda's unit catalog.
Free-text commercial name of the package; null when it has none.
The variant's active prices, one per currency, ordered by currency code. Sparse: a variant may have no price in some of the company's currencies (an invoice in such a currency cannot use it), and a price in a currency the company disabled is kept and still listed. For a surtido they are derived from its components.
object
Currency of the price (ISO 4217).
Price of one unit in that currency, before discounts and taxes, as a decimal STRING with 5 decimals (e.g. "950.00000"): the stored numeric value, not a JSON number.
How many inner units the variant holds, as a decimal STRING with 3 decimals (e.g. "12.000"); null when not set.
Unit of the inner units packSize counts; null when not set.
Codes that identify the variant elsewhere, as they were sent; null when it has none. Catalog only: the API does not add them to invoices.
object
Who assigned the code (<CodigoComercial><Tipo>, Anexo nota 12):
01: the seller's product code.02: the buyer's product code.03: code assigned by the manufacturer (industrial or importer), such as a GTIN.04: internal-use code.99: other.
The code itself, 1–20 characters (<CodigoComercial><Codigo>).
Barcode (GTIN, EAN or UPC); null when it has none.
Whether this is the item's default variant, the one catalog lists show (at most one per item).
false when the variant is paused: the EmiteCR invoice picker and the WhatsApp agent do not offer it.
Position among the item's variants, ascending.
When the variant was created.
When the variant was last changed.
Example
{ "code": "IMP-350-UNI", "variantName": "Cerveza Imperial 350ml — Unidad", "unitOfMeasure": "Unid", "unitOfMeasureCommercial": "Caja x12", "prices": [ { "currency": "AED", "unitPrice": "950.00000" } ], "packSize": "12.000", "innerUnitOfMeasure": "Unid", "commercialCodes": [ { "tipo": "01", "codigo": "SKU-IMP-350" } ], "barcode": "7441001234567", "sortOrder": 0}Invalid fields, CURRENCY_NOT_ENABLED, or VARIANT_PACK_INCOMPLETE (packSize and innerUnitOfMeasure would not be both set or both empty).
Missing or invalid JWT / API key
Tenant boundary violation or insufficient scope.
Variant not found.
Another variant already has the code (SKU).
Pausing the default variant, or SURTIDO_PRICE_DERIVED (prices sent for a surtido).