Using AI to manage your floor plan
Designing a floor plan from a real physical space, walking through rooms with a phone camera and a tape measure, drafting sections and tables, refining them against reality, is exactly the kind of task an AI assistant is good at helping with. This page explains how to give one access safely, and what it needs to know about the API to do the job well.
Access: a token, not your password
Don’t hand an AI assistant your email and password. Exchange them for an API token instead, and give the assistant only the token.
POST /employees/sign_in.json
{"employee": {"email": "you@example.com", "password": "..."}}
The response includes a token. From here on, every request the assistant
makes should include it as a header:
Token: <the token>
A token is scoped to one employee and one restaurant (if you manage more than one, it’s whichever comes first; ask your assistant to check which restaurant it’s pointed at before making changes). It carries no ability to change your password or email.
To cut off access at any point, sign out. DELETE /employees/sign_out
revokes the token server-side immediately, not just in whatever app called it.
If you’re not sure whether a token you handed out is still live, sign out from
your own normal session and hand out a fresh one next time.
The building blocks
A restaurant’s floor plan is Sections (a dining room, a patio, a bar), each
containing Tables and, optionally, SectionAreas (walls, zones) and
SectionElements (furniture, icons). All four are plain REST resources under
/supplier/api/v1/, authenticated with the token header above.
Creating a section:
POST /supplier/api/v1/sections.json
{"title": "Patio", "path": [[0,0],[15,0],[15,8],[0,8]]}
path is four corner points, not a width/height pair, the section is a
rectangle whose size is [max x, max y]. The example above is a 15x8 meter
rectangle. Sections are rectangle-only today: an irregular room is better
modeled as two or three adjacent rectangular sections than one clever polygon.
Adding a table to it:
POST /supplier/api/v1/tables.json
{"number": 12, "section_id": "<section id>", "position_x": 4, "position_y": 2}
SectionArea (walls, zones) and SectionElement (furniture) follow the same
pattern, posted to /supplier/api/v1/section_areas and
/supplier/api/v1/section_elements with a section_id.
The one gotcha that matters
Position (0, 0) is the section’s top-left corner, not a neutral default.
Placing a new table, wall, or piece of furniture there, unless that’s really
where it belongs, puts it in a corner rather than the middle of the room. Compute
an actual position instead:
position_x = max(0, (section_width - item_width) / 2)
position_y = max(0, (section_height - item_height) / 2)
Center on creation, then adjust from there once you can see it.
Working well with an early, hands-on tool
The floor-plan editor rewards an iterative approach over trying to get exact numbers right in one pass:
- Draft with approximate, proportional measurements first. Precision matters less than getting the room shapes and relative layout roughly right.
- The dining-room manager can drag and resize tables by hand in the app afterward, so a rough first pass that’s easy to see and correct beats a slow attempt at perfect numbers before anything is visible.
- There’s no photo-underlay or tracing feature yet, nothing to draw directly over a reference image, so matching a photo means reading distances off it and placing shapes by eye or by measurement, not tracing an outline.