API reference

Discounts

Discount codes customers type at checkout or in a WhatsApp chat, plus automatic birthday coupons. Scope: discounts.

The discount object

{
"id": "0199ed2a-…",
"code": "BIENVENIDA",
"type": "percentage",
"value": 1000,
"minSubtotalCents": 2000,
"usageLimit": 100,
"usageCount": 12,
"startsAt": null,
"endsAt": "2026-12-31T23:59:59.000Z",
"status": "active",
"isPublic": false,
"customerId": null,
"createdAt": "2026-10-12T15:04:05.000Z",
"updatedAt": "2026-10-12T15:04:05.000Z"
}
Field
code Stored upper-case; unique per business.
type percentage or fixed_amount.
value Basis points for percentage (1000 = 10 %, max 10000), cents for fixed_amount.
minSubtotalCents Minimum cart subtotal, or null.
usageLimit Total redemptions allowed, or null for unlimited.
startsAt / endsAt Validity window, or null.
isPublic Listed in every signed-in shopper's coupons.
customerId Only this customer may use it, or null for anyone with the code.

GET/discounts

Query
q Part of the code.
limit 1–100, default 20.
cursor From the previous page.

GET/discounts/:id

Returns one discount.

POST/discounts

Answers 201. A code already in use answers 409 code_taken.

curl -X POST "https://api.malla.fun/discounts" \
-H "Authorization: Bearer $MALLA_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "code": "BIENVENIDA", "type": "percentage", "value": 1000, "usageLimit": 100 }'

PATCH/discounts/:id

Any field. null clears a limit or a date. Set status: "inactive" to pause a code.

DELETE/discounts/:id

Deletes the discount.

GET/discounts/birthday

The birthday coupon settings: { "percentBps": 1500, "validDays": 30 }. percentBps: null means they're off.

PUT/discounts/birthday

Customers with a birth date get a personal code on their birthday.

await malla.discounts.updateBirthdaySettings({ percentBps: 1500, validDays: 30 }) // 15 % for 30 days
await malla.discounts.updateBirthdaySettings({ percentBps: null, validDays: 30 }) // off

Related events: discount.created, discount.updated, discount.deleted, discount.redeemed.