Skip to content

People, Sharing and the API

Who else can see the inventory, how they get in, and how your own scripts do — with keys that expire.

Groups are households

Chapter 4 introduced the group: one inventory, its own currency, its own members. A person can belong to several groups and switch between them, which is the model for "our house, my parents' house, the village hall storeroom" — three inventories that never blur into one another. Roles within a group decide who administers and who merely browses; the program's database keeps a role per person per group (transcript t21's table list shows the machinery).

Sharing starts with an invitation: a group can mint invitation tokens — the API shapes for them are in the endpoint map (transcript t04) — and a person who accepts lands inside that group with the role they were given. The lab ran a one-person household, so the invitation round-trip itself is documented-only here; the tokens, roles and membership endpoints it rests on are all present in the running program and were read from it.

Draw the exposure line plainly, once: an inventory is a priced map of your valuables. Share it with the people who share the house. Think twice, then think again, before the program is reachable from the open internet; a home VPN or a private network overlay is the grown-up way to reach it from away.

API keys

For scripts — a barcode scanner workstation, a nightly export, your own dashboard — a person can mint an API key from their own account. The lab created one (transcript t20):

  • The key's full value is shown once, at creation. The list of your keys afterwards shows names, dates, and when each was last used — never the key itself.
  • Keys expire: the lab's was issued with an expiry 30 days out.
  • A key works anywhere the login token works; the lab read the group statistics with it as its only credential.
  • The server secret from chapter 3 is the other half of this story: rotate the pepper and every issued key dies at once — a blunt instrument, but the right one if a key leaks.

The API itself

Everything this guide's lab did was done through the API, and the endpoints used are the ones the web pages use. The program serves its own documentation at /swagger/ — the lab's map counted 68 routes across entities, tags, templates, groups, maintenance, statistics, labels, exports and users (transcript t04). Two habits from the earlier chapters bear repeating for scripters: send the token in the Authorization header without a Bearer prefix (chapter 4), and send complete records on update, because a partial update is a deletion wearing a disguise (chapter 5).

Parts of the surface this guide did not exercise, named for completeness: notifiers (destinations the program can send event notifications to), barcode product lookup (an endpoint that resolves a barcode against outside services — it can use a contact address and third-party tokens, set in the configuration), and OIDC sign-in (a default install reports it disabled; the local password login is what this guide used).

The check for this chapter: mint a key, use it once from a script or a command line, and watch its "last used" stamp appear in the list. Then decide which of your keys deserve to exist.