Skip to main content

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​

OpMethod + pathAuthIdempotency / versioning
List / search InstallersGET /v1/orgs/{orgId}/installersteam ≥ MANAGE—
Pending requests and invitationsGET /v1/orgs/{orgId}/installers/pendingteam ≥ MANAGE—
Suspend / restore / detachPOST /v1/orgs/{orgId}/installers/{sub}:suspend · :restore · :detachteam ≥ MANAGEIf-Match required

These use existing routes, with ids taken from the screens above:

OpRoutePage
Accept / reject a join requestPOST /v1/orgs/{orgId}/join-requests/{requestId}:accept · :rejectRBAC v2
Invite an Installer by emailPOST /v1/orgs/{orgId}/invitations with roleId = installerRoleIdInvitations
Revoke an invitationDELETE /v1/orgs/{orgId}/invitations/{inviteId} (If-Match)Invitations
Resend an invitationPOST /v1/orgs/{orgId}/invitations/{inviteId}:resend (If-Match)Invitations
Show or regenerate the join codeGET / POST /v1/orgs/{orgId}/join-codeRBAC 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 with team ≥ MANAGE. That means the Business role, or Crown staff through the platform path. Installers and End Users get 403 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 → 403 BUSINESS_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.

QueryTypeRule
statusACTIVE | SUSPENDEDOptional. Without it, both are returned. A detached Installer is REMOVED and is never listed.
qstring, 1–64Optional name/email prefix search. It is normalised; fewer than 2 characters returns no rows. A search returns at most limit rows and no nextCursor.
limit1–50Optional. Default 15 on the first page, 10 on a cursor page.
cursorstringThe previous response's nextCursor. Opaque and bound to this route and filter.

Any other parameter → 400 VALIDATION_FAILED with details.unknown.

Response 200

FieldNotes
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).
nextCursorPresent when more rows exist.
countsFirst page only. { active, suspended, pendingInvitations, pendingJoinRequests }, counted exactly on each read.
installerRoleIdFirst 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.

QueryRule
typeJOIN_REQUEST or INVITATION. Without it, the first page of both lists is returned, and cursor is not allowed (400).
limit1–50; default 15 on the first page, 10 with a cursor.
cursorThat 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's version, or the ETag of 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.
VerbBodyEffectErrors
:suspend{ "note"?: string ≤ 500 } or no bodyACTIVE → 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
:restorenoneSUSPENDED → ACTIVE.409 INVALID_STATE (not SUSPENDED); 403 SUSPENDED_BY_PLATFORM (Crown staff suspended them); 409 BUSINESS_NOT_ACTIVE
:detachnoneThe 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)​

HTTPcodedetails.reasonWhen
400VALIDATION_FAILED—Unknown query parameter, bad value, cursor without type
400INVALID_CURSOR—Cursor from another route or filter, or malformed
401——No or invalid token ({"message":"Unauthorized"})
403FORBIDDEN— / SELF / SUSPENDED_BY_PLATFORM / BUSINESS_SUSPENDED / BUSINESS_CLOSEDNot a team manager of the Business; acting on yourself; a Crown suspension; the Business is not active
404NOT_FOUND—Not a member of {orgId}; the target is not a current Installer; unknown verb
409INVALID_STATE— / NOT_A_BUSINESS / BUSINESS_NOT_ACTIVEStatus precondition; not a Business
409VERSION_CONFLICT—If-Match is stale — re-read the list and retry
409CONFLICTMOVE_IN_PROGRESSA plant move for this user is running — retry
422VALIDATION_FAILED—Bad :suspend body (unknown field, note > 500)
428PRECONDITION_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.