Installers API (Business owner)
Added 2026-11-24. A Business owner lists, searches and manages the Business's Installers from the mobile app: see who is active or suspended, review pending join requests and invitations, accept or reject requests, revoke invitations, suspend or restore an Installer, and detach an Installer from the Business.
The step-by-step Flutter guide is Installer management — mobile implementation handout.
:::caution Deployed to dev, not yet captured
The three routes below (lib/routes.ts ListInstallers, ListPendingInstallers,
InstallerAction; packages/api/src/handlers/installers.ts;
packages/core/src/repositories/installers.ts) are unit-tested, carry the JWT
authorizer, and were deployed to dev on 2026-11-25. No authenticated request
has been captured against them yet, so every example on this page is still
illustrative, derived from the schemas and handler code — not a captured
response.
:::
Overview
| Op | Method + path | Auth | Idempotency / versioning |
|---|---|---|---|
| List / search Installers | GET /v1/orgs/{orgId}/installers | team ≥ MANAGE | — |
| Pending requests and invitations | GET /v1/orgs/{orgId}/installers/pending | team ≥ MANAGE | — |
| Suspend / restore / detach | POST /v1/orgs/{orgId}/installers/{sub}:suspend · :restore · :detach | team ≥ MANAGE | If-Match required |
These use existing routes, with ids taken from the screens above:
| Op | Route | Page |
|---|---|---|
| Accept / reject a join request | POST /v1/orgs/{orgId}/join-requests/{requestId}:accept · :reject | RBAC v2 |
| Invite an Installer by email | POST /v1/orgs/{orgId}/invitations with roleId = installerRoleId | Invitations |
| Revoke an invitation | DELETE /v1/orgs/{orgId}/invitations/{inviteId} (If-Match) | Invitations |
| Resend an invitation | POST /v1/orgs/{orgId}/invitations/{inviteId}:resend (If-Match) | Invitations |
| Show or regenerate the join code | GET / POST /v1/orgs/{orgId}/join-code | RBAC v2 |
Who counts as an Installer
An Installer is a member of a Business (a non-personal OPERATOR org) whose role is not a built-in role (Super Admin, Administrator, Viewer, Business, End User). In practice this is the Business's Installer role, created with the Business, or a copy of it. Installers reach every plant of their Business (scope ALL, ADR 0026 D3.1).
Authentication and authorization
Authorization: Bearer <Cognito IdToken>on every call (see API overview).- The org comes from the path (
{orgId}= the Business). The caller needs an ACTIVE membership there withteam≥ MANAGE. That means the Business role, or Crown staff through the platform path. Installers and End Users get403 FORBIDDEN. - No membership in
{orgId}→404 NOT_FOUND(the org is not revealed). {orgId}that is a personal org or the Crown org →409 INVALID_STATE,details.reason: NOT_A_BUSINESS.- A SUSPENDED or CLOSED Business →
403BUSINESS_SUSPENDED/BUSINESS_CLOSED(ADR 0026 D2.5); a blocked caller →403 ACCOUNT_BLOCKED.
GET /v1/orgs/{orgId}/installers
Lists the Business's Installers by name, or searches them.
| Query | Type | Rule |
|---|---|---|
status | ACTIVE | SUSPENDED | Optional. Without it, both are returned. A detached Installer is REMOVED and is never listed. |
q | string, 1–64 | Optional name/email prefix search. It is normalised; fewer than 2 characters returns no rows. A search returns at most limit rows and no nextCursor. |
limit | 1–50 | Optional. Default 15 on the first page, 10 on a cursor page. |
cursor | string | The previous response's nextCursor. Opaque and bound to this route and filter. |
Any other parameter → 400 VALIDATION_FAILED with details.unknown.
Response 200
| Field | Notes |
|---|---|
items[] | One row per Installer: the People row (sub, displayName, emailMasked — the full email for this caller, role { roleId, code, name }, status, scope, plantCount?, mfa, lastSignInAt?, joinedAt?), plus version (send it as If-Match for an action) and suspendedByPlatform (SUSPENDED rows only). |
nextCursor | Present when more rows exist. |
counts | First page only. { active, suspended, pendingInvitations, pendingJoinRequests }, counted exactly on each read. |
installerRoleId | First page only. The roleId to invite an Installer with; null if the Business has no Installer role. |
Illustrative example:
GET /v1/orgs/01JBUSINESS00000000000000AB/installers?limit=15
Authorization: Bearer <IdToken>
{
"items": [
{
"sub": "a1b2c3d4-0000-0000-0000-000000000001",
"displayName": "Ali Raza",
"emailMasked": "ali.raza@example.com",
"role": { "roleId": "01JINSTALLERROLE0000000000A", "code": "R-91", "name": "Installer" },
"status": "ACTIVE",
"scope": { "kind": "ALL", "targetCount": 0, "label": "All plants" },
"plantCount": 12,
"mfa": { "enabled": false, "required": false },
"lastSignInAt": "2026-11-23T09:14:00.000Z",
"joinedAt": "2026-10-02T11:00:00.000Z",
"version": 3
}
],
"nextCursor": "djI6…",
"counts": { "active": 4, "suspended": 1, "pendingInvitations": 2, "pendingJoinRequests": 1 },
"installerRoleId": "01JINSTALLERROLE0000000000A"
}
GET /v1/orgs/{orgId}/installers/pending
Returns the pending join requests and pending Installer invitations, for the "Requests" tab.
| Query | Rule |
|---|---|
type | JOIN_REQUEST or INVITATION. Without it, the first page of both lists is returned, and cursor is not allowed (400). |
limit | 1–50; default 15 on the first page, 10 with a cursor. |
cursor | That list's nextCursor. It requires type. |
Response 200 (a list is present only if it was asked for):
{
"joinRequests": {
"items": [
{
"requestId": "01JREQ0000000000000000000A",
"orgId": "01JBUSINESS00000000000000AB",
"orgName": "Sunrise Solar",
"sub": "a1b2c3d4-0000-0000-0000-000000000009",
"displayName": "Bilal Khan",
"emailNorm": "bilal@example.com",
"message": "I installed your Lahore sites",
"status": "PENDING",
"createdAt": "2026-11-24T08:00:00.000Z",
"version": 1
}
]
},
"invitations": {
"items": [
{
"inviteId": "01JINV0000000000000000000A",
"kind": "INTERNAL",
"emailMasked": "s***@example.com",
"displayName": "Sara",
"role": { "roleId": "01JINSTALLERROLE0000000000A", "name": "Installer" },
"status": "PENDING",
"expiresAt": "2026-12-01T08:00:00.000Z",
"delivery": "NOT_SENT",
"sendCount": 1,
"invitedBy": "a1b2c3d4-0000-0000-0000-000000000000",
"version": 1
}
],
"nextCursor": "djI6…"
}
}
(Illustrative.) Join requests are newest first. Invitations are PENDING, unexpired, and on an Installer-type role only. Invitation emails are always masked here.
POST /v1/orgs/{orgId}/installers/{sub}:suspend · :restore · :detach
The real API Gateway route is POST /v1/orgs/{orgId}/installers/{sub}. The verb
is part of the {sub} path value, and the handler splits it out. An unknown
verb → 404.
If-Match: "<version>"is required. Use the row'sversion, or theETagof the previous action. Missing →428 PRECONDITION_REQUIRED; stale →409 VERSION_CONFLICT.- The target must be an ACTIVE or SUSPENDED Installer of this Business.
Anyone else (a Business member, an End User, a removed member, an unknown
sub) →
404 NOT_FOUND, and nothing changes.
| Verb | Body | Effect | Errors |
|---|---|---|---|
:suspend | { "note"?: string ≤ 500 } or no body | ACTIVE → SUSPENDED. The Installer's tokens and live sessions are cut (access.revoked.v1), and they keep their plants. The response adds assignedWorkOrdersRemain. | 409 INVALID_STATE (not ACTIVE); 409 BUSINESS_NOT_ACTIVE; 403 SELF |
:restore | none | SUSPENDED → ACTIVE. | 409 INVALID_STATE (not SUSPENDED); 403 SUSPENDED_BY_PLATFORM (Crown staff suspended them); 409 BUSINESS_NOT_ACTIVE |
:detach | none | The membership becomes REMOVED and drops off every list. Sessions are cut. Plants the Installer brought into the Business move back to their personal account, which reopens. Plants created inside the Business stay in it. ADR 0036 (2026-11-27, not deployed): the Business owner becomes the assigned Installer of every plant assigned to them and the assignee of their open work orders; plants they owned go to the owner; their End Users stay in the Business. Suspending the Business suspends its Installers and activating it restores them (details). Not undoable: to bring them back, invite them again or accept a new join request. | 409 CONFLICT MOVE_IN_PROGRESS (retry shortly); 403 SELF |
Response 200 — the member drawer shape (MemberDetail, as
GET /v1/orgs/{orgId}/members/{sub}) plus action, with ETag: "<new version>":
{ "sub": "a1b2c3d4-0000-0000-0000-000000000001", "displayName": "Ali Raza", "status": "SUSPENDED", "version": 4, "action": "suspend", "assignedWorkOrdersRemain": false, "…": "…" }
(Illustrative.) These are the same rules and side effects as
POST /v1/orgs/{orgId}/members/{sub} :suspend / :restore /
:remove, limited to Installers. Every action is written to the Business
access log.
Error codes (this page)
| HTTP | code | details.reason | When |
|---|---|---|---|
| 400 | VALIDATION_FAILED | — | Unknown query parameter, bad value, cursor without type |
| 400 | INVALID_CURSOR | — | Cursor from another route or filter, or malformed |
| 401 | — | — | No or invalid token ({"message":"Unauthorized"}) |
| 403 | FORBIDDEN | — / SELF / SUSPENDED_BY_PLATFORM / BUSINESS_SUSPENDED / BUSINESS_CLOSED | Not a team manager of the Business; acting on yourself; a Crown suspension; the Business is not active |
| 404 | NOT_FOUND | — | Not a member of {orgId}; the target is not a current Installer; unknown verb |
| 409 | INVALID_STATE | — / NOT_A_BUSINESS / BUSINESS_NOT_ACTIVE | Status precondition; not a Business |
| 409 | VERSION_CONFLICT | — | If-Match is stale — re-read the list and retry |
| 409 | CONFLICT | MOVE_IN_PROGRESS | A plant move for this user is running — retry |
| 422 | VALIDATION_FAILED | — | Bad :suspend body (unknown field, note > 500) |
| 428 | PRECONDITION_REQUIRED | — | If-Match missing |
Data access and cost
No new entity, index or Scan. The list reads the People index partitions
(GSI2 ORG#<o>#MEMBERS, or GSI3 ORG#<o>#MEMBERS#<status>) filtered on
Installer-type roles, with at most 5 Queries per page. A search uses the People
search tokens plus one BatchGet. The first page adds four Select: COUNT
Queries. See docs/data-model.md → "Installers screen" in cse-http-be.