Skip to content

Add a variant to an existing item

POST
/v1/tenants/{tenantId}/items/{itemId}/variants
curl --request POST \
--url https://api.emite.cr/v1/tenants/example/items/example/variants \
--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 }'

Variants share the item's tax data but differ in code (SKU), per-currency prices, unitOfMeasure, packSize, etc. code must be unique within the tenant. On a surtido the prices sent are ignored: the new variant gets the prices derived from the composition.

tenantId
required
string

Tenant UUID.

itemId
required
string

Item UUID.

Media typeapplication/json
object
code
required

The variant's SKU, 1–50 characters, unique among the company's variants (409 when another one has it). Bulk imports match existing items by it, and for a surtido the EmiteCR app sends it as the type-03 commercial code the invoice line requires.

string
Example
IMP-350-UNI
variantName

Name of this format or presentation, 1–120 characters, shown next to the item name in catalog pickers; catalog searches match it.

string
nullable
Example
Cerveza Imperial 350ml — Unidad
unitOfMeasure
required

Unit the variant is sold in, as a symbol of Hacienda's unit catalog (UnidadMedidaType, standard RTC 443:2010; case-sensitive): for example Unid (unit), Kg (kilogram), L (litre), h (hour), Sp (professional services), Os (other service). The unitOfMeasure (<UnidadMedida>) of an invoice line that sells it.

string
Example
Unid
unitOfMeasureCommercial

Free-text commercial name of the package, up to 20 characters, kept with the catalog. Invoice lines do not carry it.

string
nullable
Example
Caja x12
prices
required

The variant's prices, one per currency (1 to 10). Prices are independent: a variant may have a price in some of the company's currencies only, and an invoice uses the price in its own currency. Ignored for a surtido, whose prices are derived from its components.

Array<object>
object
currency
required

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).

string
Allowed values: AED AFN ALL AMD ANG AOA ARS AUD AWG AZN BAM BBD BDT BGN BHD BIF BMD BND BOB BOV BRL BSD BTN BWP BYR BZD CAD CDF CHE CHF CHW CLF CLP CNY COP COU CRC CUC CUP CVE CZK DJF DKK DOP DZD EGP ERN ETB EUR FJD FKP GBP GEL GHS GIP GMD GNF GTQ GYD HKD HNL HRK HTG HUF IDR ILS INR IQD IRR ISK JMD JOD JPY KES KGS KHR KMF KPW KRW KWD KYD KZT LAK LBP LKR LRD LSL LYD MAD MDL MGA MKD MMK MNT MOP MRO MUR MVR MWK MXN MXV MYR MZN NAD NGN NIO NOK NPR NZD OMR PAB PEN PGK PHP PKR PLN PYG QAR RON RSD RUB RWF SAR SBD SCR SDG SEK SGD SHP SLL SOS SRD SSP STD SVC SYP SZL THB TJS TMT TND TOP TRY TTD TWD TZS UAH UGX USD USN UYI UYU UZS VEF VND VUV WST XAF XCD XDR XOF XPF XSU XUA YER ZAR ZMW ZWL
Example
CRC
unitPrice
required

Price 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.

number
Example
950
packSize

How many inner units this variant holds (e.g. 12 for a box of 12), greater than 0 with up to 3 decimals. Send it together with innerUnitOfMeasure: both or neither. Catalog information only.

number
nullable
Example
12
innerUnitOfMeasure

Unit of the inner units packSize counts (e.g. Unid, L), a symbol of the same Hacienda catalog as unitOfMeasure. Both or neither with packSize.

string
nullable
Example
Unid
commercialCodes

Up to 5 codes that identify the variant elsewhere (the seller's SKU, the buyer's code, a GTIN…), in the shape of an invoice line's commercialCodes (<CodigoComercial>). Kept with the catalog: the API does not add them to invoices, so copy them into a line that should carry them.

Array<object>
nullable
object
tipo
required

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.
string
Allowed values: 01 02 03 04 99
Example
01
codigo
required

