Housekeeping → Maintenance
A guide for the developer of the housekeeping system: how to send maintenance issues to the Maintenance app, and how to follow what becomes of them.
Contents
1. How it works
- Housekeeping finds a problem and sends it with
POST /issues, with its own number (ref). - It lands in Maintenance's To do as a new report, unassigned. Coordinators and supervisors are told at once.
- A coordinator gives it to an artisan, with a due date.
- The artisan starts it, finishes it, and a supervisor checks it.
- Housekeeping follows it with
GET /changes(or asks about one withGET /issues/{ref}).
Housekeeping can also add a note to an issue (the artisan sees it), and call an issue off while nobody has been given it yet.
2. The address and the key
Base address
https://ibjmiyehfhsmupsokyqt.supabase.co/functions/v1/housekeeping
Every address below is added to this one, for example …/housekeeping/issues.
The key
The Maintenance admin makes the key in the app (More › Settings › Rooms & lists › Housekeeping system) and gives it to you. It starts with hk_. Send it with every request, in this header:
X-Housekeeping-Key: hk_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Authorization: Bearer hk_… works too.
There is one key at a time, and the admin can turn the link off. A wrong or turned-off key gets 401.
3. Requests and replies
- Send JSON, with
Content-Type: application/json, UTF-8. At most 64 KB. - Times are ISO 8601 (
2026-11-27T08:15:00Z). Times you are sent are in UTC (with an offset); dates (due_date) areYYYY-MM-DD. - Every reply is JSON. It works:
{"ok": true, …}. It does not:{"ok": false, "error": {"code": "room", "message": "…"}}, with an HTTP status to match (Errors). Themessageis written for a person: you may show it to your staff as it is. - Sending the same issue twice is safe. An issue is known by your
ref. If the network fails and you send it again, you get back the issue already made ("duplicate": true), never a second one. So: on a timeout or a5xx, wait and send again, with the sameref. - A
refwith spaces or a/in it is URL-encoded in an address (HK%201%2F2).
/options
The rooms, areas, kinds of work and properties the Maintenance app knows. Use these words when you send an issue: a room it does not know is refused. They change seldom; read them once a day, or when an issue is refused with code room.
curl -s https://ibjmiyehfhsmupsokyqt.supabase.co/functions/v1/housekeeping/options \
-H "X-Housekeeping-Key: $HK_KEY"
{
"ok": true,
"rooms": ["Room 1", "Room 2", "Room 14", "B2 Room 3"],
"areas": ["Laundry", "Corridor", "Kitchen"],
"categories": ["Plumbing", "Electrical", "Carpentry", "Air-conditioning", "Other"],
"properties": [],
"priorities": ["normal", "urgent"]
}
Matching is not case-sensitive ("room 14" is "Room 14"), but it is otherwise exact. If your room names differ from these, keep a small table that turns yours into theirs.
/issues
Report one issue.
| Field | Needed | What it is |
|---|---|---|
ref | yes | Your own number for this issue, unique in your system (up to 80 characters). How you will ask about it later, and what stops it being made twice. |
room | yes | The room or area, one of rooms or areas from /options. |
description | yes | What is wrong, in words an artisan understands (up to 2,000 characters). For example “Shower drips all night; tap handle loose.” |
category | no | The kind of work, one of categories. Left out, it goes in as the general kind (“Other”), and the coordinator sorts it. |
priority | no | "normal" (the default) or "urgent". Urgent: a guest cannot use the room, water is leaking, something is unsafe. Urgent issues are chased much sooner. |
property | no | Which property, one of properties, when there is more than one. |
reported_by | no | The name of the housekeeper who found it (up to 60 characters). The app shows “Housekeeping · Ama Mensah”. |
photos | no | Up to 6 web addresses of photos, each starting https://. They must open for anyone with the address (no sign-in) for as long as the job is open: send addresses, not the pictures themselves. |
curl -s -X POST https://ibjmiyehfhsmupsokyqt.supabase.co/functions/v1/housekeeping/issues \
-H "X-Housekeeping-Key: $HK_KEY" -H "Content-Type: application/json" \
-d '{
"ref": "HK-2026-001234",
"room": "Room 14",
"category": "Plumbing",
"description": "Shower drips all night; tap handle loose.",
"priority": "urgent",
"reported_by": "Ama Mensah",
"photos": ["https://housekeeping.example.com/photos/1234-1.jpg"]
}'
201 Created the first time; 200 with "duplicate": true if that ref was already sent (you get the issue as it is now; nothing in it is changed):
{
"ok": true,
"duplicate": false,
"issue": {
"id": "4d8c608b-5176-4e88-a5c0-cb96a5dd4022",
"ref": "HK-2026-001234",
"room": "Room 14",
"category": "Plumbing",
"description": "Shower drips all night; tap handle loose.",
"priority": "urgent",
"property": null,
"reported_by": "Ama Mensah",
"reported_at": "2026-11-27T09:12:40.118Z",
"status": "waiting",
"status_text": "Waiting to be given to an artisan",
"assigned_to": null, "assigned_at": null, "due_date": null,
"done_at": null, "checked_at": null,
"cancelled_at": null, "cancel_reason": null,
"changed_at": "2026-11-27T09:12:40.118Z"
}
}
To change something about an issue already sent, add a note. A different problem in the same room is a new issue, with a new ref.
/issues/{ref}
One issue, as it is now. 404 (code missing) if there is none with that ref.
curl -s https://ibjmiyehfhsmupsokyqt.supabase.co/functions/v1/housekeeping/issues/HK-2026-001234 \
-H "X-Housekeeping-Key: $HK_KEY"
{ "ok": true, "issue": { "ref": "HK-2026-001234", "status": "assigned",
"status_text": "Given to Kojo, due 28 Nov", "assigned_to": "Kojo", "due_date": "2026-11-28", … } }
/issues?refs=HK-1,HK-2,HK-3
Several at once, up to 100, comma-separated. You get back those it knows, oldest first; any it does not know are left out.
{ "ok": true, "issues": [ { "ref": "HK-1", … }, { "ref": "HK-3", … } ] }
/changes?since=2026-11-27T08:00:00Z
Every issue you sent whose status, artisan, due date or priority has changed (or that got a note) since that time, oldest change first, up to 500. This is the way to keep your system up to date.
{
"ok": true,
"issues": [ { "ref": "HK-2026-001234", "status": "in_progress", "status_text": "Kojo is working on it", … } ],
"next_since": "2026-11-27T10:41:07.552Z",
"more": false
}
- Keep
next_since. Next time, ask from it:?since=<next_since>. - If
"more": true, there were over 500: ask again straight away from the newnext_since. - Ask every 2 to 5 minutes. More often gains nothing; much less, and your staff see old news.
- The first time, ask from the moment you started sending issues.
An issue can come back more than once (it changed twice): keep the latest, by ref.
/issues/{ref}/notes
More to say about an open issue: the room is free after 10, the guest checks out tomorrow, it got worse. It is added to the job's notes, which the artisan and coordinator see.
curl -s -X POST https://ibjmiyehfhsmupsokyqt.supabase.co/functions/v1/housekeeping/issues/HK-2026-001234/notes \
-H "X-Housekeeping-Key: $HK_KEY" -H "Content-Type: application/json" \
-d '{"note": "Room is free after 10:00, guest has checked out.", "by": "Ama Mensah"}'
note is needed (up to 1,000 characters); by is the person's name (optional). You get back the issue. A note to an issue that is done, checked or cancelled is refused (409, code closed): report a new one.
/issues/{ref}/cancel
Call an issue off (sent by mistake, or it turned out to be nothing), while it is still waiting, before anybody has been given it.
curl -s -X POST https://ibjmiyehfhsmupsokyqt.supabase.co/functions/v1/housekeeping/issues/HK-2026-001234/cancel \
-H "X-Housekeeping-Key: $HK_KEY" -H "Content-Type: application/json" \
-d '{"reason": "Sent by mistake: it was Room 15."}'
You get back the issue, "status": "cancelled". Cancelling one already cancelled is fine (you get it back as it is). Once an artisan has it, it is refused (409, code started): ask Maintenance to call it off; you will see it in /changes when they do.
The issue object
| Field | What it is |
|---|---|
id | Maintenance's own id for the job. |
ref | Your number for it. |
room, category, description, priority, property | As the app holds them (a coordinator may correct the kind of work or the priority). |
reported_by, reported_at | Who you said found it, and when it arrived. |
status | Where it is: see Statuses. Use this in your code. |
status_text | The same, in words for your staff: “Given to Kojo, due 28 Nov”. |
assigned_to, assigned_at | The artisan's first name, and when it was given to them. |
due_date | The day it is due, when a coordinator has set one. |
done_at, checked_at | When the artisan finished it, and when a supervisor checked it. |
cancelled_at, cancel_reason | When it was called off, and why. |
changed_at | When any of this last changed. |
Statuses
| status | Meaning |
|---|---|
| waiting | In To do, not yet given to an artisan. You can still cancel it. |
| assigned | Given to an artisan (assigned_to), not started. |
| in_progress | The artisan is working on it. |
| done | Finished by the artisan, waiting for a supervisor to check it. For housekeeping, the room is usable again. |
| checked | Done, and checked by a supervisor. Closed. |
| cancelled | Called off, by you or by Maintenance (cancel_reason). Closed. |
Usually: waiting → assigned → in_progress → done → checked. Maintenance can also send a job back to the artisan, so a status can go back a step; just take the latest.
Errors
| HTTP | code | Meaning, and what to do |
|---|---|---|
| 400 | ref, room, category, description, priority, property, photos, note, since | That field is missing or not right. The message says what to put right. Do not send it again unchanged. |
| 400 | json, shape | The body is not JSON, or not a JSON object. |
| 401 | key | No key, a wrong key, or the link is turned off. Stop sending, and ask the Maintenance admin. |
| 404 | missing | No issue from housekeeping has that ref. |
| 404 | path | No such address. |
| 405 | method | GET where POST is wanted, or the other way round (the Allow header says which). |
| 409 | started | Too late to cancel: an artisan has it. Ask Maintenance. |
| 409 | closed | The issue is done, checked or cancelled: no more notes to it. |
| 413 | size | Over 64 KB. |
| 500 | server | Something went wrong on the Maintenance side. Wait a minute and try again, with the same ref; if it keeps happening, tell the Maintenance admin. |
A network failure or no reply at all: treat it as a 500. Try again after 1, 2, 4, 8 … minutes, with the same ref, and keep the issue in your system as “not yet sent” until you get a 201 or 200.
Building it: a checklist
- Keep the key in your server's settings. Check it with
GET /ping:{"ok": true, "version": "1"}. - Read
/options, and map your room names to theirs. Read it again once a day. - When a housekeeper reports a problem, save it in your system with your
ref, then send it. Keep theidandstatusyou get back. - If sending fails (no reply or
5xx), try again later with the sameref. Do not make a newref. - Every few minutes, ask
/changesfrom the lastnext_since, and update your issues byref. Showstatus_textto your staff. - Add notes and cancel from your system with the two
POSTs, if your staff need to. - Try every error: a wrong key, a room not on the list, a missing description, the same
reftwice, cancelling one already given out. - Agree a test with the Maintenance admin before going live: issues you send appear in their To do straight away, and their staff are told.
Example code
JavaScript (Node 18 or later, on your server)
const BASE = 'https://ibjmiyehfhsmupsokyqt.supabase.co/functions/v1/housekeeping';
const KEY = process.env.HK_KEY; // the key, kept in the server's settings
async function hk(method, path, body) {
const res = await fetch(BASE + path, {
method,
headers: { 'X-Housekeeping-Key': KEY, 'Content-Type': 'application/json' },
body: body ? JSON.stringify(body) : undefined,
});
const data = await res.json().catch(() => ({ ok: false, error: { code: 'server', message: 'No JSON' } }));
if (!data.ok) { const e = new Error(data.error.message); e.code = data.error.code; e.status = res.status; throw e; }
return data;
}
// report one (safe to repeat with the same ref)
const { issue, duplicate } = await hk('POST', '/issues', {
ref: 'HK-2026-001234', room: 'Room 14', category: 'Plumbing',
description: 'Shower drips all night.', priority: 'urgent', reported_by: 'Ama Mensah',
});
// keep up to date
let since = loadSince() || '2026-11-27T00:00:00Z';
for (;;) {
const { issues, next_since, more } = await hk('GET', '/changes?since=' + encodeURIComponent(since));
for (const i of issues) saveStatus(i.ref, i.status, i.status_text);
since = next_since; saveSince(since);
if (!more) break;
}
Python 3 (with requests)
import os, requests
BASE = "https://ibjmiyehfhsmupsokyqt.supabase.co/functions/v1/housekeeping"
H = {"X-Housekeeping-Key": os.environ["HK_KEY"]}
r = requests.post(BASE + "/issues", headers=H, timeout=20, json={
"ref": "HK-2026-001234", "room": "Room 14",
"description": "Shower drips all night.", "priority": "urgent",
})
data = r.json()
if not data["ok"]:
print(r.status_code, data["error"]["code"], data["error"]["message"])
else:
print(data["issue"]["status_text"]) # Waiting to be given to an artisan