HTTP API reference
Bayline API · 172 operations, generated from the API's OpenAPI schema.
Auth with Authorization: Bearer bk_… (an agent key) or a browser session. Every write with a key needs an
Idempotency-Key; PATCH takes If-Match. Errors are {"code", "message"}.
Request and response bodies are in the full OpenAPI schema, which an installation serves to signed-in people and agent keys.
See the overview for keys, roles and proposals.
not in demo refused on this public demo for everyone; every agent-key (Bearer) request is refused here too.
agent
Start here: lookup, aliases, proposals, QR labels.
| Method | Path | What it does |
|---|---|---|
| GET | /api/proposals |
List proposals (status=pending|applied|rejected|expired|all)Query: status, limit, order, envelope |
| POST | /api/proposals |
Propose a change set: dry-run diff; auto-applied only if the policy allowsBody: ProposalIn not in demo |
| GET | /api/proposals/count |
Pending proposal count |
| GET | /api/proposals/{proposal_id} |
Get one proposal with its diff and results |
| POST | /api/proposals/{proposal_id}/confirm |
Confirm and apply (a person only; 409 proposal_stale if the shop changed)Body: DecisionIn |
| POST | /api/proposals/{proposal_id}/reject |
Reject, or withdraw your own proposalBody: DecisionIn |
| GET | /api/lookup |
Find anything from loose text, a barcode/QR, serial or gage id: ranked candidates with score + why (q, kinds, limit)Query: q, kinds, limit |
| GET | /api/aliases |
List aliases (nicknames, Norwegian names, barcodes, QR) for a recordQuery: target_kind, target_id, limit |
| POST | /api/aliases |
Add an alias or barcode/QR to a record (codes are unique shop-wide)Body: AliasIn |
| DELETE | /api/aliases/{alias_id} |
Remove an alias |
| GET | /api/labels |
Label codes for a QR label sheet (kind, ids comma list or q; max 500)Query: kind, ids, q, limit |
| GET | /api/labels/{kind}/{target_id} |
A record's stable label code, title and /q/<code> path |
| GET | /api/q/{code} |
Resolve a scanned label code or /q/<code> URL to its record |
| GET | /api/digest |
Daily digest: low stock, calibration and service due, pending proposals, open faults, yesterday's changesQuery: date |
board
Home screen: what needs attention now.
| Method | Path | What it does |
|---|---|---|
| GET | /api/board |
Home board: due service, due/overdue gages, low stock, recent issues |
items
Tools, inserts, consumables, stock and serials.
| Method | Path | What it does |
|---|---|---|
| GET | /api/items |
List items (filter q, kind; paginated)Query: kind, q, location_id, tracking, custody, limit, offset, cursor, envelope |
| POST | /api/items |
Create an itemBody: ItemIn |
| GET | /api/items/{item_id} |
Get one item with stock per place |
| PATCH | /api/items/{item_id} |
Edit item fields (send expected_version / If-Match)Body: ItemPatch |
| POST | /api/items/{item_id}/parts |
Item Part Add |
| PATCH | /api/items/{parent_id}/parts/{part_id} |
Item Part Patch |
| DELETE | /api/items/{parent_id}/parts/{part_id} |
Item Part Delete |
| POST | /api/items/{item_id}/favorite |
Items Favorite |
| DELETE | /api/items/{item_id}/favorite |
Items Unfavorite |
| GET | /api/items/{item_id}/history |
Item historyQuery: limit |
| POST | /api/items/{item_id}/stock |
Receive stock (qty>0) or count it (set_qty + expected_qty)Body: StockDeltaIn |
| POST | /api/serials |
Add a serial-tracked unitBody: SerialIn |
| PATCH | /api/serials/{serial_id} |
Edit a serial unitBody: SerialPatch |
| POST | /api/serials/{serial_id}/scrap |
Scrap a serial unit (final)Body: ScrapIn |
| POST | /api/items/{item_id}/scrap |
Scrap bulk stock (final)Body: ScrapIn |
| POST | /api/items/{item_id}/move |
Items Move |
| GET | /api/locations |
List places (crib bins, shelves)Query: limit, offset, cursor, envelope |
| POST | /api/locations |
Locations Create |
| GET | /api/locations/{loc_id} |
Locations Get |
| PATCH | /api/locations/{loc_id} |
Locations Patch |
| GET | /api/consumables |
List consumables (bulk items) with stockQuery: q, limit, offset, cursor, envelope |
issues
Loans/dispatches out of the crib and returns.
| Method | Path | What it does |
|---|---|---|
| GET | /api/people |
List people (for to_person_id) |
| GET | /api/issues |
List issues (open loans/dispatches)Query: item_id, to_person_id, to_machine_id, open, disposition, limit, offset, cursor, envelope |
| POST | /api/issues |
Issue (lend or dispatch) a tool to a person/machine/jobBody: IssueIn |
| GET | /api/issues/{issue_id} |
Issues Get |
| POST | /api/returns |
Return an issued tool to the cribBody: ReturnIn |
consumptions
Use (consume) and scrap stock.
| Method | Path | What it does |
|---|---|---|
| POST | /api/consumptions |
Use stock (take and consume)Body: ConsumptionIn |
machines
Machines, meter readings, service plans, flags.
| Method | Path | What it does |
|---|---|---|
| GET | /api/machines |
List machines with statusQuery: status, limit, offset, cursor, envelope |
| POST | /api/machines |
Create a machineBody: MachineIn |
| GET | /api/machines/{machine_id} |
Get one machine (plans, flags, stock here) |
| PATCH | /api/machines/{machine_id} |
Edit a machine (send expected_version / If-Match)Body: MachinePatch |
| POST | /api/machines/{machine_id}/readings |
Log a meter reading (hours/cycles)Body: ReadingIn |
| GET | /api/machines/{machine_id}/plans |
Machines Plans |
| POST | /api/machines/{machine_id}/plans |
Machines Plans CreateBody: PlanIn |
| PATCH | /api/machines/{machine_id}/plans/{plan_id} |
Machines Plan Patch |
| GET | /api/machines/{machine_id}/assemblies |
Machines Assemblies |
| GET | /api/machines/{machine_id}/flags |
Open attention flags (faults) |
service
Service events (finishing a plan; attention = fault flag).
| Method | Path | What it does |
|---|---|---|
| GET | /api/service/plans/{plan_id} |
Service Plan By Id |
| POST | /api/service/plans/{plan_id}/tasks |
Service Plan Task Append |
| PATCH | /api/service/tasks/{task_id} |
Service Task Patch |
| DELETE | /api/service/tasks/{task_id} |
Service Task Delete |
| GET | /api/service/due |
Service plans due now |
| GET | /api/service/events |
Service Events ListQuery: machine_id, plan_id, task_id, outcome, date_from, date_to, limit, offset |
| POST | /api/service-events |
Record a service event; a result with outcome 'attention' raises a fault flagBody: ServiceEventIn |
gages
Measuring equipment, calibration and use counts.
| Method | Path | What it does |
|---|---|---|
| GET | /api/gages |
List gagesQuery: status, hold_kind, q, limit, offset, cursor, envelope |
| POST | /api/gages |
Create a gageBody: GageIn |
| GET | /api/gages/due |
Gages overdue or due today (now_due), due soon, plus failed (last calibration failed), on_hold (manual status, not retired) and out_for_cal (at the calibration lab, with the expected return date) |
| GET | /api/gages/{gage_id} |
Get one gage with calibration history |
| PATCH | /api/gages/{gage_id} |
Gages Patch |
| GET | /api/gages/{gage_id}/status |
Gauge status: derived status, last calibration result, the manual hold with its comment, and the status history |
| POST | /api/gages/{gage_id}/status |
Set a gauge status (damaged, out for calibration, quarantined, retired, other) with a required comment, optional lab/dates for out_for_calibration, and up to 5 documents (upload with POST /api/files category document first). Any role but viewer may report damaged, quarantined or other (agents apply those at once); out_for_calibration and retired need gages_write (admin, superuser, quality) and an agent's request becomes a proposalBody: GageStatusIn |
| GET | /api/gages/{gage_id}/documents |
Every document on a gauge: files attached to status changes and calibration certificates, newest first |
| POST | /api/gages/{gage_id}/status/clear |
Return a gauge to service (clears the status; optional comment and up to 5 documents, e.g. the certificate). Needs gages_writeBody: GageStatusClearIn |
| GET | /api/gages/{gage_id}/issues |
Gage Issues Get |
| GET | /api/gages/{gage_id}/uses |
Gage use log, newest firstQuery: limit |
| POST | /api/gages/{gage_id}/uses |
Record gage uses (+n; usage-based calibration). Auto-applies for agents like a meter readingBody: GageUsesIn |
| POST | /api/calibrations |
Record a calibration (e.g. from a sticker photo). A passing result returns an out_for_cal gauge to service by itself; a failed one keeps it out; damaged/quarantined/other holds stay unless return_to_service is trueBody: CalibrationIn |
| POST | /api/gage-issues |
Lend a gageBody: GageIssueIn |
| POST | /api/gage-returns |
Return a gageBody: GageReturnIn |
faults
Fault reports (broken, leaking, worn, unsafe) with photos.
| Method | Path | What it does |
|---|---|---|
| GET | /api/faults |
List fault reports (status=open|ack|closed|all, machine_id, ...)Query: status, subject_kind, subject_id, machine_id, limit, envelope |
| POST | /api/faults |
Report a fault (applies at once, also for propose-only keys) |
| GET | /api/faults/count |
Open fault count |
| GET | /api/faults/{fault_id} |
One fault report with photos |
| PATCH | /api/faults/{fault_id} |
Acknowledge or close a fault (people; from a key it becomes a proposal) |
files
Certificate / file upload (multipart); signed download links.
| Method | Path | What it does |
|---|---|---|
| POST | /api/files |
Upload a photo or certificate (multipart field 'file')Body: multipart form not in demo |
photos
Photo history per item/serial/tool/gage/machine/service/calibration/scrap/delivery/fault; signed links; retention.
| Method | Path | What it does |
|---|---|---|
| GET | /api/photos |
List a subject's photos, newest first (subject_kind, subject_id, cursor, limit<=100)Query: subject_kind, subject_id, kind, include_hidden, cursor, limit |
| POST | /api/photos |
Upload 1-10 photos (multipart: file, subject_kind, subject_id, kind, caption, event_id, proposal_id). Agent kind=stock -> 202 proposal not in demo |
| GET | /api/photos/retention |
Retention dry-run report (admin/superuser) |
| GET | /api/photos/{photo_id} |
One photo with signed thumb/view/original URLs |
| PATCH | /api/photos/{photo_id} |
Set the caption (If-Match / expected_version) not in demo |
| POST | /api/photos/{photo_id}/stock |
Make this the subject's stock photo (old one kept). Agent keys: becomes a proposal not in demo |
| POST | /api/photos/{photo_id}/hold |
Set or lift legal hold (admin, superuser, quality; not agent keys) not in demo |
| POST | /api/photos/retention/run |
Run one retention pass now (people only; {dry_run}) not in demo |
events
Audit trail with before/after, agent provenance and undo.
| Method | Path | What it does |
|---|---|---|
| GET | /api/events |
Audit events (paginated)Query: since, entity_schema, entity_id, actor_id, actor_kind, limit, sort, dir, offset, cursor, envelope, type |
| GET | /api/events/{event_id}/changes |
Before/after values of the change that wrote this event |
| POST | /api/events/{event_id}/revert |
Undo the whole change that wrote this event (409 revert_conflict if later changes touched it)Body: RevertIn |
agent-keys
Bearer keys for agents (made by a signed-in person on the Agent keys page).
| Method | Path | What it does |
|---|---|---|
| GET | /api/keys/scopes |
Scopes you may grant a keyQuery: person_id |
| GET | /api/keys |
List your agent keysQuery: person_id, all |
| POST | /api/keys |
Create an agent key (token shown once; propose_only by default) not in demo |
| PATCH | /api/keys/{kid} |
Update Key not in demo |
| DELETE | /api/keys/{kid} |
Revoke an agent key not in demo |
batch
Several writes in one all-or-nothing transaction.
| Method | Path | What it does |
|---|---|---|
| POST | /api/batch |
Run several writes in one all-or-nothing transactionBody: BatchIn not in demo |
webhooks
Daily digest (agents may read) and outgoing webhooks (people only).
| Method | Path | What it does |
|---|---|---|
| GET | /api/webhooks |
Webhooks List |
| POST | /api/webhooks |
Webhooks Create not in demo |
| GET | /api/webhooks/event-types |
Webhooks Event Types |
| GET | /api/webhooks/settings |
Webhooks Settings |
| PATCH | /api/webhooks/settings |
Webhooks Settings Patch not in demo |
| GET | /api/webhooks/{webhook_id} |
Webhooks Get |
| PATCH | /api/webhooks/{webhook_id} |
Webhooks Patch not in demo |
| DELETE | /api/webhooks/{webhook_id} |
Webhooks Delete not in demo |
| POST | /api/webhooks/{webhook_id}/test |
Webhooks Test not in demo |
| GET | /api/webhooks/{webhook_id}/deliveries |
Webhooks DeliveriesQuery: status, limit |
| POST | /api/webhooks/deliveries/{delivery_id}/retry |
Webhooks Retry not in demo |
people
People and their roles.
| Method | Path | What it does |
|---|---|---|
| POST | /api/people |
People Create not in demo |
| GET | /api/people/list |
People Admin ListQuery: limit, offset, cursor, envelope |
| PATCH | /api/people/{pid} |
People Update not in demo |
| POST | /api/people/{pid}/password |
People Set Password not in demo |
| POST | /api/people/{pid}/2fa/reset |
People Reset 2Fa not in demo |
| GET | /api/people/support |
Support Get |
| POST | /api/people/support/enable |
Support Enable not in demo |
| POST | /api/people/support/disable |
Support Disable not in demo |
auth
Sign in/out, who am I, change own password.
| Method | Path | What it does |
|---|---|---|
| POST | /api/auth/login |
Do Login |
| POST | /api/auth/login/mfa |
Do Login Mfa |
| POST | /api/auth/logout |
Do Logout |
| GET | /api/auth/me |
Who am I (and which key) |
| GET | /api/auth/security |
Security Info |
| POST | /api/auth/change-password |
Change Password not in demo |
| GET | /api/auth/2fa |
Mfa Status |
| POST | /api/auth/2fa/setup |
Mfa Setup not in demo |
| POST | /api/auth/2fa/enable |
Mfa Enable not in demo |
| POST | /api/auth/2fa/disable |
Mfa Disable not in demo |
| POST | /api/auth/2fa/recovery-codes |
Mfa New Recovery not in demo |
| POST | /api/auth/2fa/recovery-ack |
Mfa Recovery Ack not in demo |
| POST | /api/auth/2fa/recovery-cancel |
Mfa Recovery Cancel not in demo |
| POST | /api/auth/2fa/forget-devices |
Mfa Forget Devices not in demo |
| GET | /api/auth/sessions |
List Sessions |
| POST | /api/auth/sessions/{sid}/revoke |
Revoke Session not in demo |
| POST | /api/auth/sessions/revoke-others |
Revoke Other Sessions not in demo |
| GET | /api/me |
Who am I: the same person object as /api/auth/me, with the saved appearance in `theme` |
| PUT | /api/me/theme |
Save my appearance: auto, light or dark (null = default, light). People only; the public demo keeps it in a cookie insteadBody: ThemeIn not in demo |
backup
Whole-shop export/import (admin only, not agent keys).
| Method | Path | What it does |
|---|---|---|
| GET | /api/backup/manifest |
Backup Manifest not in demo |
| GET | /api/backup/export |
Backup Export not in demo |
| POST | /api/backup/restore/preview |
Backup Restore PreviewBody: multipart form not in demo |
| POST | /api/backup/restore |
Backup Restore not in demo |
| POST | /api/backup/import |
Backup ImportBody: multipart form not in demo |
| GET | /api/backup/pre-restore |
Pre Restore List not in demo |
| GET | /api/backup/pre-restore/{name} |
Pre Restore DownloadQuery: once not in demo |
health
Liveness and version.
| Method | Path | What it does |
|---|---|---|
| GET | /api/health |
Liveness and version no auth |
shop
| Method | Path | What it does |
|---|---|---|
| GET | /api/shop |
Shop Get |
| PATCH | /api/shop |
Shop Patch not in demo |
correlations
| Method | Path | What it does |
|---|---|---|
| GET | /api/correlations/seats |
Seats ListQuery: holder_item_id, insert_item_id |
| POST | /api/correlations/seats |
Seats Create |
| DELETE | /api/correlations/seats/{holder_item_id}/{insert_item_id} |
Seats Delete |
| GET | /api/items/{item_id}/fits |
Item Fits Get |
| POST | /api/items/{item_id}/fits |
Item Fits Create |
| DELETE | /api/fits/{fit_id} |
Fits Delete |
| GET | /api/items/{item_id}/substitutes |
Item Substitutes Get |
| POST | /api/items/{item_id}/substitutes |
Item Substitutes Create |
| DELETE | /api/items/{item_id}/substitutes/{alt_item_id} |
Item Substitutes Delete |
| GET | /api/items/{item_id}/hints |
Item Hints Get |
| POST | /api/items/{item_id}/hints |
Item Hints Create |
| DELETE | /api/hints/{hint_id} |
Hints Delete |
| GET | /api/tap-drills |
Tap Drills List |
| POST | /api/tap-drills |
Tap Drills Create |
| DELETE | /api/tap-drills/{tap_drill_id} |
Tap Drills Delete |
assemblies
| Method | Path | What it does |
|---|---|---|
| GET | /api/assemblies |
Assemblies ListQuery: machine_id |
| POST | /api/assemblies |
Assemblies Create |
| GET | /api/assemblies/{assembly_id} |
Assemblies Get |
| DELETE | /api/assemblies/{assembly_id} |
Assemblies Delete |
charts
| Method | Path | What it does |
|---|---|---|
| GET | /api/charts/consumption |
Chart ConsumptionQuery: days, machine_id |
| GET | /api/charts/cal-due |
Chart Cal DueQuery: days |
| GET | /api/charts/service-compliance |
Chart Service ComplianceQuery: days |
stats
| Method | Path | What it does |
|---|---|---|
| GET | /api/stats |
Stats Get |
params
| Method | Path | What it does |
|---|---|---|
| GET | /api/param-codes |
Param Codes |
disclaimer
| Method | Path | What it does |
|---|---|---|
| GET | /api/disclaimer |
Disclaimer Info |
| GET | /api/disclaimer/status |
Disclaimer Status |
| POST | /api/disclaimer/ack |
Disclaimer Ack not in demo |