> For the complete documentation index, see [llms.txt](https://docs.snapfix.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.snapfix.com/product/features/housekeeping/inspections.md).

# Inspections

{% hint style="info" %}
Draft, written by an agent and not yet checked by a person ([how to read these docs](https://docs.snapfix.com/how-to-read.md)). [Source on GitHub](https://github.com/snapfix/docs/blob/main/product/features/inspections.md).
{% endhint %}

An **inspection** is a housekeeping task in which an inspector checks a room after its clean. It is linked to its [cleaning task](https://docs.snapfix.com/product/features/housekeeping/cleaning-tasks.md) and stays **locked** until the clean is green. The inspector then approves the inspection, which also approves the clean, or rejects it with a note. A rejection creates a **correction clean** and a new **correction inspection** for the same room; the new inspection stays locked until the correction clean is green. Most inspections are created with their clean; managers can also create inspections on their own.

## Rules

### Creating

* In the data, an inspection is a task of type 46, linked to its clean in [`tPri_JobLink`](https://docs.snapfix.com/engineering-reference/db/tables/tpri_joblink.md) ([Housekeeping API](https://docs.snapfix.com/engineering-reference/api/housekeeping.md)).
* A manual clean gets one linked inspection when housekeeping is on for the room's building, except the clean types listed in [Cleaning tasks](https://docs.snapfix.com/product/features/housekeeping/cleaning-tasks.md#creating-cleans-by-hand). A clean the server generates gets an inspection when its room status rule asks for one ([`tPri_RoomStatus_TaskRules`](https://docs.snapfix.com/engineering-reference/db/tables/tpri_roomstatus_taskrules.md)).
* The "Inspections" clean type creates an inspection with no clean ([`POST /v1/app/housekeeping/manual-hk-task/bulk`](https://docs.snapfix.com/engineering-reference/api/housekeeping.md#post-v1apphousekeepingmanual-hk-taskbulk)).
* The inspection goes to the inspection group of the room's status rule ([`GET /v1/app/rooms/{uuid}/hk-businesses`](https://docs.snapfix.com/engineering-reference/api/housekeeping.md#get-v1approomsuuidhk-businesses)).
* It is planned for the room's inspection duration, or 5 minutes when the room has none (api\_php\_live\_v2 @ ef3c4319f6, `app/Services/DurationCalculation.php:14`, `:74-85`).
* Its title is the room and the inspection kind: "Room 101 - Inspection", "Room 101 - Departure inspection", "Room 101 - Stayover inspection", "Room 101 - Correction inspection", or the sub type and "inspection" (api\_php\_live\_v2 @ ef3c4319f6, `app/Support/Housekeeping/HousekeepingInspectionTaskTitle.php:12-38`).
* A room that comes back from "OUT OF ORDER" or "OUT OF SERVICE" gets a return inspection ([Room status](https://docs.snapfix.com/product/features/rooms/room-status.md#what-a-status-change-does)).

### Locking

* An inspection is created locked, and a locked task can't change status ([Header and status](https://docs.snapfix.com/how-the-apps-work/screens/tasks/task-detail.md#header-and-status)). It can still be assigned while locked ([Who can do what](https://docs.snapfix.com/how-the-apps-work/screens/tasks/task-detail.md#who-can-do-what)).
* It unlocks when its clean turns green, and a chat line records who did it. A clean with no room status rule unlocks its inspection in the same way (api\_php\_live\_v2 @ ef3c4319f6, `app/Services/AssetJobService.php:4870-4877`, `:4960-4995`).
* On the timeline an inspection is placed after its clean ends, and moves with it, except for self-checkers ([Drag and drop](https://docs.snapfix.com/how-the-apps-work/screens/housekeeping/timeline.md#drag-and-drop)).

### Self-checkers

* A self-checker inspects their own cleans. With the default setting, every fourth clean of their day goes to another inspector instead; the number is "Maximum Self-Checked Tasks" in [Staff schedule](https://docs.snapfix.com/product/features/housekeeping/staff-schedule.md#rules).
* When a self-checker finishes a routine clean and is the only person assigned to its inspection, with a self-checker session today, the inspection turns green with the clean.

### Approve and reject

* Group admins and the people assigned to the inspection approve or reject it, from the task's approval request ([Approval and housekeeping](https://docs.snapfix.com/how-the-apps-work/screens/tasks/task-detail.md#approval-and-housekeeping), [Task approval](https://docs.snapfix.com/product/features/tasks/task-approval.md)).
* Approving turns the inspection green and approves its clean.
* Rejecting needs a note: always on the web, and for inspection tasks in the apps. It rejects the clean, and the inspection itself stays green ([Approval and housekeeping](https://docs.snapfix.com/how-the-apps-work/screens/tasks/task-detail.md#approval-and-housekeeping)).
* On all three platforms, the rejection then creates the follow-up pair through [`POST /v1/app/housekeeping/reject-tasks`](https://docs.snapfix.com/engineering-reference/api/housekeeping.md#post-v1apphousekeepingreject-tasks). The server allows that only for an admin of the inspection's group or a person assigned to the inspection.
* The pair is refused when the clean isn't green ("Linked housekeeping cleaning task must be completed (green) before creating follow-up tasks."), when the clean has nobody assigned, or when nobody on today's schedule can inspect ("No inspector-capable user is available to assign the correction inspection.").

### The correction pair

* **Correction clean:** titled "Room 101 - Correction clean", with the rejection note as its description and in its chat. Its checklists, tags, rooms, areas, systems and assets are copied from the rejected clean. It goes to the clean's first assignee, from the current time, and that person is notified (api\_php\_live\_v2 @ ef3c4319f6, `app/Traits/Job/JobActions.php:5011-5017`).
* **Correction inspection:** titled "Room 101 - Correction inspection", locked and linked to the correction clean. It goes to a person assigned to the rejected inspection who has an inspector session today, or else to the first person on today's schedule who can inspect, and starts right after the correction clean ends.
* The correction clean is also linked to the first clean of the chain, so a correction can be rejected again and the chain keeps its root ([`POST /v1/app/housekeeping/reject-tasks`](https://docs.snapfix.com/engineering-reference/api/housekeeping.md#post-v1apphousekeepingreject-tasks)).
* If one of the two can't be placed, for example because the person has no free time, the request fails, but both tasks are already saved.

## Flow

```mermaid
flowchart TD
  clean["Clean not yet green: inspection locked"] --> green["Clean turns green"]
  green --> unlock["Inspection unlocks"]
  unlock --> review{"Inspector checks the room"}
  review -->|approve| ok["Inspection green, clean approved"]
  review -->|"reject with a note"| pair["Correction clean, and a locked correction inspection"]
  pair --> fix["Correction clean done, green"]
  fix --> unlock2["Correction inspection unlocks"]
  unlock2 --> review
```

## Platforms

| Capability                      | Web                             | iOS                  | Android              |
| ------------------------------- | ------------------------------- | -------------------- | -------------------- |
| Locked until the clean is green | Yes                             | Yes                  | Yes                  |
| Create inspections on their own | "Inspections" in "Create Tasks" | Yes                  | Yes                  |
| Approve or reject               | Task approval request           | Task screen          | Task screen          |
| Note required on reject         | Always                          | For inspection tasks | For inspection tasks |
| Correction pair created         | Yes                             | Yes                  | Yes                  |
| See inspections on the timeline | Yes                             | Yes                  | Yes                  |

## Screens

* [Task timeline](https://docs.snapfix.com/how-the-apps-work/screens/housekeeping/timeline.md): the "Inspections" clean type and the inspections on each person's timeline.
* [Task detail](https://docs.snapfix.com/how-the-apps-work/screens/tasks/task-detail.md): the approval request, the reject note and the link to the parent clean.

## API and data

* [`POST /v1/app/housekeeping/reject-tasks`](https://docs.snapfix.com/engineering-reference/api/housekeeping.md#post-v1apphousekeepingreject-tasks): creates and assigns the correction pair.
* [`POST /v1/app/housekeeping/manual-hk-task/bulk`](https://docs.snapfix.com/engineering-reference/api/housekeeping.md#post-v1apphousekeepingmanual-hk-taskbulk) with `cleanType` `inspection`: inspections on their own.
* [`POST /v1/app/housekeeping/reassignment/{uuid}`](https://docs.snapfix.com/engineering-reference/api/housekeeping.md#post-v1apphousekeepingreassignmentuuid) and the bulk routes: place inspections after their cleans.
* The approval itself: the web's [`PUT /v1/app/tasks/{uuid}`](https://docs.snapfix.com/engineering-reference/api/tasks.md#put-v1apptasksuuid), and the apps' task sync ([`?action=save_pri_job`](https://docs.snapfix.com/engineering-reference/api/tasks.md#post-actionsave_pri_job)).
* Tables: [`tPri_Job`](https://docs.snapfix.com/engineering-reference/db/tables/tpri_job.md) (type 46, lock, correction flag, approval), [`tPri_JobLink`](https://docs.snapfix.com/engineering-reference/db/tables/tpri_joblink.md) (clean and inspection pairs), [`tPri_JobChat`](https://docs.snapfix.com/engineering-reference/db/tables/tpri_jobchat.md) (unlock, approval and rejection lines), [`tPri_User_WorkingHours`](https://docs.snapfix.com/engineering-reference/db/tables/tpri_user_workinghours.md) (who can inspect today).

## Depends on

* [Cleaning tasks](https://docs.snapfix.com/product/features/housekeeping/cleaning-tasks.md): the clean each inspection checks.
* [Task approval](https://docs.snapfix.com/product/features/tasks/task-approval.md): the approval steps that inspections use.
* [Staff schedule](https://docs.snapfix.com/product/features/housekeeping/staff-schedule.md): the roles that may inspect, today's sessions and the self-checker setting.
* [Assigning housekeeping tasks](https://docs.snapfix.com/product/features/housekeeping/housekeeping-assignment.md): inspections are assigned and moved with their cleans.
* [Room status](https://docs.snapfix.com/product/features/rooms/room-status.md): the rules that create inspections, and the return inspection.
* [Task chat](https://docs.snapfix.com/product/features/chat/task-chat.md): the unlock line, the rejection note and the lines of the correction pair.

## Edge cases

* **No inspector on today's schedule, or a clean with nobody assigned:** the rejection creates no pair, with the messages under [Approve and reject](#approve-and-reject).
* **Placement fails:** the request answers an error, but the pair is already saved.
* **Housekeeping off for the building:** a manual clean gets no inspection.
* **Archived or deleted clean:** its inspection is archived or deleted with it ([Task detail](https://docs.snapfix.com/how-the-apps-work/screens/tasks/task-detail.md#task-menu)).
* **Approval through the API:** the person assigned to a clean can change its approval through the API, which the apps don't offer.
* **Offline:** the reject flow calls the server directly to create the pair.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.snapfix.com/product/features/housekeeping/inspections.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
