Forecast
ForecastService forecasts what each location will sell, item by item and hour by hour, and drafts purchase orders and next week's shifts from it. See docs/adr/0056-demand-forecasts.md.
Forecasts are refreshed every morning at 06:00 local time from the last eight weeks of completed sales (less refunds), by business date. They are arithmetic over the business's own records: the same weekday's weighted average, a recent trend, closed days left out, slow sellers handled on their own, and new items borrowing a weekly pattern. Every number carries a one-line basis, and every past forecast is scored against what sold.
Drafts are never sent or published here: purchase orders wait in Draft for someone to send them, and shifts stay unpublished until a manager publishes the week.
GetDemandForecast#
GetDemandForecast is a location's forecast for a range of days (today and the next 13 by default): the location's orders and sales by day and hour, each item's units, and how accurate the forecasts have been.
Request body
locationIdstringlocation_idfromstringYYYY-MM-DD, inclusive; empty for today and the 13 days after. At most 60 days, and no further ahead than 14 days from today.
tostringquerystringFilters items by name; empty for all.
limitintegerAt most this many items, busiest first; 0 for 200.
Response
todaystringdaysDemandDay[]itemsItemForecast[]madeAtstringmade_atWhen the forecast was last made (RFC 3339); empty when never.
draftsActivebooleandrafts_activeWhether drafts are being made for this location, and why.
draftsReasonstringdrafts_reasoneventsForecastEvent[]Events on the requested days.
curl https://api.buziin.tech/holygrail.forecast.v1.ForecastService/GetDemandForecast \
-H "Authorization: Bearer $LUMORA_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"locationId": "0193a4f2-0b10-7f62-a4c9-6d1e2b3c4f70"
}'{
"today": "",
"days": [
{
"date": "2026-12-05",
"orders": "0",
"netSales": "0",
"lowSales": "0",
"highSales": "0",
"hourOrders": [
"0"
],
"hourSales": [
"0"
],
"confidence": "",
"basis": "",
"past": false,
"actualOrders": "0",
"actualNetSales": "0",
"upliftOrders": "0",
"upliftSales": "0",
"reasons": [
""
]
}
],
"items": [
{
"variantId": "",
"name": "Amina Mushi",
"category": "",
"days": [
"0"
],
"total": "150000",
"lowTotal": "150000",
"highTotal": "150000",
"method": "",
"confidence": "",
"basis": "",
"soldLast28Days": "0",
"uplift": "0"
}
],
"salesAccuracy": {
"days": 0,
"wapeBp": 0,
"biasBp": 0,
"text": ""
},
"itemAccuracy": {
"days": 0,
"wapeBp": 0,
"biasBp": 0,
"text": ""
},
"madeAt": "",
"draftsActive": false,
"draftsReason": "",
"events": [
{
"id": "4f1c2e9a-8b3d-4e57-9a10-2c6f7d8e9b01",
"locationId": "0193a4f2-0b10-7f62-a4c9-6d1e2b3c4f70",
"date": "2026-12-05",
"kind": "",
"name": "Amina Mushi",
"guests": 0,
"note": ""
}
]
}RefreshDemandForecast#
RefreshDemandForecast rebuilds a location's history and forecast now.
Request body
locationIdstringlocation_idResponse
itemsintegermadeAtstringmade_atcurl https://api.buziin.tech/holygrail.forecast.v1.ForecastService/RefreshDemandForecast \
-H "Authorization: Bearer $LUMORA_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"locationId": "0193a4f2-0b10-7f62-a4c9-6d1e2b3c4f70"
}'{
"items": 0,
"madeAt": ""
}GetForecastSettings#
Request body
locationIdstringlocation_idResponse
settingsForecastSettingscurl https://api.buziin.tech/holygrail.forecast.v1.ForecastService/GetForecastSettings \
-H "Authorization: Bearer $LUMORA_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"locationId": "0193a4f2-0b10-7f62-a4c9-6d1e2b3c4f70"
}'{
"settings": {
"locationId": "0193a4f2-0b10-7f62-a4c9-6d1e2b3c4f70",
"drafts": "",
"orderWeekday": 0,
"orderHour": 0,
"orderCycleDays": 0,
"scheduleWeekday": 0,
"scheduleHour": 0,
"draftsActive": false,
"draftsReason": ""
}
}UpdateForecastSettings#
Request body
settingsForecastSettingsResponse
settingsForecastSettingscurl https://api.buziin.tech/holygrail.forecast.v1.ForecastService/UpdateForecastSettings \
-H "Authorization: Bearer $LUMORA_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"settings": {
"locationId": "0193a4f2-0b10-7f62-a4c9-6d1e2b3c4f70"
}
}'{
"settings": {
"locationId": "0193a4f2-0b10-7f62-a4c9-6d1e2b3c4f70",
"drafts": "",
"orderWeekday": 0,
"orderHour": 0,
"orderCycleDays": 0,
"scheduleWeekday": 0,
"scheduleHour": 0,
"draftsActive": false,
"draftsReason": ""
}
}DraftFromForecast#
DraftFromForecast drafts purchase orders (inventory.manage) or a week's shifts (shifts.manage) now, whatever the settings say.
Request body
locationIdstringlocation_idkindstringorders or schedule.
weekStartstringweek_startFor a schedule, the Monday the week starts (YYYY-MM-DD); empty for next week.
Response
summarystringpurchaseOrderIdsstring[]purchase_order_idsshiftsDraftedintegershifts_draftedopenShiftsintegeropen_shiftscurl https://api.buziin.tech/holygrail.forecast.v1.ForecastService/DraftFromForecast \
-H "Authorization: Bearer $LUMORA_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"locationId": "0193a4f2-0b10-7f62-a4c9-6d1e2b3c4f70"
}'{
"summary": "",
"purchaseOrderIds": [
""
],
"shiftsDrafted": 0,
"openShifts": 0
}ListForecastEvents#
Events are what is known about a day ahead that history can't see: a party, a group reservation or a catering order (ADR 75). Saving or deleting one refreshes the forecast. Needs inventory.manage, shifts.manage or pos.bookings.
Request body
locationIdstringlocation_idfromstringYYYY-MM-DD; empty for today and the next 60 days.
tostringResponse
eventsForecastEvent[]curl https://api.buziin.tech/holygrail.forecast.v1.ForecastService/ListForecastEvents \
-H "Authorization: Bearer $LUMORA_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"locationId": "0193a4f2-0b10-7f62-a4c9-6d1e2b3c4f70"
}'{
"events": [
{
"id": "4f1c2e9a-8b3d-4e57-9a10-2c6f7d8e9b01",
"locationId": "0193a4f2-0b10-7f62-a4c9-6d1e2b3c4f70",
"date": "2026-12-05",
"kind": "",
"name": "Amina Mushi",
"guests": 0,
"note": ""
}
]
}SaveForecastEvent#
Request body
eventForecastEventEmpty id for a new event.
Response
eventForecastEventcurl https://api.buziin.tech/holygrail.forecast.v1.ForecastService/SaveForecastEvent \
-H "Authorization: Bearer $LUMORA_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"event": {
"id": "4f1c2e9a-8b3d-4e57-9a10-2c6f7d8e9b01",
"locationId": "0193a4f2-0b10-7f62-a4c9-6d1e2b3c4f70",
"date": "2026-12-05",
"name": "Amina Mushi",
"lines": [
{
"name": "Amina Mushi",
"quantity": 1
}
]
}
}'{
"event": {
"id": "4f1c2e9a-8b3d-4e57-9a10-2c6f7d8e9b01",
"locationId": "0193a4f2-0b10-7f62-a4c9-6d1e2b3c4f70",
"date": "2026-12-05",
"kind": "",
"name": "Amina Mushi",
"guests": 0,
"note": ""
}
}DeleteForecastEvent#
Request body
idstringResponse
No fields: send {}.
curl https://api.buziin.tech/holygrail.forecast.v1.ForecastService/DeleteForecastEvent \
-H "Authorization: Bearer $LUMORA_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"id": "4f1c2e9a-8b3d-4e57-9a10-2c6f7d8e9b01"
}'{}Types
The messages and enums these methods use. Field names are lowerCamelCase in JSON; the snake_case names work too. Enum values are sent as their names.
GetDemandForecastRequest
holygrail.forecast.v1.GetDemandForecastRequest
locationIdstringlocation_idfromstringYYYY-MM-DD, inclusive; empty for today and the 13 days after. At most 60 days, and no further ahead than 14 days from today.
tostringquerystringFilters items by name; empty for all.
limitintegerAt most this many items, busiest first; 0 for 200.
GetDemandForecastResponse
holygrail.forecast.v1.GetDemandForecastResponse
todaystringdaysDemandDay[]itemsItemForecast[]madeAtstringmade_atWhen the forecast was last made (RFC 3339); empty when never.
draftsActivebooleandrafts_activeWhether drafts are being made for this location, and why.
draftsReasonstringdrafts_reasoneventsForecastEvent[]Events on the requested days.
RefreshDemandForecastRequest
holygrail.forecast.v1.RefreshDemandForecastRequest
locationIdstringlocation_idRefreshDemandForecastResponse
holygrail.forecast.v1.RefreshDemandForecastResponse
itemsintegermadeAtstringmade_atGetForecastSettingsRequest
holygrail.forecast.v1.GetForecastSettingsRequest
locationIdstringlocation_idGetForecastSettingsResponse
holygrail.forecast.v1.GetForecastSettingsResponse
settingsForecastSettingsUpdateForecastSettingsRequest
holygrail.forecast.v1.UpdateForecastSettingsRequest
settingsForecastSettingsUpdateForecastSettingsResponse
holygrail.forecast.v1.UpdateForecastSettingsResponse
settingsForecastSettingsDraftFromForecastRequest
holygrail.forecast.v1.DraftFromForecastRequest
locationIdstringlocation_idkindstringorders or schedule.
weekStartstringweek_startFor a schedule, the Monday the week starts (YYYY-MM-DD); empty for next week.
DraftFromForecastResponse
holygrail.forecast.v1.DraftFromForecastResponse
summarystringpurchaseOrderIdsstring[]purchase_order_idsshiftsDraftedintegershifts_draftedopenShiftsintegeropen_shiftsListForecastEventsRequest
holygrail.forecast.v1.ListForecastEventsRequest
locationIdstringlocation_idfromstringYYYY-MM-DD; empty for today and the next 60 days.
tostringSaveForecastEventRequest
holygrail.forecast.v1.SaveForecastEventRequest
eventForecastEventEmpty id for a new event.
DeleteForecastEventRequest
holygrail.forecast.v1.DeleteForecastEventRequest
idstringDeleteForecastEventResponse
holygrail.forecast.v1.DeleteForecastEventResponse
No fields.
DemandDay
holygrail.forecast.v1.DemandDay
DemandDay is the location's forecast for one business date. For days already past, actual_* say what happened.
datestringordersint64 stringnetSalesint64 stringnet_saleslowSalesint64 stringlow_saleshighSalesint64 stringhigh_saleshourOrdersint64 string[]hour_orders24 values, local hour 0 to 23.
hourSalesint64 string[]hour_salesconfidencestringbasisstringpastbooleanactualOrdersint64 stringactual_ordersactualNetSalesint64 stringactual_net_salesupliftOrdersint64 stringuplift_ordersWhat bookings, hotel guests and events added to orders and sales (negative when fewer hotel guests lowered them), and why, one line each.
upliftSalesint64 stringuplift_salesreasonsstring[]ItemForecast
holygrail.forecast.v1.ItemForecast
ItemForecast is one item's units over the requested days.
variantIdstringvariant_idnamestringcategorystringdaysint64 string[]One value per requested day, in order.
totalint64 stringlowTotalint64 stringlow_totalhighTotalint64 stringhigh_totalmethodstringweekday, intermittent or new.
confidencestringbasisstringsoldLast28Daysint64 stringsold_last_28_daysUnits sold over the last 28 days, for comparison.
upliftint64 stringUnits over the days added by bookings, hotel guests and events.
Accuracy
holygrail.forecast.v1.Accuracy
Accuracy compares past forecasts with what sold.
daysintegerwapeBpintegerwape_bpWeighted absolute percentage error in basis points (1200 = 12%).
biasBpintegerbias_bpTotal forecast over total actual, less one, in basis points; positive when forecasts ran high.
textstringForecastEvent
holygrail.forecast.v1.ForecastEvent
ForecastEvent is something known about a day ahead.
idstringlocationIdstringlocation_iddatestringYYYY-MM-DD, a business date.
kindstringreservation, catering or event.
namestringguestsintegerGuests on top of the usual trade. With no lines, every item rises by guests over the day's expected orders.
notestringlinesForecastEventLine[]Exactly what it will take, when known (a catering order, a set menu).
ForecastSettings
holygrail.forecast.v1.ForecastSettings
locationIdstringlocation_iddraftsstringauto (on once forecasts have been accurate for four weeks), on or off.
orderWeekdayintegerorder_weekdayISO weekday, 1 Monday ... 7 Sunday, and local hour.
orderHourintegerorder_hourorderCycleDaysintegerorder_cycle_daysHow many days a draft order should look ahead for what needs ordering.
scheduleWeekdayintegerschedule_weekdayscheduleHourintegerschedule_hourdraftsActivebooleandrafts_activeRead only: whether drafting is on now, and why.
draftsReasonstringdrafts_reasonRead only: the last drafts made, newest first.
ForecastEventLine
holygrail.forecast.v1.ForecastEventLine
variantIdstringvariant_idnamestringRead only.
quantityint64 stringForecastRun
holygrail.forecast.v1.ForecastRun
kindstringforecast, orders or schedule.
periodstringranAtstringran_atsummarystringBase URL https://api.buziin.tech. Every method is POST with a JSON body; see Making requests.