Skip to content

Vending and POS (preview)

Each machine is a device that belongs to one business. It has its own sales channel (which products it sells), its own stock location (what is physically inside it) and a secret sdr_dev_… credential.

Every request sends:

  • Authorization: Bearer sdr_dev_…,
  • X-Device-Timestamp: current Unix time in milliseconds (accepted within ±5 minutes).

Every state change (POST) also sends X-Device-Nonce: a unique value of 16–64 characters (A–Z a–z 0–9 _ -). A reused nonce returns 409 conflict.

Step Endpoint Effect
Sync prices and stock GET /foulad/devices/catalog Products available in this machine, with BHD prices
Remote configuration GET /foulad/devices/config Display message and maintenance state
Customer selects POST /foulad/devices/vends Checks stock and reserves it
Payment confirmed POST /foulad/devices/vends/{id}/payment Authorizes payment and creates the order (not captured yet)
Item dispensed POST /foulad/devices/vends/{id}/dispensed Fulfils from the machine’s stock, then captures payment
Dispense failed POST /foulad/devices/vends/{id}/failed Cancels the order and voids the authorization; the customer is not charged
Telemetry POST /foulad/devices/telemetry Temperature, door, power, errors, firmware
Stock count POST /foulad/devices/reconcile Sets stock to the physical count and reports differences

Sedra records what a machine reports and never actuates it. No API, capability or MCP tool can dispense, unlock, open doors or drive motors. AI assistants can read device state and change business configuration only (devices_config_update). Hardware safety interlocks must stay on the device.

Full contract: Device API reference.