The code itself, 1–20 characters (<CodigoComercial><Codigo>).

string
Example
SKU-IMP-350
barcode

Barcode (GTIN, EAN or UPC), up to 50 characters; the format is not checked. The catalog search matches it by prefix, so a scanner can find the variant.

string
nullable
Example
7441001234567
isDefault

Marks the item's main variant, the one catalog lists show. An item with a single variant gets it automatically; with several variants in one request, exactly one must be true (422 otherwise). On POST …/variants, true makes the new variant the default and demotes the previous one.

boolean
Example
true
isActive

false pauses the variant without deleting it: the EmiteCR invoice picker and the WhatsApp agent stop offering it. Defaults to true.

boolean
Example
true
sortOrder

Position among the item's variants, ascending. Defaults to the variant's position in the request when the item is created, and to 0 when a variant is added later.

number
Example
0

The variant created.

Media typeapplication/json
object
id
required

Id of the variant — the {variantId} of the variant routes.

string format: uuid
itemId
required

Id of the item it belongs to.

string format: uuid
code
required

The variant's SKU, unique among the company's variants.

string
variantName
required

Name of this format or presentation; null when it has none.

string
nullable
unitOfMeasure
required

Unit the variant is sold in, a symbol of Hacienda's unit catalog.

string
unitOfMeasureCommercial
required

Free-text commercial name of the package; null when it has none.

string
nullable
prices
required

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.

Array<object>
object
currency
required

Currency of the price (ISO 4217).

string
Allowed values: AED AFN ALL AMD ANG AOA ARS AUD AWG AZN BAM BBD BDT BGN BHD BIF BMD BND BOB BOV BRL BSD BTN BWP BYR BZD CAD CDF CHE CHF CHW CLF CLP CNY COP COU CRC CUC CUP CVE CZK DJF DKK DOP DZD EGP ERN ETB EUR FJD FKP GBP GEL GHS GIP GMD GNF GTQ GYD HKD HNL HRK HTG HUF IDR ILS INR IQD IRR ISK JMD JOD JPY KES KGS KHR KMF KPW KRW KWD KYD KZT LAK LBP LKR LRD LSL LYD MAD MDL MGA MKD MMK MNT MOP MRO MUR MVR MWK MXN MXV MYR MZN NAD NGN NIO NOK NPR NZD OMR PAB PEN PGK PHP PKR PLN PYG QAR RON RSD RUB RWF SAR SBD SCR SDG SEK SGD SHP SLL SOS SRD SSP STD SVC SYP SZL THB TJS TMT TND TOP TRY TTD TWD TZS UAH UGX USD USN UYI UYU UZS VEF VND VUV WST XAF XCD XDR XOF XPF XSU XUA YER ZAR ZMW ZWL
unitPrice
required

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.

string
packSize
required

How many inner units the variant holds, as a decimal STRING with 3 decimals (e.g. "12.000"); null when not set.

string
nullable
innerUnitOfMeasure
required

Unit of the inner units packSize counts; null when not set.

string
nullable
commercialCodes
required

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.

Array<object>
nullable
object
tipo
required

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.
string
Allowed values: 01 02 03 04 99
codigo
required

The code itself, 1–20 characters (<CodigoComercial><Codigo>).

string
barcode
required

Barcode (GTIN, EAN or UPC); null when it has none.

string
nullable
isDefault
required

Whether this is the item's default variant, the one catalog lists show (at most one per item).

boolean
isActive
required

false when the variant is paused: the EmiteCR invoice picker and the WhatsApp agent do not offer it.

boolean
sortOrder
required

Position among the item's variants, ascending.

number
createdAt
required

When the variant was created.

string format: date-time
updatedAt
required

When the variant was last changed.

string format: date-time
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, or a price in a currency not enabled (CURRENCY_NOT_ENABLED).

Missing or invalid JWT / API key

Tenant boundary violation or insufficient scope.

Item not found.

Duplicate code (SKU).