Customers API (C17, C18)
Feature 004, user story 4. A customer is a CUSTOMER org linked to your operator org by a customer profile
(ORG#<op>/REL#CUSTOMER#<customer>). These routes cover the customer list, create, view and edit, closing an
account, and the customer drawer, which loads in a single call.
:::caution Deployed; no captured run yet
Deployed on dev (verified live 2026-10-13). The list's default status=ACTIVE path queries GSI3,
deployed 2026-10-13, so it is expected to work now, not yet re-verified on dev. The DynamoDB key fix for get, PATCH and :close (previously 500; an unknown customerOrgId is now 404) is
deployed to dev 2026-10-13; not yet re-verified with a signed-in call.
As of 2026-10-13 these routes are in lib/routes.ts (ListCustomers, CreateCustomer, GetCustomer,
UpdateCustomer, CloseCustomer, GetCustomerOverview). Handler: packages/api/src/handlers/customers.ts. Core:
packages/core/src/customers/repository.ts. They are unit-tested, and docs/openapi.yaml passes the parity test.
Integration tests (customers-004.int.test.ts, customer-overview-004.int.test.ts) have been written but not run.
Every JSON example below is illustrative: it was derived from the Zod schemas (CustomerProfile,
CreateCustomerInput, UpdateCustomerInput, CloseCustomerInput, CustomerListQuery, CustomerListResponse,
CustomerOverview), not captured from a real response.
The issue #14 changes (Crown org acting on any customer, operatorOrgId on create, hasPlants) were committed
2026-11-13 and are not deployed; they are unit-tested only.
:::
Common rules
| Topic | Rule |
|---|---|
| Auth | Cognito JWT (Authorization: Bearer <id token>), on every route |
| Org | {orgId} in the path is authoritative. If an X-Org-Id header differs from it, the response is 400 VALIDATION_FAILED with details.header: "X-Org-Id". Platform members are exempt |
| Permission | Category customers. Read needs ≥ VIEW; create and edit need ≥ EDIT; changing portalLevel, setting/changing/removing portalPermsLimit, and :close need ≥ MANAGE |
| Versioning | GET, PATCH and close responses carry ETag: "<version>", and the body also has version. PATCH and :close require If-Match: "<version>" |
| Bodies | Content-Type: application/json, strict schemas (unknown field → 422) |
| Not yours | A customer org that is not a customer of {orgId} → 404 NOT_FOUND |
| Scoped callers | A member whose scope is not ALL sees only the customers of their own plants: the list is filtered (since 2026-11-25 its first page carries tiles and total computed over the customers they can see) and any other customer is 404 NOT_FOUND on detail, overview, PATCH and :close (Role boundaries, 2026-11-12). An Installer is not such a caller: since ADR 0026 D3.1 its scope is always ALL, so it sees every customer of its Business |
| Contact details (RBAC-S7, 2026-11-23) | contact (name, job title, phone, email) and lastContact are returned only to a caller with customers ≥ MANAGE in the Business (Business, Crown staff). Below that — the Installer template holds customers: VIEW — both fields are absent on the list, detail and overview profile. A Business that wants its Installers to reach customers raises its Installer role to customers: MANAGE. A custom role at customers: EDIT may still set them, but the response does not echo them back. For these callers q does not match the contact name or email either (list and search suggestions), so a search cannot confirm an address |
| Crown org | A Crown Super Admin / Administrator calling the list on the Crown org gets every Business's customers and Independent End Users (Crown-wide list): operatorOrgId is the Business, refs.orgs its name, personal orgs carry personal: true; first-page tiles are platform-wide (2026-11-12). Add operatorOrgId=<businessOrgId> to see one Business's list, with its own tiles. The same caller can also open, edit, close and create any customer from the Crown path: see Crown org: any customer (issue #14, 2026-11-13) |
| Deleting | There is no DELETE. Close the account instead (:close). DELETE gets API Gateway's plain 404 |
Routes
| Method | Path | Level | Headers |
|---|---|---|---|
| GET | /v1/orgs/{orgId}/customers | VIEW | — |
| POST | /v1/orgs/{orgId}/customers | EDIT (MANAGE if portalLevel > VIEW) | Idempotency-Key required |
| GET | /v1/orgs/{orgId}/customers/{customerOrgId} | VIEW | — |
| PATCH | /v1/orgs/{orgId}/customers/{customerOrgId} | EDIT (MANAGE to change portalLevel) | If-Match required |
| POST | /v1/orgs/{orgId}/customers/{customerOrgId}:close | MANAGE | If-Match required, Idempotency-Key optional |
| GET | /v1/orgs/{orgId}/customers/{customerOrgId}/overview | VIEW | — |
:close is a colon-verb (CR-2). API Gateway registers it as POST …/customers/{customerOrgId}, and the handler
splits :close out of the path value. Any other verb, or a bare POST with no verb, returns 404 NOT_FOUND.
CustomerProfile
| Field | Type | Notes |
|---|---|---|
customerOrgId, operatorOrgId | ULID | |
code | string | CU-NNNN, platform-wide. Missing on relationships created before 004 |
name | string | 1–160 |
customerType | RESIDENTIAL | COMMERCIAL | INDUSTRIAL | Missing on relationships created before 004 |
business, city | string | optional, ≤ 120 |
contact | {name?, jobTitle?, phone?, email?} | phone E.164; email lowercased |
customerSince | date | defaults to the creation date; when a row never recorded one, the API returns the row's (personal row: the personal org's) creation date (2026-11-27) |
status | ACTIVE | CHURNED | |
portalLevel | NONE | VIEW | MONITOR | EDIT | SERVICE | FULL | default VIEW |
portalPermsLimit | PermsLimit (partial map category → Level) | Present only when set. Lowers the portal tier's ceiling per category (ADR 0014 phase 2a) |
tagIds | ULID[] | ≤ 20 tags; each must be ACTIVE and apply to CUSTOMER |
lastContact | {on: date, note?: ≤200} | |
closedAt, closedBy, closeReason | present once closed | |
plantCount | int | Since 2026-11-25: exact — the ADR 0017 plantsLive (ACTIVE + ARCHIVED plants, written in the same transaction as each plant write) whenever the customer's Crown-wide entry belongs to this Business, which is every live customer once backfill:customer-list has run. Falls back to the facet counter (approximate) only for a customer with no entry |
personal | true | Crown-wide list, detail and overview only: an Independent End User's personal org |
operatorSuspended | true or absent | Bug fix 2026-12-02. Crown-wide list only: the row's Business is SUSPENDED. The row is still listed and counted; it can be opened (GET) but not edited (PATCH / :close → 404). Show a "Business suspended" badge |
endUser | {sub, accountStatus: ACTIVE | SUSPENDED | BLOCKED} | 2026-11-25. On a personal row and on a Business's End User customer; only for callers with customers ≥ MANAGE (like contact). See End User access |
version, createdAt, updatedAt |
End Users are customers (2026-11-25)
Console request 2026-11-24. Built and unit-tested on dev; not yet run against a deployment. An End User attached to a Business is one of its customers and appears in this list, its detail and its overview like any other customer:
- Share:
plant-transfersmakes the receiver a customer of the Business the plant is in (Business mode, and Crown mode when the receiver is an End User of a Business). - Join with own plants: an End User whose personal plants moved into the Business on joining (ADR 0026 D5).
The customer org is the End User's personal org (customerOrgId = that org; it stays closed for the user while
they belong to the Business). The shared plant's customerOrgId becomes that org, so plantCount, hasPlants, the
overview's plants and the scoped (Installer) list all count it.
The row is an ordinary CustomerProfile: name = the user's display name, contact.email = their email,
portalLevel: "NONE" (they reach their plants through their membership, not a portal), customerSince = the day they
became a customer. No code or business. Owner 2026-11-27: customerType is RESIDENTIAL and city is the
city of the first linked plant that has one (filled later when missing, never overwritten; counted in tiles.cities
and matched by the city filter).
Since 2026-11-27 its contact is completed on every read from the user's profile: name (display name), jobTitle
and email fill whatever the stored contact leaves out; the stored email wins.
Since 2026-11-25 the row also carries endUser (see End User access).
| Event | Profile |
|---|---|
| Share, or join with own plants | created ACTIVE (a CHURNED one is reopened) |
plant-unshares (removed 2026-11-27, ADR 0035) | stays ACTIVE; the plant goes back to the Business (customerOrgId = the Business), so the customer can show 0 plants |
:detach / :remove of the End User | closed: CHURNED, portalLevel: NONE, closeReason END_USER_DETACHED / MEMBER_REMOVED. On the Crown-wide list the person shows as an Independent End User again only when their personal org is ACTIVE. A personal org kept CLOSED (the usual case for an End User who belonged to a Business) is neither listed nor counted (owner decision 2026-12-01, report Q3/F12) |
Plants shared before 2026-11-25 need the human-run
npm run backfill:end-user-customers.
plantCount is exact since 2026-11-25 (read from the same plantsLive that hasPlants filters on). Known gap: q: a new End User
customer matches only once its search tokens are written. If a plant already named a separate customer (a company
customer created on the web before 2026-11-20), sharing it moves it to the End User.
List — GET /v1/orgs/{orgId}/customers
Query parameters: customerType, city (exact match, case-insensitive), status (ACTIVE default | CHURNED | ALL),
portalLevel, tagId (one ULID), q (2–64 characters: matches name, code, contact name/email, city), sort
(name | -name), hasPlants (true only), limit (1–50; default 15 on the first page, 10 with a cursor (lazy loading)), cursor.
sortis not allowed together withq. Together withtagId, onlynameis allowed. Breaking either rule →400 VALIDATION_FAILED.hasPlants=truekeeps only customers with at least one live plant (ACTIVE or ARCHIVED). It works in every list mode (per-org, scoped, Crown-wide and one Business). The count is exact: it is read from the customer's ADR 0017 list entry (plantsLive), not from the approximateplantCount. A customer created before the customer list backfill ran has no entry and is left out. Any other value →400 VALIDATION_FAILED. Pages can be short (issue #14, 2026-11-13).qresults come from search tokens that are updated asynchronously. A customer created a moment ago may not match yet.qalso matches the names of the customer's plants (2026-11-24, console item 4.4). The customer profile keeps aplantNamesmap ({plantId: name}) that the stream-router updates when a plant is created, renamed, moved to another customer or deleted; the profile change then re-tokenises the customer. Plants named before the change neednpm run backfill:customer-plant-namesfollowed bynpm run rebuild:projections. On dev the stream-router is not deployed (KI-43), so there the map and tokens only refresh when those two scripts run.tiles(active,totalOnRecord,noPortalAccess,capacityKwp,cities,approximate: true) is only returned on the first page. Keep it from that response; later pages omit it. Since 2026-11-25 (console requests C1/C2):- a scoped caller gets
tilesandtotaltoo, counted over the customers they can see:active/totalOnRecord/totalby status;noPortalAccess,citiesandcapacityKwp(each customer's plants in the Business) over their ACTIVE customers. Other filters andqare ignored, as on the org tiles. - the Crown-wide list carries
tiles.citiesacross every Business (ACTIVE Business customers per normalised city), kept on the platform customer counters by the create, edit, close and create-plant-with-new-customer writes. Absent withoperatorOrgId=none(Independent End Users have no city). Existing customers count only afternpm run backfill:customer-list -- --stage dev --applyruns over every org (no--org); run on dev 2026-11-25 (Operations). - Q3 / F12 (2026-12-01). On dev, page 1 said 48 customers while paging returned 39. The 9 were Independent End
User rows whose personal org is CLOSED: they were counted but never listed. The rule now (owner decision, option a):
a personal org that is not ACTIVE is filed under
CUSTOMERS#ALL#CLOSEDand is neither listed nor counted. Existing rows move when a human rerunsnpm run backfill:customer-list -- --stage dev --applyover every org, which also rewrites the platform counters. - Bug fix 2026-12-02: on the Crown-wide list the rows and the tiles count the same customers. A suspended Business's customers
are in both (rows flagged
operatorSuspended: true). A closed Business's customers are in neither::closesubtracts them from the platform counters once, andbackfill:customer-listleaves them out. To fix counters that were already wrong before this change, rerun the backfill over every org.
- a scoped caller gets
- The cursor is tied to the exact filters and sort that produced it. If any filter changes, drop the cursor and start
from page 1. Reusing it →
400 INVALID_CURSOR. Pages can come back short and still carry anextCursor; keep paging untilnextCursoris absent.
Illustrative 200:
{
"items": [{ "customerOrgId": "01JB…", "operatorOrgId": "01JA…", "code": "CU-0042", "name": "Alpha Mills",
"customerType": "INDUSTRIAL", "status": "ACTIVE", "portalLevel": "VIEW", "tagIds": [],
"plantCount": 3, "version": 4 }],
"nextCursor": "eyJ2Ijoy…",
"tiles": { "active": 120, "totalOnRecord": 131, "noPortalAccess": 9, "capacityKwp": 5400.5, "approximate": true },
"refs": { "orgs": {}, "tags": {} }
}
:::note Admin-web 2026-11-24
Page 1 of the list also carries total and tiles.cities[] (the city filter options). On the Crown-wide list, operatorOrgId=none keeps only Independent End Users. q matches the name, code, contact name, contact email, city and (since 2026-11-24) the customer's plant names — see the list rules above. See Admin-web list totals, counts and filter options.
:::
Create — POST /v1/orgs/{orgId}/customers
Body: name, customerType (required); business?, city?, contact?, customerSince?, portalLevel? (default
VIEW), portalPermsLimit?, tagIds?, invite?: {email}, operatorOrgId?.
operatorOrgId (issue #14) names the Business that will own the customer. It is required when a Crown Super
Admin / Administrator creates from the Crown org (see Crown org: any customer).
Anywhere else it may only repeat {orgId}; another value → 400 VALIDATION_FAILED, details.field: "operatorOrgId".
portalPermsLimit (ADR 0014 phase 2a) narrows the portal tier per category — effective ceiling is
min(tier ceiling, limit), never higher than the tier — except on a FULL portal, where
portalPermsLimit may raise plants and sharing up to MANAGE (e.g. { "plants": "MANAGE", "sharing": "MANAGE" },
illustrative) so portal users can archive/restore their plants and
re-share one plant with an individual. Without those keys
FULL keeps EDIT for both; switching them on needs you to hold MANAGE there (else ESCALATION). Rules: needs customers ≥ MANAGE (403); with
portalLevel: NONE → 422 VALIDATION_FAILED, details.field: "portalPermsLimit"; if the limited ceiling exceeds
your own levels → 403 FORBIDDEN, details.reason: "ESCALATION". {} counts as no limit. On PATCH, setting
portalLevel: NONE without portalPermsLimit clears a stored limit. Without a limit the
pre-ADR rule stays: portalLevel above VIEW needs MANAGE. Since 2026-11-03 the escalation check runs on every tier or
limit change (removing a limit included), except plain portalLevel: VIEW with no limit — the default portal, so
customers-only roles such as Sales can still create customers. Example body
(illustrative): {"name":"Ali Traders","customerType":"COMMERCIAL","portalLevel":"FULL","portalPermsLimit":{"commands":"NONE","devices":"VIEW"}}.
See Roles & permissions.
Returns 201 with the flat profile, plus invitation: {inviteId, status: "PENDING_DELIVERY"} when invite was sent.
Headers: Location: /v1/orgs/{orgId}/customers/{customerOrgId} and ETag. Emits org.upserted.v1.
Idempotency: generate one Idempotency-Key (1–128 characters [A-Za-z0-9_-]) per form submission, and send the
same key again on retries.
| Situation | What the API does |
|---|---|
| Same key and same body | Returns the original response with Idempotent-Replayed: true |
| Same key, different body | 422 IDEMPOTENCY_KEY_REUSED |
| First request still running | 409 IDEMPOTENCY_IN_PROGRESS. Wait and retry with the same key |
| No key | 428 PRECONDITION_REQUIRED, details.header: "Idempotency-Key" |
Get / edit
GET …/{customerOrgId} → 200 CustomerProfile + ETag.
PATCH …/{customerOrgId} with If-Match: "<version>". Send only the fields you are changing. null clears
business, city, contact or lastContact. An empty body is rejected with 422.
- Changing
portalLevelneedscustomers≥ MANAGE (otherwise403 FORBIDDEN). Any change to it writes an access-log entryCUSTOMER_PORTAL_CHANGED. Lowering it also emitsaccess.revoked.v1(reasonPORTAL_NARROWED), which logs out portal users whose access was reduced. portalPermsLimitreplaces the whole map;nullor{}removes it. Same 403/422 rules as on create, checked against the resultingportalLevel. Lowering any category also counts as narrowing (PORTAL_NARROWED). The access-log entry carrieschanges.portalPermsLimit: {from, to}.- A rename emits
org.upserted.v1. - A CHURNED customer can only have
lastContactedited. Any other field →409 INVALID_STATE.
Close — POST …/{customerOrgId}:close
If-Match is required. Idempotency-Key is optional; send one if the client might retry. The body is optional:
{reason?: ≤200}.
The result: status becomes CHURNED, portalLevel becomes NONE, and closedAt, closedBy and closeReason
are set. It also writes access-log CUSTOMER_CLOSED and emits access.revoked.v1 (reason CUSTOMER_CLOSED). Returns
200 with the closed profile and a new ETag. The account's plants are untouched.
End User customer (2026-11-30, BE-4; deployed to dev 2026-11-30). When the closed customer is a connected
End User's personal org (source: END_USER), the close then runs the same steps as
:detach: their End User membership in the Business is removed (access ends at once) and their plants
move back to their personal org. This runs after the close is committed and is best effort: if it fails, the close
stays and the Business can still :detach the member from Team. Before this fix the End User stayed ACTIVE with
full access after the close.
Open work orders and open alerts (BE-06, 2026-12-02). openWorkOrders (the COUNT#WOCUST#OPEN#<c> counter) is
returned when the caller has service ≥ VIEW in the operator org, and on the Crown-wide list when the platform role has
service ≥ VIEW (personal rows included). openAlerts {critical, warning, info, total} is on every row: a snapshot TCP
sends as customer.alerts.v1 whenever an alert on one of the customer's plants opens, closes or changes severity (and
for every customer when TCP's persistence worker starts). HTTP stores it at ORG#<operator>/COUNT#ALERTSCUST#<customer>
(highest seq wins) and never reads telemetry. Until TCP has sent a snapshot the row shows zeros. Needs the integration
stack (busEnabled) and TCP's relay deployed.
Overview (drawer) — GET …/{customerOrgId}/overview
One call returns:
profileplants(first 25 rows,WebPlantListItem, filtered to the plants the caller can see;nextCursor→ continue withGET /v1/orgs/{orgId}/plants?customerOrgId=…)devices,service,reportspermissions(portalLevel,portalPermsLimit?when set,portalUserCount?,shares)refs
devices is always available (N-46 per-customer plant sums, approximate). service needs service ≥ VIEW and
reports needs reports ≥ VIEW; reports.lastDeliveredAt is the customer's last delivered report (absent when none).
Hide a panel when available is false; do not show zeros. Alerts and health come from the TCP backend over WSS, not from here.
End User access (2026-11-25)
Console request 2026-11-25 (Customers page). Built and unit-tested; not yet run against a deployment.
- Contact on a personal row. On the Crown-wide list, detail and overview, an Independent End User's row carries
contact.name(their display name),contact.jobTitle(2026-11-27) andcontact.email(their account email), read from their user profile. The personal org's owner is its creator. RBAC-S7 applies: omitted below customers MANAGE. - Counts and dates on a personal row (2026-11-27).
deviceCount,capacityKwp(withapproximate: true) come from the personal org's own plant sums, on the list, detail and overview (devicesisavailable: true).customerSinceis the personal org's creation date. - Type and city (owner 2026-11-27). Every End User row has
customerType: "RESIDENTIAL".cityis the city of their first plant that has one: stored on a Business's End User customer row, read live for a personal row. ThecustomerTypeandcityfilters (andq) include personal rows;tiles.citiescounts Business End User customers but not personal rows. Rows linked before 2026-11-27 get both whennpm run backfill:end-user-customers -- --stage dev --applyis rerun (human-run). - Not available for End Users.
contact.phoneis never set: the user profile does not collect a phone. - Portal access vs account access.
portalLevelis the customer portal signal only. An End User (personal row or a Business's End User customer) is alwaysportalLevel: "NONE"and reaches their plants through their account and membership. Whether they can sign in isendUser.accountStatus:SUSPENDED(2026-12-01) when their membership in the row's org is suspended — the personal org on a personal row, elseoperatorOrgId;BLOCKEDwhen a block from before ADR 0036 is still in force (it wins overSUSPENDED); otherwiseACTIVE. The console should label End Users' access fromendUser, not "None". - Manage access.
portalLevelon personal and End User rows stays not editable (PATCHon a personal row is still409 INVALID_STATE). UseendUser.subinstead:- Crown staff (team ≥ MANAGE):
POST /v1/orgs/{operatorOrgId}/members/{endUser.sub}:suspend/:restore(Activate). For an Independent End User{operatorOrgId}is their personal org (the row's owncustomerOrgId); Super Admin and Administrator reach it through the Crown platform fallback, access-logged there.:blockis retired (ADR 0036, 2026-11-27):410 BLOCK_RETIRED;:unblockremains only for accounts blocked before. The text below describes the former:block. Blocking setstokensValidAfter, signs the user out in Cognito and emitsaccess.revoked.v1USER_BLOCKED, so a signed-in user loses access at once and cannot sign in later.ACCOUNT_AND_PLANTSalso suspends their plants. - A Business never activates or deactivates an End User (owner decision 2026-11-25). It manages plants only
(share, unshare, detach).
POST /v1/orgs/{orgId}/members/{sub}:suspend/:restoreon an End User by anyone other than a Super Admin or Administrator →403 FORBIDDEN,details.reason: "END_USER_CROWN_ONLY". Crown staff may still use those routes, and:unblockfor accounts blocked before. The console shows Manage access to Admin and Super Admin only.
- Crown staff (team ≥ MANAGE):
endUseris returned only to callers with customers ≥ MANAGE, likecontact. For a Business it is read-only.
Crown org: any customer
Issue #14 (ADR 0017 §5), committed 2026-11-13, not deployed. A Crown Super Admin or Administrator (ACTIVE, scope
ALL) can act on any customer from the Crown org's own path, without switching to the owning Business. These
are the rows the Crown-wide list returns. Other
callers in the Crown org keep the per-org behaviour.
| Route | Business customer | Independent End User (personal org) |
|---|---|---|
GET /v1/orgs/{crownOrgId}/customers/{customerOrgId} | The Business's profile | A read-only profile: personal: true, operatorOrgId = its own id, portalLevel: "NONE", tagIds: [], exact plantCount, version = the org's version, plus contact and endUser (customers ≥ MANAGE, 2026-11-25), deviceCount, capacityKwp, approximate, customerSince, customerType: RESIDENTIAL and first-plant city (2026-11-27) |
GET …/{customerOrgId}/overview | The Business's drawer | That profile, its plants from the platform-wide plant list, devices from its own plant sums (2026-11-27), and service, reports and permissions.shares as available: false |
PATCH …/{customerOrgId} | Edits the Business's relationship | 409 INVALID_STATE (there is no relationship to edit) |
POST …/{customerOrgId}:close | Closes the Business's relationship | 409 INVALID_STATE |
POST /v1/orgs/{crownOrgId}/customers | Creates the customer under the Business named by operatorOrgId (required) | — |
- The owning Business is found from the customer's relationship. The call then runs in that Business through the
platform fallback, with the platform role's own levels. The usual portal and escalation checks apply (a Super
Admin is exempt). Create,
PATCHand:closewrite aPLATFORM_ACCESSaccess-log entry in that Business. - Create without
operatorOrgId→400 VALIDATION_FAILED,details.field: "operatorOrgId". AnoperatorOrgIdthat is not an ACTIVE, non-personal Business (unknown, suspended, personal, or the Crown org itself) →404 NOT_FOUND. TheLocationheader keeps the Crown path, which resolves the new customer. - An unknown
customerOrgId, or a customer of a closed Business →404 NOT_FOUND. A customer of a suspended Business can be read (GET, overview) butPATCH/:close→404 NOT_FOUND(Bug fix 2026-12-02).
Errors and what the FE should do
| Status | Code | When | FE action |
|---|---|---|---|
| 400 | VALIDATION_FAILED | bad or unknown query parameter (details.allowed), X-Org-Id ≠ path org; details.field: "operatorOrgId" when create on the Crown org has none, or create elsewhere names another org | Fix the request; this is a bug, not something the user can fix |
| 400 | INVALID_CURSOR | cursor reused with different filters, or malformed | Drop the cursor and reload page 1 |
| 400 | MALFORMED_REQUEST | body is not valid JSON | Bug |
| 403 | FORBIDDEN | customers level too low (including portalLevel or portalPermsLimit changes without MANAGE); details.reason: "ESCALATION" when the portal ceiling (any tier above VIEW, or any limit change incl. removal) exceeds your own levels | Hide or disable the action for this role |
| 404 | NOT_FOUND | not a customer of this org, or an unknown colon-verb; Crown org: unknown customer, customer of a closed Business (a suspended one's only on PATCH / :close), or an operatorOrgId that is not a usable Business | Remove the row and show "customer not found" |
| 409 | VERSION_CONFLICT | stale If-Match (details.currentVersion) | Refetch, show the user the latest values, and let them reapply |
| 409 | INVALID_STATE | close on a customer that is already closed; editing a CHURNED customer (other than lastContact); Crown org: PATCH or :close on an Independent End User's personal row | Refetch and show it as closed |
| 409 | CONFLICT | a concurrent change or code allocation collided | Retry once with the same key and If-Match |
| 409 | IDEMPOTENCY_IN_PROGRESS | the first request with this key is still running | Retry after a short wait with the same key |
| 415 | UNSUPPORTED_MEDIA_TYPE | missing JSON content type | Bug |
| 422 | VALIDATION_FAILED | body errors (details.fieldErrors); tag missing, inactive, or not a customer tag; details.field: "portalPermsLimit" when a limit is sent with portal level NONE | Show the errors on the form fields |
| 422 | IDEMPOTENCY_KEY_REUSED | same key, different body | Generate a new key for the new submission |
| 428 | PRECONDITION_REQUIRED | missing Idempotency-Key or If-Match (details.header) | Bug: always send the header |
| 503 | DEPENDENCY_UNAVAILABLE | DynamoDB throttled | Retry with backoff, using the same key |
Web console additions
See Web console additions (N-37 … N-51) for the newer, not-yet-deployed fields and routes on this area.