Skip to content

Cafe

10 operations in the cafe namespace.

Create a café site

POST /rpc/v1/cafe.createSite

A site is the unit that has somebody standing in it, which is why live views and anomaly detection are scoped here rather than to a machine.

Requires permission cafe.write and the cafe module on the organization’s plan.

Field Type Required Description
name string yes
code string yes
locationId string no
timezone string no
Terminal window
curl -X POST https://api.roastery.run/rpc/v1/cafe.createSite \
-H "Authorization: Bearer $ROASTERY_API_KEY" \
-H "X-Roastery-Org: $ORG_ID" \
-H "Content-Type: application/json" \
-d '{}'

What is happening at the bar right now

POST /rpc/v1/cafe.getLiveBar

The last five minutes and any group head currently going wrong, read from the site’s live session rather than the database — the point is to answer in seconds, not on the next rollup.

Requires permission cafe.read and the cafe module on the organization’s plan.

Field Type Required Description
siteId string yes
Terminal window
curl -X POST https://api.roastery.run/rpc/v1/cafe.getLiveBar \
-H "Authorization: Bearer $ROASTERY_API_KEY" \
-H "X-Roastery-Org: $ORG_ID" \
-H "Content-Type: application/json" \
-d '{}'

How a site has been running

POST /rpc/v1/cafe.getSitePerformance

Also available as GET with a URL-encoded input query parameter, so the response can be HTTP-cached.

Reads the hourly rollups, never the shots. A busy chain produces millions of shots a year and every dashboard would otherwise scan them.

Requires permission cafe.read and the cafe module on the organization’s plan.

Field Type Required Description
siteId string yes
from string yes
to string yes
Terminal window
curl -X POST https://api.roastery.run/rpc/v1/cafe.getSitePerformance \
-H "Authorization: Bearer $ROASTERY_API_KEY" \
-H "X-Roastery-Org: $ORG_ID" \
-H "Content-Type: application/json" \
-d '{}'

Import sales lines from a point-of-sale system

POST /rpc/v1/cafe.importPosSales

Idempotent on the POS system’s own line id, so re-importing a day — which every reconciliation job eventually does — adds nothing.

Requires permission cafe.ingest and the cafe module on the organization’s plan.

Field Type Required Description
siteId string yes
lines object[] yes
Terminal window
curl -X POST https://api.roastery.run/rpc/v1/cafe.importPosSales \
-H "Authorization: Bearer $ROASTERY_API_KEY" \
-H "X-Roastery-Org: $ORG_ID" \
-H "Content-Type: application/json" \
-d '{}'

List bar equipment

POST /rpc/v1/cafe.listMachines

Also available as GET with a URL-encoded input query parameter, so the response can be HTTP-cached.

Requires permission cafe.read and the cafe module on the organization’s plan.

Field Type Required Description
filter object no
page object no
Terminal window
curl -X POST https://api.roastery.run/rpc/v1/cafe.listMachines \
-H "Authorization: Bearer $ROASTERY_API_KEY" \
-H "X-Roastery-Org: $ORG_ID" \
-H "Content-Type: application/json" \
-d '{}'

Past reconciliations

POST /rpc/v1/cafe.listReconciliations

Also available as GET with a URL-encoded input query parameter, so the response can be HTTP-cached.

A single day’s variance says little on its own. A consistent 8% is a process problem; one bad Tuesday is a bad Tuesday, and only the history distinguishes them.

Requires permission cafe.read and the cafe module on the organization’s plan.

Field Type Required Description
filter object no
page object no
Terminal window
curl -X POST https://api.roastery.run/rpc/v1/cafe.listReconciliations \
-H "Authorization: Bearer $ROASTERY_API_KEY" \
-H "X-Roastery-Org: $ORG_ID" \
-H "Content-Type: application/json" \
-d '{}'

Individual shots

POST /rpc/v1/cafe.listShots

Also available as GET with a URL-encoded input query parameter, so the response can be HTTP-cached.

The raw rows, for investigating something the rollups surfaced. A time window is required: this is the highest-volume table in the system, and an unbounded query against it is never what anyone meant.

Requires permission cafe.read and the cafe module on the organization’s plan.

Field Type Required Description
filter object yes
limit integer no
Terminal window
curl -X POST https://api.roastery.run/rpc/v1/cafe.listShots \
-H "Authorization: Bearer $ROASTERY_API_KEY" \
-H "X-Roastery-Org: $ORG_ID" \
-H "Content-Type: application/json" \
-d '{}'

List café sites

POST /rpc/v1/cafe.listSites

Also available as GET with a URL-encoded input query parameter, so the response can be HTTP-cached.

Requires permission cafe.read and the cafe module on the organization’s plan.

Field Type Required Description
page object no
Terminal window
curl -X POST https://api.roastery.run/rpc/v1/cafe.listSites \
-H "Authorization: Bearer $ROASTERY_API_KEY" \
-H "X-Roastery-Org: $ORG_ID" \
-H "Content-Type: application/json" \
-d '{}'

Compare shots pulled against coffee sold

POST /rpc/v1/cafe.reconcilePos

Counts shots and sale shot-equivalents for one business day and records the variance. A positive variance is coffee pulled but not sold — waste, comps or theft; a negative one means the till saw sales the machines did not report, which usually means a bridge is down.

Requires permission cafe.write and the cafe module on the organization’s plan.

Field Type Required Description
siteId string yes
businessDate string yes
Terminal window
curl -X POST https://api.roastery.run/rpc/v1/cafe.reconcilePos \
-H "Authorization: Bearer $ROASTERY_API_KEY" \
-H "X-Roastery-Org: $ORG_ID" \
-H "Content-Type: application/json" \
-d '{}'

Register bar equipment

POST /rpc/v1/cafe.registerMachine

groupCount matters: every group head is judged separately, because one failing group on a three-group machine is the most common real fault and a machine-level average hides it behind two groups that are fine.

Requires permission cafe.write and the cafe module on the organization’s plan.

Field Type Required Description
siteId string yes
name string yes
code string yes
kind espresso_machine | grinder | batch_brewer | water_system yes
groupCount integer no
brand string no
model string no
deviceId string no
Terminal window
curl -X POST https://api.roastery.run/rpc/v1/cafe.registerMachine \
-H "Authorization: Bearer $ROASTERY_API_KEY" \
-H "X-Roastery-Org: $ORG_ID" \
-H "Content-Type: application/json" \
-d '{}'