Manage products and variants
A product is sold in variants, and each variant keeps its own facts.
Every product in the catalog lives under /products. If it is sold in sizes, colors or capacities, it has variants: one row per combination, with its own SKU, price, inventory count and options. Reading needs marketplace:read; writing, marketplace:write.
Variant attributes
Whatever differs between variants and is not a purchase option goes in attributes: a flat map of strings, numbers or booleans. For example, the battery range of the units behind a SKU.
curl -X PATCH "https://api.vitrinadev.com/api/v1/products/$PRODUCT_ID/variants/$VARIANT_ID" \
-H "Authorization: Bearer $VITRINA_KEY" \
-H "Content-Type: application/json" \
-d '{"attributes": {"battery_min_pct": 99, "battery_max_pct": 100}}'The response carries the whole variant, with "attributes": {"battery_min_pct": 99, "battery_max_pct": 100}. A variant with no data returns {}.
POST /products/{id}/variantsandPATCH /products/{id}/variants/{variantId}acceptattributes; so does each element ofvariants[]when creating a product.- Each key uses letters, digits,
_,.or-(up to 60 characters). Each value is a string (up to 300), a number or a boolean. Objects, lists andnullare refused. - Up to 20 keys and 2 KB per variant. Beyond that the response is
400 VALIDATION_ERROR. PATCHreplaces the whole map: send every key you want to keep.{}clears it.- The sales agent reads
attributesfromsearch_product_stockto answer questions such as «what battery does it have?».