API reference | LabBench CLI reference | MCP reference | Guide: set up a lab
This guide is for an agent (or a person at a terminal) that sets up a new lab with the labbench CLI. It follows the same six steps as the guided setup in the dashboard, and the order matters: a location comes before the stock that lives in it.
The writes in this guide need a signed-in session, not an API token. A token is refused on creating the lab, the locations, the kiosk pairing, the invitations and finishing setup (with token_write_not_allowed). Only the inventory import also takes a read-write token, but use the session throughout. Sign in once; the session is stored in the config file:
labbench login --server https://your-labbench.example
Reads such as labbench lab list and labbench setup status work with either. The account that creates a lab becomes its manager, and the later steps need the manager role.
When you work on a lab other than the saved one, pass --lab LAB_ID on each command (or set LABBENCH_LAB). Add -o json to read ids out of an answer.
labbench lab create --name "Tanaka Lab" --institution "State University" --kind academic
The answer carries the new lab's id.
Freezers, shelves and benches. One call adds up to 100 locations, all or none:
labbench locations create-batch --lab LAB_ID --data '[{"name":"Freezer A"},{"name":"Bench 2","description":"Window side"}]'
List them with labbench locations list; stock needs a location id.
A kiosk is the tablet people walk up to. Ask for a code, enter it on the tablet, then confirm the tablet that entered it:
labbench kiosks pairing-codes create --lab LAB_ID labbench kiosks pairing-codes confirm CODE --label "Freezer room"
Skip this step if the lab has no kiosk yet; it never blocks finishing setup.
Map the person's spreadsheet to the import columns, show them the rows, and make the call once they confirm:
labbench lots import --lab LAB_ID --format csv --data "$(cat inventory.csv)"
The columns are client_row_id, material, lot_number, unit, location_id, quantity, source, expires_on, content_per_unit and content_unit. Run labbench lots import --help for the rules. To add one lot at a time, use labbench lots receive.
One call invites several people, all or none. Each invitee sets their own PIN on accepting:
labbench members invite-batch --lab LAB_ID --rows '[{"email":"tess@example.org","role":"member"}]'
Finishing starts the lab's 30-day trial, dated today (UTC):
labbench setup finish --lab LAB_ID
The answer has trialStartedOn, trialEndsOn, startedNow and source. It is safe to repeat: a second call, or a trial an operator already started, keeps its original dates and answers startedNow: false. Check where a lab stands at any point with labbench setup status.
Each command above has a page in the CLI reference, and each is also an MCP tool in the MCP reference.