# tenants (operator)

Operators, customers, people (memberships), invitations, teams and customer settings (currencies, addresses, alerts, approved domains, approval policies, primary owner, closure).

## GET /customers

operationId: `listCustomers`
Summary: List customers (operator)
API key scopes: `customers:read`
Callable by: operator keys
Parameters: `X-Tenant-Id` (header, required), `X-Request-Id` (header), `cursor` (query), `limit` (query), `sort` (query), `filter` (query), `q` (query), `withTotal` (query)
Responses: 200 `CustomerPage`, 400 `Problem`, 401 `Problem`, 403 `Problem`, 429 `Problem`, default `Problem`

**API key scope:** `customers:read` (operator-level keys only, `X-Tenant-Id` = the operator id).

**Metadata filter:** `filter[metadata.<key>]=<value>` (exact match; at most 5; AND).

**Batch look-up (P12-T07):** `filter[id]=<id>,<id>,…` (at most 100) returns those rows only, e.g. to resolve names shown next to ids; combine with `limit` ≥ the number of ids.

## POST /customers

operationId: `createCustomer`
Summary: Create a customer (operator-initiated)
API key scopes: `customers:write`
Callable by: operator keys
Parameters: `X-Tenant-Id` (header, required), `X-Request-Id` (header), `Idempotency-Key` (header)
Request body: `CustomerCreate`
Responses: 201 `Customer`, 400 `Problem`, 401 `Problem`, 403 `Problem`, 409 `Problem`, 422 `Problem`, 429 `Problem`, default `Problem`

Creates a `draft` customer. With `primaryOwner` a primary-owner invitation is emailed; without it (console sessions only) no invitation is sent. Creates a draft customer and invites the primary owner. Self-registration uses `/auth/register`.

**API key scope:** `customers:write` (operator-level keys only, `X-Tenant-Id` = the operator id).

**API keys (review W3-02):** an operator key needs `customers:write`, the owner address must be on the operator settings' `apiKeyInvitationDomains` (`422 invitation_domains_required` / `domain_not_approved` before anything is written) and each key may create 10 customers a minute (`429`).

## GET /customers/{customerId}

operationId: `getCustomer`
Summary: Get customer
API key scopes: `customers:read`, `account:read`
Callable by: customer and operator keys
Parameters: `customerId` (path, required), `X-Tenant-Id` (header, required), `X-Request-Id` (header), `If-None-Match` (header)
Responses: 200 `Customer`, 304, 401 `Problem`, 403 `Problem`, 404 `Problem`, 429 `Problem`, default `Problem`

`X-Tenant-Id` is the customer itself or its operator. `customer.view` is held by operator staff roles and by every customer role (own customer only).

**API key scopes:** `customers:read` or `account:read` (customer-level keys (`X-Tenant-Id` = the key's customer) and operator-level keys (`X-Tenant-Id` = the operator id), each with a scope of its own level).

## GET /operators/{operatorId}

operationId: `getOperator`
Summary: Get operator
API key scopes: `operator:read`
Callable by: operator keys
Parameters: `operatorId` (path, required), `X-Tenant-Id` (header, required), `X-Request-Id` (header), `If-None-Match` (header)
Responses: 200 `Operator`, 304, 401 `Problem`, 403 `Problem`, 404 `Problem`, 429 `Problem`, default `Problem`

**API key scopes:** `operator:read` (operator-level keys only (`X-Tenant-Id` = the operator id)).

## PATCH /operators/{operatorId}

operationId: `updateOperator`
Summary: Update operator profile
API key scopes: `operator:write`
Callable by: operator keys
Parameters: `operatorId` (path, required), `X-Tenant-Id` (header, required), `X-Request-Id` (header), `If-Match` (header, required)
Request body: `OperatorUpdate`
Responses: 200 `Operator`, 400 `Problem`, 401 `Problem`, 403 `Problem`, 404 `Problem`, 409 `Problem`, 412 `Problem`, 422 `Problem`, 428 `Problem`, 429 `Problem`, default `Problem`

**Concurrency:** `If-Match` with the current `ETag` is required (`428` if absent, `412` if stale).

**API key scopes:** `operator:write` (operator-level keys only (`X-Tenant-Id` = the operator id)).

**Step-up and API keys (P15-T01):** API keys holding the scope call it without a step-up: the key was issued by a stepped-up session, and the route's limits, approval tiers and validation apply to keys exactly as to sessions (review W3-03).

## GET /operators/{operatorId}/branding

operationId: `getOperatorBranding`
Summary: Get operator branding
API key scopes: `operator:read`
Callable by: operator keys
Parameters: `operatorId` (path, required), `X-Tenant-Id` (header, required), `X-Request-Id` (header), `If-None-Match` (header)
Responses: 200 `Branding`, 304, 401 `Problem`, 403 `Problem`, 404 `Problem`, 429 `Problem`, default `Problem`

**API key scopes:** `operator:read` (operator-level keys only (`X-Tenant-Id` = the operator id)).

## GET /operators/{operatorId}/domains

operationId: `listOperatorDomains`
Summary: List web and sender domains
API key scopes: `operator:read`
Callable by: operator keys
Parameters: `operatorId` (path, required), `X-Tenant-Id` (header, required), `X-Request-Id` (header), `purpose` (query)
Responses: 200 `OperatorDomainList`, 400 `Problem`, 401 `Problem`, 403 `Problem`, 404 `Problem`, 429 `Problem`, default `Problem`

**API key scopes:** `operator:read` (operator-level keys only (`X-Tenant-Id` = the operator id)).

## GET /operators/{operatorId}/domains/{domainId}

operationId: `getOperatorDomain`
Summary: Get a domain
API key scopes: `operator:read`
Callable by: operator keys
Parameters: `operatorId` (path, required), `domainId` (path, required), `X-Tenant-Id` (header, required), `X-Request-Id` (header)
Responses: 200 `OperatorDomain`, 401 `Problem`, 403 `Problem`, 404 `Problem`, 429 `Problem`, default `Problem`

**API key scopes:** `operator:read` (operator-level keys only (`X-Tenant-Id` = the operator id)).

## GET /operators/{operatorId}/settings

operationId: `getOperatorSettings`
Summary: Get operator settings
API key scopes: `operator:read`
Callable by: operator keys
Parameters: `operatorId` (path, required), `X-Tenant-Id` (header, required), `X-Request-Id` (header), `If-None-Match` (header)
Responses: 200 `OperatorSettings`, 304, 401 `Problem`, 403 `Problem`, 404 `Problem`, 429 `Problem`, default `Problem`

**API key scopes:** `operator:read` (operator-level keys only (`X-Tenant-Id` = the operator id)).
