POST /products/prices sets the price of up to 500 products in one call.
Use it to drive the restaurant’s prices from your ERP, cash-and-carry price
list or spreadsheet instead of editing them one by one in Unipage. The till,
the webshop, the kiosk and the Storefront API all follow.
curl -X POST https://api.unipage.eu/x94d3/products/prices \
-H "X-API-Key: $UNIPAGE_CORE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prices": [
{ "id": "p7d2x", "price": 4.2 },
{ "internal_reference": "FRIES-L", "price": 3.8 }
]
}'Request
| Field | Rule |
|---|---|
prices |
required, a list of 1 to 500 entries |
prices[].id |
the product id, as in GET /generic/products |
prices[].internal_reference |
or: the product’s own code, used when id is not given |
prices[].price |
the new price including VAT, in the restaurant’s currency: a number (or numeric string) from 0 to 100000, at most two decimals |
dry_run |
optional, true (in the body, or ?dry_run=1): check everything and report what would change, without changing anything |
Your own product codes: internal_reference
Every product has an optional code the restaurant fills in on the product, in
Unipage’s product editor (Geavanceerd > “Interne code”). Put your ERP’s article
number or SKU there once, and you never need to store Unipage ids: send
internal_reference instead of id. Matching ignores upper and lower case.
The code is in the catalog feed as internal_reference, so you can check which
products have one.
A code that two products share cannot be used: send their id instead.
Response
{
"dry_run": false,
"updated": [
{ "id": "p7d2x", "internal_reference": null, "name": "Bicky burger", "price": 4.2, "previous_price": 3.9 },
{ "id": "k2m8q", "internal_reference": "FRIES-L", "name": "Grote friet", "price": 3.8, "previous_price": 3.6 }
],
"unchanged": []
}updatedlists the products whose price changed, with the price before (previous_price).unchangedlists the products that already had that price. Nothing is written for them, so sending your whole price list every night is fine.- With
dry_run, the same answer tells you what would change; nothing does.
All or nothing
Every entry is checked before anything is written. If one entry is wrong,
nothing changes and the answer lists every wrong entry, by its position in
prices:
{
"error": "validation_failed",
"message": "Nothing was changed: fix the listed prices and send the request again",
"fields": {
"prices.1.id": "No product with this id",
"prices.2.internal_reference": "No product with this internal reference",
"prices.3.price": "A price from 0 to 100000 with at most 2 decimals",
"prices.4": "This product is already in the list at prices.0"
}
}| Field message | Cause |
|---|---|
No product with this id |
unknown id, or a product of another restaurant |
No product with this internal reference |
no product has that code |
More than one product has this internal reference, use the id |
the code is not unique |
Give the product id or its internal_reference |
the entry has neither |
A price from 0 to 100000 with at most 2 decimals |
4.999, -1, "abc" |
This product is already in the list at prices.<i> |
the same product twice in one request |
Send a non-empty list of prices / At most 500 prices per request |
on prices itself |
Because the batch is all or nothing, it is safe to retry: sending the same
prices again changes nothing and reports them as unchanged.
What changes, and where
- The product’s base price. It is the price the restaurant sets on the product in Unipage. Prices of options (sauces, sizes, supplements) are not changed by this endpoint.
- Every location that sells the product. Locations of one group share their catalog: a product’s price is the same on each of them, exactly as when the restaurant edits it in Unipage.
- The tills update live. Unipos PLUS receives the new price within seconds; a till that is offline catches up when it reconnects.
- The webshop, kiosk and Storefront API follow within a few minutes, once their menu cache is refreshed.
- Linked options follow. An option that is linked to a product (a menu with a choice of burger, for example) and takes its price from it is re-priced too.
- Menu planning wins. When the restaurant gives a product another price in a menu plan (a lunch price, for example), that plan price stays in force during the plan; the new base price applies outside it.
- A percentage service fee stays on top. When the restaurant charges a percentage service fee inside its online prices, customers see the new price plus that fee, as with every price.
- Every change is recorded in the restaurant’s activity log (a dry run or an unchanged price records nothing).
Syncing a price list
Send the whole list in pages of 500, one call per second at most (the rate limit). Run a dry run first when the list comes from a person rather than a system.
Sync on a schedule (nightly, or when your price list changes), not every minute: a call that changes many prices makes every till of the restaurant reload its catalog. Unchanged prices cost nothing, so sending the full list each time is fine.
const rows = loadPriceList(); // [{ sku: "FRIES-L", price: 3.8 }, ...]
const url = `https://api.unipage.eu/${BUSINESS_ID}/products/prices`;
for (let i = 0; i < rows.length; i += 500) {
const prices = rows.slice(i, i + 500).map((r) => ({ internal_reference: r.sku, price: r.price }));
const res = await fetch(url, {
method: "POST",
headers: { "X-API-Key": process.env.UNIPAGE_CORE_API_KEY, "Content-Type": "application/json" },
body: JSON.stringify({ prices }),
});
const body = await res.json();
if (res.status === 422) {
// Nothing in this page was changed: report and stop, do not retry unchanged.
console.error(body.fields);
break;
}
console.log(`${body.updated.length} changed, ${body.unchanged.length} unchanged`);
await new Promise((r) => setTimeout(r, 1100));
}