API reference

Customers

Your CRM: everyone who wrote to you, ordered or signed in to your store. Customers are created automatically by orders and messages, and you can create and update them. Scope: customers.

The customer object

{
"id": "0199ed2a-…",
"phone": "50370000000",
"name": "Ana López",
"email": "ana@example.com",
"notes": "Prefiere entregas por la tarde.",
"tags": ["vip", "mayorista"],
"acceptsMarketing": true,
"preferredContact": "whatsapp",
"birthDate": "1992-04-18",
"ordersCount": 7,
"totalSpentCents": 31500,
"lastOrderAt": "2026-10-12T15:04:05.000Z",
"lastMessageAt": "2026-10-12T14:58:00.000Z",
"createdAt": "2026-03-02T10:00:00.000Z",
"updatedAt": "2026-10-12T15:04:05.000Z"
}

phone is stored as digits with country code. It's unique per business.

GET/customers

Query
q Name, phone or email.
tag Only customers with this tag.
limit 1–100, default 20.
cursor From the previous page.
curl "https://api.malla.fun/customers?tag=vip" -H "Authorization: Bearer $MALLA_API_KEY"

GET/customers/:id

The customer plus their recent orders, their conversation and the addresses they saved in your storefront.

const customer = await malla.customers.retrieve(id)

POST/customers

Answers 201. A phone already in use answers 409 phone_taken.

Body
phone Required. 6–15 digits once punctuation is removed.
name, email, notes Optional.
tags Up to 30 tags of up to 40 characters.
curl -X POST "https://api.malla.fun/customers" \
-H "Authorization: Bearer $MALLA_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "phone": "+503 7000 0000", "name": "Ana López", "tags": ["vip"] }'

PATCH/customers/:id

null (or "") clears name, email or notes. tags replaces the whole list. acceptsMarketing records that you vouch for (or withdraw) the customer's consent to promotions.

await malla.customers.update(id, { tags: ['vip', 'mayorista'], notes: null })

GET/customers/tags

Every tag in use, as an array of strings.

const tags = await malla.customers.tags()

Related events: customer.created, customer.updated, customer.deleted, claim.opened, claim.replied.