API reference

Products

The catalog: products, their options (Size, Color…), the variants those options produce, and stock. Scope: products.

A product without options has exactly one variant, which holds its price and stock. Adding options generates one variant per combination (M / Red, L / Red…), each with its own price, SKU, stock and image. Orders always reference a variant.

The product object

{
"id": "0199ed2a-6b1e-7c40-9a3f-1d2e8b4c7a10",
"title": "Camisa Oxford",
"description": "Algodón 100 %.",
"status": "active",
"coverImageUrl": "https://…/oxford.jpg",
"trackInventory": true,
"totalInventory": 37,
"category": { "id": "…", "label": "Camisas", "ancestors": [{ "id": "…", "label": "Ropa" }] },
"collections": [{ "id": "…", "title": "Nuevos" }],
"options": [
{ "id": "…", "name": "Talla", "values": [{ "id": "…", "value": "M" }, { "id": "…", "value": "L" }] }
],
"variants": [
{ "id": "…", "title": "M", "sku": "OX-M", "priceCents": 2500, "compareAtPriceCents": null, "inventoryQuantity": 12, "optionValueIds": { "…": "…" } }
],
"createdAt": "2026-10-12T15:04:05.000Z",
"updatedAt": "2026-10-12T15:04:05.000Z"
}
Field
status draft, active or archived. Only active products are sold.
trackInventory When false the product never runs out.
totalInventory Stock summed over the variants.

GET/products

Lists products, newest first. Returns a page of summaries (id, title, status, category, variantCount, totalInventory, hasOptions, coverImageUrl…).

Query
status draft, active or archived.
q Every word must appear in the title, a variant title or a SKU (accents ignored).
limit 1–100, default 10.
cursor From the previous page.
curl "https://api.malla.fun/products?status=active&q=camisa" \
-H "Authorization: Bearer $MALLA_API_KEY"

GET/products/:id

Returns the full product with options and variants.

const product = await malla.products.retrieve(id)

POST/products

Creates a product with a single default variant. Answers 201.

Body
title Required.
slug Required. URL handle, unique in your store.
description Optional.
status Default draft.
trackInventory Optional.
inventoryQuantity Stock of a product without options.
curl -X POST "https://api.malla.fun/products" \
-H "Authorization: Bearer $MALLA_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "title": "Café de altura 1 lb", "slug": "cafe-altura-1lb", "status": "active", "inventoryQuantity": 40 }'

Set the price on its variant with PATCH /products/:id/variants/:variantId (below).

PATCH/products/:id

Updates any of the fields of POST /products. Returns the product.

await malla.products.update(id, { status: 'archived' })

DELETE/products/:id

Deletes the product. Past orders keep their lines. Returns { "ok": true }.

PUT/products/:id/options

Replaces the product's options, in order, and regenerates its variants. Send the full list every time. You generate the ids (UUIDs) for new options and values: an id that doesn't exist yet is created, an existing one you leave out is deleted, so variants of values you keep are preserved.

await malla.products.setOptions(id, [
{
id: crypto.randomUUID(),
name: 'Talla',
values: [
{ id: crypto.randomUUID(), value: 'M' },
{ id: crypto.randomUUID(), value: 'L' },
],
},
])

Option names must be unique in the product, and values unique within an option.

PATCH/products/:id/variants/:variantId

Changes a variant's priceCents, compareAtPriceCents (crossed-out price, null to remove), sku, inventoryQuantity or imageKey. A variant's title always comes from its option values.

await malla.products.updateVariant(productId, variantId, { priceCents: 1250, inventoryQuantity: 30 })

DELETE/products/:id/variants/:variantId

Deletes one combination (e.g. a size you don't make). A product's last variant can't be deleted (409 last_variant).

GET/products/inventory

Stock per variant across the catalog, for restocking and stock syncs.

Query
stock all (default), low (tracked, between 1 and lowThreshold) or out (tracked, at 0).
lowThreshold Default 5.
q Search.
limit / cursor Default 50.
const { data } = await malla.products.inventory({ stock: 'low' })
for (const item of data)
console.log(item.productTitle, item.variantTitle, item.inventoryQuantity)

Related events: product.created, product.updated, product.deleted, inventory.low_stock.