API Reference - amalps565/Smart-Workspace-Seating-Chart GitHub Wiki
This is the contract the backend and frontend implement. Any change must update both sides in the same PR, and the root
CLAUDE.mdin the repo.
All endpoints except login need Authorization: Bearer <jwt>. Dates are YYYY-MM-DD in the office's time zone.
Every error returns the same shape:
{ "code": "SPACING_VIOLATION", "message": "A neighbouring desk is already booked for 2026-10-02." }See Domain Rules for all error codes.
Request:
{ "username": "alice", "password": "..." }Responses:
-
200with{ "token": "<jwt>", "username": "alice", "displayName": "Alice Anders" } -
401INVALID_CREDENTIALS
Every other /api/** call without a valid token returns 401 UNAUTHORIZED.
Lists floors.
[{ "id": 1, "name": "Floor 3", "rows": 8, "cols": 12, "neighbourMode": "ORTHOGONAL" }]Returns the whole grid for one date, plus the current version of each desk.
{
"floorId": 1,
"date": "2026-10-02",
"rows": 8,
"cols": 12,
"neighbourMode": "ORTHOGONAL",
"cells": [
{ "id": 101, "row": 0, "col": 0, "type": "DESK", "label": "3-A1",
"status": "BOOKED", "bookedBy": "Alice Anders", "bookedByUsername": "alice",
"bookingId": 555, "seq": 1042 },
{ "id": 107, "row": 0, "col": 6, "type": "WALKWAY", "label": null,
"status": null, "bookedBy": null, "bookedByUsername": null, "bookingId": null, "seq": null }
]
}row and col are 0-based. bookingId is included only on your own booking, so you can cancel it. The snapshot takes a fixed two queries, whatever the floor size.
Request:
{ "deskId": 101, "date": "2026-10-02" }| Status | Code | Meaning |
|---|---|---|
201 |
Booked. The body is { id, deskId, floorId, date, seq }; seq equals the seq in the WebSocket update for this booking. |
|
400 |
INVALID_DATE, NOT_A_DESK, VALIDATION_ERROR
|
The request can't be booked, or a field is missing or malformed |
404 |
NOT_FOUND |
Unknown desk |
409 |
DESK_TAKEN |
The desk is already booked that day |
409 |
SPACING_VIOLATION |
A neighbour is booked that day |
409 |
ALREADY_BOOKED_TODAY |
You already have a booking that day |
When several rules fail, the code returned is DESK_TAKEN, then ALREADY_BOOKED_TODAY, then SPACING_VIOLATION.
| Status | Meaning |
|---|---|
204 |
Cancelled |
403 |
Not your booking |
404 |
No such booking |
Returns your bookings from today onward.
See Real-Time Updates.