openapi: 3.1.0
info:
  title: Passway API
  description: |-
    The Passway public API. The console, CLI, MCP server and Terraform provider use these same endpoints.

    **The model.** It follows the standards for each part of the problem. Places follow IFC: a site holds areas (buildings, floors, rooms, units) in a tree, and zones group areas across sites. Access control follows ONVIF: a door is the physical opening; an access point is one controlled way from one area into another, which readers serve; an access profile is a set of access policies (where, when, and which Aliro capabilities). An access assignment gives a profile to groups and people. People and groups use SCIM core names, and events are CloudEvents 1.0.

    **Authentication.** OAuth 2.0. Each organization is its own issuer at its own host (on Passway's cloud, `https://<name>.ext.passway.com`), with its metadata at `/.well-known/oauth-authorization-server` (RFC 8414), and its public signing keys at `/.well-known/jwks.json`. Machines (Terraform, CI, connectors, agents) are API clients and use the client credentials grant at `/oauth/token`, authenticating with HTTP Basic or form fields. Agents (see Agents) authenticate with a signed client assertion instead (RFC 7523) and must send a DPoP proof (RFC 9449); their tokens have `token_type` `DPoP`, go in `Authorization: DPoP <token>` with a fresh proof on every request, and are refused as bearer tokens. Administrators sign in through the organization's own identity provider at `/sign-in` (see Identity providers) and get a session cookie that `/v1` also accepts; writes with it must carry the organization's own `Origin`. The admin console is the built-in public app `console`: people with a role sign in to it with the authorization code flow and PKCE, and its tokens are DPoP-bound, last 10 minutes and act as the person, with their groups' roles worked out on every request (see Roles). Access tokens are opaque, last an hour and can be revoked at `/oauth/revoke` (RFC 7009). A missing or dead token gets `401`; a token without the operation's scope gets `403` with `WWW-Authenticate: Bearer error="insufficient_scope"` (RFC 6750). Scopes are `<collection>:read` for reads and `<collection>:write` for everything else, plus `credentials:revoke`.

    **Directory sync.** Okta, Microsoft Entra ID and other identity providers push people and groups to `/scim/v2` on the organization's host (SCIM 2.0, RFC 7643 and 7644), with a token from `POST /v1/connectors`. That endpoint follows the SCIM specifications rather than this document.

    **IDs.** Every ID has a prefix that says what it is: `site_`, `area_`, `ap_`, `per_` and so on.

    **Fields.** snake_case names; timestamps are RFC 3339 in UTC; time zones are IANA names; country codes are ISO 3166-1 alpha-2; labels use Kubernetes label syntax.

    **Pagination.** List endpoints take `page_size` (1 to 200; `0` or absent means 50, and more than 200 means 200) and `page_token`, and return `next_page_token`, which is `null` on the last page (Google AIP-158).

    **Concurrency.** Every resource has an `etag`. `PATCH` and `DELETE` require `If-Match` with that value in double quotes (RFC 9110). A missing header returns `428`, one that names no entity tag `400`, and a stale one `412`.

    **Retries.** `POST` accepts `Idempotency-Key`. Repeating a successful request with the same key within 24 hours returns the original response instead of acting twice. A request that failed changed nothing and can be retried with the same key. While a request with the key is still running, a repeat returns `409` with `/problems/idempotency-key-in-progress` and `Retry-After`; repeat it after that.

    **Event log.** Events are hash-chained per organization: each carries `chainseq` and `chainhash` once sealed, a few seconds after it happens. Every minute the chain's head is signed with the organization's key and recorded as a `com.passway.log.checkpoint` event, so a copy of the log kept elsewhere can be checked against `/.well-known/jwks.json`. Events older than the organization's retention are purged hourly, except during a legal hold; see `/v1/organization`.

    **Errors.** RFC 9457 problem details (`application/problem+json`). Validation failures list every rejected field with a JSON Pointer (RFC 6901).

    **Updates.** `PATCH` bodies are JSON merge patches (RFC 7396, `application/merge-patch+json`): fields in the body replace the current ones, `null` removes a field, objects such as `labels` and `address` are merged, and lists are replaced whole. `null` is accepted only where the schema allows it, for fields that can be empty such as `email`; elsewhere, such as `active` or `enabled`, it is refused rather than reset to a default. Leave a field out to keep it. The result is validated as a whole.

    **Actions.** Operations that are not create, read, update or delete are `POST` to `{id}:verb` (Google AIP-136), such as `/v1/credentials/{credential_id}:revoke`, or to `collection:verb` when they act on many, such as `/v1/agents:suspend`.

    **Compatibility.** Within `/v1`, changes are additive. Clients must ignore unknown fields and unknown event types.

    **Readers stay offline.** No tap waits on this API. Changes reach readers as new Access Documents, trust lists and revocation lists.
  version: 1.0.0-draft
servers:
- url: https://{host}
  description: Your Passway API host
  variables:
    host:
      default: api.passway.example
paths:
  /v1/organization:
    get:
      tags:
      - Organization
      summary: Get the organization
      description: Where its data lives, its issuer, and how long its event log keeps events.
      operationId: getOrganization
      responses:
        '200':
          description: The organization
          headers:
            ETag:
              $ref: '#/components/headers/ETag'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Organization'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - organization:read
    patch:
      tags:
      - Organization
      summary: Update the organization
      description: A JSON merge patch (RFC 7396) of the name, the kind, the event retention, the legal hold, whether devices must prove their device keys (`require_device_keys`) and how often the issuer keys rotate on their own (`issuer_rotation_days`). Requires `If-Match` with the current `etag`. The data location and issuer are set when the organization is created and cannot be changed here. Each change is a `com.passway.organization.updated` event, so the start and end of a legal hold are in the log.
      operationId: updateOrganization
      parameters:
      - $ref: '#/components/parameters/IfMatch'
      requestBody:
        content:
          application/merge-patch+json:
            schema:
              $ref: '#/components/schemas/OrganizationUpdate'
        required: true
      responses:
        '200':
          description: The updated organization
          headers:
            ETag:
              $ref: '#/components/headers/ETag'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Organization'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '412':
          $ref: '#/components/responses/PreconditionFailed'
        '422':
          $ref: '#/components/responses/UnprocessableContent'
        '428':
          $ref: '#/components/responses/PreconditionRequired'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - organization:write
  /v1/sites:
    get:
      tags:
      - Sites
      summary: List sites
      operationId: listSites
      parameters:
      - $ref: '#/components/parameters/PageSize'
      - $ref: '#/components/parameters/PageToken'
      - $ref: '#/components/parameters/UpdatedSince'
      responses:
        '200':
          description: A page of sites
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SiteList'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          $ref: '#/components/responses/UnprocessableContent'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - sites:read
    post:
      tags:
      - Sites
      summary: Create a site
      operationId: createSite
      parameters:
      - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SiteCreate'
        required: true
      responses:
        '201':
          description: The new site
          headers:
            ETag:
              $ref: '#/components/headers/ETag'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Site'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '409':
          $ref: '#/components/responses/Conflict'
        '422':
          $ref: '#/components/responses/UnprocessableContent'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - sites:write
  /v1/sites/{site_id}:
    get:
      tags:
      - Sites
      summary: Get a site
      operationId: getSite
      parameters:
      - name: site_id
        in: path
        required: true
        schema:
          $ref: '#/components/schemas/SiteId'
      responses:
        '200':
          description: The site
          headers:
            ETag:
              $ref: '#/components/headers/ETag'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Site'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - sites:read
    delete:
      tags:
      - Sites
      summary: Delete a site
      description: A site that still has areas, doors, access points or reader groups returns `409` with `/problems/has-dependents`, listing them.
      operationId: deleteSite
      parameters:
      - name: site_id
        in: path
        required: true
        schema:
          $ref: '#/components/schemas/SiteId'
      - $ref: '#/components/parameters/IfMatch'
      responses:
        '204':
          description: Deleted
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/Conflict'
        '412':
          $ref: '#/components/responses/PreconditionFailed'
        '428':
          $ref: '#/components/responses/PreconditionRequired'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - sites:write
    patch:
      tags:
      - Sites
      summary: Update a site
      description: 'A JSON merge patch (RFC 7396): fields in the body replace the current ones, `null` removes a field where the schema allows `null`, and objects such as `labels` are merged. Requires `If-Match` with the current `etag`.'
      operationId: updateSite
      parameters:
      - name: site_id
        in: path
        required: true
        schema:
          $ref: '#/components/schemas/SiteId'
      - $ref: '#/components/parameters/IfMatch'
      requestBody:
        content:
          application/merge-patch+json:
            schema:
              $ref: '#/components/schemas/SiteUpdate'
        required: true
      responses:
        '200':
          description: The updated site
          headers:
            ETag:
              $ref: '#/components/headers/ETag'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Site'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/Conflict'
        '412':
          $ref: '#/components/responses/PreconditionFailed'
        '422':
          $ref: '#/components/responses/UnprocessableContent'
        '428':
          $ref: '#/components/responses/PreconditionRequired'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - sites:write
  /v1/areas:
    get:
      tags:
      - Areas
      summary: List areas
      operationId: listAreas
      parameters:
      - $ref: '#/components/parameters/PageSize'
      - $ref: '#/components/parameters/PageToken'
      - $ref: '#/components/parameters/UpdatedSince'
      - name: site_id
        in: query
        description: Only areas at this site.
        required: false
        schema:
          $ref: '#/components/schemas/SiteId'
      - name: parent_id
        in: query
        description: Only the direct children of this area.
        required: false
        schema:
          $ref: '#/components/schemas/AreaId'
      - name: kind
        in: query
        description: Only areas of this kind.
        required: false
        schema:
          $ref: '#/components/schemas/AreaKind'
      responses:
        '200':
          description: A page of areas
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AreaList'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          $ref: '#/components/responses/UnprocessableContent'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - areas:read
    post:
      tags:
      - Areas
      summary: Create an area
      operationId: createArea
      parameters:
      - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AreaCreate'
        required: true
      responses:
        '201':
          description: The new area
          headers:
            ETag:
              $ref: '#/components/headers/ETag'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Area'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '409':
          $ref: '#/components/responses/Conflict'
        '422':
          $ref: '#/components/responses/UnprocessableContent'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - areas:write
  /v1/areas/{area_id}:
    get:
      tags:
      - Areas
      summary: Get an area
      operationId: getArea
      parameters:
      - name: area_id
        in: path
        required: true
        schema:
          $ref: '#/components/schemas/AreaId'
      responses:
        '200':
          description: The area
          headers:
            ETag:
              $ref: '#/components/headers/ETag'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Area'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - areas:read
    delete:
      tags:
      - Areas
      summary: Delete an area
      description: An area with child areas, or that access points lead into or out of, returns `409` with `/problems/has-dependents`.
      operationId: deleteArea
      parameters:
      - name: area_id
        in: path
        required: true
        schema:
          $ref: '#/components/schemas/AreaId'
      - $ref: '#/components/parameters/IfMatch'
      responses:
        '204':
          description: Deleted
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/Conflict'
        '412':
          $ref: '#/components/responses/PreconditionFailed'
        '428':
          $ref: '#/components/responses/PreconditionRequired'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - areas:write
    patch:
      tags:
      - Areas
      summary: Update an area
      description: 'A JSON merge patch (RFC 7396): fields in the body replace the current ones, `null` removes a field where the schema allows `null`, and objects such as `labels` are merged. Requires `If-Match` with the current `etag`.'
      operationId: updateArea
      parameters:
      - name: area_id
        in: path
        required: true
        schema:
          $ref: '#/components/schemas/AreaId'
      - $ref: '#/components/parameters/IfMatch'
      requestBody:
        content:
          application/merge-patch+json:
            schema:
              $ref: '#/components/schemas/AreaUpdate'
        required: true
      responses:
        '200':
          description: The updated area
          headers:
            ETag:
              $ref: '#/components/headers/ETag'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Area'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/Conflict'
        '412':
          $ref: '#/components/responses/PreconditionFailed'
        '422':
          $ref: '#/components/responses/UnprocessableContent'
        '428':
          $ref: '#/components/responses/PreconditionRequired'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - areas:write
  /v1/zones:
    get:
      tags:
      - Zones
      summary: List zones
      operationId: listZones
      parameters:
      - $ref: '#/components/parameters/PageSize'
      - $ref: '#/components/parameters/PageToken'
      - $ref: '#/components/parameters/UpdatedSince'
      - name: area_id
        in: query
        description: Only zones that contain this area.
        required: false
        schema:
          $ref: '#/components/schemas/AreaId'
      responses:
        '200':
          description: A page of zones
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ZoneList'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          $ref: '#/components/responses/UnprocessableContent'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - zones:read
    post:
      tags:
      - Zones
      summary: Create a zone
      operationId: createZone
      parameters:
      - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ZoneCreate'
        required: true
      responses:
        '201':
          description: The new zone
          headers:
            ETag:
              $ref: '#/components/headers/ETag'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Zone'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '409':
          $ref: '#/components/responses/Conflict'
        '422':
          $ref: '#/components/responses/UnprocessableContent'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - zones:write
  /v1/zones/{zone_id}:
    get:
      tags:
      - Zones
      summary: Get a zone
      operationId: getZone
      parameters:
      - name: zone_id
        in: path
        required: true
        schema:
          $ref: '#/components/schemas/ZoneId'
      responses:
        '200':
          description: The zone
          headers:
            ETag:
              $ref: '#/components/headers/ETag'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Zone'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - zones:read
    delete:
      tags:
      - Zones
      summary: Delete a zone
      description: A zone that access profiles name returns `409` with `/problems/has-dependents`.
      operationId: deleteZone
      parameters:
      - name: zone_id
        in: path
        required: true
        schema:
          $ref: '#/components/schemas/ZoneId'
      - $ref: '#/components/parameters/IfMatch'
      responses:
        '204':
          description: Deleted
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/Conflict'
        '412':
          $ref: '#/components/responses/PreconditionFailed'
        '428':
          $ref: '#/components/responses/PreconditionRequired'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - zones:write
    patch:
      tags:
      - Zones
      summary: Update a zone
      description: 'A JSON merge patch (RFC 7396): fields in the body replace the current ones, `null` removes a field where the schema allows `null`, and objects such as `labels` are merged. Requires `If-Match` with the current `etag`.'
      operationId: updateZone
      parameters:
      - name: zone_id
        in: path
        required: true
        schema:
          $ref: '#/components/schemas/ZoneId'
      - $ref: '#/components/parameters/IfMatch'
      requestBody:
        content:
          application/merge-patch+json:
            schema:
              $ref: '#/components/schemas/ZoneUpdate'
        required: true
      responses:
        '200':
          description: The updated zone
          headers:
            ETag:
              $ref: '#/components/headers/ETag'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Zone'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/Conflict'
        '412':
          $ref: '#/components/responses/PreconditionFailed'
        '422':
          $ref: '#/components/responses/UnprocessableContent'
        '428':
          $ref: '#/components/responses/PreconditionRequired'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - zones:write
  /v1/doors:
    get:
      tags:
      - Doors
      summary: List doors
      operationId: listDoors
      parameters:
      - $ref: '#/components/parameters/PageSize'
      - $ref: '#/components/parameters/PageToken'
      - $ref: '#/components/parameters/UpdatedSince'
      - name: site_id
        in: query
        description: Only doors at this site.
        required: false
        schema:
          $ref: '#/components/schemas/SiteId'
      responses:
        '200':
          description: A page of doors
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DoorList'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          $ref: '#/components/responses/UnprocessableContent'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - doors:read
    post:
      tags:
      - Doors
      summary: Create a door
      operationId: createDoor
      parameters:
      - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DoorCreate'
        required: true
      responses:
        '201':
          description: The new door
          headers:
            ETag:
              $ref: '#/components/headers/ETag'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Door'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '409':
          $ref: '#/components/responses/Conflict'
        '422':
          $ref: '#/components/responses/UnprocessableContent'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - doors:write
  /v1/doors/{door_id}:
    get:
      tags:
      - Doors
      summary: Get a door
      operationId: getDoor
      parameters:
      - name: door_id
        in: path
        required: true
        schema:
          $ref: '#/components/schemas/DoorId'
      responses:
        '200':
          description: The door
          headers:
            ETag:
              $ref: '#/components/headers/ETag'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Door'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - doors:read
    delete:
      tags:
      - Doors
      summary: Delete a door
      description: A door that access points control returns `409` with `/problems/has-dependents`.
      operationId: deleteDoor
      parameters:
      - name: door_id
        in: path
        required: true
        schema:
          $ref: '#/components/schemas/DoorId'
      - $ref: '#/components/parameters/IfMatch'
      responses:
        '204':
          description: Deleted
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/Conflict'
        '412':
          $ref: '#/components/responses/PreconditionFailed'
        '428':
          $ref: '#/components/responses/PreconditionRequired'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - doors:write
    patch:
      tags:
      - Doors
      summary: Update a door
      description: 'A JSON merge patch (RFC 7396): fields in the body replace the current ones, `null` removes a field where the schema allows `null`, and objects such as `labels` are merged. Requires `If-Match` with the current `etag`.'
      operationId: updateDoor
      parameters:
      - name: door_id
        in: path
        required: true
        schema:
          $ref: '#/components/schemas/DoorId'
      - $ref: '#/components/parameters/IfMatch'
      requestBody:
        content:
          application/merge-patch+json:
            schema:
              $ref: '#/components/schemas/DoorUpdate'
        required: true
      responses:
        '200':
          description: The updated door
          headers:
            ETag:
              $ref: '#/components/headers/ETag'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Door'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/Conflict'
        '412':
          $ref: '#/components/responses/PreconditionFailed'
        '422':
          $ref: '#/components/responses/UnprocessableContent'
        '428':
          $ref: '#/components/responses/PreconditionRequired'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - doors:write
  /v1/access-points:
    get:
      tags:
      - Access points
      summary: List access points
      operationId: listAccessPoints
      parameters:
      - $ref: '#/components/parameters/PageSize'
      - $ref: '#/components/parameters/PageToken'
      - $ref: '#/components/parameters/UpdatedSince'
      - name: site_id
        in: query
        description: Only access points at this site.
        required: false
        schema:
          $ref: '#/components/schemas/SiteId'
      - name: door_id
        in: query
        description: Only access points that control this door.
        required: false
        schema:
          $ref: '#/components/schemas/DoorId'
      - name: area_id
        in: query
        description: Only access points into or out of this area.
        required: false
        schema:
          $ref: '#/components/schemas/AreaId'
      responses:
        '200':
          description: A page of access points
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AccessPointList'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          $ref: '#/components/responses/UnprocessableContent'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - access-points:read
    post:
      tags:
      - Access points
      summary: Create an access point
      operationId: createAccessPoint
      parameters:
      - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AccessPointCreate'
        required: true
      responses:
        '201':
          description: The new access point
          headers:
            ETag:
              $ref: '#/components/headers/ETag'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AccessPoint'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '409':
          $ref: '#/components/responses/Conflict'
        '422':
          $ref: '#/components/responses/UnprocessableContent'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - access-points:write
  /v1/access-points/{access_point_id}:
    get:
      tags:
      - Access points
      summary: Get an access point
      operationId: getAccessPoint
      parameters:
      - name: access_point_id
        in: path
        required: true
        schema:
          $ref: '#/components/schemas/AccessPointId'
      responses:
        '200':
          description: The access point
          headers:
            ETag:
              $ref: '#/components/headers/ETag'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AccessPoint'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - access-points:read
    delete:
      tags:
      - Access points
      summary: Delete an access point
      description: Readers that serve the access point stop serving it. Access profiles that name it stop covering it.
      operationId: deleteAccessPoint
      parameters:
      - name: access_point_id
        in: path
        required: true
        schema:
          $ref: '#/components/schemas/AccessPointId'
      - $ref: '#/components/parameters/IfMatch'
      responses:
        '204':
          description: Deleted
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/Conflict'
        '412':
          $ref: '#/components/responses/PreconditionFailed'
        '428':
          $ref: '#/components/responses/PreconditionRequired'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - access-points:write
    patch:
      tags:
      - Access points
      summary: Update an access point
      description: 'A JSON merge patch (RFC 7396): fields in the body replace the current ones, `null` removes a field where the schema allows `null`, and objects such as `labels` are merged. Requires `If-Match` with the current `etag`.'
      operationId: updateAccessPoint
      parameters:
      - name: access_point_id
        in: path
        required: true
        schema:
          $ref: '#/components/schemas/AccessPointId'
      - $ref: '#/components/parameters/IfMatch'
      requestBody:
        content:
          application/merge-patch+json:
            schema:
              $ref: '#/components/schemas/AccessPointUpdate'
        required: true
      responses:
        '200':
          description: The updated access point
          headers:
            ETag:
              $ref: '#/components/headers/ETag'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AccessPoint'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/Conflict'
        '412':
          $ref: '#/components/responses/PreconditionFailed'
        '422':
          $ref: '#/components/responses/UnprocessableContent'
        '428':
          $ref: '#/components/responses/PreconditionRequired'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - access-points:write
  /v1/reader-groups:
    get:
      tags:
      - Reader groups
      summary: List reader groups
      operationId: listReaderGroups
      parameters:
      - $ref: '#/components/parameters/PageSize'
      - $ref: '#/components/parameters/PageToken'
      - $ref: '#/components/parameters/UpdatedSince'
      - name: site_id
        in: query
        description: Only groups tied to this site.
        required: false
        schema:
          $ref: '#/components/schemas/SiteId'
      responses:
        '200':
          description: A page of reader groups
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ReaderGroupList'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          $ref: '#/components/responses/UnprocessableContent'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - reader-groups:read
    post:
      tags:
      - Reader groups
      summary: Create a reader group
      operationId: createReaderGroup
      parameters:
      - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ReaderGroupCreate'
        required: true
      responses:
        '201':
          description: The new reader group
          headers:
            ETag:
              $ref: '#/components/headers/ETag'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ReaderGroup'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '409':
          $ref: '#/components/responses/Conflict'
        '422':
          $ref: '#/components/responses/UnprocessableContent'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - reader-groups:write
  /v1/reader-groups/{reader_group_id}:
    get:
      tags:
      - Reader groups
      summary: Get a reader group
      operationId: getReaderGroup
      parameters:
      - name: reader_group_id
        in: path
        required: true
        schema:
          $ref: '#/components/schemas/ReaderGroupId'
      responses:
        '200':
          description: The reader group
          headers:
            ETag:
              $ref: '#/components/headers/ETag'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ReaderGroup'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - reader-groups:read
    delete:
      tags:
      - Reader groups
      summary: Delete a reader group
      description: A group that still has readers returns `409` with `/problems/has-dependents`.
      operationId: deleteReaderGroup
      parameters:
      - name: reader_group_id
        in: path
        required: true
        schema:
          $ref: '#/components/schemas/ReaderGroupId'
      - $ref: '#/components/parameters/IfMatch'
      responses:
        '204':
          description: Deleted
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/Conflict'
        '412':
          $ref: '#/components/responses/PreconditionFailed'
        '428':
          $ref: '#/components/responses/PreconditionRequired'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - reader-groups:write
    patch:
      tags:
      - Reader groups
      summary: Update a reader group
      description: 'A JSON merge patch (RFC 7396): fields in the body replace the current ones, `null` removes a field where the schema allows `null`, and objects such as `labels` are merged. Requires `If-Match` with the current `etag`.'
      operationId: updateReaderGroup
      parameters:
      - name: reader_group_id
        in: path
        required: true
        schema:
          $ref: '#/components/schemas/ReaderGroupId'
      - $ref: '#/components/parameters/IfMatch'
      requestBody:
        content:
          application/merge-patch+json:
            schema:
              $ref: '#/components/schemas/ReaderGroupUpdate'
        required: true
      responses:
        '200':
          description: The updated reader group
          headers:
            ETag:
              $ref: '#/components/headers/ETag'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ReaderGroup'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/Conflict'
        '412':
          $ref: '#/components/responses/PreconditionFailed'
        '422':
          $ref: '#/components/responses/UnprocessableContent'
        '428':
          $ref: '#/components/responses/PreconditionRequired'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - reader-groups:write
  /v1/readers:
    get:
      tags:
      - Readers
      summary: List readers
      operationId: listReaders
      parameters:
      - $ref: '#/components/parameters/PageSize'
      - $ref: '#/components/parameters/PageToken'
      - $ref: '#/components/parameters/UpdatedSince'
      - name: reader_group_id
        in: query
        description: Only readers in this group.
        required: false
        schema:
          $ref: '#/components/schemas/ReaderGroupId'
      - name: access_point_id
        in: query
        description: Only readers that serve this access point.
        required: false
        schema:
          $ref: '#/components/schemas/AccessPointId'
      - name: status
        in: query
        description: Only readers with this status.
        required: false
        schema:
          $ref: '#/components/schemas/ReaderStatus'
      responses:
        '200':
          description: A page of readers
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ReaderList'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          $ref: '#/components/responses/UnprocessableContent'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - readers:read
    post:
      tags:
      - Readers
      summary: Create a reader
      description: The response holds a one-time `enrollment_token` for the installer or provisioning script. It is not shown again.
      operationId: createReader
      parameters:
      - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ReaderCreate'
        required: true
      responses:
        '201':
          description: The new reader
          headers:
            ETag:
              $ref: '#/components/headers/ETag'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ReaderCreated'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '409':
          $ref: '#/components/responses/Conflict'
        '422':
          $ref: '#/components/responses/UnprocessableContent'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - readers:write
  /v1/readers/{reader_id}:
    get:
      tags:
      - Readers
      summary: Get a reader
      operationId: getReader
      parameters:
      - name: reader_id
        in: path
        required: true
        schema:
          $ref: '#/components/schemas/ReaderId'
      responses:
        '200':
          description: The reader
          headers:
            ETag:
              $ref: '#/components/headers/ETag'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Reader'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - readers:read
    delete:
      tags:
      - Readers
      summary: Delete a reader
      description: Only readers in `pending_enrollment` or `retired` can be deleted; retire an enrolled reader first.
      operationId: deleteReader
      parameters:
      - name: reader_id
        in: path
        required: true
        schema:
          $ref: '#/components/schemas/ReaderId'
      - $ref: '#/components/parameters/IfMatch'
      responses:
        '204':
          description: Deleted
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/Conflict'
        '412':
          $ref: '#/components/responses/PreconditionFailed'
        '428':
          $ref: '#/components/responses/PreconditionRequired'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - readers:write
    patch:
      tags:
      - Readers
      summary: Update a reader
      description: 'A JSON merge patch (RFC 7396): fields in the body replace the current ones, `null` removes a field where the schema allows `null`, and objects such as `labels` are merged. Requires `If-Match` with the current `etag`.'
      operationId: updateReader
      parameters:
      - name: reader_id
        in: path
        required: true
        schema:
          $ref: '#/components/schemas/ReaderId'
      - $ref: '#/components/parameters/IfMatch'
      requestBody:
        content:
          application/merge-patch+json:
            schema:
              $ref: '#/components/schemas/ReaderUpdate'
        required: true
      responses:
        '200':
          description: The updated reader
          headers:
            ETag:
              $ref: '#/components/headers/ETag'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Reader'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/Conflict'
        '412':
          $ref: '#/components/responses/PreconditionFailed'
        '422':
          $ref: '#/components/responses/UnprocessableContent'
        '428':
          $ref: '#/components/responses/PreconditionRequired'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - readers:write
  /v1/readers/{reader_id}:retire:
    post:
      tags:
      - Readers
      summary: Retire a reader
      description: Revokes the reader's certificate so it can no longer check in or receive trust lists. The reader keeps its history. Retiring cannot be undone.
      operationId: retireReader
      parameters:
      - name: reader_id
        in: path
        required: true
        schema:
          $ref: '#/components/schemas/ReaderId'
      - $ref: '#/components/parameters/IfMatchOptional'
      responses:
        '200':
          description: Success
          headers:
            ETag:
              $ref: '#/components/headers/ETag'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Reader'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/Conflict'
        '412':
          $ref: '#/components/responses/PreconditionFailed'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - readers:write
  /v1/cameras:
    get:
      tags:
      - Cameras
      summary: List cameras
      operationId: listCameras
      parameters:
      - $ref: '#/components/parameters/PageSize'
      - $ref: '#/components/parameters/PageToken'
      - $ref: '#/components/parameters/UpdatedSince'
      - name: site_id
        in: query
        description: Only cameras at this site.
        required: false
        schema:
          $ref: '#/components/schemas/SiteId'
      responses:
        '200':
          description: A page of cameras
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CameraList'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          $ref: '#/components/responses/UnprocessableContent'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - cameras:read
    post:
      tags:
      - Cameras
      summary: Create a camera
      description: '`face_recognition: true` returns `422` while the organization''s `face_recognition` is off.'
      operationId: createCamera
      parameters:
      - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CameraCreate'
        required: true
      responses:
        '201':
          description: The new camera
          headers:
            ETag:
              $ref: '#/components/headers/ETag'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Camera'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '409':
          $ref: '#/components/responses/Conflict'
        '422':
          $ref: '#/components/responses/UnprocessableContent'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - cameras:write
  /v1/cameras/{camera_id}:
    get:
      tags:
      - Cameras
      summary: Get a camera
      operationId: getCamera
      parameters:
      - name: camera_id
        in: path
        required: true
        schema:
          $ref: '#/components/schemas/CameraId'
      responses:
        '200':
          description: The camera
          headers:
            ETag:
              $ref: '#/components/headers/ETag'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Camera'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - cameras:read
    delete:
      tags:
      - Cameras
      summary: Delete a camera
      description: Its reports so far stay in the event log.
      operationId: deleteCamera
      parameters:
      - name: camera_id
        in: path
        required: true
        schema:
          $ref: '#/components/schemas/CameraId'
      - $ref: '#/components/parameters/IfMatch'
      responses:
        '204':
          description: Deleted
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/Conflict'
        '412':
          $ref: '#/components/responses/PreconditionFailed'
        '428':
          $ref: '#/components/responses/PreconditionRequired'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - cameras:write
    patch:
      tags:
      - Cameras
      summary: Update a camera
      description: 'A JSON merge patch (RFC 7396): fields in the body replace the current ones, `null` removes a field where the schema allows `null`, and objects such as `labels` are merged. Requires `If-Match` with the current `etag`.'
      operationId: updateCamera
      parameters:
      - name: camera_id
        in: path
        required: true
        schema:
          $ref: '#/components/schemas/CameraId'
      - $ref: '#/components/parameters/IfMatch'
      requestBody:
        content:
          application/merge-patch+json:
            schema:
              $ref: '#/components/schemas/CameraUpdate'
        required: true
      responses:
        '200':
          description: The updated camera
          headers:
            ETag:
              $ref: '#/components/headers/ETag'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Camera'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/Conflict'
        '412':
          $ref: '#/components/responses/PreconditionFailed'
        '422':
          $ref: '#/components/responses/UnprocessableContent'
        '428':
          $ref: '#/components/responses/PreconditionRequired'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - cameras:write
  /v1/cameras/{camera_id}:observe:
    post:
      tags:
      - Cameras
      summary: Report what a camera saw
      description: 'People counted and faces recognized at the camera''s access points, at most 1,000 at a time. Each is matched with the grants there within 10 seconds of it: more people than grants raises `com.passway.access.tailgating`; a face raises `com.passway.access.face_recognized`, with `matches_badge` saying whether that person''s credential opened the door. Report about 30 seconds after the fact, so the readers'' taps are in. A face is refused (`409`) unless the organization and the camera have `face_recognition` on; so is a disabled camera, an access point the camera doesn''t watch, and anything from outside the last day.'
      operationId: observeCamera
      parameters:
      - name: camera_id
        in: path
        required: true
        schema:
          $ref: '#/components/schemas/CameraId'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CameraObservations'
        required: true
      responses:
        '200':
          description: Success
          headers:
            ETag:
              $ref: '#/components/headers/ETag'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ObservationResult'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/Conflict'
        '422':
          $ref: '#/components/responses/UnprocessableContent'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - cameras:write
  /v1/musters:
    get:
      tags:
      - Musters
      summary: List musters
      operationId: listMusters
      parameters:
      - $ref: '#/components/parameters/PageSize'
      - $ref: '#/components/parameters/PageToken'
      - $ref: '#/components/parameters/UpdatedSince'
      - name: site_id
        in: query
        description: Only musters at this site.
        required: false
        schema:
          $ref: '#/components/schemas/SiteId'
      - name: status
        in: query
        description: Only musters in this state.
        required: false
        schema:
          $ref: '#/components/schemas/MusterStatus'
      responses:
        '200':
          description: A page of musters
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MusterList'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          $ref: '#/components/responses/UnprocessableContent'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - musters:read
    post:
      tags:
      - Musters
      summary: Create a muster
      description: A site with a muster going returns `409`.
      operationId: createMuster
      parameters:
      - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/MusterCreate'
        required: true
      responses:
        '201':
          description: The new muster
          headers:
            ETag:
              $ref: '#/components/headers/ETag'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Muster'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '409':
          $ref: '#/components/responses/Conflict'
        '422':
          $ref: '#/components/responses/UnprocessableContent'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - musters:write
  /v1/musters/{muster_id}:
    get:
      tags:
      - Musters
      summary: Get a muster
      operationId: getMuster
      parameters:
      - name: muster_id
        in: path
        required: true
        schema:
          $ref: '#/components/schemas/MusterId'
      responses:
        '200':
          description: The muster
          headers:
            ETag:
              $ref: '#/components/headers/ETag'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Muster'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - musters:read
    delete:
      tags:
      - Musters
      summary: Delete a muster
      description: Its events stay in the log.
      operationId: deleteMuster
      parameters:
      - name: muster_id
        in: path
        required: true
        schema:
          $ref: '#/components/schemas/MusterId'
      - $ref: '#/components/parameters/IfMatch'
      responses:
        '204':
          description: Deleted
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/Conflict'
        '412':
          $ref: '#/components/responses/PreconditionFailed'
        '428':
          $ref: '#/components/responses/PreconditionRequired'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - musters:write
    patch:
      tags:
      - Musters
      summary: Update a muster
      description: 'A JSON merge patch (RFC 7396): fields in the body replace the current ones, `null` removes a field where the schema allows `null`, and objects such as `labels` are merged. Requires `If-Match` with the current `etag`.'
      operationId: updateMuster
      parameters:
      - name: muster_id
        in: path
        required: true
        schema:
          $ref: '#/components/schemas/MusterId'
      - $ref: '#/components/parameters/IfMatch'
      requestBody:
        content:
          application/merge-patch+json:
            schema:
              $ref: '#/components/schemas/MusterUpdate'
        required: true
      responses:
        '200':
          description: The updated muster
          headers:
            ETag:
              $ref: '#/components/headers/ETag'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Muster'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/Conflict'
        '412':
          $ref: '#/components/responses/PreconditionFailed'
        '422':
          $ref: '#/components/responses/UnprocessableContent'
        '428':
          $ref: '#/components/responses/PreconditionRequired'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - musters:write
  /v1/musters/{muster_id}:account:
    post:
      tags:
      - Musters
      summary: Mark someone safe
      description: A warden counts someone off by hand, such as a person seen at the assembly point without their phone. Raises `com.passway.muster.accounted`. An ended muster returns `409`.
      operationId: accountMusterPerson
      parameters:
      - name: muster_id
        in: path
        required: true
        schema:
          $ref: '#/components/schemas/MusterId'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/MusterAccount'
        required: true
      responses:
        '200':
          description: Success
          headers:
            ETag:
              $ref: '#/components/headers/ETag'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Muster'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/Conflict'
        '422':
          $ref: '#/components/responses/UnprocessableContent'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - musters:write
  /v1/musters/{muster_id}:end:
    post:
      tags:
      - Musters
      summary: End a muster
      description: Stops counting and keeps the roll as it stands. Raises `com.passway.muster.ended` with the counts. An ended muster returns `409`.
      operationId: endMuster
      parameters:
      - name: muster_id
        in: path
        required: true
        schema:
          $ref: '#/components/schemas/MusterId'
      responses:
        '200':
          description: Success
          headers:
            ETag:
              $ref: '#/components/headers/ETag'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Muster'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/Conflict'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - musters:write
  /v1/schedules:
    get:
      tags:
      - Schedules
      summary: List schedules
      operationId: listSchedules
      parameters:
      - $ref: '#/components/parameters/PageSize'
      - $ref: '#/components/parameters/PageToken'
      - $ref: '#/components/parameters/UpdatedSince'
      responses:
        '200':
          description: A page of schedules
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ScheduleList'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          $ref: '#/components/responses/UnprocessableContent'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - schedules:read
    post:
      tags:
      - Schedules
      summary: Create a schedule
      operationId: createSchedule
      parameters:
      - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ScheduleCreate'
        required: true
      responses:
        '201':
          description: The new schedule
          headers:
            ETag:
              $ref: '#/components/headers/ETag'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Schedule'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '409':
          $ref: '#/components/responses/Conflict'
        '422':
          $ref: '#/components/responses/UnprocessableContent'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - schedules:write
  /v1/schedules/{schedule_id}:
    get:
      tags:
      - Schedules
      summary: Get a schedule
      operationId: getSchedule
      parameters:
      - name: schedule_id
        in: path
        required: true
        schema:
          $ref: '#/components/schemas/ScheduleId'
      responses:
        '200':
          description: The schedule
          headers:
            ETag:
              $ref: '#/components/headers/ETag'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Schedule'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - schedules:read
    delete:
      tags:
      - Schedules
      summary: Delete a schedule
      description: A schedule that access policies use returns `409` with `/problems/has-dependents`.
      operationId: deleteSchedule
      parameters:
      - name: schedule_id
        in: path
        required: true
        schema:
          $ref: '#/components/schemas/ScheduleId'
      - $ref: '#/components/parameters/IfMatch'
      responses:
        '204':
          description: Deleted
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/Conflict'
        '412':
          $ref: '#/components/responses/PreconditionFailed'
        '428':
          $ref: '#/components/responses/PreconditionRequired'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - schedules:write
    patch:
      tags:
      - Schedules
      summary: Update a schedule
      description: 'A JSON merge patch (RFC 7396): fields in the body replace the current ones, `null` removes a field where the schema allows `null`, and objects such as `labels` are merged. Requires `If-Match` with the current `etag`.'
      operationId: updateSchedule
      parameters:
      - name: schedule_id
        in: path
        required: true
        schema:
          $ref: '#/components/schemas/ScheduleId'
      - $ref: '#/components/parameters/IfMatch'
      requestBody:
        content:
          application/merge-patch+json:
            schema:
              $ref: '#/components/schemas/ScheduleUpdate'
        required: true
      responses:
        '200':
          description: The updated schedule
          headers:
            ETag:
              $ref: '#/components/headers/ETag'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Schedule'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/Conflict'
        '412':
          $ref: '#/components/responses/PreconditionFailed'
        '422':
          $ref: '#/components/responses/UnprocessableContent'
        '428':
          $ref: '#/components/responses/PreconditionRequired'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - schedules:write
  /v1/access-profiles:
    get:
      tags:
      - Access profiles
      summary: List access profiles
      operationId: listAccessProfiles
      parameters:
      - $ref: '#/components/parameters/PageSize'
      - $ref: '#/components/parameters/PageToken'
      - $ref: '#/components/parameters/UpdatedSince'
      - name: access_point_id
        in: query
        description: Only profiles with a policy that names this access point.
        required: false
        schema:
          $ref: '#/components/schemas/AccessPointId'
      - name: area_id
        in: query
        description: Only profiles with a policy that names this area.
        required: false
        schema:
          $ref: '#/components/schemas/AreaId'
      - name: zone_id
        in: query
        description: Only profiles with a policy that names this zone.
        required: false
        schema:
          $ref: '#/components/schemas/ZoneId'
      - name: site_id
        in: query
        description: Only profiles with a policy that names this site.
        required: false
        schema:
          $ref: '#/components/schemas/SiteId'
      - name: schedule_id
        in: query
        description: Only profiles with a policy that uses this schedule.
        required: false
        schema:
          $ref: '#/components/schemas/ScheduleId'
      responses:
        '200':
          description: A page of access profiles
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AccessProfileList'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          $ref: '#/components/responses/UnprocessableContent'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - access-profiles:read
    post:
      tags:
      - Access profiles
      summary: Create an access profile
      operationId: createAccessProfile
      parameters:
      - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AccessProfileCreate'
        required: true
      responses:
        '201':
          description: The new access profile
          headers:
            ETag:
              $ref: '#/components/headers/ETag'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AccessProfile'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '409':
          $ref: '#/components/responses/Conflict'
        '422':
          $ref: '#/components/responses/UnprocessableContent'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - access-profiles:write
  /v1/access-profiles/{access_profile_id}:
    get:
      tags:
      - Access profiles
      summary: Get an access profile
      operationId: getAccessProfile
      parameters:
      - name: access_profile_id
        in: path
        required: true
        schema:
          $ref: '#/components/schemas/AccessProfileId'
      responses:
        '200':
          description: The access profile
          headers:
            ETag:
              $ref: '#/components/headers/ETag'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AccessProfile'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - access-profiles:read
    delete:
      tags:
      - Access profiles
      summary: Delete an access profile
      description: An access profile that assignments use returns `409` with `/problems/has-dependents`.
      operationId: deleteAccessProfile
      parameters:
      - name: access_profile_id
        in: path
        required: true
        schema:
          $ref: '#/components/schemas/AccessProfileId'
      - $ref: '#/components/parameters/IfMatch'
      responses:
        '204':
          description: Deleted
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/Conflict'
        '412':
          $ref: '#/components/responses/PreconditionFailed'
        '428':
          $ref: '#/components/responses/PreconditionRequired'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - access-profiles:write
    patch:
      tags:
      - Access profiles
      summary: Update an access profile
      description: 'A JSON merge patch (RFC 7396): fields in the body replace the current ones, `null` removes a field where the schema allows `null`, and objects such as `labels` are merged. Requires `If-Match` with the current `etag`.'
      operationId: updateAccessProfile
      parameters:
      - name: access_profile_id
        in: path
        required: true
        schema:
          $ref: '#/components/schemas/AccessProfileId'
      - $ref: '#/components/parameters/IfMatch'
      requestBody:
        content:
          application/merge-patch+json:
            schema:
              $ref: '#/components/schemas/AccessProfileUpdate'
        required: true
      responses:
        '200':
          description: The updated access profile
          headers:
            ETag:
              $ref: '#/components/headers/ETag'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AccessProfile'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/Conflict'
        '412':
          $ref: '#/components/responses/PreconditionFailed'
        '422':
          $ref: '#/components/responses/UnprocessableContent'
        '428':
          $ref: '#/components/responses/PreconditionRequired'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - access-profiles:write
  /v1/access-profiles:dry-run:
    post:
      tags:
      - Access profiles
      summary: Try access policies against real passages
      description: 'Before giving people new access, see how it would have decided the passages they actually made: in place of an existing profile''s policies (`replaces`, for everyone it is assigned to), or as a new profile for `person_ids` and `group_ids`. Each of their grants and policy denials in the window (the last 7 days by default, at most 31; the most recent 2,000) is judged by today''s policies and by the proposal, as readers judge them: the places that cover the reader''s access points, schedules in the site''s time zone or their own, and the people''s, assignments'' and memberships'' dates. The answer lists what would change: passages newly allowed and newly refused, and who gains and who loses. Nothing is saved.'
      operationId: dryRunAccessProfile
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AccessProfileDryRun'
        required: true
      responses:
        '200':
          description: Success
          headers:
            ETag:
              $ref: '#/components/headers/ETag'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AccessDryRun'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          $ref: '#/components/responses/UnprocessableContent'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - access-profiles:write
  /v1/access-assignments:
    get:
      tags:
      - Access assignments
      summary: List access assignments
      operationId: listAccessAssignments
      parameters:
      - $ref: '#/components/parameters/PageSize'
      - $ref: '#/components/parameters/PageToken'
      - $ref: '#/components/parameters/UpdatedSince'
      - name: access_profile_id
        in: query
        description: Only assignments of this profile.
        required: false
        schema:
          $ref: '#/components/schemas/AccessProfileId'
      - name: group_id
        in: query
        description: Only assignments that name this group.
        required: false
        schema:
          $ref: '#/components/schemas/GroupId'
      - name: person_id
        in: query
        description: Only assignments that name this person directly.
        required: false
        schema:
          $ref: '#/components/schemas/PersonId'
      responses:
        '200':
          description: A page of access assignments
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AccessAssignmentList'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          $ref: '#/components/responses/UnprocessableContent'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - access-assignments:read
    post:
      tags:
      - Access assignments
      summary: Create an access assignment
      operationId: createAccessAssignment
      parameters:
      - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AccessAssignmentCreate'
        required: true
      responses:
        '201':
          description: The new access assignment
          headers:
            ETag:
              $ref: '#/components/headers/ETag'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AccessAssignment'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '409':
          $ref: '#/components/responses/Conflict'
        '422':
          $ref: '#/components/responses/UnprocessableContent'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - access-assignments:write
  /v1/access-assignments/{access_assignment_id}:
    get:
      tags:
      - Access assignments
      summary: Get an access assignment
      operationId: getAccessAssignment
      parameters:
      - name: access_assignment_id
        in: path
        required: true
        schema:
          $ref: '#/components/schemas/AccessAssignmentId'
      responses:
        '200':
          description: The access assignment
          headers:
            ETag:
              $ref: '#/components/headers/ETag'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AccessAssignment'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - access-assignments:read
    delete:
      tags:
      - Access assignments
      summary: Delete an access assignment
      description: Access given only by this assignment is removed from every affected credential.
      operationId: deleteAccessAssignment
      parameters:
      - name: access_assignment_id
        in: path
        required: true
        schema:
          $ref: '#/components/schemas/AccessAssignmentId'
      - $ref: '#/components/parameters/IfMatch'
      responses:
        '204':
          description: Deleted
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/Conflict'
        '412':
          $ref: '#/components/responses/PreconditionFailed'
        '428':
          $ref: '#/components/responses/PreconditionRequired'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - access-assignments:write
    patch:
      tags:
      - Access assignments
      summary: Update an access assignment
      description: 'A JSON merge patch (RFC 7396): fields in the body replace the current ones, `null` removes a field where the schema allows `null`, and objects such as `labels` are merged. Requires `If-Match` with the current `etag`.'
      operationId: updateAccessAssignment
      parameters:
      - name: access_assignment_id
        in: path
        required: true
        schema:
          $ref: '#/components/schemas/AccessAssignmentId'
      - $ref: '#/components/parameters/IfMatch'
      requestBody:
        content:
          application/merge-patch+json:
            schema:
              $ref: '#/components/schemas/AccessAssignmentUpdate'
        required: true
      responses:
        '200':
          description: The updated access assignment
          headers:
            ETag:
              $ref: '#/components/headers/ETag'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AccessAssignment'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/Conflict'
        '412':
          $ref: '#/components/responses/PreconditionFailed'
        '422':
          $ref: '#/components/responses/UnprocessableContent'
        '428':
          $ref: '#/components/responses/PreconditionRequired'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - access-assignments:write
  /v1/people:
    get:
      tags:
      - People
      summary: List people
      operationId: listPeople
      parameters:
      - $ref: '#/components/parameters/PageSize'
      - $ref: '#/components/parameters/PageToken'
      - $ref: '#/components/parameters/UpdatedSince'
      - name: active
        in: query
        description: Only active, or only inactive, people.
        required: false
        schema:
          type: boolean
      - name: user_type
        in: query
        description: Only people with this user type.
        required: false
        schema:
          type: string
      - name: email
        in: query
        description: Only the person with this email (exact match, case-insensitive).
        required: false
        schema:
          type: string
      - name: external_id
        in: query
        description: Only the person with this external ID.
        required: false
        schema:
          type: string
      - name: group_id
        in: query
        description: Only members of this group.
        required: false
        schema:
          $ref: '#/components/schemas/GroupId'
      responses:
        '200':
          description: A page of people
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PersonList'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          $ref: '#/components/responses/UnprocessableContent'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - people:read
    post:
      tags:
      - People
      summary: Create a person
      description: For people no other system knows about, such as visitors. The person's source is `manual`.
      operationId: createPerson
      parameters:
      - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PersonCreate'
        required: true
      responses:
        '201':
          description: The new person
          headers:
            ETag:
              $ref: '#/components/headers/ETag'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Person'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '409':
          $ref: '#/components/responses/Conflict'
        '422':
          $ref: '#/components/responses/UnprocessableContent'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - people:write
  /v1/people/{person_id}:
    get:
      tags:
      - People
      summary: Get a person
      operationId: getPerson
      parameters:
      - name: person_id
        in: path
        required: true
        schema:
          $ref: '#/components/schemas/PersonId'
      responses:
        '200':
          description: The person
          headers:
            ETag:
              $ref: '#/components/headers/ETag'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Person'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - people:read
    delete:
      tags:
      - People
      summary: Delete a person
      description: Revokes every credential the person holds. People from SCIM or a connector return `409` with `/problems/wrong-writer`; remove them at the source.
      operationId: deletePerson
      parameters:
      - name: person_id
        in: path
        required: true
        schema:
          $ref: '#/components/schemas/PersonId'
      - $ref: '#/components/parameters/IfMatch'
      responses:
        '204':
          description: Deleted
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/Conflict'
        '412':
          $ref: '#/components/responses/PreconditionFailed'
        '428':
          $ref: '#/components/responses/PreconditionRequired'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - people:write
    patch:
      tags:
      - People
      summary: Update a person
      description: 'A JSON merge patch (RFC 7396): fields in the body replace the current ones, `null` removes a field where the schema allows `null`, and objects such as `labels` are merged. Requires `If-Match` with the current `etag`.'
      operationId: updatePerson
      parameters:
      - name: person_id
        in: path
        required: true
        schema:
          $ref: '#/components/schemas/PersonId'
      - $ref: '#/components/parameters/IfMatch'
      requestBody:
        content:
          application/merge-patch+json:
            schema:
              $ref: '#/components/schemas/PersonUpdate'
        required: true
      responses:
        '200':
          description: The updated person
          headers:
            ETag:
              $ref: '#/components/headers/ETag'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Person'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/Conflict'
        '412':
          $ref: '#/components/responses/PreconditionFailed'
        '422':
          $ref: '#/components/responses/UnprocessableContent'
        '428':
          $ref: '#/components/responses/PreconditionRequired'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - people:write
  /v1/people/statistics:
    get:
      tags:
      - People
      summary: Get people statistics
      description: Exact counts of all people and enabled people.
      operationId: getPeopleStatistics
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PeopleStatistics'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - people:read
  /v1/people/{person_id}:relink:
    post:
      tags:
      - People
      summary: Confirm a person whose Passway ID was recovered
      description: 'Passway ID stamps an ID''s last recovery on its ID tokens (`passway_recovered_at`), and a sign-in through an identity provider whose ID was recovered since the person last proved themselves here is refused (`com.passway.session.refused`, reason `passway_id_recovered`): whoever recovered it proved an email address, not that they are the person. Phones issued through the provider are suspended at their next check. Call this once you have confirmed the person another way, such as in person or on a call: their next sign-in goes through. Signing in with one of the organization''s passkeys does the same. `GET /v1/attention` lists the people waiting (`recovered_ids`). Raises `com.passway.person.relinked`. An inactive person is refused (`409`).'
      operationId: relinkPerson
      parameters:
      - name: person_id
        in: path
        required: true
        schema:
          $ref: '#/components/schemas/PersonId'
      responses:
        '200':
          description: Success
          headers:
            ETag:
              $ref: '#/components/headers/ETag'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Person'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/Conflict'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - people:write
  /v1/people/{person_id}/enrollments:
    post:
      tags:
      - People
      summary: Start an enrolment
      description: Returns a link the person opens on their phone to add a credential to their wallet. The phone generates the key. Device management tools call this to deliver the link with the managed app.
      operationId: createPersonEnrollment
      parameters:
      - name: person_id
        in: path
        required: true
        schema:
          $ref: '#/components/schemas/PersonId'
      - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/EnrollmentCreate'
        required: false
      responses:
        '201':
          description: Success
          headers:
            ETag:
              $ref: '#/components/headers/ETag'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Enrollment'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/Conflict'
        '422':
          $ref: '#/components/responses/UnprocessableContent'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - people:write
  /v1/people/{person_id}/passkey-invitations:
    post:
      tags:
      - People
      summary: Invite a person to make a passkey
      description: 'Returns a link to give the person. It works once, on the organization''s own host: the passkey it makes uses it up. People sign in to Passway with passkeys; there are no passwords and no recovery by email, so someone who loses theirs gets a new invitation.'
      operationId: createPasskeyInvitation
      parameters:
      - name: person_id
        in: path
        required: true
        schema:
          $ref: '#/components/schemas/PersonId'
      - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PasskeyInvitationCreate'
        required: false
      responses:
        '201':
          description: Success
          headers:
            ETag:
              $ref: '#/components/headers/ETag'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PasskeyInvitation'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/Conflict'
        '422':
          $ref: '#/components/responses/UnprocessableContent'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - people:write
  /v1/people/{person_id}/passkeys:
    get:
      tags:
      - People
      summary: List a person's passkeys
      description: Only what identifies each passkey and when it was used; the public keys stay sealed.
      operationId: listPasskeys
      parameters:
      - name: person_id
        in: path
        required: true
        schema:
          $ref: '#/components/schemas/PersonId'
      - $ref: '#/components/parameters/PageSize'
      - $ref: '#/components/parameters/PageToken'
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PasskeyList'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - people:read
  /v1/people/{person_id}/passkeys/{passkey_id}:
    get:
      tags:
      - People
      summary: Get a passkey
      operationId: getPasskey
      parameters:
      - name: person_id
        in: path
        required: true
        schema:
          $ref: '#/components/schemas/PersonId'
      - name: passkey_id
        in: path
        required: true
        schema:
          $ref: '#/components/schemas/PasskeyId'
      responses:
        '200':
          description: Success
          headers:
            ETag:
              $ref: '#/components/headers/ETag'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Passkey'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - people:read
    delete:
      tags:
      - People
      summary: Remove a passkey
      description: Sessions started with it end at once, and it signs in no more.
      operationId: deletePasskey
      parameters:
      - name: person_id
        in: path
        required: true
        schema:
          $ref: '#/components/schemas/PersonId'
      - name: passkey_id
        in: path
        required: true
        schema:
          $ref: '#/components/schemas/PasskeyId'
      - $ref: '#/components/parameters/IfMatch'
      responses:
        '204':
          description: Success
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '412':
          $ref: '#/components/responses/PreconditionFailed'
        '428':
          $ref: '#/components/responses/PreconditionRequired'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - people:write
  /v1/people/{person_id}/permissions:
    get:
      tags:
      - People
      summary: What someone may do on /v1, and why
      description: Each scope the person holds now, with every role and group it comes from. Empty for someone inactive or in no group with a role.
      operationId: getPersonPermissions
      parameters:
      - name: person_id
        in: path
        required: true
        schema:
          $ref: '#/components/schemas/PersonId'
      responses:
        '200':
          description: Success
          headers:
            ETag:
              $ref: '#/components/headers/ETag'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Permissions'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - people:read
  /v1/groups:
    get:
      tags:
      - Groups
      summary: List groups
      operationId: listGroups
      parameters:
      - $ref: '#/components/parameters/PageSize'
      - $ref: '#/components/parameters/PageToken'
      - $ref: '#/components/parameters/UpdatedSince'
      - name: name
        in: query
        description: Only the group with this exact name. This is how Terraform looks up a synced group.
        required: false
        schema:
          type: string
      - name: source
        in: query
        description: Only groups from this source.
        required: false
        schema:
          $ref: '#/components/schemas/SourceKind'
      - name: person_id
        in: query
        description: Only groups this person belongs to.
        required: false
        schema:
          $ref: '#/components/schemas/PersonId'
      responses:
        '200':
          description: A page of groups
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GroupList'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          $ref: '#/components/responses/UnprocessableContent'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - groups:read
    post:
      tags:
      - Groups
      summary: Create a group
      description: Creates a manual group. With a `membership_rule`, everyone active whose details match joins at once, and people come and go as their details change. Setting or changing the rule of a group that has a role needs the role's scopes.
      operationId: createGroup
      parameters:
      - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GroupCreate'
        required: true
      responses:
        '201':
          description: The new group
          headers:
            ETag:
              $ref: '#/components/headers/ETag'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Group'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '409':
          $ref: '#/components/responses/Conflict'
        '422':
          $ref: '#/components/responses/UnprocessableContent'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - groups:write
  /v1/groups/{group_id}:
    get:
      tags:
      - Groups
      summary: Get a group
      operationId: getGroup
      parameters:
      - name: group_id
        in: path
        required: true
        schema:
          $ref: '#/components/schemas/GroupId'
      responses:
        '200':
          description: The group
          headers:
            ETag:
              $ref: '#/components/headers/ETag'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Group'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - groups:read
    delete:
      tags:
      - Groups
      summary: Delete a group
      description: Only manual groups can be deleted. Groups that access or role assignments name, or that another group names as its approvers, return `409` with `/problems/has-dependents`, and so does the break-glass group. Deleting a group that has a role needs that role's scopes. Requests to join it go with it.
      operationId: deleteGroup
      parameters:
      - name: group_id
        in: path
        required: true
        schema:
          $ref: '#/components/schemas/GroupId'
      - $ref: '#/components/parameters/IfMatch'
      responses:
        '204':
          description: Deleted
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/Conflict'
        '412':
          $ref: '#/components/responses/PreconditionFailed'
        '428':
          $ref: '#/components/responses/PreconditionRequired'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - groups:write
    patch:
      tags:
      - Groups
      summary: Update a group
      description: 'A JSON merge patch (RFC 7396): fields in the body replace the current ones, `null` removes a field where the schema allows `null`, and objects such as `labels` are merged. Requires `If-Match` with the current `etag`.'
      operationId: updateGroup
      parameters:
      - name: group_id
        in: path
        required: true
        schema:
          $ref: '#/components/schemas/GroupId'
      - $ref: '#/components/parameters/IfMatch'
      requestBody:
        content:
          application/merge-patch+json:
            schema:
              $ref: '#/components/schemas/GroupUpdate'
        required: true
      responses:
        '200':
          description: The updated group
          headers:
            ETag:
              $ref: '#/components/headers/ETag'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Group'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/Conflict'
        '412':
          $ref: '#/components/responses/PreconditionFailed'
        '422':
          $ref: '#/components/responses/UnprocessableContent'
        '428':
          $ref: '#/components/responses/PreconditionRequired'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - groups:write
  /v1/groups/{group_id}/members:
    get:
      tags:
      - Groups
      summary: List a group's members
      operationId: listGroupMembers
      parameters:
      - name: group_id
        in: path
        required: true
        schema:
          $ref: '#/components/schemas/GroupId'
      - $ref: '#/components/parameters/PageSize'
      - $ref: '#/components/parameters/PageToken'
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GroupMemberList'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - groups:read
    post:
      tags:
      - Groups
      summary: Add a member to a manual group
      description: Returns `201` for a new member. Adding an existing member sets `valid_to` to the one sent and returns `200`; someone the group's rule already matches stays while either holds. Synced groups return `409` with `/problems/wrong-writer`, and so do groups whose `manual_members` is `approval` (ask at `/v1/membership-requests`) or `never`. With `max_manual_days`, `valid_to` is needed and must be within it (`409`). A group that has a role needs the role's scopes (`403`); the break-glass group takes only manual people, without `valid_to` (`409`).
      operationId: addGroupMember
      parameters:
      - name: group_id
        in: path
        required: true
        schema:
          $ref: '#/components/schemas/GroupId'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GroupMemberCreate'
        required: true
      responses:
        '200':
          description: 'Already a member: `valid_to` is now the one sent'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GroupMember'
        '201':
          description: Success
          headers:
            ETag:
              $ref: '#/components/headers/ETag'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GroupMember'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/Conflict'
        '422':
          $ref: '#/components/responses/UnprocessableContent'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - groups:write
  /v1/groups/{group_id}/members/{person_id}:
    delete:
      tags:
      - Groups
      summary: Remove a member from a manual group
      description: Takes away an addition by hand. Removing someone who is not a member returns `404`; someone only the group's rule matches returns `409` (change the rule or their details), and someone it also matches stays a member. A group that has a role needs the role's scopes (`403`). The break-glass group's last member can't be removed (`409`).
      operationId: removeGroupMember
      parameters:
      - name: group_id
        in: path
        required: true
        schema:
          $ref: '#/components/schemas/GroupId'
      - name: person_id
        in: path
        required: true
        schema:
          $ref: '#/components/schemas/PersonId'
      responses:
        '204':
          description: Success
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/Conflict'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - groups:write
  /v1/membership-requests:
    get:
      tags:
      - Membership requests
      summary: List membership requests
      operationId: listMembershipRequests
      parameters:
      - $ref: '#/components/parameters/PageSize'
      - $ref: '#/components/parameters/PageToken'
      - $ref: '#/components/parameters/UpdatedSince'
      - name: group_id
        in: query
        description: Only requests to join this group.
        required: false
        schema:
          $ref: '#/components/schemas/GroupId'
      - name: person_id
        in: query
        description: Only requests for this person.
        required: false
        schema:
          $ref: '#/components/schemas/PersonId'
      - name: status
        in: query
        description: Only requests that stand here.
        required: false
        schema:
          $ref: '#/components/schemas/MembershipRequestStatus'
      responses:
        '200':
          description: A page of membership requests
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MembershipRequestList'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          $ref: '#/components/responses/UnprocessableContent'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - membership-requests:read
    post:
      tags:
      - Membership requests
      summary: Create a membership request
      description: The group must take members by approval (`409` otherwise), and `valid_to` must be within its `max_manual_days`.
      operationId: createMembershipRequest
      parameters:
      - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/MembershipRequestCreate'
        required: true
      responses:
        '201':
          description: The new membership request
          headers:
            ETag:
              $ref: '#/components/headers/ETag'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MembershipRequest'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '409':
          $ref: '#/components/responses/Conflict'
        '422':
          $ref: '#/components/responses/UnprocessableContent'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - membership-requests:write
  /v1/membership-requests/{membership_request_id}:
    get:
      tags:
      - Membership requests
      summary: Get a membership request
      operationId: getMembershipRequest
      parameters:
      - name: membership_request_id
        in: path
        required: true
        schema:
          $ref: '#/components/schemas/MembershipRequestId'
      responses:
        '200':
          description: The membership request
          headers:
            ETag:
              $ref: '#/components/headers/ETag'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MembershipRequest'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - membership-requests:read
  /v1/membership-requests/{membership_request_id}:approve:
    post:
      tags:
      - Membership requests
      summary: Approve a request to join a group
      description: Adds the person, until the request's `valid_to`. Whoever asked, and the person joining, can't approve it (`403`); with the group's `approver_group_id`, only its members can. A group that has a role needs the role's scopes (`403`). A request already decided, or expired, returns `409`.
      operationId: approveMembershipRequest
      parameters:
      - name: membership_request_id
        in: path
        required: true
        schema:
          $ref: '#/components/schemas/MembershipRequestId'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/MembershipRequestDecision'
        required: false
      responses:
        '200':
          description: Success
          headers:
            ETag:
              $ref: '#/components/headers/ETag'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MembershipRequest'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/Conflict'
        '422':
          $ref: '#/components/responses/UnprocessableContent'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - membership-requests:write
  /v1/membership-requests/{membership_request_id}:deny:
    post:
      tags:
      - Membership requests
      summary: Deny a request to join a group
      description: Whoever asked may deny their own request, to withdraw it. A request already decided, or expired, returns `409`.
      operationId: denyMembershipRequest
      parameters:
      - name: membership_request_id
        in: path
        required: true
        schema:
          $ref: '#/components/schemas/MembershipRequestId'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/MembershipRequestDecision'
        required: false
      responses:
        '200':
          description: Success
          headers:
            ETag:
              $ref: '#/components/headers/ETag'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MembershipRequest'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/Conflict'
        '422':
          $ref: '#/components/responses/UnprocessableContent'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - membership-requests:write
  /v1/role-assignments:
    get:
      tags:
      - Roles
      summary: List roles
      operationId: listRoleAssignments
      parameters:
      - $ref: '#/components/parameters/PageSize'
      - $ref: '#/components/parameters/PageToken'
      - $ref: '#/components/parameters/UpdatedSince'
      - name: group_id
        in: query
        description: Only assignments to this group.
        required: false
        schema:
          $ref: '#/components/schemas/GroupId'
      - name: role_id
        in: query
        description: Only assignments of this role.
        required: false
        schema:
          $ref: '#/components/schemas/RoleId'
      responses:
        '200':
          description: A page of roles
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RoleAssignmentList'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          $ref: '#/components/responses/UnprocessableContent'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - role-assignments:read
    post:
      tags:
      - Roles
      summary: Create a role assignment
      description: The caller must already hold every scope the role gives, or it's refused with `403`. A group has each role at most once (`409`).
      operationId: createRoleAssignment
      parameters:
      - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RoleAssignmentCreate'
        required: true
      responses:
        '201':
          description: The new role assignment
          headers:
            ETag:
              $ref: '#/components/headers/ETag'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RoleAssignment'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '409':
          $ref: '#/components/responses/Conflict'
        '422':
          $ref: '#/components/responses/UnprocessableContent'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - role-assignments:write
  /v1/role-assignments/{role_assignment_id}:
    get:
      tags:
      - Roles
      summary: Get a role assignment
      operationId: getRoleAssignment
      parameters:
      - name: role_assignment_id
        in: path
        required: true
        schema:
          $ref: '#/components/schemas/RoleAssignmentId'
      responses:
        '200':
          description: The role assignment
          headers:
            ETag:
              $ref: '#/components/headers/ETag'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RoleAssignment'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - role-assignments:read
    delete:
      tags:
      - Roles
      summary: Delete a role assignment
      description: The caller must hold every scope the role gives.
      operationId: deleteRoleAssignment
      parameters:
      - name: role_assignment_id
        in: path
        required: true
        schema:
          $ref: '#/components/schemas/RoleAssignmentId'
      - $ref: '#/components/parameters/IfMatch'
      responses:
        '204':
          description: Deleted
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/Conflict'
        '412':
          $ref: '#/components/responses/PreconditionFailed'
        '428':
          $ref: '#/components/responses/PreconditionRequired'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - role-assignments:write
    patch:
      tags:
      - Roles
      summary: Update a role assignment
      description: 'A JSON merge patch (RFC 7396): fields in the body replace the current ones, `null` removes a field where the schema allows `null`, and objects such as `labels` are merged. Requires `If-Match` with the current `etag`.'
      operationId: updateRoleAssignment
      parameters:
      - name: role_assignment_id
        in: path
        required: true
        schema:
          $ref: '#/components/schemas/RoleAssignmentId'
      - $ref: '#/components/parameters/IfMatch'
      requestBody:
        content:
          application/merge-patch+json:
            schema:
              $ref: '#/components/schemas/RoleAssignmentUpdate'
        required: true
      responses:
        '200':
          description: The updated role assignment
          headers:
            ETag:
              $ref: '#/components/headers/ETag'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RoleAssignment'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/Conflict'
        '412':
          $ref: '#/components/responses/PreconditionFailed'
        '422':
          $ref: '#/components/responses/UnprocessableContent'
        '428':
          $ref: '#/components/responses/PreconditionRequired'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - role-assignments:write
  /v1/apps:
    get:
      tags:
      - Apps
      summary: List apps
      operationId: listApps
      parameters:
      - $ref: '#/components/parameters/PageSize'
      - $ref: '#/components/parameters/PageToken'
      - $ref: '#/components/parameters/UpdatedSince'
      - name: name
        in: query
        description: Only the app with this exact name.
        required: false
        schema:
          type: string
      - name: group_id
        in: query
        description: Only apps this group may sign in to.
        required: false
        schema:
          $ref: '#/components/schemas/GroupId'
      responses:
        '200':
          description: A page of apps
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AppList'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          $ref: '#/components/responses/UnprocessableContent'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - apps:read
    post:
      tags:
      - Apps
      summary: Create an app
      description: A confidential app's client secret is in the response and never shown again. A public app gets none and must use PKCE.
      operationId: createApp
      parameters:
      - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AppCreate'
        required: true
      responses:
        '201':
          description: The new app
          headers:
            ETag:
              $ref: '#/components/headers/ETag'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AppSecret'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '409':
          $ref: '#/components/responses/Conflict'
        '422':
          $ref: '#/components/responses/UnprocessableContent'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - apps:write
  /v1/apps/{app_id}:
    get:
      tags:
      - Apps
      summary: Get an app
      operationId: getApp
      parameters:
      - name: app_id
        in: path
        required: true
        schema:
          $ref: '#/components/schemas/AppId'
      responses:
        '200':
          description: The app
          headers:
            ETag:
              $ref: '#/components/headers/ETag'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/App'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - apps:read
    delete:
      tags:
      - Apps
      summary: Delete an app
      description: Its secret goes with it; people can no longer sign in to it.
      operationId: deleteApp
      parameters:
      - name: app_id
        in: path
        required: true
        schema:
          $ref: '#/components/schemas/AppId'
      - $ref: '#/components/parameters/IfMatch'
      responses:
        '204':
          description: Deleted
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/Conflict'
        '412':
          $ref: '#/components/responses/PreconditionFailed'
        '428':
          $ref: '#/components/responses/PreconditionRequired'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - apps:write
    patch:
      tags:
      - Apps
      summary: Update an app
      description: 'A JSON merge patch (RFC 7396): fields in the body replace the current ones, `null` removes a field where the schema allows `null`, and objects such as `labels` are merged. Requires `If-Match` with the current `etag`.'
      operationId: updateApp
      parameters:
      - name: app_id
        in: path
        required: true
        schema:
          $ref: '#/components/schemas/AppId'
      - $ref: '#/components/parameters/IfMatch'
      requestBody:
        content:
          application/merge-patch+json:
            schema:
              $ref: '#/components/schemas/AppUpdate'
        required: true
      responses:
        '200':
          description: The updated app
          headers:
            ETag:
              $ref: '#/components/headers/ETag'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/App'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/Conflict'
        '412':
          $ref: '#/components/responses/PreconditionFailed'
        '422':
          $ref: '#/components/responses/UnprocessableContent'
        '428':
          $ref: '#/components/responses/PreconditionRequired'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - apps:write
  /v1/apps/{app_id}:rotate-secret:
    post:
      tags:
      - Apps
      summary: Rotate an app's client secret
      description: 'Returns a new secret, which replaces the old one at once. A public app has no secret: `409`.'
      operationId: rotateAppSecret
      parameters:
      - name: app_id
        in: path
        required: true
        schema:
          $ref: '#/components/schemas/AppId'
      - $ref: '#/components/parameters/IfMatchOptional'
      - $ref: '#/components/parameters/IdempotencyKey'
      responses:
        '200':
          description: Success
          headers:
            ETag:
              $ref: '#/components/headers/ETag'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AppSecret'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/Conflict'
        '412':
          $ref: '#/components/responses/PreconditionFailed'
        '422':
          $ref: '#/components/responses/UnprocessableContent'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - apps:write
  /v1/api-clients:
    get:
      tags:
      - API clients
      summary: List api clients
      operationId: listApiClients
      parameters:
      - $ref: '#/components/parameters/PageSize'
      - $ref: '#/components/parameters/PageToken'
      - $ref: '#/components/parameters/UpdatedSince'
      - name: name
        in: query
        description: Only the client with this exact name.
        required: false
        schema:
          type: string
      responses:
        '200':
          description: A page of api clients
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiClientList'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          $ref: '#/components/responses/UnprocessableContent'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - api-clients:read
    post:
      tags:
      - API clients
      summary: Create an api client
      description: Returns the client secret, which is never shown again. A caller can give only scopes it has itself.
      operationId: createApiClient
      parameters:
      - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ApiClientCreate'
        required: true
      responses:
        '201':
          description: The new api client
          headers:
            ETag:
              $ref: '#/components/headers/ETag'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiClientSecret'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '409':
          $ref: '#/components/responses/Conflict'
        '422':
          $ref: '#/components/responses/UnprocessableContent'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - api-clients:write
  /v1/api-clients/{api_client_id}:
    get:
      tags:
      - API clients
      summary: Get an api client
      operationId: getApiClient
      parameters:
      - name: api_client_id
        in: path
        required: true
        schema:
          $ref: '#/components/schemas/ApiClientId'
      responses:
        '200':
          description: The api client
          headers:
            ETag:
              $ref: '#/components/headers/ETag'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiClient'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - api-clients:read
    delete:
      tags:
      - API clients
      summary: Delete an api client
      description: Revokes the client's access tokens. A caller can delete only clients whose scopes it has.
      operationId: deleteApiClient
      parameters:
      - name: api_client_id
        in: path
        required: true
        schema:
          $ref: '#/components/schemas/ApiClientId'
      - $ref: '#/components/parameters/IfMatch'
      responses:
        '204':
          description: Deleted
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/Conflict'
        '412':
          $ref: '#/components/responses/PreconditionFailed'
        '428':
          $ref: '#/components/responses/PreconditionRequired'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - api-clients:write
    patch:
      tags:
      - API clients
      summary: Update an api client
      description: 'A JSON merge patch (RFC 7396): fields in the body replace the current ones, `null` removes a field where the schema allows `null`, and objects such as `labels` are merged. Requires `If-Match` with the current `etag`.'
      operationId: updateApiClient
      parameters:
      - name: api_client_id
        in: path
        required: true
        schema:
          $ref: '#/components/schemas/ApiClientId'
      - $ref: '#/components/parameters/IfMatch'
      requestBody:
        content:
          application/merge-patch+json:
            schema:
              $ref: '#/components/schemas/ApiClientUpdate'
        required: true
      responses:
        '200':
          description: The updated api client
          headers:
            ETag:
              $ref: '#/components/headers/ETag'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiClient'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/Conflict'
        '412':
          $ref: '#/components/responses/PreconditionFailed'
        '422':
          $ref: '#/components/responses/UnprocessableContent'
        '428':
          $ref: '#/components/responses/PreconditionRequired'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - api-clients:write
  /v1/api-clients/{api_client_id}:rotate-secret:
    post:
      tags:
      - API clients
      summary: Rotate an API client's secret
      description: Returns a new secret, which replaces the old one at once and revokes the client's access tokens. A caller can rotate only clients whose scopes it has.
      operationId: rotateApiClientSecret
      parameters:
      - name: api_client_id
        in: path
        required: true
        schema:
          $ref: '#/components/schemas/ApiClientId'
      - $ref: '#/components/parameters/IfMatchOptional'
      - $ref: '#/components/parameters/IdempotencyKey'
      responses:
        '200':
          description: Success
          headers:
            ETag:
              $ref: '#/components/headers/ETag'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiClientSecret'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '412':
          $ref: '#/components/responses/PreconditionFailed'
        '422':
          $ref: '#/components/responses/UnprocessableContent'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - api-clients:write
  /v1/connectors:
    get:
      tags:
      - Connectors
      summary: List connectors
      operationId: listConnectors
      parameters:
      - $ref: '#/components/parameters/PageSize'
      - $ref: '#/components/parameters/PageToken'
      - $ref: '#/components/parameters/UpdatedSince'
      - name: kind
        in: query
        description: Only connectors of this kind.
        required: false
        schema:
          $ref: '#/components/schemas/ConnectorKind'
      responses:
        '200':
          description: A page of connectors
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ConnectorList'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          $ref: '#/components/responses/UnprocessableContent'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - connectors:read
    post:
      tags:
      - Connectors
      summary: Create a connector
      description: For a `scim` connector, returns the SCIM base URL and the bearer token to give the identity provider; the token is never shown again. A `google_workspace` connector needs `service_account_key`, which is kept sealed and never returned, and syncs within a minute.
      operationId: createConnector
      parameters:
      - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ConnectorCreate'
        required: true
      responses:
        '201':
          description: The new connector
          headers:
            ETag:
              $ref: '#/components/headers/ETag'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ConnectorToken'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '409':
          $ref: '#/components/responses/Conflict'
        '422':
          $ref: '#/components/responses/UnprocessableContent'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - connectors:write
  /v1/connectors/{connector_id}:
    get:
      tags:
      - Connectors
      summary: Get a connector
      operationId: getConnector
      parameters:
      - name: connector_id
        in: path
        required: true
        schema:
          $ref: '#/components/schemas/ConnectorId'
      responses:
        '200':
          description: The connector
          headers:
            ETag:
              $ref: '#/components/headers/ETag'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Connector'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - connectors:read
    delete:
      tags:
      - Connectors
      summary: Delete a connector
      description: Its token stops working at once. The people and groups it created stay, and become the organization's to change through `/v1`.
      operationId: deleteConnector
      parameters:
      - name: connector_id
        in: path
        required: true
        schema:
          $ref: '#/components/schemas/ConnectorId'
      - $ref: '#/components/parameters/IfMatch'
      responses:
        '204':
          description: Deleted
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/Conflict'
        '412':
          $ref: '#/components/responses/PreconditionFailed'
        '428':
          $ref: '#/components/responses/PreconditionRequired'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - connectors:write
    patch:
      tags:
      - Connectors
      summary: Update a connector
      description: 'A JSON merge patch (RFC 7396): fields in the body replace the current ones, `null` removes a field where the schema allows `null`, and objects such as `labels` are merged. Requires `If-Match` with the current `etag`.'
      operationId: updateConnector
      parameters:
      - name: connector_id
        in: path
        required: true
        schema:
          $ref: '#/components/schemas/ConnectorId'
      - $ref: '#/components/parameters/IfMatch'
      requestBody:
        content:
          application/merge-patch+json:
            schema:
              $ref: '#/components/schemas/ConnectorUpdate'
        required: true
      responses:
        '200':
          description: The updated connector
          headers:
            ETag:
              $ref: '#/components/headers/ETag'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Connector'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/Conflict'
        '412':
          $ref: '#/components/responses/PreconditionFailed'
        '422':
          $ref: '#/components/responses/UnprocessableContent'
        '428':
          $ref: '#/components/responses/PreconditionRequired'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - connectors:write
  /v1/connectors/{connector_id}:rotate-token:
    post:
      tags:
      - Connectors
      summary: Rotate a connector's token
      description: Returns a new token, which replaces the old one at once. Give it to the identity provider. Only `scim` connectors have a token; others return `409`.
      operationId: rotateConnectorToken
      parameters:
      - name: connector_id
        in: path
        required: true
        schema:
          $ref: '#/components/schemas/ConnectorId'
      - $ref: '#/components/parameters/IfMatchOptional'
      - $ref: '#/components/parameters/IdempotencyKey'
      responses:
        '200':
          description: Success
          headers:
            ETag:
              $ref: '#/components/headers/ETag'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ConnectorToken'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/Conflict'
        '412':
          $ref: '#/components/responses/PreconditionFailed'
        '422':
          $ref: '#/components/responses/UnprocessableContent'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - connectors:write
  /v1/connectors/{connector_id}:sync:
    post:
      tags:
      - Connectors
      summary: Sync a connector from its directory now
      description: 'For connectors Passway pulls from. Reads the directory and applies it, and returns the connector: `sync` says how it went. A sync that cannot read the directory changes nothing and records why. `confirm_removals` applies removals a sync held. A disabled connector or a `scim` one returns `409`.'
      operationId: syncConnector
      parameters:
      - name: connector_id
        in: path
        required: true
        schema:
          $ref: '#/components/schemas/ConnectorId'
      - $ref: '#/components/parameters/IfMatchOptional'
      - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ConnectorSyncRequest'
        required: false
      responses:
        '200':
          description: Success
          headers:
            ETag:
              $ref: '#/components/headers/ETag'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Connector'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/Conflict'
        '412':
          $ref: '#/components/responses/PreconditionFailed'
        '422':
          $ref: '#/components/responses/UnprocessableContent'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - connectors:write
  /v1/connectors/{connector_id}:set-service-account-key:
    post:
      tags:
      - Connectors
      summary: Set a Google Workspace connector's key
      description: Replaces the service account's JSON key. It is kept sealed and never returned. The connector syncs within a minute with the new key.
      operationId: setConnectorServiceAccountKey
      parameters:
      - name: connector_id
        in: path
        required: true
        schema:
          $ref: '#/components/schemas/ConnectorId'
      - $ref: '#/components/parameters/IfMatchOptional'
      - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ServiceAccountKeySet'
        required: true
      responses:
        '200':
          description: Success
          headers:
            ETag:
              $ref: '#/components/headers/ETag'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Connector'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/Conflict'
        '412':
          $ref: '#/components/responses/PreconditionFailed'
        '422':
          $ref: '#/components/responses/UnprocessableContent'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - connectors:write
  /v1/agents:
    get:
      tags:
      - Agents
      summary: List agents
      operationId: listAgents
      parameters:
      - $ref: '#/components/parameters/PageSize'
      - $ref: '#/components/parameters/PageToken'
      - $ref: '#/components/parameters/UpdatedSince'
      - name: sponsor_id
        in: query
        description: Only this sponsor's agents.
        required: false
        schema:
          $ref: '#/components/schemas/PersonId'
      - name: status
        in: query
        description: Only active or only suspended agents.
        required: false
        schema:
          $ref: '#/components/schemas/AgentStatus'
      - name: kind
        in: query
        description: Only software or only robots.
        required: false
        schema:
          $ref: '#/components/schemas/AgentKind'
      responses:
        '200':
          description: A page of agents
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AgentList'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          $ref: '#/components/responses/UnprocessableContent'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - agents:read
    post:
      tags:
      - Agents
      summary: Create an agent
      description: The sponsor must be an active person, and the caller must hold every scope it gives. `jwks` holds public keys only.
      operationId: createAgent
      parameters:
      - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AgentCreate'
        required: true
      responses:
        '201':
          description: The new agent
          headers:
            ETag:
              $ref: '#/components/headers/ETag'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Agent'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '409':
          $ref: '#/components/responses/Conflict'
        '422':
          $ref: '#/components/responses/UnprocessableContent'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - agents:write
  /v1/agents/{agent_id}:
    get:
      tags:
      - Agents
      summary: Get an agent
      operationId: getAgent
      parameters:
      - name: agent_id
        in: path
        required: true
        schema:
          $ref: '#/components/schemas/AgentId'
      responses:
        '200':
          description: The agent
          headers:
            ETag:
              $ref: '#/components/headers/ETag'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Agent'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - agents:read
    delete:
      tags:
      - Agents
      summary: Delete an agent
      description: Its access tokens stop working at once.
      operationId: deleteAgent
      parameters:
      - name: agent_id
        in: path
        required: true
        schema:
          $ref: '#/components/schemas/AgentId'
      - $ref: '#/components/parameters/IfMatch'
      responses:
        '204':
          description: Deleted
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/Conflict'
        '412':
          $ref: '#/components/responses/PreconditionFailed'
        '428':
          $ref: '#/components/responses/PreconditionRequired'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - agents:write
    patch:
      tags:
      - Agents
      summary: Update an agent
      description: 'A JSON merge patch (RFC 7396): fields in the body replace the current ones, `null` removes a field where the schema allows `null`, and objects such as `labels` are merged. Requires `If-Match` with the current `etag`.'
      operationId: updateAgent
      parameters:
      - name: agent_id
        in: path
        required: true
        schema:
          $ref: '#/components/schemas/AgentId'
      - $ref: '#/components/parameters/IfMatch'
      requestBody:
        content:
          application/merge-patch+json:
            schema:
              $ref: '#/components/schemas/AgentUpdate'
        required: true
      responses:
        '200':
          description: The updated agent
          headers:
            ETag:
              $ref: '#/components/headers/ETag'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Agent'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/Conflict'
        '412':
          $ref: '#/components/responses/PreconditionFailed'
        '422':
          $ref: '#/components/responses/UnprocessableContent'
        '428':
          $ref: '#/components/responses/PreconditionRequired'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - agents:write
  /v1/agents/{agent_id}:suspend:
    post:
      tags:
      - Agents
      summary: Suspend an agent
      description: 'The kill switch for one agent: its access tokens stop working at once and it gets no new ones until `:resume`.'
      operationId: suspendAgent
      parameters:
      - name: agent_id
        in: path
        required: true
        schema:
          $ref: '#/components/schemas/AgentId'
      - $ref: '#/components/parameters/IfMatchOptional'
      - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AgentSuspend'
        required: false
      responses:
        '200':
          description: Success
          headers:
            ETag:
              $ref: '#/components/headers/ETag'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Agent'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '412':
          $ref: '#/components/responses/PreconditionFailed'
        '422':
          $ref: '#/components/responses/UnprocessableContent'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - agents:write
  /v1/agents/{agent_id}:resume:
    post:
      tags:
      - Agents
      summary: Resume a suspended agent
      description: Refused with `409` while the sponsor is inactive or the agent has expired.
      operationId: resumeAgent
      parameters:
      - name: agent_id
        in: path
        required: true
        schema:
          $ref: '#/components/schemas/AgentId'
      - $ref: '#/components/parameters/IfMatchOptional'
      - $ref: '#/components/parameters/IdempotencyKey'
      responses:
        '200':
          description: Success
          headers:
            ETag:
              $ref: '#/components/headers/ETag'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Agent'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/Conflict'
        '412':
          $ref: '#/components/responses/PreconditionFailed'
        '422':
          $ref: '#/components/responses/UnprocessableContent'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - agents:write
  /v1/agents:suspend:
    post:
      tags:
      - Agents
      summary: Suspend many agents
      description: 'The kill switch for a sponsor''s agents, an operator''s, or all of them: name exactly one. Returns the agents it suspended; ones already suspended are left as they are.'
      operationId: suspendAgents
      parameters:
      - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AgentsSuspend'
        required: true
      responses:
        '200':
          description: Success
          headers:
            ETag:
              $ref: '#/components/headers/ETag'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AgentsSuspended'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          $ref: '#/components/responses/UnprocessableContent'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - agents:write
  /v1/identity-providers:
    get:
      tags:
      - Identity providers
      summary: List identity providers
      operationId: listIdentityProviders
      parameters:
      - $ref: '#/components/parameters/PageSize'
      - $ref: '#/components/parameters/PageToken'
      - $ref: '#/components/parameters/UpdatedSince'
      - name: enabled
        in: query
        description: Only enabled or only disabled ones.
        required: false
        schema:
          type: boolean
      responses:
        '200':
          description: A page of identity providers
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/IdentityProviderList'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          $ref: '#/components/responses/UnprocessableContent'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - identity-providers:read
    post:
      tags:
      - Identity providers
      summary: Create an identity provider
      description: Register `redirect_uri` from the answer at the provider. The client secret is kept sealed and never returned.
      operationId: createIdentityProvider
      parameters:
      - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/IdentityProviderCreate'
        required: true
      responses:
        '201':
          description: The new identity provider
          headers:
            ETag:
              $ref: '#/components/headers/ETag'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/IdentityProvider'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '409':
          $ref: '#/components/responses/Conflict'
        '422':
          $ref: '#/components/responses/UnprocessableContent'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - identity-providers:write
  /v1/identity-providers/{identity_provider_id}:
    get:
      tags:
      - Identity providers
      summary: Get an identity provider
      operationId: getIdentityProvider
      parameters:
      - name: identity_provider_id
        in: path
        required: true
        schema:
          $ref: '#/components/schemas/IdentityProviderId'
      responses:
        '200':
          description: The identity provider
          headers:
            ETag:
              $ref: '#/components/headers/ETag'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/IdentityProvider'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - identity-providers:read
    delete:
      tags:
      - Identity providers
      summary: Delete an identity provider
      description: Its sessions end at once.
      operationId: deleteIdentityProvider
      parameters:
      - name: identity_provider_id
        in: path
        required: true
        schema:
          $ref: '#/components/schemas/IdentityProviderId'
      - $ref: '#/components/parameters/IfMatch'
      responses:
        '204':
          description: Deleted
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/Conflict'
        '412':
          $ref: '#/components/responses/PreconditionFailed'
        '428':
          $ref: '#/components/responses/PreconditionRequired'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - identity-providers:write
    patch:
      tags:
      - Identity providers
      summary: Update an identity provider
      description: 'A JSON merge patch (RFC 7396): fields in the body replace the current ones, `null` removes a field where the schema allows `null`, and objects such as `labels` are merged. Requires `If-Match` with the current `etag`.'
      operationId: updateIdentityProvider
      parameters:
      - name: identity_provider_id
        in: path
        required: true
        schema:
          $ref: '#/components/schemas/IdentityProviderId'
      - $ref: '#/components/parameters/IfMatch'
      requestBody:
        content:
          application/merge-patch+json:
            schema:
              $ref: '#/components/schemas/IdentityProviderUpdate'
        required: true
      responses:
        '200':
          description: The updated identity provider
          headers:
            ETag:
              $ref: '#/components/headers/ETag'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/IdentityProvider'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/Conflict'
        '412':
          $ref: '#/components/responses/PreconditionFailed'
        '422':
          $ref: '#/components/responses/UnprocessableContent'
        '428':
          $ref: '#/components/responses/PreconditionRequired'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - identity-providers:write
  /v1/identity-providers/{identity_provider_id}:set-client-secret:
    post:
      tags:
      - Identity providers
      summary: Set an identity provider's client secret
      description: Replaces the client secret Passway uses at the provider. It is kept sealed and never returned.
      operationId: setIdentityProviderClientSecret
      parameters:
      - name: identity_provider_id
        in: path
        required: true
        schema:
          $ref: '#/components/schemas/IdentityProviderId'
      - $ref: '#/components/parameters/IfMatchOptional'
      - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ClientSecretSet'
        required: true
      responses:
        '200':
          description: Success
          headers:
            ETag:
              $ref: '#/components/headers/ETag'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/IdentityProvider'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '412':
          $ref: '#/components/responses/PreconditionFailed'
        '422':
          $ref: '#/components/responses/UnprocessableContent'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - identity-providers:write
  /v1/domains:
    get:
      tags:
      - Domains
      summary: List domains
      operationId: listDomains
      parameters:
      - $ref: '#/components/parameters/PageSize'
      - $ref: '#/components/parameters/PageToken'
      - $ref: '#/components/parameters/UpdatedSince'
      - name: status
        in: query
        description: Only domains in this state.
        required: false
        schema:
          $ref: '#/components/schemas/DomainStatus'
      - name: hostname
        in: query
        description: Only this host.
        required: false
        schema:
          type: string
      responses:
        '200':
          description: A page of domains
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DomainList'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          $ref: '#/components/responses/UnprocessableContent'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - domains:read
    post:
      tags:
      - Domains
      summary: Create a domain
      description: The host must be a subdomain (a CNAME cannot sit at the apex) under a registrable domain, and not one of Passway's. The answer has the TXT record to publish.
      operationId: createDomain
      parameters:
      - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DomainCreate'
        required: true
      responses:
        '201':
          description: The new domain
          headers:
            ETag:
              $ref: '#/components/headers/ETag'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Domain'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '409':
          $ref: '#/components/responses/Conflict'
        '422':
          $ref: '#/components/responses/UnprocessableContent'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - domains:write
  /v1/domains/{domain_id}:
    get:
      tags:
      - Domains
      summary: Get a domain
      operationId: getDomain
      parameters:
      - name: domain_id
        in: path
        required: true
        schema:
          $ref: '#/components/schemas/DomainId'
      responses:
        '200':
          description: The domain
          headers:
            ETag:
              $ref: '#/components/headers/ETag'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Domain'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - domains:read
    delete:
      tags:
      - Domains
      summary: Delete a domain
      description: The host stops being the organization's at once.
      operationId: deleteDomain
      parameters:
      - name: domain_id
        in: path
        required: true
        schema:
          $ref: '#/components/schemas/DomainId'
      - $ref: '#/components/parameters/IfMatch'
      responses:
        '204':
          description: Deleted
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/Conflict'
        '412':
          $ref: '#/components/responses/PreconditionFailed'
        '428':
          $ref: '#/components/responses/PreconditionRequired'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - domains:write
    patch:
      tags:
      - Domains
      summary: Update a domain
      description: 'A JSON merge patch (RFC 7396): fields in the body replace the current ones, `null` removes a field where the schema allows `null`, and objects such as `labels` are merged. Requires `If-Match` with the current `etag`.'
      operationId: updateDomain
      parameters:
      - name: domain_id
        in: path
        required: true
        schema:
          $ref: '#/components/schemas/DomainId'
      - $ref: '#/components/parameters/IfMatch'
      requestBody:
        content:
          application/merge-patch+json:
            schema:
              $ref: '#/components/schemas/DomainUpdate'
        required: true
      responses:
        '200':
          description: The updated domain
          headers:
            ETag:
              $ref: '#/components/headers/ETag'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Domain'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/Conflict'
        '412':
          $ref: '#/components/responses/PreconditionFailed'
        '422':
          $ref: '#/components/responses/UnprocessableContent'
        '428':
          $ref: '#/components/responses/PreconditionRequired'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - domains:write
  /v1/domains/{domain_id}:verify:
    post:
      tags:
      - Domains
      summary: Check a domain's DNS now
      description: 'Looks up the TXT record and the CNAME, and answers with what was found: `verified` once both are right, or `last_error` saying what is missing.'
      operationId: verifyDomain
      parameters:
      - name: domain_id
        in: path
        required: true
        schema:
          $ref: '#/components/schemas/DomainId'
      - $ref: '#/components/parameters/IfMatchOptional'
      - $ref: '#/components/parameters/IdempotencyKey'
      responses:
        '200':
          description: Success
          headers:
            ETag:
              $ref: '#/components/headers/ETag'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Domain'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '412':
          $ref: '#/components/responses/PreconditionFailed'
        '422':
          $ref: '#/components/responses/UnprocessableContent'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - domains:write
  /v1/log-streams:
    get:
      tags:
      - Log streams
      summary: List log streams
      operationId: listLogStreams
      parameters:
      - $ref: '#/components/parameters/PageSize'
      - $ref: '#/components/parameters/PageToken'
      - $ref: '#/components/parameters/UpdatedSince'
      - name: enabled
        in: query
        description: Only enabled, or only paused, streams.
        required: false
        schema:
          type: boolean
      responses:
        '200':
          description: A page of log streams
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LogStreamList'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          $ref: '#/components/responses/UnprocessableContent'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - log-streams:read
    post:
      tags:
      - Log streams
      summary: Create a log stream
      description: '`authorization` is kept sealed and never returned. `start` is `now` (the default) or `oldest`, to deliver everything the log still keeps.'
      operationId: createLogStream
      parameters:
      - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/LogStreamCreate'
        required: true
      responses:
        '201':
          description: The new log stream
          headers:
            ETag:
              $ref: '#/components/headers/ETag'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LogStream'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '409':
          $ref: '#/components/responses/Conflict'
        '422':
          $ref: '#/components/responses/UnprocessableContent'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - log-streams:write
  /v1/log-streams/{log_stream_id}:
    get:
      tags:
      - Log streams
      summary: Get a log stream
      operationId: getLogStream
      parameters:
      - name: log_stream_id
        in: path
        required: true
        schema:
          $ref: '#/components/schemas/LogStreamId'
      responses:
        '200':
          description: The log stream
          headers:
            ETag:
              $ref: '#/components/headers/ETag'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LogStream'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - log-streams:read
    delete:
      tags:
      - Log streams
      summary: Delete a log stream
      description: Delivery stops at once.
      operationId: deleteLogStream
      parameters:
      - name: log_stream_id
        in: path
        required: true
        schema:
          $ref: '#/components/schemas/LogStreamId'
      - $ref: '#/components/parameters/IfMatch'
      responses:
        '204':
          description: Deleted
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/Conflict'
        '412':
          $ref: '#/components/responses/PreconditionFailed'
        '428':
          $ref: '#/components/responses/PreconditionRequired'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - log-streams:write
    patch:
      tags:
      - Log streams
      summary: Update a log stream
      description: 'A JSON merge patch (RFC 7396): fields in the body replace the current ones, `null` removes a field where the schema allows `null`, and objects such as `labels` are merged. Requires `If-Match` with the current `etag`.'
      operationId: updateLogStream
      parameters:
      - name: log_stream_id
        in: path
        required: true
        schema:
          $ref: '#/components/schemas/LogStreamId'
      - $ref: '#/components/parameters/IfMatch'
      requestBody:
        content:
          application/merge-patch+json:
            schema:
              $ref: '#/components/schemas/LogStreamUpdate'
        required: true
      responses:
        '200':
          description: The updated log stream
          headers:
            ETag:
              $ref: '#/components/headers/ETag'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LogStream'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/Conflict'
        '412':
          $ref: '#/components/responses/PreconditionFailed'
        '422':
          $ref: '#/components/responses/UnprocessableContent'
        '428':
          $ref: '#/components/responses/PreconditionRequired'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - log-streams:write
  /v1/log-streams/{log_stream_id}:set-authorization:
    post:
      tags:
      - Log streams
      summary: Set a log stream's Authorization header
      description: Replaces the `Authorization` header an `https` stream sends, or with `null` sends none. It is kept sealed and never returned. A bucket stream returns `409`.
      operationId: setLogStreamAuthorization
      parameters:
      - name: log_stream_id
        in: path
        required: true
        schema:
          $ref: '#/components/schemas/LogStreamId'
      - $ref: '#/components/parameters/IfMatchOptional'
      - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AuthorizationSet'
        required: true
      responses:
        '200':
          description: Success
          headers:
            ETag:
              $ref: '#/components/headers/ETag'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LogStream'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/Conflict'
        '412':
          $ref: '#/components/responses/PreconditionFailed'
        '422':
          $ref: '#/components/responses/UnprocessableContent'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - log-streams:write
  /v1/log-streams/{log_stream_id}:set-credentials:
    post:
      tags:
      - Log streams
      summary: Set a bucket stream's credentials
      description: 'Replaces the credentials a bucket stream writes with, in the form its kind takes: `ACCESS_KEY_ID:SECRET_ACCESS_KEY` for `s3`, a service account''s JSON key file for `google_cloud_storage`, a SAS token for `azure_blob`. They are kept sealed and never returned. An `https` stream returns `409`.'
      operationId: setLogStreamCredentials
      parameters:
      - name: log_stream_id
        in: path
        required: true
        schema:
          $ref: '#/components/schemas/LogStreamId'
      - $ref: '#/components/parameters/IfMatchOptional'
      - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CredentialsSet'
        required: true
      responses:
        '200':
          description: Success
          headers:
            ETag:
              $ref: '#/components/headers/ETag'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LogStream'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/Conflict'
        '412':
          $ref: '#/components/responses/PreconditionFailed'
        '422':
          $ref: '#/components/responses/UnprocessableContent'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - log-streams:write
  /v1/credentials:
    get:
      tags:
      - Credentials
      summary: List credentials
      operationId: listCredentials
      parameters:
      - $ref: '#/components/parameters/PageSize'
      - $ref: '#/components/parameters/PageToken'
      - $ref: '#/components/parameters/UpdatedSince'
      - name: person_id
        in: query
        description: Only this person's credentials.
        required: false
        schema:
          $ref: '#/components/schemas/PersonId'
      - name: status
        in: query
        description: Only credentials with this status.
        required: false
        schema:
          $ref: '#/components/schemas/CredentialStatus'
      responses:
        '200':
          description: A page of credentials
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CredentialList'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          $ref: '#/components/responses/UnprocessableContent'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - credentials:read
  /v1/credentials/{credential_id}:
    get:
      tags:
      - Credentials
      summary: Get a credential
      operationId: getCredential
      parameters:
      - name: credential_id
        in: path
        required: true
        schema:
          $ref: '#/components/schemas/CredentialId'
      responses:
        '200':
          description: The credential
          headers:
            ETag:
              $ref: '#/components/headers/ETag'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Credential'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - credentials:read
  /v1/credentials/statistics:
    get:
      tags:
      - Credentials
      summary: Get credentials statistics
      description: Exact counts of wallet credentials by status.
      operationId: getCredentialStatistics
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CredentialStatistics'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - credentials:read
  /v1/credentials/{credential_id}:suspend:
    post:
      tags:
      - Credentials
      summary: Suspend a credential
      description: Readers refuse the credential once they receive the next revocation list. `:resume` undoes it.
      operationId: suspendCredential
      parameters:
      - name: credential_id
        in: path
        required: true
        schema:
          $ref: '#/components/schemas/CredentialId'
      - $ref: '#/components/parameters/IfMatchOptional'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CredentialAction'
        required: false
      responses:
        '200':
          description: Success
          headers:
            ETag:
              $ref: '#/components/headers/ETag'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Credential'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/Conflict'
        '412':
          $ref: '#/components/responses/PreconditionFailed'
        '422':
          $ref: '#/components/responses/UnprocessableContent'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - credentials:write
  /v1/credentials/{credential_id}:resume:
    post:
      tags:
      - Credentials
      summary: Resume a suspended credential
      operationId: resumeCredential
      parameters:
      - name: credential_id
        in: path
        required: true
        schema:
          $ref: '#/components/schemas/CredentialId'
      - $ref: '#/components/parameters/IfMatchOptional'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CredentialAction'
        required: false
      responses:
        '200':
          description: Success
          headers:
            ETag:
              $ref: '#/components/headers/ETag'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Credential'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/Conflict'
        '412':
          $ref: '#/components/responses/PreconditionFailed'
        '422':
          $ref: '#/components/responses/UnprocessableContent'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - credentials:write
  /v1/credentials/{credential_id}:revoke:
    post:
      tags:
      - Credentials
      summary: Revoke a credential
      description: Removes the pass from the wallet and adds the credential to every relevant reader's revocation list. `revocation` on the credential shows how many readers have confirmed. Cannot be undone.
      operationId: revokeCredential
      parameters:
      - name: credential_id
        in: path
        required: true
        schema:
          $ref: '#/components/schemas/CredentialId'
      - $ref: '#/components/parameters/IfMatchOptional'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CredentialAction'
        required: false
      responses:
        '200':
          description: Success
          headers:
            ETag:
              $ref: '#/components/headers/ETag'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Credential'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/Conflict'
        '412':
          $ref: '#/components/responses/PreconditionFailed'
        '422':
          $ref: '#/components/responses/UnprocessableContent'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - credentials:revoke
  /v1/events:
    get:
      tags:
      - Events
      summary: List events
      operationId: listEvents
      parameters:
      - $ref: '#/components/parameters/PageSize'
      - $ref: '#/components/parameters/PageToken'
      - name: type
        in: query
        description: Only events of this type, such as `com.passway.access.denied`.
        required: false
        schema:
          type: string
      - name: subject
        in: query
        description: Only events about this resource.
        required: false
        schema:
          type: string
      - name: from
        in: query
        description: Only events at or after this time.
        required: false
        schema:
          $ref: '#/components/schemas/Timestamp'
      - name: before
        in: query
        description: Only events strictly before this time.
        required: false
        schema:
          $ref: '#/components/schemas/Timestamp'
      - name: after
        in: query
        description: Only events after this one. Use the last event ID you processed to resume.
        required: false
        schema:
          $ref: '#/components/schemas/EventId'
      - name: category
        in: query
        description: |-
          Only events in these categories, comma-separated: `access`,
          `directory`, `credentials`, `sign_in`, `configuration`, `system`.
          The console leaves out `system` to hide housekeeping.
        required: false
        schema:
          type: string
        example: access,credentials
      responses:
        '200':
          description: A page of events
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EventList'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          $ref: '#/components/responses/UnprocessableContent'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - events:read
  /v1/events/{event_id}:
    get:
      tags:
      - Events
      summary: Get an event
      operationId: getEvent
      parameters:
      - name: event_id
        in: path
        required: true
        schema:
          $ref: '#/components/schemas/EventId'
      responses:
        '200':
          description: The event
          headers:
            ETag:
              $ref: '#/components/headers/ETag'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Event'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - events:read
  /v1/events/statistics:
    get:
      tags:
      - Events
      summary: Get events statistics
      description: Event counts by time and category in the requested time zone. Calendar periods return hours, days or months through the present, each with a preview of its newest events.
      operationId: getEventStatistics
      parameters:
      - name: days
        in: query
        description: Number of calendar days, including today. Defaults to seven when no period is given.
        required: false
        schema:
          type: integer
          format: int32
          maximum: 30
          minimum: 1
      - name: period
        in: query
        description: Calendar period to date. Mutually exclusive with days.
        required: false
        schema:
          $ref: '#/components/schemas/EventPeriod'
      - name: time_zone
        in: query
        description: IANA time zone used for calendar day boundaries. Defaults to UTC.
        required: false
        schema:
          $ref: '#/components/schemas/TimeZone'
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EventStatistics'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - events:read
  /v1/events/summary:
    get:
      tags:
      - Events
      summary: Event counts for charts
      description: 'Counts for a window, by hour or by day in a time zone, so a chart needn''t page through the events. Every bucket in the window is there, empty ones too, each with the events in it by category and the decisions at doors. Over the whole window: totals by category, and denials by reason and at the five access points with the most. Days are calendar days in the time zone; an hour repeated when the clocks go back is one bucket. At most 400 buckets.'
      operationId: getEventSummary
      parameters:
      - name: from
        in: query
        description: The window's start, RFC 3339.
        required: true
        schema:
          type: string
          minLength: 1
      - name: to
        in: query
        description: The window's end, RFC 3339, not included.
        required: true
        schema:
          type: string
          minLength: 1
      - name: bucket
        in: query
        description: '`hour` or `day` (the default).'
        required: false
        schema:
          type: string
          minLength: 1
      - name: time_zone
        in: query
        description: An IANA time zone such as `America/New_York`; `UTC` by default.
        required: false
        schema:
          type: string
          minLength: 1
      responses:
        '200':
          description: Success
          headers:
            ETag:
              $ref: '#/components/headers/ETag'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EventSummary'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - events:read
  /v1/events/occupancy:
    get:
      tags:
      - Events
      summary: Who is in each area
      description: 'Each person''s last passage through an access point in the last `hours`, and the area it led into (`area_to_id`): that is where they are. A passage into no area is a way out, and a reader whose access points lead into different areas, such as an elevator''s, says nothing. Each area counts the people in it (`count`) and in it or any area inside it (`total`), as a building counts its floors. Only what readers saw: someone who came in behind another is not counted, and someone who left through a door without a reader still is until `hours` pass.'
      operationId: getOccupancy
      parameters:
      - name: site_id
        in: query
        description: Only areas at this site.
        required: false
        schema:
          type: string
          minLength: 1
      - name: hours
        in: query
        description: 'How far back passages count: 1 to 168, 24 by default.'
        required: false
        schema:
          type: string
          minLength: 1
      responses:
        '200':
          description: Success
          headers:
            ETag:
              $ref: '#/components/headers/ETag'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Occupancy'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - events:read
  /v1/me:
    get:
      tags:
      - Roles
      summary: Who is calling, and what they may do
      description: 'For a person signed in: who they are, every scope they hold now, and the role and group each comes from. For an API client or agent: its scopes. Anyone signed in may ask; a person with no role gets `403`, as for everything on `/v1`.'
      operationId: getMe
      responses:
        '200':
          description: Success
          headers:
            ETag:
              $ref: '#/components/headers/ETag'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Me'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2: []
  /v1/organization/issuer-keys:
    get:
      tags:
      - Organization
      summary: The issuer keys
      description: 'The keys that sign the organization''s Access Documents: ECDSA P-256, which every Aliro reader checks, and ML-DSA-87, which post-quantum reader groups check as well (#349). During a rotation, the next keys and how many enrolled readers trust them; after one, the previous keys and until when readers keep trusting them.'
      operationId: getIssuerKeys
      responses:
        '200':
          description: Success
          headers:
            ETag:
              $ref: '#/components/headers/ETag'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/IssuerKeys'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - organization:read
  /v1/organization/issuer-keys:rotate:
    post:
      tags:
      - Organization
      summary: Rotate the issuer keys
      description: |-
        Starts rotating the ECDSA and ML-DSA-87 issuer keys together, with no downtime. Readers trust the next keys at once, beside the current ones. Documents are signed with them once every enrolled reader has applied a configuration that trusts them (at once with no readers), and phones fetch new documents. The old keys stay trusted for as long as a document signed with them can last, 3 days and an hour. `409` while a rotation is under way. Keys also rotate on their own every `issuer_rotation_days` (on the organization; every 3 days by default). `com.passway.issuer.rotation_started` and `com.passway.issuer.rotated` events record it.

        With `emergency`, for keys that may have been stolen: new keys sign documents at once, and readers stop trusting every earlier key, whatever rotation was under way. Phones fetch new documents when the app next opens; until then, those doors refuse them.
      operationId: rotateIssuerKeys
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/IssuerKeyRotate'
        required: false
      responses:
        '200':
          description: Success
          headers:
            ETag:
              $ref: '#/components/headers/ETag'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/IssuerKeys'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '409':
          $ref: '#/components/responses/Conflict'
        '422':
          $ref: '#/components/responses/UnprocessableContent'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - organization:write
  /v1/attention:
    get:
      tags:
      - Events
      summary: What needs attention
      description: 'What in the organization needs someone''s attention now, most severe first: doors forced or held open, readers offline, passes turned away again and again, taps from unknown phones, break-glass sign-ins, failing or held directory syncs, failing log streams, agents about to expire, domains not served or waiting for DNS, active people with no wallet pass, and enrolment links not used yet. Each item has a count, a sentence, a severity and up to 10 IDs. Anyone signed in may ask; each kind of item needs the read scope of what it is about and is left out without it. Empty `items` means all is clear.'
      operationId: getAttention
      responses:
        '200':
          description: Success
          headers:
            ETag:
              $ref: '#/components/headers/ETag'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Attention'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2: []
  /v1/time-punches:
    get:
      tags:
      - Events
      summary: Time clock punches
      description: 'Grants at access points with `timekeeping` on (#324), as `com.passway.time.punch` events record them: who, where, when by the reader''s own clock, and `in` (into the site from outside) or `out` (out of it). Raw punches: Passway never pairs, rounds or edits them, and a tap means someone was there, not that they started work. Earliest first, at most 10,000 and 31 days at a time. Needs `time-punches:read`, so payroll staff can read punches without the rest of the event log.'
      operationId: listTimePunches
      parameters:
      - name: from
        in: query
        description: The window's start, RFC 3339, by the readers' clocks.
        required: true
        schema:
          type: string
          minLength: 1
      - name: to
        in: query
        description: The window's end, RFC 3339, not included.
        required: true
        schema:
          type: string
          minLength: 1
      - name: site_id
        in: query
        description: Only punches at this site.
        required: false
        schema:
          type: string
          minLength: 1
      - name: person_id
        in: query
        description: Only this person's punches.
        required: false
        schema:
          type: string
          minLength: 1
      responses:
        '200':
          description: Success
          headers:
            ETag:
              $ref: '#/components/headers/ETag'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TimePunches'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - time-punches:read
  /v1/display-names:
    get:
      tags:
      - Events
      summary: What things are called
      description: 'Names for the IDs that events and lists show, up to 100 at once: a person''s name, a group''s, an app''s, and so on, and `Admin token` for `admin`. An ID the caller may not read, that doesn''t exist or that has no name is left out, so show the ID instead. Anyone signed in may ask; a person''s name needs `people:read`.'
      operationId: getDisplayNames
      parameters:
      - name: ids
        in: query
        description: 'IDs, comma-separated: at most 100.'
        required: true
        schema:
          type: string
          minLength: 1
      responses:
        '200':
          description: Success
          headers:
            ETag:
              $ref: '#/components/headers/ETag'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DisplayNames'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2: []
  /v1/roles:
    get:
      tags:
      - Roles
      summary: List roles
      description: 'The built-in roles first: `role_viewer` reads everything, `role_security` also suspends, resumes and revokes credentials, and `role_admin` has every scope. Then the organization''s own, by name.'
      operationId: listRoles
      parameters:
      - $ref: '#/components/parameters/PageSize'
      - $ref: '#/components/parameters/PageToken'
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RoleList'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - roles:read
    post:
      tags:
      - Roles
      summary: Make a role
      description: 'A role of the organization''s own, with exactly the scopes chosen, now and later, such as a help desk''s: read people, suspend credentials. To start from a built-in role, copy its `scopes`. The caller must hold every scope it gives. Raises `com.passway.role.created`.'
      operationId: createRole
      parameters:
      - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RoleCreate'
        required: true
      responses:
        '201':
          description: Success
          headers:
            ETag:
              $ref: '#/components/headers/ETag'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Role'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '409':
          $ref: '#/components/responses/Conflict'
        '422':
          $ref: '#/components/responses/UnprocessableContent'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - roles:write
  /v1/roles/{role_id}:
    get:
      tags:
      - Roles
      summary: Get a role
      operationId: getRole
      parameters:
      - name: role_id
        in: path
        required: true
        schema:
          $ref: '#/components/schemas/RoleId'
      responses:
        '200':
          description: Success
          headers:
            ETag:
              $ref: '#/components/headers/ETag'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Role'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - roles:read
    delete:
      tags:
      - Roles
      summary: Delete a role
      description: The organization's own roles only, once no group has them (`409` with `/problems/has-dependents` otherwise). Built-in roles return `409`. The caller must hold every scope it gives. Raises `com.passway.role.deleted`.
      operationId: deleteRole
      parameters:
      - name: role_id
        in: path
        required: true
        schema:
          $ref: '#/components/schemas/RoleId'
      - $ref: '#/components/parameters/IfMatch'
      responses:
        '204':
          description: Success
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/Conflict'
        '412':
          $ref: '#/components/responses/PreconditionFailed'
        '428':
          $ref: '#/components/responses/PreconditionRequired'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - roles:write
    patch:
      tags:
      - Roles
      summary: Change a role
      description: 'The organization''s own roles only: built-in ones return `409`. The caller must hold every scope the role gives, before and after. Its holders have the new scopes from their next request. Raises `com.passway.role.updated`.'
      operationId: updateRole
      parameters:
      - name: role_id
        in: path
        required: true
        schema:
          $ref: '#/components/schemas/RoleId'
      - $ref: '#/components/parameters/IfMatch'
      requestBody:
        content:
          application/merge-patch+json:
            schema:
              $ref: '#/components/schemas/RoleUpdate'
        required: true
      responses:
        '200':
          description: Success
          headers:
            ETag:
              $ref: '#/components/headers/ETag'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Role'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/Conflict'
        '412':
          $ref: '#/components/responses/PreconditionFailed'
        '422':
          $ref: '#/components/responses/UnprocessableContent'
        '428':
          $ref: '#/components/responses/PreconditionRequired'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - roles:write
  /v1/roles/{role_id}/holders:
    get:
      tags:
      - Roles
      summary: Who holds a role
      description: 'Everyone who holds the role now, and the group each holds it through: active people in a group the role is assigned to, and for `role_admin`, the break-glass group''s members.'
      operationId: getRoleHolders
      parameters:
      - name: role_id
        in: path
        required: true
        schema:
          $ref: '#/components/schemas/RoleId'
      responses:
        '200':
          description: Success
          headers:
            ETag:
              $ref: '#/components/headers/ETag'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RoleHolders'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
      - oauth2:
        - roles:read
components:
  schemas:
    AccessAssignment:
      type: object
      description: |-
        One access profile given to groups and people, optionally only between
        `valid_from` and `valid_to`.
      required:
      - id
      - etag
      - access_profile_id
      - group_ids
      - person_ids
      - valid_from
      - valid_to
      - labels
      - managed_by
      - created_at
      - updated_at
      properties:
        id:
          $ref: '#/components/schemas/AccessAssignmentId'
          description: Access assignment ID.
        etag:
          $ref: '#/components/schemas/ETag'
          description: Current version.
        access_profile_id:
          $ref: '#/components/schemas/AccessProfileId'
          description: The profile given. Cannot change.
        group_ids:
          type: array
          items:
            $ref: '#/components/schemas/GroupId'
          description: Members of these groups get the profile.
        person_ids:
          type: array
          items:
            $ref: '#/components/schemas/PersonId'
          description: These people get the profile.
        valid_from:
          oneOf:
          - $ref: '#/components/schemas/Timestamp'
            description: The assignment has no effect before this time.
          - type: 'null'
        valid_to:
          oneOf:
          - $ref: '#/components/schemas/Timestamp'
            description: The assignment has no effect from this time. Used for temporary access.
          - type: 'null'
        labels:
          $ref: '#/components/schemas/Labels'
          description: Labels.
        managed_by:
          type:
          - string
          - 'null'
          description: The tool that manages this resource, such as `terraform`.
          examples:
          - terraform
        created_at:
          $ref: '#/components/schemas/Timestamp'
          description: When the assignment was created.
        updated_at:
          $ref: '#/components/schemas/Timestamp'
          description: When the assignment last changed.
    AccessAssignmentCreate:
      type: object
      description: Body of `POST /v1/access-assignments`.
      required:
      - access_profile_id
      properties:
        access_profile_id:
          $ref: '#/components/schemas/AccessProfileId'
          description: The profile to give.
        group_ids:
          type: array
          items:
            $ref: '#/components/schemas/GroupId'
          description: Members of these groups get the profile.
          maxItems: 1000
        person_ids:
          type: array
          items:
            $ref: '#/components/schemas/PersonId'
          description: These people get the profile.
          maxItems: 1000
        valid_from:
          $ref: '#/components/schemas/Timestamp'
          description: The assignment has no effect before this time.
        valid_to:
          $ref: '#/components/schemas/Timestamp'
          description: The assignment has no effect from this time.
        labels:
          $ref: '#/components/schemas/Labels'
          description: Labels.
        managed_by:
          type: string
          description: The tool that manages this resource. Terraform sets `terraform`.
          examples:
          - terraform
          maxLength: 64
          pattern: ^[a-z0-9_-]{1,64}$
      additionalProperties: false
    AccessAssignmentId:
      type: string
      description: 'Access assignment ID: `asgn_` followed by 1 to 64 lowercase letters and digits.'
      examples:
      - asgn_01jd8k3m2v9x4q7r5t6w8y0z1a
      maxLength: 69
      pattern: ^asgn_[0-9a-z]{1,64}$
    AccessAssignmentList:
      type: object
      required:
      - data
      - next_page_token
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/AccessAssignment'
        next_page_token:
          type:
          - string
          - 'null'
          description: Pass as `page_token` to get the next page; `null` on the last page.
    AccessAssignmentUpdate:
      type: object
      description: |-
        Body of `PATCH /v1/access-assignments/{access_assignment_id}`, a JSON
        merge patch. Lists replace the current lists.
      properties:
        group_ids:
          type: array
          items:
            $ref: '#/components/schemas/GroupId'
          description: New groups.
          maxItems: 1000
        person_ids:
          type: array
          items:
            $ref: '#/components/schemas/PersonId'
          description: New people.
          maxItems: 1000
        valid_from:
          oneOf:
          - $ref: '#/components/schemas/Timestamp'
            description: New start, or `null` to remove it.
          - type: 'null'
        valid_to:
          oneOf:
          - $ref: '#/components/schemas/Timestamp'
            description: New end, or `null` to remove it.
          - type: 'null'
        labels:
          oneOf:
          - $ref: '#/components/schemas/LabelsPatch'
            description: Labels to set or remove, or `null` to remove every label.
          - type: 'null'
        managed_by:
          type:
          - string
          - 'null'
          description: New managing tool, or `null` to clear it.
          maxLength: 64
          pattern: ^[a-z0-9_-]{1,64}$
      additionalProperties: false
    AccessDryRun:
      type: object
      description: |-
        Response to `POST /v1/access-profiles:dry-run`: how the proposed
        policies would have decided the people's passages, against how today's
        policies decide them. Readers' other reasons, such as a revoked or
        suspended credential or a disabled door, are left out: the policies
        don't change them.
      required:
      - from
      - to
      - people
      - passages
      - truncated
      - newly_allowed_count
      - newly_refused_count
      - newly_allowed
      - newly_refused
      - people_gaining
      - people_losing
      properties:
        from:
          $ref: '#/components/schemas/Timestamp'
          description: The window's start.
        to:
          $ref: '#/components/schemas/Timestamp'
          description: The window's end.
        people:
          type: integer
          format: int64
          description: The people whose access the proposal would touch.
          minimum: 0
        passages:
          type: integer
          format: int64
          description: 'Their passages examined: grants and policy denials.'
          minimum: 0
        truncated:
          type: boolean
          description: Whether there were more than 2,000, so only the most recent were.
        newly_allowed_count:
          type: integer
          format: int64
          description: Passages today's policies refuse and the proposal would allow.
          minimum: 0
        newly_refused_count:
          type: integer
          format: int64
          description: Passages today's policies allow and the proposal would refuse.
          minimum: 0
        newly_allowed:
          type: array
          items:
            $ref: '#/components/schemas/DryRunPassage'
          description: Up to 100 of them, most recent first.
        newly_refused:
          type: array
          items:
            $ref: '#/components/schemas/DryRunPassage'
          description: Up to 100 of them, most recent first.
        people_gaining:
          type: array
          items:
            $ref: '#/components/schemas/PersonId'
          description: |-
            People with a passage the proposal would allow and today's policies
            refuse.
        people_losing:
          type: array
          items:
            $ref: '#/components/schemas/PersonId'
          description: |-
            People with a passage the proposal would refuse and today's policies
            allow: who would be locked out of where they go.
    AccessPoint:
      type: object
      description: |-
        One controlled way from one area into another. Access profiles grant
        access to access points, and readers serve them.
      required:
      - id
      - etag
      - site_id
      - name
      - description
      - door_id
      - area_from_id
      - area_to_id
      - enabled
      - labels
      - managed_by
      - created_at
      - updated_at
      properties:
        id:
          $ref: '#/components/schemas/AccessPointId'
          description: Access point ID.
        etag:
          $ref: '#/components/schemas/ETag'
          description: Current version.
        site_id:
          $ref: '#/components/schemas/SiteId'
          description: The site the access point is at. Cannot change.
        name:
          type: string
          description: Display name, unique within the site.
          examples:
          - Lab 3 entry
        description:
          type: string
          description: Free text.
        door_id:
          oneOf:
          - $ref: '#/components/schemas/DoorId'
            description: The door this access point controls, at the same site; `null` for one without a door, such as an elevator floor.
          - type: 'null'
        area_from_id:
          oneOf:
          - $ref: '#/components/schemas/AreaId'
            description: The area people leave through this access point, at the same site (ONVIF `AreaFrom`).
          - type: 'null'
        area_to_id:
          oneOf:
          - $ref: '#/components/schemas/AreaId'
            description: The area people enter through this access point, at the same site (ONVIF `AreaTo`).
          - type: 'null'
        enabled:
          type: boolean
          description: A disabled access point refuses every credential.
        policy_mode:
          $ref: '#/components/schemas/PolicyMode'
          description: |-
            `enforce` keeps out whoever the access policies don't allow; `audit`
            lets in anyone with a working credential of the organization and
            records whether the policies allowed them; `warn` does the same and
            raises `com.passway.access.policy_warning` too (as Kubernetes Pod
            Security admission's modes). A reader serving several access points
            lets people in only when none of them is in `enforce`.
        timekeeping:
          type: boolean
          description: |-
            Whether passages here are time clock punches (#324): each grant here
            also raises `com.passway.time.punch`, `in` when it leads into the
            site from outside and `out` when it leads out. Off by default.
        labels:
          $ref: '#/components/schemas/Labels'
          description: Labels.
        managed_by:
          type:
          - string
          - 'null'
          description: The tool that manages this resource, such as `terraform`.
          examples:
          - terraform
        created_at:
          $ref: '#/components/schemas/Timestamp'
          description: When the access point was created.
        updated_at:
          $ref: '#/components/schemas/Timestamp'
          description: When the access point last changed.
    AccessPointCount:
      type: object
      description: A count of denials at one access point.
      required:
      - access_point_id
      - count
      properties:
        access_point_id:
          type: string
          description: The access point.
        count:
          type: integer
          format: int64
          description: How many.
          minimum: 0
    AccessPointCreate:
      type: object
      description: Body of `POST /v1/access-points`.
      required:
      - site_id
      - name
      properties:
        site_id:
          $ref: '#/components/schemas/SiteId'
          description: The site the access point is at.
        name:
          type: string
          description: Display name, unique within the site.
          examples:
          - Lab 3 entry
          maxLength: 128
          minLength: 1
        description:
          type: string
          description: Free text.
          maxLength: 1024
        door_id:
          $ref: '#/components/schemas/DoorId'
          description: The door this access point controls, at the same site.
        area_from_id:
          $ref: '#/components/schemas/AreaId'
          description: The area people leave through this access point, at the same site.
        area_to_id:
          $ref: '#/components/schemas/AreaId'
          description: The area people enter through this access point, at the same site.
        enabled:
          type: boolean
          description: Whether the access point accepts credentials.
          default: true
        policy_mode:
          $ref: '#/components/schemas/PolicyMode'
          description: |-
            `enforce` (the default), `audit` (let in anyone with a working
            credential of the organization, and record whether the access
            policies allowed them) or `warn` (`audit`, and raise
            `com.passway.access.policy_warning`).
        timekeeping:
          type: boolean
          description: |-
            Whether passages here are time clock punches (`com.passway.time.punch`).
            Off by default.
        labels:
          $ref: '#/components/schemas/Labels'
          description: Labels.
        managed_by:
          type: string
          description: The tool that manages this resource. Terraform sets `terraform`.
          examples:
          - terraform
          maxLength: 64
          pattern: ^[a-z0-9_-]{1,64}$
      additionalProperties: false
    AccessPointId:
      type: string
      description: 'Access point ID: `ap_` followed by 1 to 64 lowercase letters and digits.'
      examples:
      - ap_01jd8k3m2v9x4q7r5t6w8y0z1a
      maxLength: 67
      pattern: ^ap_[0-9a-z]{1,64}$
    AccessPointList:
      type: object
      required:
      - data
      - next_page_token
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/AccessPoint'
        next_page_token:
          type:
          - string
          - 'null'
          description: Pass as `page_token` to get the next page; `null` on the last page.
    AccessPointUpdate:
      type: object
      description: Body of `PATCH /v1/access-points/{access_point_id}`, a JSON merge patch.
      properties:
        name:
          type: string
          description: New name.
          maxLength: 128
          minLength: 1
        description:
          type: string
          description: New description.
          maxLength: 1024
        door_id:
          oneOf:
          - $ref: '#/components/schemas/DoorId'
            description: New door, or `null` for none.
          - type: 'null'
        area_from_id:
          oneOf:
          - $ref: '#/components/schemas/AreaId'
            description: New area people leave, or `null` for none.
          - type: 'null'
        area_to_id:
          oneOf:
          - $ref: '#/components/schemas/AreaId'
            description: New area people enter, or `null` for none.
          - type: 'null'
        enabled:
          type: boolean
          description: Enable or disable the access point.
        policy_mode:
          $ref: '#/components/schemas/PolicyMode'
          description: '`enforce`, `audit` or `warn`.'
        timekeeping:
          type: boolean
          description: Make passages here time clock punches, or stop.
        labels:
          oneOf:
          - $ref: '#/components/schemas/LabelsPatch'
            description: Labels to set or remove, or `null` to remove every label.
          - type: 'null'
        managed_by:
          type:
          - string
          - 'null'
          description: New managing tool, or `null` to clear it.
          maxLength: 64
          pattern: ^[a-z0-9_-]{1,64}$
      additionalProperties: false
    AccessPolicy:
      type: object
      description: |-
        Where, when and what: one rule in an access profile (ONVIF `AccessPolicy`).

        An area means the access points that lead into it, not those of the
        areas inside it: access to a floor does not open its server room. A
        zone means its areas; a site means every access point at the site,
        including ones added later.
      properties:
        access_point_ids:
          type: array
          items:
            $ref: '#/components/schemas/AccessPointId'
          description: These access points.
          maxItems: 1000
        area_ids:
          type: array
          items:
            $ref: '#/components/schemas/AreaId'
          description: The access points into these areas.
          maxItems: 1000
        zone_ids:
          type: array
          items:
            $ref: '#/components/schemas/ZoneId'
          description: The access points into these zones' areas.
          maxItems: 1000
        site_ids:
          type: array
          items:
            $ref: '#/components/schemas/SiteId'
          description: Every access point at these sites.
          maxItems: 1000
        schedule_id:
          $ref: '#/components/schemas/ScheduleId'
          description: When the policy applies. Leave out for at all times.
        capabilities:
          type: array
          items:
            $ref: '#/components/schemas/Capability'
          description: What it allows. Defaults to `momentary_unsecure`.
          default:
          - momentary_unsecure
          maxItems: 5
          minItems: 1
      additionalProperties: false
    AccessProfile:
      type: object
      description: |-
        A named set of access policies: where and when, ready to give to people
        with an access assignment (ONVIF `AccessProfile`).
      required:
      - id
      - etag
      - name
      - description
      - access_policies
      - labels
      - managed_by
      - created_at
      - updated_at
      properties:
        id:
          $ref: '#/components/schemas/AccessProfileId'
          description: Access profile ID.
        etag:
          $ref: '#/components/schemas/ETag'
          description: Current version.
        name:
          type: string
          description: Display name, unique within the organization.
          examples:
          - hq-weekdays
        description:
          type: string
          description: Free text.
        access_policies:
          type: array
          items:
            $ref: '#/components/schemas/AccessPolicy'
          description: The policies, 1 to 32. Access is allowed if any policy allows it.
        labels:
          $ref: '#/components/schemas/Labels'
          description: Labels.
        managed_by:
          type:
          - string
          - 'null'
          description: The tool that manages this resource, such as `terraform`.
          examples:
          - terraform
        created_at:
          $ref: '#/components/schemas/Timestamp'
          description: When the profile was created.
        updated_at:
          $ref: '#/components/schemas/Timestamp'
          description: When the profile last changed.
    AccessProfileCreate:
      type: object
      description: Body of `POST /v1/access-profiles`.
      required:
      - name
      - access_policies
      properties:
        name:
          type: string
          description: Display name, unique within the organization.
          examples:
          - hq-weekdays
          maxLength: 128
          minLength: 1
        description:
          type: string
          description: Free text.
          maxLength: 1024
        access_policies:
          type: array
          items:
            $ref: '#/components/schemas/AccessPolicy'
          description: The policies, 1 to 32.
          maxItems: 32
          minItems: 1
        labels:
          $ref: '#/components/schemas/Labels'
          description: Labels.
        managed_by:
          type: string
          description: The tool that manages this resource. Terraform sets `terraform`.
          examples:
          - terraform
          maxLength: 64
          pattern: ^[a-z0-9_-]{1,64}$
      additionalProperties: false
    AccessProfileDryRun:
      type: object
      description: |-
        Body of `POST /v1/access-profiles:dry-run` (#76): access policies to try
        against the passages people actually made, before giving them to
        anyone.
      required:
      - access_policies
      properties:
        access_policies:
          type: array
          items:
            $ref: '#/components/schemas/AccessPolicy'
          description: The proposed policies.
          maxItems: 32
          minItems: 1
        replaces:
          $ref: '#/components/schemas/AccessProfileId'
          description: Try them in place of this profile's, for everyone it is assigned to.
        person_ids:
          type: array
          items:
            $ref: '#/components/schemas/PersonId'
          description: Try them as a new profile assigned to these people…
          maxItems: 1000
        group_ids:
          type: array
          items:
            $ref: '#/components/schemas/GroupId'
          description: …and to these groups' members.
          maxItems: 1000
        from:
          $ref: '#/components/schemas/Timestamp'
          description: The passages from this time; 7 days before `to` by default.
        to:
          $ref: '#/components/schemas/Timestamp'
          description: The passages up to this time, not included; now by default.
      additionalProperties: false
    AccessProfileId:
      type: string
      description: 'Access profile ID: `prof_` followed by 1 to 64 lowercase letters and digits.'
      examples:
      - prof_01jd8k3m2v9x4q7r5t6w8y0z1a
      maxLength: 69
      pattern: ^prof_[0-9a-z]{1,64}$
    AccessProfileList:
      type: object
      required:
      - data
      - next_page_token
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/AccessProfile'
        next_page_token:
          type:
          - string
          - 'null'
          description: Pass as `page_token` to get the next page; `null` on the last page.
    AccessProfileUpdate:
      type: object
      description: |-
        Body of `PATCH /v1/access-profiles/{access_profile_id}`, a JSON merge
        patch. `access_policies` replaces every policy.
      properties:
        name:
          type: string
          description: New name.
          maxLength: 128
          minLength: 1
        description:
          type: string
          description: New description.
          maxLength: 1024
        access_policies:
          type: array
          items:
            $ref: '#/components/schemas/AccessPolicy'
          description: New policies, replacing the current ones.
          maxItems: 32
          minItems: 1
        labels:
          oneOf:
          - $ref: '#/components/schemas/LabelsPatch'
            description: Labels to set or remove, or `null` to remove every label.
          - type: 'null'
        managed_by:
          type:
          - string
          - 'null'
          description: New managing tool, or `null` to clear it.
          maxLength: 64
          pattern: ^[a-z0-9_-]{1,64}$
      additionalProperties: false
    AccessSummary:
      type: object
      description: Decisions at doors over the whole window.
      required:
      - granted
      - denied
      - denied_by_reason
      - denied_by_access_point
      properties:
        granted:
          type: integer
          format: int64
          description: Doors opened.
          minimum: 0
        denied:
          type: integer
          format: int64
          description: People turned away.
          minimum: 0
        denied_by_reason:
          type: array
          items:
            $ref: '#/components/schemas/DenialReasonCount'
          description: Denials by reason, most first.
        denied_by_access_point:
          type: array
          items:
            $ref: '#/components/schemas/AccessPointCount'
          description: 'The access points with the most denials, most first: at most five.'
        granted_not_permitted:
          type: integer
          format: int64
          description: |-
            Doors opened in audit mode for people the access policies did not
            allow (`permitted: false`, #382). Counted in `granted` too.
          minimum: 0
    Accounted:
      type: object
      description: Someone counted off.
      required:
      - person_id
      - at
      - by
      - access_point_id
      properties:
        person_id:
          $ref: '#/components/schemas/PersonId'
          description: The person.
        at:
          $ref: '#/components/schemas/Timestamp'
          description: When.
        by:
          $ref: '#/components/schemas/AccountedBy'
          description: How.
        access_point_id:
          oneOf:
          - $ref: '#/components/schemas/AccessPointId'
            description: Where, for a muster point or a way out.
          - type: 'null'
    AccountedBy:
      type: string
      description: How someone was counted off.
      enum:
      - muster_point
      - left_site
      - warden
    ActorKind:
      type: string
      description: Who or what caused an event.
      enum:
      - person
      - api_client
      - reader
      - connector
      - agent
      - system
    Address:
      type: object
      description: A postal address. Field names follow schema.org `PostalAddress`.
      required:
      - lines
      - country
      properties:
        lines:
          type: array
          items:
            type: string
            maxLength: 128
          description: Street lines, 1 to 4, each at most 128 characters.
          maxItems: 4
          minItems: 1
        locality:
          type: string
          description: City or town (`addressLocality`).
          examples:
          - New York
          maxLength: 128
        region:
          type: string
          description: State, province or region (`addressRegion`).
          examples:
          - NY
          maxLength: 128
        postal_code:
          type: string
          description: Postal code.
          examples:
          - '10118'
          maxLength: 32
        country:
          type: string
          description: ISO 3166-1 alpha-2 country code.
          examples:
          - US
          pattern: ^[A-Z]{2}$
      additionalProperties: false
    AddressPatch:
      type: object
      description: |-
        An address in a merge patch: fields left out are unchanged, and `null`
        resets an optional field to empty.
      properties:
        lines:
          type: array
          items:
            type: string
            maxLength: 128
          description: 'New street lines, replacing the current ones: 1 to 4, each at most 128 characters.'
          maxItems: 4
          minItems: 1
        locality:
          type:
          - string
          - 'null'
          description: New city or town.
          maxLength: 128
        region:
          type:
          - string
          - 'null'
          description: New state, province or region.
          maxLength: 128
        postal_code:
          type:
          - string
          - 'null'
          description: New postal code.
          maxLength: 32
        country:
          type: string
          description: New country code.
          pattern: ^[A-Z]{2}$
      additionalProperties: false
    Agent:
      type: object
      description: An agent.
      required:
      - id
      - etag
      - name
      - description
      - kind
      - sponsor_id
      - operator
      - status
      - suspended_reason
      - expires_at
      - scopes
      - workload_audiences
      - federated_credentials
      - jwks
      - labels
      - managed_by
      - created_at
      - updated_at
      properties:
        id:
          $ref: '#/components/schemas/AgentId'
          description: 'Agent ID: also its OAuth client ID.'
        etag:
          $ref: '#/components/schemas/ETag'
          description: Current version, for `If-Match`.
        name:
          type: string
          description: Unique in the organization.
          examples:
          - lobby-delivery-bot
        description:
          type: string
          description: What it is for.
        kind:
          $ref: '#/components/schemas/AgentKind'
          description: Software or a robot.
        sponsor_id:
          $ref: '#/components/schemas/PersonId'
          description: The person accountable for it.
        operator:
          type: string
          description: 'Who built or runs it: the AI or robot vendor.'
          examples:
          - acme-robotics
        status:
          $ref: '#/components/schemas/AgentStatus'
          description: Whether it may act. Changed only by `:suspend` and `:resume`.
        suspended_reason:
          type:
          - string
          - 'null'
          description: Why it was suspended.
        expires_at:
          $ref: '#/components/schemas/Timestamp'
          description: When it stops working.
        scopes:
          type: array
          items:
            type: string
          description: The scopes its tokens may carry.
        workload_audiences:
          type: array
          items:
            type: string
          description: |-
            The audiences this may ask for workload tokens for: short-lived JWTs
            that other platforms trust, such as `sts.amazonaws.com`. Exact
            strings; empty means none.
        federated_credentials:
          type: array
          items:
            $ref: '#/components/schemas/FederatedCredential'
          description: |-
            Outside identities this trusts instead of a secret (see
            `docs/federated-credentials.md`).
        jwks:
          type: object
          description: 'Its public keys, as a JWKS: it signs client assertions with one.'
        labels:
          $ref: '#/components/schemas/Labels'
          description: Labels.
        managed_by:
          type:
          - string
          - 'null'
          description: The tool that manages it, if any.
        created_at:
          $ref: '#/components/schemas/Timestamp'
          description: When it was created.
        updated_at:
          $ref: '#/components/schemas/Timestamp'
          description: When it last changed.
    AgentCreate:
      type: object
      description: Body of `POST /v1/agents`.
      required:
      - name
      - kind
      - sponsor_id
      - operator
      - jwks
      properties:
        name:
          type: string
          description: Unique in the organization.
          maxLength: 128
          minLength: 1
        description:
          type: string
          description: What it is for.
          maxLength: 1024
        kind:
          $ref: '#/components/schemas/AgentKind'
          description: Software or a robot.
        sponsor_id:
          $ref: '#/components/schemas/PersonId'
          description: 'The person accountable for it: an active person.'
        operator:
          type: string
          description: Who built or runs it.
          maxLength: 128
          minLength: 1
        expires_at:
          $ref: '#/components/schemas/Timestamp'
          description: 'When it stops working: within a year. Default 90 days from now.'
        scopes:
          type: array
          items:
            type: string
          description: |-
            The scopes its tokens may carry. Never the ones that manage
            identity or access; and only scopes the creator holds.
        workload_audiences:
          type: array
          items:
            type: string
          description: |-
            The audiences this may ask for workload tokens for (see
            `POST /oauth/token` with `audience`): at most 10 exact strings.
          maxItems: 10
        federated_credentials:
          type: array
          items:
            $ref: '#/components/schemas/FederatedCredential'
          description: |-
            Outside identities this trusts instead of a secret: tokens another
            platform issues to a workload, such as a GitHub Actions job.
          maxItems: 20
        jwks:
          type: object
          description: |-
            Its public keys, as a JWKS (`{"keys": [...]}`): EC P-256 or RSA,
            at most five, never a private key.
        labels:
          $ref: '#/components/schemas/Labels'
          description: Labels.
        managed_by:
          type: string
          description: The tool that manages it, if any.
          maxLength: 64
          pattern: ^[a-z0-9_-]{1,64}$
      additionalProperties: false
    AgentId:
      type: string
      description: 'Agent ID: `agt_` followed by 1 to 64 lowercase letters and digits.'
      examples:
      - agt_01jd8k3m2v9x4q7r5t6w8y0z1a
      maxLength: 68
      pattern: ^agt_[0-9a-z]{1,64}$
    AgentKind:
      type: string
      description: Software or a robot.
      enum:
      - software
      - robot
    AgentList:
      type: object
      required:
      - data
      - next_page_token
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/Agent'
        next_page_token:
          type:
          - string
          - 'null'
          description: Pass as `page_token` to get the next page; `null` on the last page.
    AgentStatus:
      type: string
      description: Whether an agent may act.
      enum:
      - active
      - suspended
    AgentSuspend:
      type: object
      description: Body of `POST /v1/agents/{agent_id}:suspend`.
      properties:
        reason:
          type: string
          description: Why, for the log and the sponsor.
          maxLength: 1024
      additionalProperties: false
    AgentUpdate:
      type: object
      description: |-
        Body of `PATCH /v1/agents/{agent_id}`, a JSON merge patch. The status
        changes only with `:suspend` and `:resume`.
      properties:
        name:
          type: string
          description: New name.
          maxLength: 128
          minLength: 1
        description:
          type: string
          description: New description.
          maxLength: 1024
        sponsor_id:
          $ref: '#/components/schemas/PersonId'
          description: 'A new sponsor: an active person.'
        operator:
          type: string
          description: New operator.
        expires_at:
          $ref: '#/components/schemas/Timestamp'
          description: 'A new expiry, within a year of now: how a sponsor renews it.'
        scopes:
          type: array
          items:
            type: string
          description: New scopes.
        workload_audiences:
          type: array
          items:
            type: string
          description: New workload audiences, replacing the current ones.
          maxItems: 10
        federated_credentials:
          type: array
          items:
            $ref: '#/components/schemas/FederatedCredential'
          description: New federated credentials, replacing the current ones.
          maxItems: 20
        jwks:
          type: object
          description: New keys.
        labels:
          oneOf:
          - $ref: '#/components/schemas/LabelsPatch'
            description: Labels to set; `null` values remove a label.
          - type: 'null'
        managed_by:
          type:
          - string
          - 'null'
          description: The tool that manages it; `null` clears it.
          maxLength: 64
          pattern: ^[a-z0-9_-]{1,64}$
      additionalProperties: false
    AgentsSuspend:
      type: object
      description: |-
        Body of `POST /v1/agents:suspend`: the kill switch for many agents. Name
        exactly one of a sponsor, an operator, or all.
      properties:
        sponsor_id:
          $ref: '#/components/schemas/PersonId'
          description: Every agent this person sponsors.
        operator:
          type: string
          description: Every agent from this operator.
        all:
          type: boolean
          description: Every agent in the organization.
        reason:
          type: string
          description: Why, for the log.
          maxLength: 1024
      additionalProperties: false
    AgentsSuspended:
      type: object
      description: The agents a kill switch suspended.
      required:
      - suspended
      properties:
        suspended:
          type: array
          items:
            $ref: '#/components/schemas/AgentId'
          description: Those it suspended now; those already suspended are not listed.
    AntiPassback:
      type: string
      description: |-
        Whether Passway checks that people leave an area before they enter it
        again (#75). Readers decide taps on their own, offline, so Passway checks
        after the fact and raises `com.passway.access.passback`, much as soft
        anti-passback works in other systems; it never keeps anyone out.
      enum:
      - off
      - soft
    ApiClient:
      type: object
      description: |-
        An API client: a program that calls the API with credentials of its own,
        such as Terraform, CI, a connector or an agent. It gets access tokens from
        its organization's token endpoint with the OAuth 2.0 client credentials
        grant (RFC 6749 §4.4), and every token carries at most the client's
        scopes. The secret is shown once, when the client is created or its
        secret is rotated.
      required:
      - id
      - etag
      - name
      - description
      - scopes
      - workload_audiences
      - federated_credentials
      - labels
      - managed_by
      - created_at
      - updated_at
      properties:
        id:
          $ref: '#/components/schemas/ApiClientId'
          description: API client ID. It is also the OAuth `client_id`.
        etag:
          $ref: '#/components/schemas/ETag'
          description: Current version.
        name:
          type: string
          description: Display name, unique within the organization.
          examples:
          - terraform-ci
        description:
          type: string
          description: Free text.
        scopes:
          type: array
          items:
            type: string
          description: |-
            The scopes the client's access tokens may carry, from the `oauth2`
            security scheme.
        workload_audiences:
          type: array
          items:
            type: string
          description: |-
            The audiences this may ask for workload tokens for: short-lived JWTs
            that other platforms trust, such as `sts.amazonaws.com`. Exact
            strings; empty means none.
        federated_credentials:
          type: array
          items:
            $ref: '#/components/schemas/FederatedCredential'
          description: |-
            Outside identities this trusts instead of a secret (see
            `docs/federated-credentials.md`).
        labels:
          $ref: '#/components/schemas/Labels'
          description: Labels.
        managed_by:
          type:
          - string
          - 'null'
          description: The tool that manages this resource, such as `terraform`.
          examples:
          - terraform
        created_at:
          $ref: '#/components/schemas/Timestamp'
          description: When the client was created.
        updated_at:
          $ref: '#/components/schemas/Timestamp'
          description: When the client last changed.
    ApiClientCreate:
      type: object
      description: Body of `POST /v1/api-clients`.
      required:
      - name
      - scopes
      properties:
        name:
          type: string
          description: Display name, unique within the organization.
          examples:
          - terraform-ci
          maxLength: 128
          minLength: 1
        description:
          type: string
          description: Free text.
          maxLength: 1024
        scopes:
          type: array
          items:
            type: string
          description: |-
            The scopes the client's access tokens may carry, from the `oauth2`
            security scheme. A caller can give only scopes it has itself.
          minItems: 1
        workload_audiences:
          type: array
          items:
            type: string
          description: |-
            The audiences this may ask for workload tokens for (see
            `POST /oauth/token` with `audience`): at most 10 exact strings.
          maxItems: 10
        federated_credentials:
          type: array
          items:
            $ref: '#/components/schemas/FederatedCredential'
          description: |-
            Outside identities this trusts instead of a secret: tokens another
            platform issues to a workload, such as a GitHub Actions job.
          maxItems: 20
        labels:
          $ref: '#/components/schemas/Labels'
          description: Labels.
        managed_by:
          type: string
          description: The tool that manages this resource. Terraform sets `terraform`.
          examples:
          - terraform
          maxLength: 64
          pattern: ^[a-z0-9_-]{1,64}$
      additionalProperties: false
    ApiClientId:
      type: string
      description: 'API client ID: `apc_` followed by 1 to 64 lowercase letters and digits.'
      examples:
      - apc_01jd8k3m2v9x4q7r5t6w8y0z1a
      maxLength: 68
      pattern: ^apc_[0-9a-z]{1,64}$
    ApiClientList:
      type: object
      required:
      - data
      - next_page_token
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/ApiClient'
        next_page_token:
          type:
          - string
          - 'null'
          description: Pass as `page_token` to get the next page; `null` on the last page.
    ApiClientSecret:
      type: object
      description: |-
        Response to `POST /v1/api-clients` and
        `POST /v1/api-clients/{api_client_id}:rotate-secret`: the client and its
        secret. The secret is never shown again; Passway keeps only its hash.
      required:
      - api_client
      - client_secret
      properties:
        api_client:
          $ref: '#/components/schemas/ApiClient'
          description: The client.
        client_secret:
          type: string
          description: |-
            The client secret, for the token endpoint with HTTP Basic
            authentication (`client_secret_basic`) or in the form
            (`client_secret_post`).
          examples:
          - pwcs_7Hq2kX9vN4mP8sL3wQ5rT1yU6iO0pA2s
    ApiClientUpdate:
      type: object
      description: |-
        Body of `PATCH /v1/api-clients/{api_client_id}`, a JSON merge patch.
        Changing `scopes` revokes the client's access tokens; it gets new ones
        with the new scopes.
      properties:
        name:
          type: string
          description: New name.
          maxLength: 128
          minLength: 1
        description:
          type: string
          description: New description.
          maxLength: 1024
        scopes:
          type: array
          items:
            type: string
          description: New scopes, replacing the current ones.
          minItems: 1
        workload_audiences:
          type: array
          items:
            type: string
          description: New workload audiences, replacing the current ones.
          maxItems: 10
        federated_credentials:
          type: array
          items:
            $ref: '#/components/schemas/FederatedCredential'
          description: New federated credentials, replacing the current ones.
          maxItems: 20
        labels:
          oneOf:
          - $ref: '#/components/schemas/LabelsPatch'
            description: Labels to set or remove, or `null` to remove every label.
          - type: 'null'
        managed_by:
          type:
          - string
          - 'null'
          description: New managing tool, or `null` to clear it.
          maxLength: 64
          pattern: ^[a-z0-9_-]{1,64}$
      additionalProperties: false
    App:
      type: object
      description: |-
        An app: another application that people sign in to with Passway, as an
        OpenID Connect relying party. Only members of the app's groups can sign
        in to it; an app with no groups lets nobody in. Its ID is also its
        OAuth `client_id`.
      required:
      - id
      - etag
      - name
      - description
      - redirect_uris
      - group_ids
      - client_type
      - id_token_signed_response_alg
      - labels
      - managed_by
      - created_at
      - updated_at
      properties:
        id:
          $ref: '#/components/schemas/AppId'
          description: App ID. It is also the OAuth `client_id`.
        etag:
          $ref: '#/components/schemas/ETag'
          description: Current version.
        name:
          type: string
          description: |-
            Display name, unique within the organization. People see it when
            they sign in.
          examples:
          - Expenses
        description:
          type: string
          description: Free text.
        redirect_uris:
          type: array
          items:
            type: string
          description: |-
            Where Passway may send people back after they sign in: exact `https`
            URLs, or `http` on a loopback address (`127.0.0.1` or `[::1]`, any
            port) for native apps (RFC 8252).
        post_logout_redirect_uris:
          type: array
          items:
            type: string
          description: |-
            Where Passway may send people after they sign out at the end session
            endpoint (`post_logout_redirect_uri`, OpenID Connect RP-Initiated
            Logout), under the same rules as `redirect_uris`.
        group_ids:
          type: array
          items:
            $ref: '#/components/schemas/GroupId'
          description: The groups whose members may sign in. Nobody else can.
        client_type:
          $ref: '#/components/schemas/AppClientType'
          description: |-
            `confidential` for a server that keeps a client secret; `public`
            for a browser or native app that can't, and proves itself with PKCE
            alone. Set when the app is created.
        id_token_signed_response_alg:
          $ref: '#/components/schemas/IdTokenAlg'
          description: The algorithm its ID tokens are signed with.
        offline_access:
          type: boolean
          description: |-
            Whether people stay signed in to the app between visits: it may ask
            for the `offline_access` scope and get a refresh token, which works
            for 7 days unused and 30 days in all, and is replaced each time it is
            used. Off by default. Turning it off ends those sign-ins at their next
            refresh.
        pkce_required:
          type: boolean
          description: |-
            Whether the app must use PKCE (RFC 7636): an S256 `code_challenge`
            with every sign-in, and its verifier with the code. On by default,
            and always on for a public app. Only a confidential app can turn it
            off, for a library that doesn't send PKCE; it then relies on its
            secret and the ID token's `nonce` (RFC 9700 §2.1.1). A sign-in that
            sends a challenge must still redeem its code with the verifier.
        labels:
          $ref: '#/components/schemas/Labels'
          description: Labels.
        managed_by:
          type:
          - string
          - 'null'
          description: The tool that manages this resource, such as `terraform`.
          examples:
          - terraform
        created_at:
          $ref: '#/components/schemas/Timestamp'
          description: When the app was created.
        updated_at:
          $ref: '#/components/schemas/Timestamp'
          description: When the app last changed.
    AppClientType:
      type: string
      description: Whether an app can keep a secret.
      enum:
      - confidential
      - public
    AppCreate:
      type: object
      description: Body of `POST /v1/apps`.
      required:
      - name
      - redirect_uris
      properties:
        name:
          type: string
          description: Display name, unique within the organization.
          examples:
          - Expenses
          maxLength: 128
          minLength: 1
        description:
          type: string
          description: Free text.
          maxLength: 1024
        redirect_uris:
          type: array
          items:
            type: string
          description: |-
            Where Passway may send people back: exact `https` URLs, or `http` on
            `127.0.0.1` or `[::1]` for native apps. No fragments, no user
            information.
          maxItems: 20
          minItems: 1
        post_logout_redirect_uris:
          type: array
          items:
            type: string
          description: |-
            Where Passway may send people after they sign out, under the same
            rules. None by default.
          maxItems: 20
        group_ids:
          type: array
          items:
            $ref: '#/components/schemas/GroupId'
          description: The groups whose members may sign in. Empty lets nobody in.
        client_type:
          $ref: '#/components/schemas/AppClientType'
          description: |-
            `confidential` (the default) gets a client secret; `public` gets
            none and must use PKCE. Can't be changed later.
        id_token_signed_response_alg:
          $ref: '#/components/schemas/IdTokenAlg'
          description: 'The algorithm its ID tokens are signed with: `ES256` by default.'
        offline_access:
          type: boolean
          description: |-
            Whether people stay signed in to the app between visits: it may ask
            for the `offline_access` scope and get a refresh token, which works
            for 7 days unused and 30 days in all, and is replaced each time it is
            used. Off by default. Turning it off ends those sign-ins at their next
            refresh.
        pkce_required:
          type: boolean
          description: |-
            Whether the app must use PKCE (RFC 7636): an S256 `code_challenge`
            with every sign-in, and its verifier with the code. On by default,
            and always on for a public app. Only a confidential app can turn it
            off, for a library that doesn't send PKCE; it then relies on its
            secret and the ID token's `nonce` (RFC 9700 §2.1.1). A sign-in that
            sends a challenge must still redeem its code with the verifier.
          default: true
        labels:
          $ref: '#/components/schemas/Labels'
          description: Labels.
        managed_by:
          type: string
          description: The tool that manages this resource. Terraform sets `terraform`.
          examples:
          - terraform
          maxLength: 64
          pattern: ^[a-z0-9_-]{1,64}$
      additionalProperties: false
    AppId:
      type: string
      description: 'App ID: `app_` followed by 1 to 64 lowercase letters and digits.'
      examples:
      - app_01jd8k3m2v9x4q7r5t6w8y0z1a
      maxLength: 68
      pattern: ^app_[0-9a-z]{1,64}$
    AppList:
      type: object
      required:
      - data
      - next_page_token
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/App'
        next_page_token:
          type:
          - string
          - 'null'
          description: Pass as `page_token` to get the next page; `null` on the last page.
    AppSecret:
      type: object
      description: |-
        Response to `POST /v1/apps` and `POST /v1/apps/{app_id}:rotate-secret`:
        the app and, for a confidential app, its client secret. The secret is
        never shown again; Passway keeps only its hash.
      required:
      - app
      - client_secret
      properties:
        app:
          $ref: '#/components/schemas/App'
          description: The app.
        client_secret:
          type:
          - string
          - 'null'
          description: |-
            The client secret, for the token endpoint (`client_secret_basic` or
            `client_secret_post`); `null` for a public app.
          examples:
          - pwas_7Hq2kX9vN4mP8sL3wQ5rT1yU6iO0pA2s
    AppUpdate:
      type: object
      description: Body of `PATCH /v1/apps/{app_id}`, a JSON merge patch.
      properties:
        name:
          type: string
          description: New name.
          maxLength: 128
          minLength: 1
        description:
          type: string
          description: New description.
          maxLength: 1024
        redirect_uris:
          type: array
          items:
            type: string
          description: New redirect URIs, replacing the current ones.
          maxItems: 20
          minItems: 1
        post_logout_redirect_uris:
          type: array
          items:
            type: string
          description: |-
            New post-logout redirect URIs, replacing the current ones; `[]` for
            none.
          maxItems: 20
        group_ids:
          type: array
          items:
            $ref: '#/components/schemas/GroupId'
          description: New groups, replacing the current ones.
        id_token_signed_response_alg:
          $ref: '#/components/schemas/IdTokenAlg'
          description: A new ID token algorithm.
        offline_access:
          type: boolean
          description: |-
            Whether people stay signed in with refresh tokens. Turning it off
            ends those sign-ins at their next refresh.
        pkce_required:
          type: boolean
          description: |-
            Whether the app must use PKCE. Only a confidential app can turn it
            off. Turning it on refuses codes issued without a challenge that
            haven't been redeemed yet.
        labels:
          oneOf:
          - $ref: '#/components/schemas/LabelsPatch'
            description: Labels to set or remove, or `null` to remove every label.
          - type: 'null'
        managed_by:
          type:
          - string
          - 'null'
          description: New managing tool, or `null` to clear it.
          maxLength: 64
          pattern: ^[a-z0-9_-]{1,64}$
      additionalProperties: false
    Area:
      type: object
      description: A place at a site, in a tree of areas.
      required:
      - id
      - etag
      - site_id
      - parent_id
      - name
      - description
      - kind
      - labels
      - managed_by
      - created_at
      - updated_at
      properties:
        id:
          $ref: '#/components/schemas/AreaId'
          description: Area ID.
        etag:
          $ref: '#/components/schemas/ETag'
          description: Current version.
        site_id:
          $ref: '#/components/schemas/SiteId'
          description: The site the area is at. Cannot change.
        parent_id:
          oneOf:
          - $ref: '#/components/schemas/AreaId'
            description: The area this one is inside, such as the floor of a room; `null` at the top of the site.
          - type: 'null'
        name:
          type: string
          description: Display name, unique among the parent's children.
          examples:
          - Floor 21
        description:
          type: string
          description: Free text.
        kind:
          $ref: '#/components/schemas/AreaKind'
          description: What kind of place this is.
        anti_passback:
          $ref: '#/components/schemas/AntiPassback'
          description: |-
            `soft` raises `com.passway.access.passback` when someone enters the
            area without having left it, or leaves without having entered.
        labels:
          $ref: '#/components/schemas/Labels'
          description: Labels.
        managed_by:
          type:
          - string
          - 'null'
          description: The tool that manages this resource, such as `terraform`.
          examples:
          - terraform
        created_at:
          $ref: '#/components/schemas/Timestamp'
          description: When the area was created.
        updated_at:
          $ref: '#/components/schemas/Timestamp'
          description: When the area last changed.
    AreaCreate:
      type: object
      description: Body of `POST /v1/areas`.
      required:
      - site_id
      - name
      properties:
        site_id:
          $ref: '#/components/schemas/SiteId'
          description: The site the area is at.
        parent_id:
          $ref: '#/components/schemas/AreaId'
          description: The area this one is inside. It must be at the same site.
        name:
          type: string
          description: Display name, unique among the parent's children.
          examples:
          - Floor 21
          maxLength: 128
          minLength: 1
        description:
          type: string
          description: Free text.
          maxLength: 1024
        kind:
          $ref: '#/components/schemas/AreaKind'
          description: What kind of place this is.
        anti_passback:
          $ref: '#/components/schemas/AntiPassback'
          description: |-
            `off` (the default) or `soft`: raise `com.passway.access.passback`
            when someone enters the area without having left it, or leaves
            without having entered.
        labels:
          $ref: '#/components/schemas/Labels'
          description: Labels.
        managed_by:
          type: string
          description: The tool that manages this resource. Terraform sets `terraform`.
          examples:
          - terraform
          maxLength: 64
          pattern: ^[a-z0-9_-]{1,64}$
      additionalProperties: false
    AreaId:
      type: string
      description: 'Area ID: `area_` followed by 1 to 64 lowercase letters and digits.'
      examples:
      - area_01jd8k3m2v9x4q7r5t6w8y0z1a
      maxLength: 69
      pattern: ^area_[0-9a-z]{1,64}$
    AreaKind:
      type: string
      description: What kind of place an area is.
      enum:
      - building
      - floor
      - wing
      - room
      - unit
      - parking
      - outdoor
      - other
    AreaList:
      type: object
      required:
      - data
      - next_page_token
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/Area'
        next_page_token:
          type:
          - string
          - 'null'
          description: Pass as `page_token` to get the next page; `null` on the last page.
    AreaOccupancy:
      type: object
      description: The people in one area.
      required:
      - area_id
      - site_id
      - count
      - total
      - people
      properties:
        area_id:
          $ref: '#/components/schemas/AreaId'
          description: The area.
        site_id:
          $ref: '#/components/schemas/SiteId'
          description: Its site.
        count:
          type: integer
          format: int64
          description: The people in this area itself, not counting the areas inside it.
          minimum: 0
        total:
          type: integer
          format: int64
          description: |-
            The people in this area and every area inside it, as a building
            counts the people on its floors.
          minimum: 0
        people:
          type: array
          items:
            $ref: '#/components/schemas/Occupant'
          description: The people in this area itself, most recent first.
    AreaUpdate:
      type: object
      description: |-
        Body of `PATCH /v1/areas/{area_id}`, a JSON merge patch. An area can move
        to another parent at the same site, but not to another site.
      properties:
        parent_id:
          oneOf:
          - $ref: '#/components/schemas/AreaId'
            description: New parent, or `null` to move the area to the top of the site.
          - type: 'null'
        name:
          type: string
          description: New name.
          maxLength: 128
          minLength: 1
        description:
          type: string
          description: New description.
          maxLength: 1024
        kind:
          $ref: '#/components/schemas/AreaKind'
          description: New kind.
        anti_passback:
          $ref: '#/components/schemas/AntiPassback'
          description: Turn the anti-passback check on (`soft`) or off.
        labels:
          oneOf:
          - $ref: '#/components/schemas/LabelsPatch'
            description: Labels to set or remove, or `null` to remove every label.
          - type: 'null'
        managed_by:
          type:
          - string
          - 'null'
          description: New managing tool, or `null` to clear it.
          maxLength: 64
          pattern: ^[a-z0-9_-]{1,64}$
      additionalProperties: false
    Attention:
      type: object
      description: Response to `GET /v1/attention`.
      required:
      - items
      - checked_at
      properties:
        items:
          type: array
          items:
            $ref: '#/components/schemas/AttentionItem'
          description: |-
            What needs attention, most severe first, then largest. Empty when all
            is clear. Only what the caller may read is included.
        checked_at:
          $ref: '#/components/schemas/Timestamp'
          description: When this was worked out.
    AttentionItem:
      type: object
      description: One thing that needs attention.
      required:
      - kind
      - severity
      - count
      - summary
      - ids
      properties:
        kind:
          $ref: '#/components/schemas/AttentionKind'
          description: What it is about.
        severity:
          $ref: '#/components/schemas/Severity'
          description: How much it matters.
        count:
          type: integer
          format: int64
          description: 'How many: readers, doors, people and so on.'
          minimum: 0
        summary:
          type: string
          description: A sentence for people.
          examples:
          - 2 readers haven't checked in for 5 minutes.
        ids:
          type: array
          items:
            type: string
          description: |-
            Up to 10 of the IDs it is about, to name (`GET /v1/display-names`) and
            link to.
    AttentionKind:
      type: string
      description: |-
        What an item is about. New kinds may be added: show an unknown one by
        its `summary`.
      enum:
      - musters
      - door_alarms
      - tailgating
      - face_mismatches
      - policy_warnings
      - passbacks
      - readers_offline
      - repeated_denials
      - unknown_credentials
      - break_glass_sign_ins
      - recovered_ids
      - connectors_failing
      - connectors_held
      - log_streams_failing
      - agents_expiring
      - devices_without_keys
      - issuer_rotation_waiting
      - domains_unrouted
      - domains_pending
      - people_without_pass
      - enrollments_pending
    AuthorizationSet:
      type: object
      description: Body of `POST /v1/log-streams/{log_stream_id}:set-authorization`.
      required:
      - authorization
      properties:
        authorization:
          type:
          - string
          - 'null'
          description: |-
            The new `Authorization` header, or `null` to send none. Required:
            leaving it out is not the same as `null`.
          maxLength: 4096
      additionalProperties: false
    Camera:
      type: object
      description: A camera watching access points.
      required:
      - id
      - etag
      - site_id
      - name
      - description
      - access_point_ids
      - face_recognition
      - enabled
      - labels
      - managed_by
      - created_at
      - updated_at
      properties:
        id:
          $ref: '#/components/schemas/CameraId'
          description: Camera ID.
        etag:
          $ref: '#/components/schemas/ETag'
          description: Current version.
        site_id:
          $ref: '#/components/schemas/SiteId'
          description: The site the camera is at. Cannot change.
        name:
          type: string
          description: Display name, unique within the site.
          examples:
          - Lobby turnstiles, east
        description:
          type: string
          description: Free text.
        access_point_ids:
          type: array
          items:
            $ref: '#/components/schemas/AccessPointId'
          description: The access points it watches, at the same site.
        face_recognition:
          type: boolean
          description: |-
            Whether it reports face recognition. Needs the organization's
            `face_recognition` on.
        enabled:
          type: boolean
          description: While false, its reports are refused.
        labels:
          $ref: '#/components/schemas/Labels'
          description: Labels.
        managed_by:
          type:
          - string
          - 'null'
          description: The tool that manages this resource, such as `terraform`.
          examples:
          - terraform
        created_at:
          $ref: '#/components/schemas/Timestamp'
          description: When the camera was created.
        updated_at:
          $ref: '#/components/schemas/Timestamp'
          description: When the camera last changed.
    CameraCreate:
      type: object
      description: Body of `POST /v1/cameras`.
      required:
      - site_id
      - name
      properties:
        site_id:
          $ref: '#/components/schemas/SiteId'
          description: The site the camera is at.
        name:
          type: string
          description: Display name, unique within the site.
          examples:
          - Lobby turnstiles, east
          maxLength: 128
          minLength: 1
        description:
          type: string
          description: Free text.
          maxLength: 1024
        access_point_ids:
          type: array
          items:
            $ref: '#/components/schemas/AccessPointId'
          description: The access points it watches, at the same site.
          maxItems: 16
        face_recognition:
          type: boolean
          description: |-
            Whether it reports face recognition. Off by default; needs the
            organization's `face_recognition` on.
        enabled:
          type: boolean
          description: Whether its reports are taken.
          default: true
        labels:
          $ref: '#/components/schemas/Labels'
          description: Labels.
        managed_by:
          type: string
          description: The tool that manages this resource. Terraform sets `terraform`.
          examples:
          - terraform
          maxLength: 64
          pattern: ^[a-z0-9_-]{1,64}$
      additionalProperties: false
    CameraId:
      type: string
      description: 'Camera ID: `cam_` followed by 1 to 64 lowercase letters and digits.'
      examples:
      - cam_01jd8k3m2v9x4q7r5t6w8y0z1a
      maxLength: 68
      pattern: ^cam_[0-9a-z]{1,64}$
    CameraList:
      type: object
      required:
      - data
      - next_page_token
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/Camera'
        next_page_token:
          type:
          - string
          - 'null'
          description: Pass as `page_token` to get the next page; `null` on the last page.
    CameraObservation:
      oneOf:
      - type: object
        description: |-
          People crossed the camera's line into an access point's area (ONVIF
          Profile M line crossing counter).
        required:
        - at
        - count
        - kind
        properties:
          at:
            $ref: '#/components/schemas/Timestamp'
            description: When.
          count:
            type: integer
            format: int32
            description: How many crossed.
            maximum: 1000
            minimum: 1
          access_point_id:
            oneOf:
            - $ref: '#/components/schemas/AccessPointId'
              description: |-
                The access point they went through, when the camera watches
                more than one; otherwise its one access point.
            - type: 'null'
          kind:
            type: string
            enum:
            - people_counted
      - type: object
        description: |-
          The camera recognized a face (ONVIF Profile M face recognition).
          Refused unless the organization and the camera have
          `face_recognition` on.
        required:
        - at
        - person_id
        - likelihood
        - kind
        properties:
          at:
            $ref: '#/components/schemas/Timestamp'
            description: When.
          person_id:
            oneOf:
            - $ref: '#/components/schemas/PersonId'
              description: |-
                The person the camera matched: its face records are named by
                Passway person IDs. `null` for a face it detected and could not
                match.
            - type: 'null'
          likelihood:
            type: number
            format: double
            description: How sure the camera was, from 0 to 1.
            maximum: 1
            minimum: 0
          access_point_id:
            oneOf:
            - $ref: '#/components/schemas/AccessPointId'
              description: The access point, as for `people_counted`.
            - type: 'null'
          kind:
            type: string
            enum:
            - face_recognized
      description: One thing a camera saw.
    CameraObservations:
      type: object
      description: Body of `POST /v1/cameras/{camera_id}:observe`.
      required:
      - observations
      properties:
        observations:
          type: array
          items:
            $ref: '#/components/schemas/CameraObservation'
          description: What the camera saw, at most 1,000 at a time.
          maxItems: 1000
      additionalProperties: false
    CameraUpdate:
      type: object
      description: Body of `PATCH /v1/cameras/{camera_id}`, a JSON merge patch.
      properties:
        name:
          type: string
          description: New name.
          maxLength: 128
          minLength: 1
        description:
          type: string
          description: New description.
          maxLength: 1024
        access_point_ids:
          type: array
          items:
            $ref: '#/components/schemas/AccessPointId'
          description: The access points it watches, replacing the current ones.
          maxItems: 16
        face_recognition:
          type: boolean
          description: Report face recognition, or stop.
        enabled:
          type: boolean
          description: Take its reports, or refuse them.
        labels:
          oneOf:
          - $ref: '#/components/schemas/LabelsPatch'
            description: Labels to set or remove, or `null` to remove every label.
          - type: 'null'
        managed_by:
          type:
          - string
          - 'null'
          description: New managing tool, or `null` to clear it.
          maxLength: 64
          pattern: ^[a-z0-9_-]{1,64}$
      additionalProperties: false
    Capability:
      type: string
      description: |-
        What a credential may do at an access point. The values are the Aliro
        `AccessRuleCapabilities`, which the reader enforces.
      enum:
      - momentary_unsecure
      - extended_momentary_unsecure
      - secure
      - unsecure
      - toggle_secure_or_unsecure
    CategoryCounts:
      type: object
      description: Counts of events by category.
      required:
      - access
      - directory
      - credentials
      - sign_in
      - configuration
      - system
      properties:
        access:
          type: integer
          format: int64
          description: Decisions at doors, door alarms, readers on and offline.
          minimum: 0
        directory:
          type: integer
          format: int64
          description: People, groups and directory sync.
          minimum: 0
        credentials:
          type: integer
          format: int64
          description: Wallet passes, invitations and passkeys.
          minimum: 0
        sign_in:
          type: integer
          format: int64
          description: Signing in.
          minimum: 0
        configuration:
          type: integer
          format: int64
          description: Setup changes.
          minimum: 0
        system:
          type: integer
          format: int64
          description: Housekeeping.
          minimum: 0
    ClientSecretSet:
      type: object
      description: Body of `POST /v1/identity-providers/{identity_provider_id}:set-client-secret`.
      required:
      - client_secret
      properties:
        client_secret:
          type: string
          description: The new client secret.
          writeOnly: true
          maxLength: 1024
          minLength: 1
      additionalProperties: false
    Connector:
      type: object
      description: A connector.
      required:
      - id
      - etag
      - name
      - description
      - kind
      - enabled
      - google_workspace
      - sync
      - labels
      - managed_by
      - created_at
      - updated_at
      properties:
        id:
          $ref: '#/components/schemas/ConnectorId'
          description: Connector ID.
        etag:
          $ref: '#/components/schemas/ETag'
          description: Current version, for `If-Match`.
        name:
          type: string
          description: Unique in the organization.
          examples:
          - okta
        description:
          type: string
          description: What it is for.
        kind:
          $ref: '#/components/schemas/ConnectorKind'
          description: How it gets people and groups. Set when it is created.
        enabled:
          type: boolean
          description: |-
            While false, its token is refused, it does not sync, and nothing it
            manages changes.
        google_workspace:
          oneOf:
          - $ref: '#/components/schemas/GoogleWorkspace'
            description: 'For `google_workspace`: where it reads from. `null` for other kinds.'
          - type: 'null'
        sync:
          oneOf:
          - $ref: '#/components/schemas/ConnectorSync'
            description: |-
              For connectors Passway pulls from: how syncing is going. `null` for
              `scim`.
          - type: 'null'
        labels:
          $ref: '#/components/schemas/Labels'
          description: Labels.
        managed_by:
          type:
          - string
          - 'null'
          description: The tool that manages it, if any.
          examples:
          - terraform
        created_at:
          $ref: '#/components/schemas/Timestamp'
          description: When it was created.
        updated_at:
          $ref: '#/components/schemas/Timestamp'
          description: When it last changed.
    ConnectorCreate:
      type: object
      description: Body of `POST /v1/connectors`.
      required:
      - name
      - kind
      properties:
        name:
          type: string
          description: Unique in the organization.
          examples:
          - okta
          maxLength: 128
          minLength: 1
        description:
          type: string
          description: What it is for.
          maxLength: 1024
        kind:
          $ref: '#/components/schemas/ConnectorKind'
          description: How it gets people and groups.
        enabled:
          type: boolean
          description: Whether it starts enabled. Default true.
        google_workspace:
          $ref: '#/components/schemas/GoogleWorkspaceSettings'
          description: Required for `google_workspace`, and only for it.
        labels:
          $ref: '#/components/schemas/Labels'
          description: Labels.
        managed_by:
          type: string
          description: The tool that manages it, if any.
          maxLength: 64
          pattern: ^[a-z0-9_-]{1,64}$
      additionalProperties: false
    ConnectorId:
      type: string
      description: 'Connector ID: `con_` followed by 1 to 64 lowercase letters and digits.'
      examples:
      - con_01jd8k3m2v9x4q7r5t6w8y0z1a
      maxLength: 68
      pattern: ^con_[0-9a-z]{1,64}$
    ConnectorKind:
      type: string
      description: How a connector gets people and groups.
      enum:
      - scim
      - google_workspace
    ConnectorList:
      type: object
      required:
      - data
      - next_page_token
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/Connector'
        next_page_token:
          type:
          - string
          - 'null'
          description: Pass as `page_token` to get the next page; `null` on the last page.
    ConnectorSync:
      type: object
      description: |-
        How a connector Passway pulls from is doing. Syncs do not change the
        connector's `etag`.
      required:
      - state
      - last_sync_at
      - last_success_at
      - last_error
      - next_sync_at
      - people
      - groups
      - held_removals
      - push_until
      properties:
        state:
          $ref: '#/components/schemas/ConnectorSyncState'
          description: How it is doing.
        last_sync_at:
          oneOf:
          - $ref: '#/components/schemas/Timestamp'
            description: When the last sync finished, successful or not.
          - type: 'null'
        last_success_at:
          oneOf:
          - $ref: '#/components/schemas/Timestamp'
            description: When the last successful sync finished.
          - type: 'null'
        last_error:
          type:
          - string
          - 'null'
          description: |-
            Why the last sync failed or was held, or what a successful one
            skipped (a group whose name is taken). `null` after a clean sync.
        next_sync_at:
          oneOf:
          - $ref: '#/components/schemas/Timestamp'
            description: When the next scheduled sync is due.
          - type: 'null'
        people:
          type: integer
          format: int64
          description: People the connector manages.
          minimum: 0
        groups:
          type: integer
          format: int64
          description: Groups the connector manages.
          minimum: 0
        held_removals:
          type: integer
          format: int64
          description: |-
            While `held`: the people, groups and group memberships the sync
            would remove.
          minimum: 0
        push_until:
          oneOf:
          - $ref: '#/components/schemas/Timestamp'
            description: |-
              For `google_workspace`: until when Google tells Passway of changes
              to users the moment they happen (push notifications), so a sync
              follows within seconds. Passway renews it. `null` when it isn't on:
              the schedule still syncs every 15 minutes.
          - type: 'null'
    ConnectorSyncRequest:
      type: object
      description: Body of `POST /v1/connectors/{connector_id}:sync`, which may be empty.
      properties:
        confirm_removals:
          type: boolean
          description: |-
            Apply removals even if there are more than a sync makes on its own:
            confirms a `held` sync. Default false.
      additionalProperties: false
    ConnectorSyncState:
      type: string
      description: How a connector Passway pulls from is doing.
      enum:
      - pending
      - ok
      - failing
      - held
      - disabled
    ConnectorToken:
      type: object
      description: |-
        A connector with what its identity provider needs. For a `scim`
        connector, that is the SCIM base URL and a bearer token: the token is
        shown only here, and rotating it ends the old one at once. A connector
        Passway pulls from has neither.
      required:
      - connector
      properties:
        connector:
          $ref: '#/components/schemas/Connector'
          description: The connector.
        scim_url:
          type: string
          description: 'For `scim`: the SCIM 2.0 base URL to give the identity provider.'
          examples:
          - https://acme.ext.passway.com/scim/v2
        token:
          type: string
          description: |-
            For `scim`: the bearer token to give the identity provider. Shown
            once.
          examples:
          - pwsc_3q2K…
    ConnectorUpdate:
      type: object
      description: |-
        Body of `PATCH /v1/connectors/{connector_id}`, a JSON merge patch. The
        kind cannot change.
      properties:
        name:
          type: string
          description: New name.
          maxLength: 128
          minLength: 1
        description:
          type: string
          description: New description.
          maxLength: 1024
        enabled:
          type: boolean
          description: Enable or disable it.
        google_workspace:
          $ref: '#/components/schemas/GoogleWorkspaceUpdate'
          description: |-
            For `google_workspace`: new settings. The key changes with
            `:set-service-account-key`.
        labels:
          oneOf:
          - $ref: '#/components/schemas/LabelsPatch'
            description: Labels to set; `null` values remove a label.
          - type: 'null'
        managed_by:
          type:
          - string
          - 'null'
          description: The tool that manages it; `null` clears it.
          maxLength: 64
          pattern: ^[a-z0-9_-]{1,64}$
      additionalProperties: false
    Credential:
      type: object
      description: |-
        An Aliro credential in a person's wallet. Credentials come from
        enrolment, never from `POST`; the API can only suspend, resume and
        revoke them.
      required:
      - id
      - etag
      - person_id
      - status
      - wallet
      - issuer_id
      - issued_at
      - expires_at
      - revoked_at
      - revocation
      - signed_in_at
      - identity_provider_id
      - suspended_by
      - provider_checked_at
      - created_at
      - updated_at
      properties:
        id:
          $ref: '#/components/schemas/CredentialId'
          description: Credential ID.
        etag:
          $ref: '#/components/schemas/ETag'
          description: Current version.
        person_id:
          $ref: '#/components/schemas/PersonId'
          description: The person holding it.
        status:
          $ref: '#/components/schemas/CredentialStatus'
          description: Where it is in its life.
        wallet:
          $ref: '#/components/schemas/Wallet'
          description: The wallet holding it.
        issuer_id:
          oneOf:
          - $ref: '#/components/schemas/IssuerId'
            description: The issuer that signed it, once issued.
          - type: 'null'
        issued_at:
          oneOf:
          - $ref: '#/components/schemas/Timestamp'
            description: When it reached the wallet.
          - type: 'null'
        expires_at:
          oneOf:
          - $ref: '#/components/schemas/Timestamp'
            description: When readers stop accepting it.
          - type: 'null'
        revoked_at:
          oneOf:
          - $ref: '#/components/schemas/Timestamp'
            description: When it was revoked.
          - type: 'null'
        revocation:
          oneOf:
          - $ref: '#/components/schemas/RevocationProgress'
            description: For revoked credentials, how many readers have confirmed.
          - type: 'null'
        signed_in_at:
          oneOf:
          - $ref: '#/components/schemas/Timestamp'
            description: |-
              For a phone enrolled by signing in to the Passway app (#336): when the
              person last signed in on it. `null` for one enrolled from a link.
          - type: 'null'
        identity_provider_id:
          oneOf:
          - $ref: '#/components/schemas/IdentityProviderId'
            description: |-
              The identity provider that sign-in went through; `null` for a passkey
              or a link.
          - type: 'null'
        suspended_by:
          oneOf:
          - $ref: '#/components/schemas/SuspendedBy'
            description: For a suspended credential, who suspended it; otherwise `null`.
          - type: 'null'
        provider_checked_at:
          oneOf:
          - $ref: '#/components/schemas/Timestamp'
            description: |-
              When the identity provider last confirmed that the person is still
              there, by refreshing the token it issued when they signed in on this
              phone (`phone_check_minutes`). `null` if it has never been asked: a
              phone enrolled from a link or with a passkey, or a provider that
              gave no refresh token.
          - type: 'null'
        created_at:
          $ref: '#/components/schemas/Timestamp'
          description: When enrolment created it.
        updated_at:
          $ref: '#/components/schemas/Timestamp'
          description: When it last changed.
    CredentialAction:
      type: object
      description: Body of `:suspend`, `:resume` and `:revoke` on a credential.
      properties:
        reason:
          type: string
          description: Why, for the audit log.
          examples:
          - Lost phone
          maxLength: 256
      additionalProperties: false
    CredentialId:
      type: string
      description: 'Credential ID: `cred_` followed by 1 to 64 lowercase letters and digits.'
      examples:
      - cred_01jd8k3m2v9x4q7r5t6w8y0z1a
      maxLength: 69
      pattern: ^cred_[0-9a-z]{1,64}$
    CredentialList:
      type: object
      required:
      - data
      - next_page_token
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/Credential'
        next_page_token:
          type:
          - string
          - 'null'
          description: Pass as `page_token` to get the next page; `null` on the last page.
    CredentialStatistics:
      type: object
      description: Current wallet credentials, by status.
      required:
      - pending
      - active
      - suspended
      - revoked
      - expired
      properties:
        pending:
          type: integer
          format: int64
          description: Number of pending credentials.
        active:
          type: integer
          format: int64
          description: Number of active credentials.
        suspended:
          type: integer
          format: int64
          description: Number of suspended credentials.
        revoked:
          type: integer
          format: int64
          description: Number of revoked credentials.
        expired:
          type: integer
          format: int64
          description: Number of expired credentials.
    CredentialStatus:
      type: string
      description: Where a credential is in its life.
      enum:
      - pending
      - active
      - suspended
      - revoked
      - expired
    CredentialsSet:
      type: object
      description: Body of `POST /v1/log-streams/{log_stream_id}:set-credentials`.
      required:
      - credentials
      properties:
        credentials:
          type: string
          description: |-
            The bucket's new credentials, in the form the stream's kind takes
            (see `credentials` on create). Kept sealed; never returned.
          writeOnly: true
          maxLength: 16384
          minLength: 1
        url:
          type:
          - string
          - 'null'
          description: |-
            A new `url`, set together with the credentials. This is the only way
            to point a bucket stream at another bucket, S3 region or Azure
            storage account: a patch may change only the prefix, so credentials
            never reach a destination they weren't set for. Delivery continues
            from where it was.
          maxLength: 2048
      additionalProperties: false
    DailyEventCount:
      type: object
      description: Number of recorded events on a calendar day in the requested time zone.
      required:
      - date
      - count
      - by_category
      properties:
        date:
          type: string
          format: date
          description: Local date in YYYY-MM-DD form.
        count:
          type: integer
          format: int64
          description: Retained events recorded on this day.
        by_category:
          type: array
          items:
            $ref: '#/components/schemas/EventCategoryCount'
          description: Counts by category, omitting categories with zero events.
    DenialReason:
      type: string
      description: |-
        Why a reader turned someone away, as a code the console can label (#342).
        The server works it out when the reader reports the decision, from
        what it knows of the credential and the door, and keeps the reader's own
        words beside it as `reason`.
      enum:
      - unknown_credential
      - revoked
      - suspended
      - expired
      - outside_schedule
      - not_assigned
      - door_disabled
      - other
    DenialReasonCount:
      type: object
      description: A count of denials for one reason.
      required:
      - reason_code
      - count
      properties:
        reason_code:
          $ref: '#/components/schemas/DenialReason'
          description: The reason.
        count:
          type: integer
          format: int64
          description: How many.
          minimum: 0
    DisplayNames:
      type: object
      description: 'Response to `GET /v1/display-names`: what each ID is called.'
      required:
      - display_names
      properties:
        display_names:
          type: object
          description: |-
            Names by ID. IDs the caller may not read, that don't exist, or that
            have no name are left out.
          additionalProperties:
            type: string
          propertyNames:
            type: string
          example:
            admin: Admin token
            per_92hd: Ada Lovelace
    Domain:
      type: object
      description: A custom domain.
      required:
      - id
      - etag
      - hostname
      - status
      - verification
      - cname_target
      - verified_at
      - last_error
      - labels
      - managed_by
      - created_at
      - updated_at
      properties:
        id:
          $ref: '#/components/schemas/DomainId'
          description: Domain ID.
        etag:
          $ref: '#/components/schemas/ETag'
          description: Current version.
        hostname:
          type: string
          description: The host, such as `login.acme.com`. Cannot change.
        status:
          $ref: '#/components/schemas/DomainStatus'
          description: Where it stands.
        verification:
          $ref: '#/components/schemas/DomainVerification'
          description: The TXT record to publish.
        cname_target:
          type: string
          description: 'What the host must be a CNAME to: the organization''s own host.'
        verified_at:
          oneOf:
          - $ref: '#/components/schemas/Timestamp'
            description: When it was first verified.
          - type: 'null'
        last_error:
          type:
          - string
          - 'null'
          description: |-
            What the last check found wrong, if anything. Rechecks that find
            nothing new change nothing, so the `ETag` moves only with news.
        labels:
          $ref: '#/components/schemas/Labels'
          description: Labels.
        managed_by:
          type:
          - string
          - 'null'
          description: The tool that manages this resource, such as `terraform`.
        created_at:
          $ref: '#/components/schemas/Timestamp'
          description: When the domain was added.
        updated_at:
          $ref: '#/components/schemas/Timestamp'
          description: When the domain last changed.
    DomainCreate:
      type: object
      description: Body of `POST /v1/domains`.
      required:
      - hostname
      properties:
        hostname:
          type: string
          description: 'The host: a subdomain, because a CNAME cannot sit at a domain''s apex.'
          examples:
          - login.acme.com
          maxLength: 253
        labels:
          $ref: '#/components/schemas/Labels'
          description: Labels.
        managed_by:
          type: string
          description: The tool that manages this resource. Terraform sets `terraform`.
          maxLength: 64
          pattern: ^[a-z0-9_-]{1,64}$
      additionalProperties: false
    DomainId:
      type: string
      description: 'Domain ID: `dom_` followed by 1 to 64 lowercase letters and digits.'
      examples:
      - dom_01jd8k3m2v9x4q7r5t6w8y0z1a
      maxLength: 68
      pattern: ^dom_[0-9a-z]{1,64}$
    DomainList:
      type: object
      required:
      - data
      - next_page_token
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/Domain'
        next_page_token:
          type:
          - string
          - 'null'
          description: Pass as `page_token` to get the next page; `null` on the last page.
    DomainStatus:
      type: string
      description: Where a domain stands.
      enum:
      - pending
      - verified
      - unrouted
    DomainUpdate:
      type: object
      description: |-
        Body of `PATCH /v1/domains/{domain_id}`, a JSON merge patch. The host
        cannot change: add another domain instead.
      properties:
        labels:
          oneOf:
          - $ref: '#/components/schemas/LabelsPatch'
            description: Labels to set or remove, or `null` to remove every label.
          - type: 'null'
        managed_by:
          type:
          - string
          - 'null'
          description: New managing tool, or `null` to clear it.
          maxLength: 64
          pattern: ^[a-z0-9_-]{1,64}$
      additionalProperties: false
    DomainVerification:
      type: object
      description: The TXT record that proves the organization owns the host.
      required:
      - record
      - value
      properties:
        record:
          type: string
          description: The record's name.
          examples:
          - _passway-challenge.login.acme.com
        value:
          type: string
          description: The value it must hold, exactly.
          examples:
          - passway-verification=3hd8f0e1c2b4a6d9
    Door:
      type: object
      description: |-
        A physical opening and its lock timings. The timings follow ONVIF
        `Timings`; the extended times apply to access granted with the
        `extended_momentary_unsecure` capability, for people who need longer.
      required:
      - id
      - etag
      - site_id
      - name
      - description
      - kind
      - release_seconds
      - open_seconds
      - extended_release_seconds
      - extended_open_seconds
      - labels
      - managed_by
      - created_at
      - updated_at
      properties:
        id:
          $ref: '#/components/schemas/DoorId'
          description: Door ID.
        etag:
          $ref: '#/components/schemas/ETag'
          description: Current version.
        site_id:
          $ref: '#/components/schemas/SiteId'
          description: The site the door is at. Cannot change.
        name:
          type: string
          description: Display name, unique within the site.
          examples:
          - Lab 3
        description:
          type: string
          description: Free text.
        kind:
          $ref: '#/components/schemas/DoorKind'
          description: What kind of opening this is.
        release_seconds:
          type: integer
          format: int32
          description: How long the lock stays released after access is granted, unless the door is opened (ONVIF `ReleaseTime`).
          maximum: 300
          minimum: 1
        open_seconds:
          type: integer
          format: int32
          description: How long the door may stay open before `door.open_too_long` is raised; 0 turns the alarm off (ONVIF `OpenTime`).
          maximum: 3600
          minimum: 0
        extended_release_seconds:
          type: integer
          format: int32
          description: Time added to `release_seconds` for extended access (ONVIF `ExtendedReleaseTime`).
          maximum: 300
          minimum: 0
        extended_open_seconds:
          type: integer
          format: int32
          description: Time added to `open_seconds` for extended access (ONVIF `ExtendedOpenTime`).
          maximum: 3600
          minimum: 0
        labels:
          $ref: '#/components/schemas/Labels'
          description: Labels.
        managed_by:
          type:
          - string
          - 'null'
          description: The tool that manages this resource, such as `terraform`.
          examples:
          - terraform
        created_at:
          $ref: '#/components/schemas/Timestamp'
          description: When the door was created.
        updated_at:
          $ref: '#/components/schemas/Timestamp'
          description: When the door last changed.
    DoorCreate:
      type: object
      description: Body of `POST /v1/doors`.
      required:
      - site_id
      - name
      properties:
        site_id:
          $ref: '#/components/schemas/SiteId'
          description: The site the door is at.
        name:
          type: string
          description: Display name, unique within the site.
          examples:
          - Lab 3
          maxLength: 128
          minLength: 1
        description:
          type: string
          description: Free text.
          maxLength: 1024
        kind:
          $ref: '#/components/schemas/DoorKind'
          description: What kind of opening this is.
        release_seconds:
          type: integer
          format: int32
          description: How long the lock stays released after access is granted.
          default: 5
          maximum: 300
          minimum: 1
        open_seconds:
          type: integer
          format: int32
          description: How long the door may stay open before `door.open_too_long`; 0 turns the alarm off.
          default: 30
          maximum: 3600
          minimum: 0
        extended_release_seconds:
          type: integer
          format: int32
          description: Time added to `release_seconds` for extended access.
          default: 0
          maximum: 300
          minimum: 0
        extended_open_seconds:
          type: integer
          format: int32
          description: Time added to `open_seconds` for extended access.
          default: 0
          maximum: 3600
          minimum: 0
        labels:
          $ref: '#/components/schemas/Labels'
          description: Labels.
        managed_by:
          type: string
          description: The tool that manages this resource. Terraform sets `terraform`.
          examples:
          - terraform
          maxLength: 64
          pattern: ^[a-z0-9_-]{1,64}$
      additionalProperties: false
    DoorId:
      type: string
      description: 'Door ID: `door_` followed by 1 to 64 lowercase letters and digits.'
      examples:
      - door_01jd8k3m2v9x4q7r5t6w8y0z1a
      maxLength: 69
      pattern: ^door_[0-9a-z]{1,64}$
    DoorKind:
      type: string
      description: What kind of opening a door is. The values follow ONVIF `DoorType`.
      enum:
      - door
      - mantrap
      - turnstile
      - revolving_door
      - barrier
      - other
    DoorList:
      type: object
      required:
      - data
      - next_page_token
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/Door'
        next_page_token:
          type:
          - string
          - 'null'
          description: Pass as `page_token` to get the next page; `null` on the last page.
    DoorUpdate:
      type: object
      description: |-
        Body of `PATCH /v1/doors/{door_id}`, a JSON merge patch. A door cannot
        move to another site.
      properties:
        name:
          type: string
          description: New name.
          maxLength: 128
          minLength: 1
        description:
          type: string
          description: New description.
          maxLength: 1024
        kind:
          $ref: '#/components/schemas/DoorKind'
          description: New kind.
        release_seconds:
          type: integer
          format: int32
          description: New release time.
          maximum: 300
          minimum: 1
        open_seconds:
          type: integer
          format: int32
          description: New open time; 0 turns the alarm off.
          maximum: 3600
          minimum: 0
        extended_release_seconds:
          type: integer
          format: int32
          description: New extended release time.
          maximum: 300
          minimum: 0
        extended_open_seconds:
          type: integer
          format: int32
          description: New extended open time.
          maximum: 3600
          minimum: 0
        labels:
          oneOf:
          - $ref: '#/components/schemas/LabelsPatch'
            description: Labels to set or remove, or `null` to remove every label.
          - type: 'null'
        managed_by:
          type:
          - string
          - 'null'
          description: New managing tool, or `null` to clear it.
          maxLength: 64
          pattern: ^[a-z0-9_-]{1,64}$
      additionalProperties: false
    DryRunPassage:
      type: object
      description: One passage a dry run would decide differently.
      required:
      - event_id
      - at
      - person_id
      - access_point_ids
      properties:
        event_id:
          $ref: '#/components/schemas/EventId'
          description: The event that recorded it.
        at:
          $ref: '#/components/schemas/Timestamp'
          description: When it happened.
        person_id:
          $ref: '#/components/schemas/PersonId'
          description: Who.
        access_point_ids:
          type: array
          items:
            $ref: '#/components/schemas/AccessPointId'
          description: The reader's access points.
    ETag:
      type: string
      description: Version of this resource. Send it back in double quotes in `If-Match` to update or delete it.
      examples:
      - 3f9a
      pattern: ^[0-9A-Za-z_-]{1,64}$
    Enrollment:
      type: object
      description: |-
        A link that lets a person add a credential to their wallet. The phone
        makes the key; Passway never sees it.
      required:
      - id
      - person_id
      - url
      - status
      - credential_id
      - expires_at
      - created_at
      - emailed_to
      properties:
        id:
          $ref: '#/components/schemas/EnrollmentId'
          description: Enrolment ID.
        person_id:
          $ref: '#/components/schemas/PersonId'
          description: The person enrolling.
        url:
          type: string
          description: The link to open on the phone.
          examples:
          - https://enroll.passway.example/e/enr_4kq1
        status:
          $ref: '#/components/schemas/EnrollmentStatus'
          description: Where the enrolment is.
        credential_id:
          oneOf:
          - $ref: '#/components/schemas/CredentialId'
            description: The credential it produced, once completed.
          - type: 'null'
        expires_at:
          $ref: '#/components/schemas/Timestamp'
          description: When the link stops working.
        created_at:
          $ref: '#/components/schemas/Timestamp'
          description: When the enrolment was created.
        emailed_to:
          type:
          - string
          - 'null'
          description: |-
            Where the link was emailed, when `notify` was `email`. The message is
            sent within seconds; `email.sent` and `email.failed` events say how
            it went.
    EnrollmentCreate:
      type: object
      description: Body of `POST /v1/people/{person_id}/enrollments`.
      properties:
        notify:
          $ref: '#/components/schemas/Notify'
          description: How to deliver the link.
        ttl_seconds:
          type: integer
          format: int32
          description: How long the link works, in seconds.
          default: 604800
          maximum: 2592000
          minimum: 300
      additionalProperties: false
    EnrollmentId:
      type: string
      description: 'Enrollment ID: `enr_` followed by 1 to 64 lowercase letters and digits.'
      examples:
      - enr_01jd8k3m2v9x4q7r5t6w8y0z1a
      maxLength: 68
      pattern: ^enr_[0-9a-z]{1,64}$
    EnrollmentStatus:
      type: string
      description: Where an enrolment is.
      enum:
      - pending
      - completed
      - expired
      - canceled
    Event:
      type: object
      description: |-
        One event, as a CloudEvent. Delivery is at least once and ordered per
        subject, so receivers deduplicate on `source` and `id`.

        `actortype`, `actorid` and `actorvia` are CloudEvents extension
        attributes saying who caused the event and through what.
      required:
      - specversion
      - id
      - source
      - type
      - subject
      - time
      - datacontenttype
      - actortype
      - actorid
      - actorvia
      - data
      properties:
        specversion:
          type: string
          description: 'CloudEvents version: `1.0`.'
          examples:
          - '1.0'
        id:
          $ref: '#/components/schemas/EventId'
          description: Event ID, unique within `source`. Event IDs sort by time.
        source:
          type: string
          description: The organization the event belongs to, as `/orgs/{org_id}`.
          examples:
          - /orgs/org_acme
        type:
          type: string
          description: Event type, such as `com.passway.access.denied`. Ignore types you do not know.
          examples:
          - com.passway.access.denied
          pattern: ^[a-z_]+(\.[a-z_]+)+$
        subject:
          type: string
          description: The ID of the resource the event is about, such as `ap_lab3in`. Its prefix says its type.
          examples:
          - ap_lab3in
        time:
          $ref: '#/components/schemas/Timestamp'
          description: When it happened.
        datacontenttype:
          type: string
          description: 'Media type of `data`: always `application/json`.'
          examples:
          - application/json
        actortype:
          $ref: '#/components/schemas/ActorKind'
          description: Who caused it.
        actorid:
          type:
          - string
          - 'null'
          description: The actor's ID; `null` for `system`.
          examples:
          - per_92hd
        actorvia:
          $ref: '#/components/schemas/Via'
          description: The channel the change came through.
        data:
          type: object
          description: Type-specific details.
        chainseq:
          type:
          - integer
          - 'null'
          format: int64
          description: |-
            The event's place in the organization's hash chain, once sealed
            (seconds after it is written). See [`crate::chain`].
          examples:
          - 42
          minimum: 1
        chainhash:
          type:
          - string
          - 'null'
          description: |-
            SHA-256, hex, of the previous event's `chainhash` followed by this
            event in canonical JSON without `chainseq` and `chainhash`.
          pattern: ^[0-9a-f]{64}$
    EventBucket:
      type: object
      description: Event counts for one hour, day or month of a calendar period.
      required:
      - from
      - before
      - count
      - by_category
      properties:
        from:
          type: string
          format: date-time
          description: Inclusive bucket start in UTC.
        before:
          type: string
          format: date-time
          description: Exclusive bucket end in UTC.
        count:
          type: integer
          format: int64
          description: Retained events recorded in this interval.
        by_category:
          type: array
          items:
            $ref: '#/components/schemas/EventCategoryCount'
          description: Counts by category, omitting categories with zero events.
        recent:
          type: array
          items:
            $ref: '#/components/schemas/EventPreview'
          description: The six newest events in this bucket, newest first.
    EventCategory:
      type: string
      description: Dashboard grouping for recorded event types.
      enum:
      - access
      - directory
      - wallet_credentials
      - authentication
      - configuration
      - system
      - other
    EventCategoryCount:
      type: object
      description: Number of events in one category within a time interval.
      required:
      - category
      - count
      properties:
        category:
          $ref: '#/components/schemas/EventCategory'
          description: The category inferred from the event type.
        count:
          type: integer
          format: int64
          description: Number of retained events in this category.
    EventId:
      type: string
      description: 'Event ID: `evt_` followed by 1 to 64 lowercase letters and digits.'
      examples:
      - evt_01jd8k3m2v9x4q7r5t6w8y0z1a
      maxLength: 68
      pattern: ^evt_[0-9a-z]{1,64}$
    EventList:
      type: object
      required:
      - data
      - next_page_token
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/Event'
        next_page_token:
          type:
          - string
          - 'null'
          description: Pass as `page_token` to get the next page; `null` on the last page.
    EventPeriod:
      type: string
      description: Event activity periods in the requested time zone.
      enum:
      - today
      - week
      - month
      - year
    EventPreview:
      type: object
      description: Audit event fields shown in a bucket preview.
      required:
      - id
      - type
      - subject
      - time
      - actortype
      - actorid
      properties:
        id:
          $ref: '#/components/schemas/EventId'
          description: Event ID for opening the full event.
        type:
          type: string
          description: Recorded event type.
        subject:
          type: string
          description: Resource the event is about.
        time:
          $ref: '#/components/schemas/Timestamp'
          description: When the event happened.
        actortype:
          $ref: '#/components/schemas/ActorKind'
          description: Who caused the event.
        actorid:
          type:
          - string
          - 'null'
          description: The actor's ID, if present.
    EventStatistics:
      type: object
      description: Event volume and a short feed in one response.
      required:
      - daily
      - recent
      properties:
        daily:
          type: array
          items:
            $ref: '#/components/schemas/DailyEventCount'
          description: Oldest day first, including empty days. Empty for calendar period requests.
        buckets:
          type:
          - array
          - 'null'
          items:
            $ref: '#/components/schemas/EventBucket'
          description: Calendar buckets, oldest first, including empty buckets. Omitted without a period.
        recent:
          type: array
          items:
            $ref: '#/components/schemas/Event'
          description: The six newest retained events, newest first, limited to the period when supplied.
    EventSummary:
      type: object
      description: |-
        Response to `GET /v1/events/summary`: counts for a window, by hour or by
        day in a time zone, every bucket present, so a chart needs no more.
      required:
      - from
      - to
      - bucket
      - time_zone
      - totals
      - buckets
      - access
      properties:
        from:
          type: string
          description: The window's start, as asked.
        to:
          type: string
          description: The window's end, as asked (not included).
        bucket:
          type: string
          description: '`hour` or `day`.'
          examples:
          - day
        time_zone:
          type: string
          description: The time zone buckets start in.
          examples:
          - America/New_York
        totals:
          $ref: '#/components/schemas/CategoryCounts'
          description: Counts over the whole window, by category.
        buckets:
          type: array
          items:
            $ref: '#/components/schemas/SummaryBucket'
          description: Every bucket in the window, in order, empty ones too.
        access:
          $ref: '#/components/schemas/AccessSummary'
          description: Decisions at doors.
    FederatedCredential:
      type: object
      description: |-
        A trusted outside identity: tokens from `issuer`, for `audience`, about
        `subject` (or a subject matching `subject_pattern`), with `claims`.
      required:
      - name
      - issuer
      - audience
      properties:
        name:
          type: string
          description: |-
            A name for it, unique on the API client or agent, such as
            `github-main`.
          examples:
          - github-main
          maxLength: 64
          minLength: 1
        issuer:
          type: string
          description: |-
            The platform's issuer, exactly as its tokens' `iss`: an `https` URL
            that serves `/.well-known/openid-configuration`.
          examples:
          - https://token.actions.githubusercontent.com
          maxLength: 512
        subject:
          type:
          - string
          - 'null'
          description: The `sub` a token must have, exactly. Set this or `subject_pattern`.
          examples:
          - repo:acme/infra:ref:refs/heads/main
          maxLength: 512
        subject_pattern:
          type:
          - string
          - 'null'
          description: |-
            A pattern the `sub` must match instead, where `*` stands for any run
            of characters. It must start with a literal part, so
            `repo:acme/infra:*` is allowed and `*:ref:refs/heads/main` is not.
          examples:
          - repo:acme/infra:environment:*
          maxLength: 512
        audience:
          type: string
          description: |-
            The `aud` a token must carry: what the workload asks its platform
            for, such as the organization's issuer URL.
          maxLength: 512
          minLength: 1
        claims:
          type: object
          description: |-
            Other claims a token must carry with exactly these values, such as
            GitHub's `repository_owner` or `environment`.
          additionalProperties:
            type: string
          propertyNames:
            type: string
      additionalProperties: false
    FieldError:
      type: object
      description: One rejected field.
      required:
      - pointer
      - reason
      - detail
      properties:
        pointer:
          type: string
          description: JSON Pointer (RFC 6901) to the field in the request body, such as `/rules/0/to`.
          examples:
          - /name
        reason:
          $ref: '#/components/schemas/Reason'
          description: Machine-readable reason.
        detail:
          type: string
          description: What is wrong, for people.
          examples:
          - must be at most 128 characters
    GoogleWorkspace:
      type: object
      description: |-
        Where a `google_workspace` connector reads from, with the service
        account its key belongs to.
      required:
      - admin_email
      - customer
      - service_account
      - client_id
      - key_id
      properties:
        admin_email:
          type: string
          description: The Workspace administrator the service account acts as.
        customer:
          type: string
          description: The Workspace customer ID, or `my_customer`.
        service_account:
          type:
          - string
          - 'null'
          description: |-
            The service account Passway signs as: the key's, or else the cell's
            own, which has no key. `null` until there is one.
          examples:
          - passway-sync@acme-it.iam.gserviceaccount.com
        client_id:
          type:
          - string
          - 'null'
          description: |-
            The service account's numeric client ID, to grant domain-wide
            delegation to in the Google Admin console.
          examples:
          - '110394857230948572304'
        key_id:
          type:
          - string
          - 'null'
          description: The key's ID; `null` with the cell's own account, which has no key.
    GoogleWorkspaceSettings:
      type: object
      description: Where a `google_workspace` connector reads from, as set.
      required:
      - admin_email
      properties:
        admin_email:
          type: string
          description: |-
            A Workspace administrator for the service account to act as. Passway
            only reads, with the `admin.directory.user.readonly` and
            `admin.directory.group.readonly` scopes.
          examples:
          - it-admin@acme.com
        customer:
          type: string
          description: |-
            The Workspace customer ID, such as `C03az79cb`. The default,
            `my_customer`, is the administrator's own account.
          examples:
          - my_customer
          maxLength: 64
          minLength: 1
          pattern: ^[A-Za-z0-9_]{1,64}$
      additionalProperties: false
    GoogleWorkspaceUpdate:
      type: object
      description: Changes to a `google_workspace` connector's settings, a JSON merge patch.
      properties:
        admin_email:
          type: string
          description: New administrator to act as.
        customer:
          type: string
          description: New customer ID.
          maxLength: 64
          minLength: 1
          pattern: ^[A-Za-z0-9_]{1,64}$
      additionalProperties: false
    Group:
      type: object
      description: |-
        A group of people. Most groups are synced from the identity provider and
        read-only here; `manual` groups are managed by hand, through the console,
        Terraform or an access request tool.
      required:
      - id
      - etag
      - name
      - description
      - source
      - external_id
      - member_count
      - membership_rule
      - max_manual_days
      - approver_group_id
      - labels
      - managed_by
      - created_at
      - updated_at
      properties:
        id:
          $ref: '#/components/schemas/GroupId'
          description: Group ID.
        etag:
          $ref: '#/components/schemas/ETag'
          description: Current version.
        name:
          type: string
          description: Display name. Synced groups keep the identity provider's name.
          examples:
          - engineering
        description:
          type: string
          description: Free text.
        source:
          $ref: '#/components/schemas/Source'
          description: Where the group comes from.
        external_id:
          type:
          - string
          - 'null'
          description: The group's ID in the source system.
        member_count:
          type: integer
          format: int32
          description: How many people are in the group.
          minimum: 0
        break_glass:
          type: boolean
          description: |-
            The organization's break-glass group: always `admin`, for when its
            identity provider is down or misconfigured. At most one group has it;
            it must be `manual`, its members must sign in with passkeys and be
            managed by hand, and its last member can't be removed. Setting or
            clearing it needs every scope.
        membership_rule:
          oneOf:
          - $ref: '#/components/schemas/MembershipRule'
            description: |-
              Who is in the group by their details, for manual groups. Members it
              matches come and go as people change; `null` for none.
          - type: 'null'
        manual_members:
          $ref: '#/components/schemas/ManualMembers'
          description: |-
            Whether people may also be added by hand: directly, only with
            someone else's approval, or never.
        max_manual_days:
          type:
          - integer
          - 'null'
          format: int32
          description: |-
            The longest anyone added by hand stays, in days: each addition must
            end (`valid_to`) within this. `null` for no limit.
          maximum: 3650
          minimum: 1
        approver_group_id:
          oneOf:
          - $ref: '#/components/schemas/GroupId'
            description: |-
              Only members of this group may approve requests to join, besides
              holding `membership-requests:write`. `null` for anyone who holds it.
          - type: 'null'
        labels:
          $ref: '#/components/schemas/Labels'
          description: Labels.
        managed_by:
          type:
          - string
          - 'null'
          description: The tool that manages this resource, such as `terraform`.
          examples:
          - terraform
        created_at:
          $ref: '#/components/schemas/Timestamp'
          description: When the group was created.
        updated_at:
          $ref: '#/components/schemas/Timestamp'
          description: When the group last changed.
    GroupCreate:
      type: object
      description: Body of `POST /v1/groups`. Creates a manual group.
      required:
      - name
      properties:
        name:
          type: string
          description: Display name, unique within the organization.
          examples:
          - contractors-q1
          maxLength: 128
          minLength: 1
        description:
          type: string
          description: Free text.
          maxLength: 1024
        break_glass:
          type: boolean
          description: |-
            The organization's break-glass group: always `admin`, for when its
            identity provider is down or misconfigured. At most one group has it;
            it must be `manual`, its members must sign in with passkeys and be
            managed by hand, and its last member can't be removed. Setting or
            clearing it needs every scope.
        membership_rule:
          oneOf:
          - $ref: '#/components/schemas/MembershipRule'
            description: |-
              Who is in the group by their details. Members it matches come and
              go as people change.
          - type: 'null'
        manual_members:
          $ref: '#/components/schemas/ManualMembers'
          description: |-
            Whether people may also be added by hand: directly (the default),
            only with someone else's approval, or never.
        max_manual_days:
          type:
          - integer
          - 'null'
          format: int32
          description: The longest anyone added by hand stays, in days.
          maximum: 3650
          minimum: 1
        approver_group_id:
          oneOf:
          - $ref: '#/components/schemas/GroupId'
            description: Only members of this group may approve requests to join.
          - type: 'null'
        labels:
          $ref: '#/components/schemas/Labels'
          description: Labels.
        managed_by:
          type: string
          description: The tool that manages this resource. Terraform sets `terraform`.
          examples:
          - terraform
          maxLength: 64
          pattern: ^[a-z0-9_-]{1,64}$
      additionalProperties: false
    GroupId:
      type: string
      description: 'Group ID: `grp_` followed by 1 to 64 lowercase letters and digits.'
      examples:
      - grp_01jd8k3m2v9x4q7r5t6w8y0z1a
      maxLength: 68
      pattern: ^grp_[0-9a-z]{1,64}$
    GroupList:
      type: object
      required:
      - data
      - next_page_token
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/Group'
        next_page_token:
          type:
          - string
          - 'null'
          description: Pass as `page_token` to get the next page; `null` on the last page.
    GroupMember:
      type: object
      description: A person's membership in a group.
      required:
      - group_id
      - person_id
      - valid_to
      - created_at
      properties:
        group_id:
          $ref: '#/components/schemas/GroupId'
          description: The group.
        person_id:
          $ref: '#/components/schemas/PersonId'
          description: The member.
        valid_to:
          oneOf:
          - $ref: '#/components/schemas/Timestamp'
            description: |-
              The membership ends at this time: when an addition by hand ends.
              `null` while the group's rule matches them, or for no end.
          - type: 'null'
        via:
          type: array
          items:
            $ref: '#/components/schemas/MemberVia'
          description: |-
            Why they are in it: the group's rule, an addition by hand, or the
            directory it is synced from. Someone both matched and added stays
            while either holds.
        membership_request_id:
          oneOf:
          - $ref: '#/components/schemas/MembershipRequestId'
            description: The approved request they were added through, if any.
          - type: 'null'
        created_at:
          $ref: '#/components/schemas/Timestamp'
          description: When the person was added.
    GroupMemberCreate:
      type: object
      description: |-
        Body of `POST /v1/groups/{group_id}/members`. Adding a person who is
        already a member updates `valid_to` and returns `200`.
      required:
      - person_id
      properties:
        person_id:
          $ref: '#/components/schemas/PersonId'
          description: The person to add.
        valid_to:
          $ref: '#/components/schemas/Timestamp'
          description: End the membership at this time.
      additionalProperties: false
    GroupMemberList:
      type: object
      required:
      - data
      - next_page_token
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/GroupMember'
        next_page_token:
          type:
          - string
          - 'null'
          description: Pass as `page_token` to get the next page; `null` on the last page.
    GroupUpdate:
      type: object
      description: |-
        Body of `PATCH /v1/groups/{group_id}`, a JSON merge patch. Synced groups accept only
        `labels`; everything else comes from their source.
      properties:
        name:
          type: string
          description: New name.
          maxLength: 128
          minLength: 1
        description:
          type: string
          description: New description.
          maxLength: 1024
        break_glass:
          type: boolean
          description: |-
            Make this the break-glass group, or stop it being one. Needs every
            scope.
        membership_rule:
          oneOf:
          - $ref: '#/components/schemas/MembershipRulePatch'
            description: |-
              A new rule, or `null` to remove it: the people it alone kept in
              leave.
          - type: 'null'
        manual_members:
          $ref: '#/components/schemas/ManualMembers'
          description: |-
            Whether people may be added by hand. Changing it leaves those
            already added in.
        max_manual_days:
          type:
          - integer
          - 'null'
          format: int32
          description: |-
            A new limit in days, or `null` for none. It applies to additions
            from now on.
          maximum: 3650
          minimum: 1
        approver_group_id:
          oneOf:
          - $ref: '#/components/schemas/GroupId'
            description: A new approvers' group, or `null` for anyone who may approve.
          - type: 'null'
        labels:
          oneOf:
          - $ref: '#/components/schemas/LabelsPatch'
            description: Labels to set or remove, or `null` to remove every label.
          - type: 'null'
        managed_by:
          type:
          - string
          - 'null'
          description: New managing tool, or `null` to clear it.
          maxLength: 64
          pattern: ^[a-z0-9_-]{1,64}$
      additionalProperties: false
    IdTokenAlg:
      type: string
      description: The algorithm an app's ID tokens are signed with.
      enum:
      - ES256
      - RS256
      - ML-DSA-87
    IdentityProvider:
      type: object
      description: An identity provider administrators sign in with.
      required:
      - id
      - etag
      - name
      - issuer
      - client_id
      - scopes
      - enabled
      - redirect_uri
      - labels
      - managed_by
      - created_at
      - updated_at
      properties:
        id:
          $ref: '#/components/schemas/IdentityProviderId'
          description: Identity provider ID.
        etag:
          $ref: '#/components/schemas/ETag'
          description: Current version, for `If-Match`.
        name:
          type: string
          description: Unique in the organization; shown on the sign-in page.
          examples:
          - Okta
        issuer:
          type: string
          description: The provider's OpenID Connect issuer.
          examples:
          - https://acme.okta.com
        client_id:
          type: string
          description: The client ID Passway has at the provider.
        scopes:
          type: array
          items:
            type: string
          description: Scopes to ask for.
        enabled:
          type: boolean
          description: While false, nobody signs in with it.
        phone_sign_in_days:
          type: integer
          format: int32
          description: |-
            How often, in days, a phone enrolled by signing in through this
            provider must sign in through it again (#336). In between, the phone
            renews its badge with its own keys; after it, the phone gets no new
            badge until the person signs in again, and its last one stops at its
            expiry (3 days at most).
          examples:
          - 30
          maximum: 365
          minimum: 1
        phone_check_minutes:
          type: integer
          format: int32
          description: |-
            How often, in minutes, Passway asks this provider whether the person
            behind each phone enrolled through it is still there (#336). When a
            phone signs in, Passway asks for a refresh token (`offline_access`;
            Google's `access_type=offline`). It then refreshes it at this
            interval. A refusal (`invalid_grant`: the person was deactivated or
            their sessions revoked) suspends the credential at once, at the
            readers too, until the person signs in through the provider again.
            `0` turns the checks off and asks for no refresh token; phones then
            rely on `phone_sign_in_days` alone.
          examples:
          - 60
          maximum: 1440
          minimum: 0
        redirect_uri:
          type: string
          description: The redirect URI to register at the provider.
          examples:
          - https://acme.ext.passway.com/sign-in/callback
        labels:
          $ref: '#/components/schemas/Labels'
          description: Labels.
        managed_by:
          type:
          - string
          - 'null'
          description: The tool that manages it, if any.
        created_at:
          $ref: '#/components/schemas/Timestamp'
          description: When it was created.
        updated_at:
          $ref: '#/components/schemas/Timestamp'
          description: When it last changed.
    IdentityProviderCreate:
      type: object
      description: Body of `POST /v1/identity-providers`.
      required:
      - name
      - issuer
      - client_id
      properties:
        name:
          type: string
          description: Unique in the organization.
          maxLength: 128
          minLength: 1
        issuer:
          type: string
          description: |-
            The provider's issuer: an `https` URL with its discovery document at
            `/.well-known/openid-configuration`.
        client_id:
          type: string
          description: The client ID Passway has at the provider.
        client_secret:
          type: string
          description: |-
            The client secret. Kept sealed and never returned; change it with
            `:set-client-secret`.
          writeOnly: true
        scopes:
          type: array
          items:
            type: string
          description: |-
            Scopes to ask for. Default `openid email profile`; add `groups` for
            Okta's groups claim.
        enabled:
          type: boolean
          description: Whether it starts enabled. Default true.
        phone_sign_in_days:
          type: integer
          format: int32
          description: |-
            How often, in days, a phone enrolled by signing in through it must
            sign in through it again. Default 30.
          maximum: 365
          minimum: 1
        phone_check_minutes:
          type: integer
          format: int32
          description: |-
            How often, in minutes, to ask the provider whether each phone's
            person is still there: 5 to 1440, or 0 for never. Default 60.
          maximum: 1440
          minimum: 0
        labels:
          $ref: '#/components/schemas/Labels'
          description: Labels.
        managed_by:
          type: string
          description: The tool that manages it, if any.
          maxLength: 64
          pattern: ^[a-z0-9_-]{1,64}$
      additionalProperties: false
    IdentityProviderId:
      type: string
      description: 'Identity provider ID: `idp_` followed by 1 to 64 lowercase letters and digits.'
      examples:
      - idp_01jd8k3m2v9x4q7r5t6w8y0z1a
      maxLength: 68
      pattern: ^idp_[0-9a-z]{1,64}$
    IdentityProviderList:
      type: object
      required:
      - data
      - next_page_token
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/IdentityProvider'
        next_page_token:
          type:
          - string
          - 'null'
          description: Pass as `page_token` to get the next page; `null` on the last page.
    IdentityProviderUpdate:
      type: object
      description: |-
        Body of `PATCH /v1/identity-providers/{identity_provider_id}`, a JSON
        merge patch. The client secret changes with `:set-client-secret`.
      properties:
        name:
          type: string
          description: New name.
          maxLength: 128
          minLength: 1
        issuer:
          type: string
          description: New issuer.
        client_id:
          type: string
          description: New client ID.
        scopes:
          type: array
          items:
            type: string
          description: New scopes.
        enabled:
          type: boolean
          description: Enable or disable it.
        phone_sign_in_days:
          type: integer
          format: int32
          description: A new interval for phones to sign in again, in days.
          maximum: 365
          minimum: 1
        phone_check_minutes:
          type: integer
          format: int32
          description: |-
            A new interval for asking the provider about phones, in minutes; 0
            turns the checks off.
          maximum: 1440
          minimum: 0
        labels:
          oneOf:
          - $ref: '#/components/schemas/LabelsPatch'
            description: Labels to set; `null` values remove a label.
          - type: 'null'
        managed_by:
          type:
          - string
          - 'null'
          description: The tool that manages it; `null` clears it.
          maxLength: 64
          pattern: ^[a-z0-9_-]{1,64}$
      additionalProperties: false
    IssuerId:
      type: string
      description: 'Issuer ID: `iss_` followed by 1 to 64 lowercase letters and digits.'
      examples:
      - iss_01jd8k3m2v9x4q7r5t6w8y0z1a
      maxLength: 68
      pattern: ^iss_[0-9a-z]{1,64}$
    IssuerKeyPair:
      type: object
      description: 'An issuer''s public keys, hex: what readers trust (#349).'
      required:
      - es256
      - ml_dsa_87
      properties:
        es256:
          type: string
          description: The ECDSA P-256 key every Aliro reader checks, uncompressed SEC1.
        ml_dsa_87:
          type: string
          description: The ML-DSA-87 key that post-quantum reader groups check as well.
    IssuerKeyRotate:
      type: object
      description: |-
        Body of `POST /v1/organization/issuer-keys:rotate`; none for an
        ordinary rotation.
      properties:
        emergency:
          type: boolean
          description: |-
            For keys that may have been stolen: rotate now, and stop trusting
            every earlier key at once instead of keeping them while documents
            signed with them last. Phones fetch new documents when the app next
            opens; until then, and at readers that haven't loaded the change,
            their doors refuse them.
        reason:
          type: string
          description: Why, for the audit log.
          examples:
          - Suspected leak of a database backup
          maxLength: 256
      additionalProperties: false
    IssuerKeyRotation:
      type: object
      description: |-
        A rotation under way: the keys documents will be signed with once every
        enrolled reader trusts them.
      required:
      - es256
      - ml_dsa_87
      - readers_ready
      - readers_total
      properties:
        es256:
          type: string
          description: The next ECDSA key, uncompressed SEC1 hex.
        ml_dsa_87:
          type: string
          description: The next ML-DSA-87 key, hex.
        readers_ready:
          type: integer
          format: int32
          description: Enrolled readers that have applied a configuration trusting them.
          minimum: 0
        readers_total:
          type: integer
          format: int32
          description: Enrolled readers.
          minimum: 0
    IssuerKeys:
      type: object
      description: |-
        Response to `GET /v1/organization/issuer-keys`: the keys that sign the
        organization's Access Documents, and any rotation (#349).
      required:
      - current
      - next
      - previous
      - rotations
      properties:
        current:
          $ref: '#/components/schemas/IssuerKeyPair'
          description: The keys documents are signed with now.
        next:
          oneOf:
          - $ref: '#/components/schemas/IssuerKeyRotation'
            description: A rotation under way, if any.
          - type: 'null'
        previous:
          type: array
          items:
            $ref: '#/components/schemas/IssuerKeysPrevious'
          description: |-
            The keys earlier rotations moved from, newest first, while readers
            still trust them: each until no document signed with it can still be
            good.
        rotations:
          type: integer
          format: int64
          description: How many rotations have finished.
          minimum: 0
    IssuerKeysPrevious:
      type: object
      description: |-
        The keys a finished rotation moved from, which readers keep trusting
        for as long as a document signed with them can last.
      required:
      - es256
      - ml_dsa_87
      - trusted_until
      properties:
        es256:
          type: string
          description: The previous ECDSA key, uncompressed SEC1 hex.
        ml_dsa_87:
          type: string
          description: The previous ML-DSA-87 key, hex.
        trusted_until:
          $ref: '#/components/schemas/Timestamp'
          description: When readers stop trusting them.
    Labels:
      type: object
      description: 'Key/value labels, with Kubernetes label syntax: keys are an optional DNS-subdomain prefix and `/`, then a name of up to 63 characters; values are up to 63 characters. At most 64 labels.'
      additionalProperties:
        type: string
        maxLength: 63
        pattern: ^(([A-Za-z0-9][-A-Za-z0-9_.]{0,61})?[A-Za-z0-9])?$
      propertyNames:
        type: string
        maxLength: 317
        pattern: ^([a-z0-9]([-a-z0-9]{0,61}[a-z0-9])?(\.[a-z0-9]([-a-z0-9]{0,61}[a-z0-9])?)*/)?[A-Za-z0-9]([-A-Za-z0-9_.]{0,61}[A-Za-z0-9])?$
      examples:
      - passway.example/cost-center: '4410'
        team: facilities
      maxProperties: 64
    LabelsPatch:
      type: object
      description: Labels to set, or `null` to remove a label. Labels left out are unchanged. A patch may remove every label and set a full new set at once, so it can have up to twice as many entries as a resource can have labels; the result must still have at most 64.
      additionalProperties:
        type:
        - string
        - 'null'
        maxLength: 63
        pattern: ^(([A-Za-z0-9][-A-Za-z0-9_.]{0,61})?[A-Za-z0-9])?$
      propertyNames:
        type: string
        maxLength: 317
        pattern: ^([a-z0-9]([-a-z0-9]{0,61}[a-z0-9])?(\.[a-z0-9]([-a-z0-9]{0,61}[a-z0-9])?)*/)?[A-Za-z0-9]([-A-Za-z0-9_.]{0,61}[A-Za-z0-9])?$
      examples:
      - old-label: null
        team: security
      maxProperties: 128
    LogStream:
      type: object
      description: A log stream.
      required:
      - id
      - etag
      - name
      - description
      - kind
      - url
      - enabled
      - authorization_set
      - status
      - labels
      - managed_by
      - created_at
      - updated_at
      properties:
        id:
          $ref: '#/components/schemas/LogStreamId'
          description: Log stream ID.
        etag:
          $ref: '#/components/schemas/ETag'
          description: Current version. Deliveries do not change it.
        name:
          type: string
          description: Display name, unique within the organization.
        description:
          type: string
          description: Free text.
        kind:
          $ref: '#/components/schemas/LogStreamKind'
          description: Where it delivers.
        url:
          type: string
          description: |-
            For `https`, the endpoint, on a public address. For a bucket, the
            bucket and the prefix objects are written under.
        enabled:
          type: boolean
          description: Whether it delivers.
        authorization_set:
          type: boolean
          description: |-
            For `https`: whether an `Authorization` header is set. Its value is
            kept sealed and never returned.
        credentials_set:
          type: boolean
          description: |-
            For a bucket: whether credentials are set. They are kept sealed and
            never returned.
        status:
          $ref: '#/components/schemas/LogStreamStatus'
          description: Delivery, as of the request.
        labels:
          $ref: '#/components/schemas/Labels'
          description: Labels.
        managed_by:
          type:
          - string
          - 'null'
          description: The tool that manages this resource, such as `terraform`.
        created_at:
          $ref: '#/components/schemas/Timestamp'
          description: When the stream was created.
        updated_at:
          $ref: '#/components/schemas/Timestamp'
          description: When the stream last changed.
    LogStreamCreate:
      type: object
      description: Body of `POST /v1/log-streams`.
      required:
      - name
      - url
      properties:
        name:
          type: string
          description: Display name, unique within the organization.
          examples:
          - splunk
          maxLength: 128
          minLength: 1
        description:
          type: string
          description: Free text.
          maxLength: 1024
        kind:
          $ref: '#/components/schemas/LogStreamKind'
          description: Where it delivers. Default `https`. Set when it is created.
        url:
          type: string
          description: |-
            For `https`, the endpoint, on a public address. For a bucket,
            `https://BUCKET.s3.REGION.amazonaws.com/PREFIX`,
            `https://storage.googleapis.com/BUCKET/PREFIX` or
            `https://ACCOUNT.blob.core.windows.net/CONTAINER/PREFIX`. The prefix
            may be empty.
          examples:
          - https://http-inputs-acme.splunkcloud.com/services/collector/raw
          maxLength: 2048
        enabled:
          type: boolean
          description: Whether it delivers. Default true.
        labels:
          $ref: '#/components/schemas/Labels'
          description: Labels.
        managed_by:
          type: string
          description: The tool that manages this resource. Terraform sets `terraform`.
          maxLength: 64
          pattern: ^[a-z0-9_-]{1,64}$
      additionalProperties: false
    LogStreamId:
      type: string
      description: 'Log stream ID: `lstr_` followed by 1 to 64 lowercase letters and digits.'
      examples:
      - lstr_01jd8k3m2v9x4q7r5t6w8y0z1a
      maxLength: 69
      pattern: ^lstr_[0-9a-z]{1,64}$
    LogStreamKind:
      type: string
      description: Where a stream delivers.
      enum:
      - https
      - s3
      - google_cloud_storage
      - azure_blob
    LogStreamList:
      type: object
      required:
      - data
      - next_page_token
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/LogStream'
        next_page_token:
          type:
          - string
          - 'null'
          description: Pass as `page_token` to get the next page; `null` on the last page.
    LogStreamState:
      type: string
      description: How a stream is doing.
      enum:
      - healthy
      - behind
      - failing
      - disabled
    LogStreamStatus:
      type: object
      description: A stream's delivery, as of the request.
      required:
      - state
      - delivered_seq
      - delivered_at
      - lag
      - skipped
      - last_error
      - last_error_at
      properties:
        state:
          $ref: '#/components/schemas/LogStreamState'
          description: How it is doing.
        delivered_seq:
          type:
          - integer
          - 'null'
          format: int64
          description: The `chainseq` of the last event delivered, or `null` before any.
        delivered_at:
          oneOf:
          - $ref: '#/components/schemas/Timestamp'
            description: When that delivery was acknowledged.
          - type: 'null'
        lag:
          type: integer
          format: int64
          description: Sealed events not yet delivered.
        skipped:
          type: integer
          format: int64
          description: |-
            Events purged by retention before the stream delivered them. A
            stream that falls behind by more than the retention loses events.
        last_error:
          type:
          - string
          - 'null'
          description: Why the last failed delivery failed, kept until a delivery succeeds.
        last_error_at:
          oneOf:
          - $ref: '#/components/schemas/Timestamp'
            description: When it failed.
          - type: 'null'
    LogStreamUpdate:
      type: object
      description: |-
        Body of `PATCH /v1/log-streams/{log_stream_id}`, a JSON merge patch. The
        `Authorization` header changes with `:set-authorization`.
      properties:
        name:
          type: string
          description: New name.
          maxLength: 128
          minLength: 1
        description:
          type: string
          description: New description.
          maxLength: 1024
        url:
          type: string
          description: |-
            New endpoint. Delivery continues from where it was. A bucket
            stream's patch may change only the prefix: another bucket, region or
            account takes new credentials, through `:set-credentials`.
          maxLength: 2048
        enabled:
          type: boolean
          description: |-
            Pause (`false`) or resume (`true`) delivery. A resumed stream picks up
            where it stopped, if retention still keeps those events.
        labels:
          oneOf:
          - $ref: '#/components/schemas/LabelsPatch'
            description: Labels to set or remove, or `null` to remove every label.
          - type: 'null'
        managed_by:
          type:
          - string
          - 'null'
          description: New managing tool, or `null` to clear it.
          maxLength: 64
          pattern: ^[a-z0-9_-]{1,64}$
      additionalProperties: false
    ManualMembers:
      type: string
      description: Whether people may be added to a group by hand, beside its rule.
      enum:
      - allowed
      - approval
      - never
    Me:
      type: object
      description: |-
        Who is calling `/v1`, and what they may do: `GET /v1/me`. The console
        shows only what the caller can do; the server still checks every
        request.
      required:
      - actor_type
      - actor_id
      - person
      - scopes
      - roles
      properties:
        actor_type:
          type: string
          description: '`person` for someone signed in, `api_client` or `agent` otherwise.'
          examples:
          - person
        actor_id:
          type: string
          description: Their ID; `admin` for the server's administrator token.
        person:
          oneOf:
          - $ref: '#/components/schemas/Person'
            description: The person, when a person is signed in.
          - type: 'null'
        scopes:
          type: array
          items:
            type: string
          description: Every scope they hold now, sorted.
        roles:
          type: array
          items:
            $ref: '#/components/schemas/RoleGrant'
          description: |-
            Where a person's scopes come from: each role and the group that
            gives it. Empty for API clients and agents.
    MemberVia:
      type: string
      description: Why someone is in a group.
      enum:
      - rule
      - added
      - source
    MembershipRequest:
      type: object
      description: |-
        A request to add someone to a group whose `manual_members` is
        `approval`. Someone other than whoever asked, and other than the person
        joining, approves or denies it; approving adds them.
      required:
      - id
      - group_id
      - person_id
      - valid_to
      - reason
      - status
      - requested_by
      - decided_by
      - decision_note
      - decided_at
      - expires_at
      - created_at
      properties:
        id:
          $ref: '#/components/schemas/MembershipRequestId'
          description: Request ID.
        group_id:
          $ref: '#/components/schemas/GroupId'
          description: The group.
        person_id:
          $ref: '#/components/schemas/PersonId'
          description: The person to add.
        valid_to:
          oneOf:
          - $ref: '#/components/schemas/Timestamp'
            description: When the membership would end.
          - type: 'null'
        reason:
          type: string
          description: Why they need it.
        status:
          $ref: '#/components/schemas/MembershipRequestStatus'
          description: Where it stands.
        requested_by:
          $ref: '#/components/schemas/RequestActor'
          description: Who asked.
        decided_by:
          oneOf:
          - $ref: '#/components/schemas/RequestActor'
            description: Who approved or denied it.
          - type: 'null'
        decision_note:
          type:
          - string
          - 'null'
          description: What they said.
        decided_at:
          oneOf:
          - $ref: '#/components/schemas/Timestamp'
            description: When it was decided.
          - type: 'null'
        expires_at:
          $ref: '#/components/schemas/Timestamp'
          description: It expires, undecided, at this time.
        created_at:
          $ref: '#/components/schemas/Timestamp'
          description: When it was made.
    MembershipRequestCreate:
      type: object
      description: Body of `POST /v1/membership-requests`.
      required:
      - group_id
      - person_id
      - reason
      properties:
        group_id:
          $ref: '#/components/schemas/GroupId'
          description: The group, whose `manual_members` is `approval`.
        person_id:
          $ref: '#/components/schemas/PersonId'
          description: The person to add.
        valid_to:
          $ref: '#/components/schemas/Timestamp'
          description: |-
            When the membership would end. Needed when the group has
            `max_manual_days`, and within it.
        reason:
          type: string
          description: Why they need it, for whoever decides and for the record.
          examples:
          - On call for the data center move, Dec 8-12
          maxLength: 1024
          minLength: 1
      additionalProperties: false
    MembershipRequestDecision:
      type: object
      description: |-
        Body of `POST /v1/membership-requests/{membership_request_id}:approve`
        and `:deny`. It may be left out.
      properties:
        note:
          type: string
          description: A note for the record.
          maxLength: 1024
      additionalProperties: false
    MembershipRequestId:
      type: string
      description: 'Membership request ID: `mreq_` followed by 1 to 64 lowercase letters and digits.'
      examples:
      - mreq_01jd8k3m2v9x4q7r5t6w8y0z1a
      maxLength: 69
      pattern: ^mreq_[0-9a-z]{1,64}$
    MembershipRequestList:
      type: object
      required:
      - data
      - next_page_token
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/MembershipRequest'
        next_page_token:
          type:
          - string
          - 'null'
          description: Pass as `page_token` to get the next page; `null` on the last page.
    MembershipRequestStatus:
      type: string
      description: Where a request to join a group stands.
      enum:
      - pending
      - approved
      - denied
      - expired
    MembershipRule:
      type: object
      description: |-
        Who is in a group by their details: people whose details match are
        members while they match and are active, and leave when they stop.
      required:
      - conditions
      properties:
        match:
          $ref: '#/components/schemas/RuleMatch'
          description: Whether every condition must hold (`all`, the default) or any one.
        conditions:
          type: array
          items:
            $ref: '#/components/schemas/RuleCondition'
          description: The conditions, one to 20.
          maxItems: 20
          minItems: 1
      additionalProperties: false
    MembershipRulePatch:
      type: object
      description: |-
        Changes to a group's [`MembershipRule`], a JSON merge patch: what is
        left out stays. `conditions` replaces every condition.
      properties:
        match:
          $ref: '#/components/schemas/RuleMatch'
          description: '`all` or `any`.'
        conditions:
          type: array
          items:
            $ref: '#/components/schemas/RuleCondition'
          description: The conditions, one to 20.
          maxItems: 20
          minItems: 1
      additionalProperties: false
    Muster:
      type: object
      description: A roll call at a site, as in an evacuation.
      required:
      - id
      - etag
      - site_id
      - name
      - description
      - muster_point_ids
      - status
      - ended_at
      - expected_count
      - accounted
      - missing
      - labels
      - managed_by
      - created_at
      - updated_at
      properties:
        id:
          $ref: '#/components/schemas/MusterId'
          description: Muster ID.
        etag:
          $ref: '#/components/schemas/ETag'
          description: Current version.
        site_id:
          $ref: '#/components/schemas/SiteId'
          description: The site being evacuated. Cannot change.
        name:
          type: string
          description: Display name.
          examples:
          - Fire alarm, east stair
        description:
          type: string
          description: Free text.
        muster_point_ids:
          type: array
          items:
            $ref: '#/components/schemas/AccessPointId'
          description: |-
            Access points at the assembly points: a tap there, granted or not,
            counts the person off.
        status:
          $ref: '#/components/schemas/MusterStatus'
          description: Whether it is still counting.
        ended_at:
          oneOf:
          - $ref: '#/components/schemas/Timestamp'
            description: |-
              When it ended (`POST /v1/musters/{muster_id}:end`). It started when
              it was created.
          - type: 'null'
        expected_count:
          type: integer
          format: int64
          description: |-
            How many people were inside the site when it was created, by their
            last passage in the 24 hours before.
          minimum: 0
        accounted:
          type: array
          items:
            $ref: '#/components/schemas/Accounted'
          description: The people counted off, in order.
        missing:
          type: array
          items:
            $ref: '#/components/schemas/PersonId'
          description: The people expected and not yet counted off.
        labels:
          $ref: '#/components/schemas/Labels'
          description: Labels.
        managed_by:
          type:
          - string
          - 'null'
          description: The tool that manages this resource, such as `terraform`.
          examples:
          - terraform
        created_at:
          $ref: '#/components/schemas/Timestamp'
          description: 'When the muster was created: when it started.'
        updated_at:
          $ref: '#/components/schemas/Timestamp'
          description: When the muster last changed.
    MusterAccount:
      type: object
      description: |-
        Body of `POST /v1/musters/{muster_id}:account`: a warden marks someone
        safe.
      required:
      - person_id
      properties:
        person_id:
          $ref: '#/components/schemas/PersonId'
          description: The person.
      additionalProperties: false
    MusterCreate:
      type: object
      description: 'Body of `POST /v1/musters`: start one.'
      required:
      - site_id
      - name
      properties:
        site_id:
          $ref: '#/components/schemas/SiteId'
          description: The site being evacuated. One muster at a time per site.
        name:
          type: string
          description: Display name.
          examples:
          - Fire alarm, east stair
          maxLength: 128
          minLength: 1
        description:
          type: string
          description: Free text.
          maxLength: 1024
        muster_point_ids:
          type: array
          items:
            $ref: '#/components/schemas/AccessPointId'
          description: Access points at the assembly points, at the same site.
          maxItems: 16
        labels:
          $ref: '#/components/schemas/Labels'
          description: Labels.
        managed_by:
          type: string
          description: The tool that manages this resource.
          examples:
          - terraform
          maxLength: 64
          pattern: ^[a-z0-9_-]{1,64}$
      additionalProperties: false
    MusterId:
      type: string
      description: 'Muster ID: `mus_` followed by 1 to 64 lowercase letters and digits.'
      examples:
      - mus_01jd8k3m2v9x4q7r5t6w8y0z1a
      maxLength: 68
      pattern: ^mus_[0-9a-z]{1,64}$
    MusterList:
      type: object
      required:
      - data
      - next_page_token
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/Muster'
        next_page_token:
          type:
          - string
          - 'null'
          description: Pass as `page_token` to get the next page; `null` on the last page.
    MusterStatus:
      type: string
      description: Whether a muster is still going.
      enum:
      - active
      - ended
    MusterUpdate:
      type: object
      description: Body of `PATCH /v1/musters/{muster_id}`, a JSON merge patch.
      properties:
        name:
          type: string
          description: New name.
          maxLength: 128
          minLength: 1
        description:
          type: string
          description: New description.
          maxLength: 1024
        muster_point_ids:
          type: array
          items:
            $ref: '#/components/schemas/AccessPointId'
          description: The muster points, replacing the current ones.
          maxItems: 16
        labels:
          oneOf:
          - $ref: '#/components/schemas/LabelsPatch'
            description: Labels to set or remove, or `null` to remove every label.
          - type: 'null'
        managed_by:
          type:
          - string
          - 'null'
          description: New managing tool, or `null` to clear it.
          maxLength: 64
          pattern: ^[a-z0-9_-]{1,64}$
      additionalProperties: false
    Notify:
      type: string
      description: How to deliver an enrolment link.
      enum:
      - none
      - email
    ObservationResult:
      type: object
      description: |-
        Response to `POST /v1/cameras/{camera_id}:observe`: what Passway made
        of the report.
      required:
      - accepted
      - tailgating
      - faces
      properties:
        accepted:
          type: integer
          format: int64
          description: Observations taken.
          minimum: 0
        tailgating:
          type: integer
          format: int64
          description: Tailgating events raised.
          minimum: 0
        faces:
          type: integer
          format: int64
          description: Face recognition events raised.
          minimum: 0
    Occupancy:
      type: object
      description: Response to `GET /v1/events/occupancy`.
      required:
      - areas
      - from
      - checked_at
      properties:
        areas:
          type: array
          items:
            $ref: '#/components/schemas/AreaOccupancy'
          description: |-
            Areas with anyone in them or in an area inside them, largest
            `total` first.
        from:
          $ref: '#/components/schemas/Timestamp'
          description: Passages count from this time.
        checked_at:
          $ref: '#/components/schemas/Timestamp'
          description: When this was worked out.
    Occupant:
      type: object
      description: One person in an area.
      required:
      - person_id
      - since
      - access_point_id
      properties:
        person_id:
          $ref: '#/components/schemas/PersonId'
          description: The person.
        since:
          $ref: '#/components/schemas/Timestamp'
          description: 'When they went in: their last passage.'
        access_point_id:
          $ref: '#/components/schemas/AccessPointId'
          description: |-
            The access point they went in through. A reader serving several
            access points into the same area names the first.
    OrgKind:
      type: string
      description: What kind of place the organization runs, which sets privacy defaults.
      enum:
      - workplace
      - residential
    Organization:
      type: object
      description: The organization.
      required:
      - id
      - display_name
      - issuer
      - data_location
      - kind
      - event_retention_days
      - legal_hold
      - max_manual_member_days
      - created_at
      properties:
        id:
          type: string
          description: Organization ID.
          examples:
          - org_acme
        display_name:
          type:
          - string
          - 'null'
          description: |-
            Its name, as people see it in the console and in the passkey
            chooser; `null` until set.
          examples:
          - Acme
        issuer:
          type: string
          description: 'Its OAuth and OpenID Connect issuer: its own host.'
          examples:
          - https://acme.ext.passway.com
        data_location:
          type: string
          description: |-
            Where its data is stored and processed: the location of its cell.
            Set when the organization is created.
          examples:
          - us
        kind:
          $ref: '#/components/schemas/OrgKind'
          description: What kind of place it runs.
        event_retention_days:
          type: integer
          format: int32
          description: |-
            How many days the event log keeps events. Older events are purged
            hourly, except during a legal hold. Signed checkpoints and purge
            records are kept.
          examples:
          - 365
          maximum: 2555
          minimum: 7
        legal_hold:
          type: boolean
          description: While true, nothing is purged.
        require_device_keys:
          type: boolean
          description: |-
            Whether every reader and phone must prove its device keys (#248) on
            every device call, so a device token alone is refused, and devices
            must register keys when they enroll. Devices enrolled before device
            keys register them at their next start; check that they have before
            turning this on.
        issuer_rotation_days:
          type: integer
          format: int32
          description: |-
            How often, in days, the issuer keys rotate on their own (#349); `0`
            for only when an administrator asks. Every 3 days by default, as long
            as an Access Document lasts. A rotation has no downtime, and readers
            keep trusting the old keys for as long as a document signed with them
            can last (3 days and an hour). So a key stolen without anyone noticing
            stops opening doors at most this many days plus 3 later: about 6 days
            by default.
          examples:
          - 3
          maximum: 365
          minimum: 0
        face_recognition:
          type: boolean
          description: |-
            Whether cameras may report face recognition (#382). Off by default.
            Face geometry is biometric information under laws such as Illinois's
            BIPA, which needs a public policy and each person's written consent
            first: turn this on only once counsel has signed off. Passway keeps
            no face data, only which person a camera matched and how sure it was.
        manual_group_members:
          $ref: '#/components/schemas/ManualMembers'
          description: |-
            Whether people may be added to groups by hand: `allowed` (the
            default), `approval` (by a request someone else approves) or `never`.
            No group can loosen it; the break-glass group is exempt.
        max_manual_member_days:
          type:
          - integer
          - 'null'
          format: int32
          description: |-
            The longest any addition to a group by hand may last, in days;
            `null` for no limit beyond each group's own. The break-glass group is
            exempt.
          maximum: 3650
          minimum: 1
        created_at:
          $ref: '#/components/schemas/Timestamp'
          description: When it was created.
      additionalProperties: false
    OrganizationUpdate:
      type: object
      description: |-
        Changes to the organization, as a JSON Merge Patch.

        `event_retention_days` must stay within the kind's range: 30 to 2,555
        days for a workplace, 7 to 90 for a residential organization. `null`
        sets the kind's default (365 or 90). A legal hold stops purging
        whatever the retention, residential organizations included.
      properties:
        display_name:
          type:
          - string
          - 'null'
          description: A new name, or `null` to clear it.
          examples:
          - Acme
          maxLength: 128
          minLength: 1
        kind:
          $ref: '#/components/schemas/OrgKind'
          description: New kind.
        event_retention_days:
          type:
          - integer
          - 'null'
          format: int32
          description: New retention, or `null` for the kind's default.
          maximum: 2555
          minimum: 7
        legal_hold:
          type: boolean
          description: Start or end a legal hold.
        require_device_keys:
          type: boolean
          description: Require device keys, or stop requiring them.
        issuer_rotation_days:
          type: integer
          format: int32
          description: |-
            A new interval for the issuer keys to rotate on their own, in days;
            `0` for only when asked.
          maximum: 365
          minimum: 0
        face_recognition:
          type: boolean
          description: |-
            Accept face recognition from cameras, or stop accepting it. Turning
            it off leaves cameras' `face_recognition` set, but refuses their
            face results.
        manual_group_members:
          $ref: '#/components/schemas/ManualMembers'
          description: |-
            Whether people may be added to groups by hand, for every group.
            Changing it leaves those already added in.
        max_manual_member_days:
          type:
          - integer
          - 'null'
          format: int32
          description: |-
            A new longest addition by hand, in days, or `null` for none. It
            applies to additions from now on.
          maximum: 3650
          minimum: 1
      additionalProperties: false
    Passkey:
      type: object
      description: |-
        A passkey a person signs in with. Passkeys come from invitations, never
        from `POST`; the API can list and delete them. Passway keeps only the
        public key.
      required:
      - id
      - etag
      - person_id
      - name
      - backed_up
      - algorithm
      - last_used_at
      - created_at
      - updated_at
      properties:
        id:
          $ref: '#/components/schemas/PasskeyId'
          description: Passkey ID.
        etag:
          $ref: '#/components/schemas/ETag'
          description: Current version.
        person_id:
          $ref: '#/components/schemas/PersonId'
          description: The person it signs in.
        name:
          type: string
          description: What the person called it when they made it, such as "Work laptop".
          examples:
          - Work laptop
        backed_up:
          type: boolean
          description: |-
            Whether the passkey is synced to the person's other devices (iCloud
            Keychain, Google Password Manager), rather than held by one device or
            security key, as of its last use.
        algorithm:
          type: string
          description: |-
            Its signature algorithm. `ML-DSA-87`, `ML-DSA-65` and `ML-DSA-44`
            are post-quantum (#297); `ES256`, `RS256` and `EdDSA` are classical.
          examples:
          - ML-DSA-87
          - ES256
        last_used_at:
          oneOf:
          - $ref: '#/components/schemas/Timestamp'
            description: When it was last used to sign in.
          - type: 'null'
        created_at:
          $ref: '#/components/schemas/Timestamp'
          description: When it was made.
        updated_at:
          $ref: '#/components/schemas/Timestamp'
          description: When it last changed.
    PasskeyId:
      type: string
      description: 'Passkey ID: `pky_` followed by 1 to 64 lowercase letters and digits.'
      examples:
      - pky_01jd8k3m2v9x4q7r5t6w8y0z1a
      maxLength: 68
      pattern: ^pky_[0-9a-z]{1,64}$
    PasskeyInvitation:
      type: object
      description: |-
        A link that lets a person make a passkey. It works once: the first
        passkey made with it uses it up.
      required:
      - person_id
      - url
      - expires_at
      properties:
        person_id:
          $ref: '#/components/schemas/PersonId'
          description: The person it is for.
        url:
          type: string
          description: |-
            The link to give the person, on the organization's own host. The
            token is in the fragment, so it never reaches a server's logs and a
            mail scanner opening the link cannot use it up.
          examples:
          - https://acme.ext.passway.example/passkeys/new#pwpi_4kq1
        expires_at:
          $ref: '#/components/schemas/Timestamp'
          description: When the link stops working.
    PasskeyInvitationCreate:
      type: object
      description: Body of `POST /v1/people/{person_id}/passkey-invitations`.
      properties:
        ttl_seconds:
          type: integer
          format: int32
          description: How long the link works, in seconds.
          default: 86400
          maximum: 604800
          minimum: 300
      additionalProperties: false
    PasskeyList:
      type: object
      required:
      - data
      - next_page_token
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/Passkey'
        next_page_token:
          type:
          - string
          - 'null'
          description: Pass as `page_token` to get the next page; `null` on the last page.
    PeopleStatistics:
      type: object
      description: Current directory size and enabled people.
      required:
      - total
      - active
      properties:
        total:
          type: integer
          format: int64
          description: People of every status.
        active:
          type: integer
          format: int64
          description: 'People with `active: true`.'
    Permissions:
      type: object
      description: |-
        Response to `GET /v1/people/{person_id}/permissions`: what the person
        may do on `/v1` now, and why.
      required:
      - person_id
      - scopes
      properties:
        person_id:
          $ref: '#/components/schemas/PersonId'
          description: The person.
        scopes:
          type: array
          items:
            $ref: '#/components/schemas/ScopeSource'
          description: |-
            Each scope they hold, sorted, with where it comes from. Empty for
            someone inactive or in no group with a role.
    Person:
      type: object
      description: |-
        Someone who can hold credentials: an employee, contractor, resident or
        visitor. Passway keeps only what access decisions need. Field names
        follow the SCIM core `User` schema (RFC 7643): `display_name`, `emails`
        as one `email`, `external_id`, `user_type` and `active`.
      required:
      - id
      - etag
      - display_name
      - email
      - external_id
      - user_type
      - active
      - source
      - valid_from
      - valid_to
      - labels
      - created_at
      - updated_at
      properties:
        id:
          $ref: '#/components/schemas/PersonId'
          description: Person ID.
        etag:
          $ref: '#/components/schemas/ETag'
          description: Current version.
        display_name:
          type: string
          description: Name to show in the console, audit log and wallet pass.
          examples:
          - Ada Lovelace
        email:
          type:
          - string
          - 'null'
          description: Work email, used to send enrolment links.
          examples:
          - ada@example.com
        external_id:
          type:
          - string
          - 'null'
          description: The person's ID in the source system, such as an Okta user ID.
          examples:
          - 00u1abcd2EFGHIJKLM3n4
        user_type:
          type:
          - string
          - 'null'
          description: |-
            How the person relates to the organization, as the source sends it,
            such as `Employee`, `Contractor` or `Resident` (SCIM `userType`).
          examples:
          - Employee
        active:
          type: boolean
          description: Inactive people have every credential revoked and get no new ones (SCIM `active`).
        source:
          $ref: '#/components/schemas/Source'
          description: Where the person comes from.
        valid_from:
          oneOf:
          - $ref: '#/components/schemas/Timestamp'
            description: No access before this time, such as a start date or lease start.
          - type: 'null'
        valid_to:
          oneOf:
          - $ref: '#/components/schemas/Timestamp'
            description: No access from this time, such as an end date or move-out.
          - type: 'null'
        attributes:
          $ref: '#/components/schemas/PersonAttributes'
          description: Department, title, location and the like, for groups' membership rules.
        labels:
          $ref: '#/components/schemas/Labels'
          description: Labels.
        created_at:
          $ref: '#/components/schemas/Timestamp'
          description: When the person was created.
        updated_at:
          $ref: '#/components/schemas/Timestamp'
          description: When the person last changed.
    PersonAttributes:
      type: object
      description: |-
        What a directory says about someone's work and where they are, for
        groups' membership rules. The names are those of the SCIM enterprise
        extension (RFC 7643 §4.3) and the core `title`; `location` is the office
        or building. Directory sync fills them for the people it manages; only
        it may change them there.
      properties:
        department:
          type:
          - string
          - 'null'
          description: Department, such as `Engineering`.
          examples:
          - Engineering
          maxLength: 256
        division:
          type:
          - string
          - 'null'
          description: Division.
          maxLength: 256
        organization:
          type:
          - string
          - 'null'
          description: Organization, such as a subsidiary.
          maxLength: 256
        cost_center:
          type:
          - string
          - 'null'
          description: Cost center.
          maxLength: 256
        employee_number:
          type:
          - string
          - 'null'
          description: Employee number.
          maxLength: 256
        title:
          type:
          - string
          - 'null'
          description: Job title.
          examples:
          - Site reliability engineer
          maxLength: 256
        location:
          type:
          - string
          - 'null'
          description: Office or building, such as `New York`.
          examples:
          - New York
          maxLength: 256
      additionalProperties: false
    PersonAttributesPatch:
      type: object
      description: |-
        Changes to a person's [`PersonAttributes`], a JSON merge patch: `null`
        removes one.
      properties:
        department:
          type:
          - string
          - 'null'
          description: New department, or `null` to remove it.
          maxLength: 256
        division:
          type:
          - string
          - 'null'
          description: New division, or `null` to remove it.
          maxLength: 256
        organization:
          type:
          - string
          - 'null'
          description: New organization, or `null` to remove it.
          maxLength: 256
        cost_center:
          type:
          - string
          - 'null'
          description: New cost center, or `null` to remove it.
          maxLength: 256
        employee_number:
          type:
          - string
          - 'null'
          description: New employee number, or `null` to remove it.
          maxLength: 256
        title:
          type:
          - string
          - 'null'
          description: New title, or `null` to remove it.
          maxLength: 256
        location:
          type:
          - string
          - 'null'
          description: New location, or `null` to remove it.
          maxLength: 256
      additionalProperties: false
    PersonCreate:
      type: object
      description: |-
        Body of `POST /v1/people`, for people who are not synced from another
        system, such as visitors.
      required:
      - display_name
      properties:
        display_name:
          type: string
          description: Name to show in the console, audit log and wallet pass.
          examples:
          - Ada Lovelace
          maxLength: 128
          minLength: 1
        email:
          type: string
          description: Email, used to send enrolment links.
          examples:
          - ada@example.com
          maxLength: 254
        external_id:
          type: string
          description: Your own ID for this person.
          maxLength: 256
        user_type:
          type: string
          description: How the person relates to the organization, such as `Visitor`.
          examples:
          - Visitor
          maxLength: 64
        active:
          type: boolean
          description: Whether the person can hold credentials.
          default: true
        valid_from:
          $ref: '#/components/schemas/Timestamp'
          description: No access before this time.
        valid_to:
          $ref: '#/components/schemas/Timestamp'
          description: No access from this time.
        attributes:
          $ref: '#/components/schemas/PersonAttributes'
          description: Department, title, location and the like, for groups' membership rules.
        labels:
          $ref: '#/components/schemas/Labels'
          description: Labels.
      additionalProperties: false
    PersonId:
      type: string
      description: 'Person ID: `per_` followed by 1 to 64 lowercase letters and digits.'
      examples:
      - per_01jd8k3m2v9x4q7r5t6w8y0z1a
      maxLength: 68
      pattern: ^per_[0-9a-z]{1,64}$
    PersonList:
      type: object
      required:
      - data
      - next_page_token
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/Person'
        next_page_token:
          type:
          - string
          - 'null'
          description: Pass as `page_token` to get the next page; `null` on the last page.
    PersonUpdate:
      type: object
      description: |-
        Body of `PATCH /v1/people/{person_id}`, a JSON merge patch. People from
        SCIM or a connector can only be changed by that source, except `labels`.
      properties:
        display_name:
          type: string
          description: New display name.
          maxLength: 128
          minLength: 1
        email:
          type:
          - string
          - 'null'
          description: New email, or `null` to remove it.
          maxLength: 254
        external_id:
          type:
          - string
          - 'null'
          description: New external ID, or `null` to remove it.
          maxLength: 256
        user_type:
          type:
          - string
          - 'null'
          description: New user type, or `null` to remove it.
          maxLength: 64
        active:
          type: boolean
          description: '`false` revokes every credential the person holds.'
        valid_from:
          oneOf:
          - $ref: '#/components/schemas/Timestamp'
            description: New start, or `null` to remove it.
          - type: 'null'
        valid_to:
          oneOf:
          - $ref: '#/components/schemas/Timestamp'
            description: New end, or `null` to remove it.
          - type: 'null'
        attributes:
          oneOf:
          - $ref: '#/components/schemas/PersonAttributesPatch'
            description: Attributes to set or remove, or `null` to remove them all.
          - type: 'null'
        labels:
          oneOf:
          - $ref: '#/components/schemas/LabelsPatch'
            description: Labels to set or remove, or `null` to remove every label.
          - type: 'null'
      additionalProperties: false
    PolicyMode:
      type: string
      description: |-
        What an access point does with someone its access policies don't allow
        (#382). The modes follow Kubernetes Pod Security admission: `enforce`
        refuses; `audit` lets them in and records it; `warn` lets them in,
        records it and raises a warning.
      enum:
      - enforce
      - audit
      - warn
    Problem:
      type: object
      description: |-
        An error response (RFC 9457 problem details).

        `type` identifies the kind of problem and is stable; `title` and `detail`
        are for people and may change. Validation failures list every rejected
        field in `errors`.
      required:
      - type
      - title
      - status
      properties:
        type:
          type: string
          description: URI reference identifying the problem type, such as `/problems/validation`.
          examples:
          - /problems/validation
        title:
          type: string
          description: Short summary of the problem type.
          examples:
          - The request has invalid fields
        status:
          type: integer
          format: int32
          description: The HTTP status code.
          examples:
          - 422
          maximum: 599
          minimum: 400
        detail:
          type: string
          description: What went wrong in this case.
        instance:
          type: string
          description: The request ID, for support.
          examples:
          - req_01jd8k3m2v9x4q7r5t6w8y0z1a
        errors:
          type: array
          items:
            $ref: '#/components/schemas/FieldError'
          description: |-
            The rejected fields, for `/problems/validation`: at most 100. When
            there were more, `detail` says how many.
    PunchDirection:
      type: string
      description: Which way a punch went, from the access point's areas.
      enum:
      - in
      - out
    Reader:
      type: object
      description: One Aliro or retrofit reader.
      required:
      - id
      - etag
      - reader_group_id
      - access_point_ids
      - workload_audiences
      - name
      - status
      - device
      - last_seen_at
      - labels
      - managed_by
      - created_at
      - updated_at
      properties:
        id:
          $ref: '#/components/schemas/ReaderId'
          description: Reader ID.
        etag:
          $ref: '#/components/schemas/ETag'
          description: Current version.
        reader_group_id:
          $ref: '#/components/schemas/ReaderGroupId'
          description: The reader group whose trust list this reader uses. Cannot change.
        access_point_ids:
          type: array
          items:
            $ref: '#/components/schemas/AccessPointId'
          description: |-
            The access points this reader serves: usually one, or one per floor for an elevator reader. At the
            group's site, if the group is tied to one.
        workload_audiences:
          type: array
          items:
            type: string
          description: |-
            The audiences this may ask for workload tokens for: short-lived JWTs
            that other platforms trust, such as `sts.amazonaws.com`. Exact
            strings; empty means none.
        name:
          type: string
          description: Display name.
          examples:
          - Lab 3 entry
        status:
          $ref: '#/components/schemas/ReaderStatus'
          description: Where the reader is in its life.
        device:
          oneOf:
          - $ref: '#/components/schemas/ReaderDevice'
            description: What the device reported; `null` until it enrols.
          - type: 'null'
        last_seen_at:
          oneOf:
          - $ref: '#/components/schemas/Timestamp'
            description: When the reader last checked in.
          - type: 'null'
        labels:
          $ref: '#/components/schemas/Labels'
          description: Labels.
        managed_by:
          type:
          - string
          - 'null'
          description: The tool that manages this resource, such as `terraform`.
          examples:
          - terraform
        created_at:
          $ref: '#/components/schemas/Timestamp'
          description: When the reader was created.
        updated_at:
          $ref: '#/components/schemas/Timestamp'
          description: When the reader last changed.
    ReaderCreate:
      type: object
      description: Body of `POST /v1/readers`.
      required:
      - reader_group_id
      - name
      properties:
        reader_group_id:
          $ref: '#/components/schemas/ReaderGroupId'
          description: The reader group whose trust list this reader uses.
        access_point_ids:
          type: array
          items:
            $ref: '#/components/schemas/AccessPointId'
          description: The access points this reader serves; at the group's site, if the group is tied to one.
          maxItems: 128
        workload_audiences:
          type: array
          items:
            type: string
          description: |-
            The audiences this may ask for workload tokens for (see
            `POST /oauth/token` with `audience`): at most 10 exact strings.
          maxItems: 10
        name:
          type: string
          description: Display name.
          examples:
          - Lab 3 entry
          maxLength: 128
          minLength: 1
        labels:
          $ref: '#/components/schemas/Labels'
          description: Labels.
        managed_by:
          type: string
          description: The tool that manages this resource. Terraform sets `terraform`.
          examples:
          - terraform
          maxLength: 64
          pattern: ^[a-z0-9_-]{1,64}$
      additionalProperties: false
    ReaderCreated:
      type: object
      description: |-
        Response to `POST /v1/readers`: the reader, and the one-time token the
        device uses to enrol. The token is never shown again.
      required:
      - reader
      - enrollment_token
      - enrollment_token_expires_at
      properties:
        reader:
          $ref: '#/components/schemas/Reader'
          description: The new reader, in `pending_enrollment`.
        enrollment_token:
          type: string
          description: One-time enrolment token for the installer or provisioning script.
          examples:
          - rdr-enroll-7Hq2kX9vN4mP8sL3
        enrollment_token_expires_at:
          $ref: '#/components/schemas/Timestamp'
          description: When the token stops working.
    ReaderDevice:
      type: object
      description: What the device reported about itself at enrolment and check-in.
      required:
      - model
      - firmware_version
      - serial_number
      - transports
      - retrofit
      properties:
        model:
          type: string
          description: Hardware model.
          examples:
          - passway-r1
        firmware_version:
          type: string
          description: Firmware version.
          examples:
          - 0.4.2
        serial_number:
          type: string
          description: Hardware serial number.
        transports:
          type: array
          items:
            $ref: '#/components/schemas/ReaderTransport'
          description: Radios the reader supports.
        retrofit:
          type: boolean
          description: |-
            True for a retrofit reader, which passes an existing reader's badges
            through to the panel alongside Aliro taps.
        kiosk:
          type: boolean
          description: |-
            True for a kiosk (#364): a phone or tablet running the Passway app as
            a scanner. People present over Passway's post-quantum exchange,
            usually over `ble`. A kiosk can't drive a door strike: it records
            check-ins, or stands beside a door as its post-quantum second factor.
            Its reader group should require post-quantum.
    ReaderGroup:
      type: object
      description: |-
        Readers that trust the same issuer keys and share one revocation list.
        Most organizations need one group per site; separate groups keep a test
        lab or a tenant's floor on its own trust list.
      required:
      - id
      - etag
      - name
      - description
      - site_id
      - reader_count
      - labels
      - managed_by
      - created_at
      - updated_at
      properties:
        id:
          $ref: '#/components/schemas/ReaderGroupId'
          description: Reader group ID.
        etag:
          $ref: '#/components/schemas/ETag'
          description: Current version.
        name:
          type: string
          description: Display name, unique within the organization.
          examples:
          - HQ readers
        description:
          type: string
          description: Free text.
        site_id:
          oneOf:
          - $ref: '#/components/schemas/SiteId'
            description: The site this group serves, if it is tied to one. Cannot change.
          - type: 'null'
        reader_count:
          type: integer
          format: int32
          description: How many readers are in the group, retired readers excluded.
          minimum: 0
        require_post_quantum:
          type: boolean
          description: |-
            Post-quantum required (#349): the group's readers accept an Access
            Document only with an ML-DSA-87 issuer signature beside the ECDSA
            one, and Passway adds it to every credential's documents. Readers
            need `aliro-readerd` with `pq_issuer_keys`. Documents grow by about
            4.7 KB, which slows NFC taps: measure before turning it on for busy
            doors.
        labels:
          $ref: '#/components/schemas/Labels'
          description: Labels.
        managed_by:
          type:
          - string
          - 'null'
          description: The tool that manages this resource, such as `terraform`.
          examples:
          - terraform
        created_at:
          $ref: '#/components/schemas/Timestamp'
          description: When the group was created.
        updated_at:
          $ref: '#/components/schemas/Timestamp'
          description: When the group last changed.
    ReaderGroupCreate:
      type: object
      description: Body of `POST /v1/reader-groups`.
      required:
      - name
      properties:
        name:
          type: string
          description: Display name, unique within the organization.
          examples:
          - HQ readers
          maxLength: 128
          minLength: 1
        description:
          type: string
          description: Free text.
          maxLength: 1024
        site_id:
          $ref: '#/components/schemas/SiteId'
          description: The site this group serves.
        require_post_quantum:
          type: boolean
          description: Post-quantum required (#349). Off by default.
        labels:
          $ref: '#/components/schemas/Labels'
          description: Labels.
        managed_by:
          type: string
          description: The tool that manages this resource. Terraform sets `terraform`.
          examples:
          - terraform
          maxLength: 64
          pattern: ^[a-z0-9_-]{1,64}$
      additionalProperties: false
    ReaderGroupId:
      type: string
      description: 'Reader group ID: `rgrp_` followed by 1 to 64 lowercase letters and digits.'
      examples:
      - rgrp_01jd8k3m2v9x4q7r5t6w8y0z1a
      maxLength: 69
      pattern: ^rgrp_[0-9a-z]{1,64}$
    ReaderGroupList:
      type: object
      required:
      - data
      - next_page_token
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/ReaderGroup'
        next_page_token:
          type:
          - string
          - 'null'
          description: Pass as `page_token` to get the next page; `null` on the last page.
    ReaderGroupUpdate:
      type: object
      description: Body of `PATCH /v1/reader-groups/{reader_group_id}`.
      properties:
        name:
          type: string
          description: New name.
          maxLength: 128
          minLength: 1
        description:
          type: string
          description: New description.
          maxLength: 1024
        require_post_quantum:
          type: boolean
          description: Turn post-quantum required on or off (#349).
        labels:
          oneOf:
          - $ref: '#/components/schemas/LabelsPatch'
            description: Labels to set or remove, or `null` to remove every label.
          - type: 'null'
        managed_by:
          type:
          - string
          - 'null'
          description: New managing tool, or `null` to clear it.
          maxLength: 64
          pattern: ^[a-z0-9_-]{1,64}$
      additionalProperties: false
    ReaderId:
      type: string
      description: 'Reader ID: `rdr_` followed by 1 to 64 lowercase letters and digits.'
      examples:
      - rdr_01jd8k3m2v9x4q7r5t6w8y0z1a
      maxLength: 68
      pattern: ^rdr_[0-9a-z]{1,64}$
    ReaderList:
      type: object
      required:
      - data
      - next_page_token
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/Reader'
        next_page_token:
          type:
          - string
          - 'null'
          description: Pass as `page_token` to get the next page; `null` on the last page.
    ReaderStatus:
      type: string
      description: Where a reader is in its life.
      enum:
      - pending_enrollment
      - online
      - offline
      - retired
    ReaderTransport:
      type: string
      description: A radio the reader supports.
      enum:
      - nfc
      - ble
      - uwb
    ReaderUpdate:
      type: object
      description: Body of `PATCH /v1/readers/{reader_id}`.
      properties:
        name:
          type: string
          description: New name.
          maxLength: 128
          minLength: 1
        access_point_ids:
          type: array
          items:
            $ref: '#/components/schemas/AccessPointId'
          description: New access points, replacing the current ones.
          maxItems: 128
        workload_audiences:
          type: array
          items:
            type: string
          description: New workload audiences, replacing the current ones.
          maxItems: 10
        labels:
          oneOf:
          - $ref: '#/components/schemas/LabelsPatch'
            description: Labels to set or remove, or `null` to remove every label.
          - type: 'null'
        managed_by:
          type:
          - string
          - 'null'
          description: New managing tool, or `null` to clear it.
          maxLength: 64
          pattern: ^[a-z0-9_-]{1,64}$
      additionalProperties: false
    Reason:
      type: string
      description: Why a field was rejected.
      enum:
      - required
      - too_short
      - too_long
      - too_many
      - out_of_range
      - duplicate
      - invalid
      - conflict
    RequestActor:
      type: object
      description: Who asked, or who decided.
      required:
      - type
      - id
      properties:
        type:
          $ref: '#/components/schemas/ActorKind'
          description: A person (signed in to the console), an API client or an agent.
        id:
          type: string
          description: Their ID.
    RevocationProgress:
      type: object
      description: How far a revocation has spread to readers.
      required:
      - readers_confirmed
      - readers_total
      properties:
        readers_confirmed:
          type: integer
          format: int32
          description: Readers that have confirmed the new revocation list.
          minimum: 0
        readers_total:
          type: integer
          format: int32
          description: Readers that need to confirm it.
          minimum: 0
    Role:
      type: object
      description: A named set of scopes.
      required:
      - id
      - name
      - description
      - scopes
      - built_in
      - created_at
      - updated_at
      properties:
        id:
          $ref: '#/components/schemas/RoleId'
          description: |-
            Role ID. The built-in roles are `role_viewer`, `role_security` and
            `role_admin`.
        name:
          type: string
          description: Display name.
          examples:
          - Security
        description:
          type: string
          description: What it's for.
        scopes:
          type: array
          items:
            type: string
          description: The scopes it gives, sorted.
        built_in:
          type: boolean
          description: Whether it's built in. Built-in roles can't be changed or deleted.
        created_at:
          oneOf:
          - $ref: '#/components/schemas/Timestamp'
            description: When the organization made it; `null` for a built-in role.
          - type: 'null'
        updated_at:
          oneOf:
          - $ref: '#/components/schemas/Timestamp'
            description: When it last changed; `null` for a built-in role.
          - type: 'null'
    RoleAssignment:
      type: object
      description: |-
        A role given to a group: every member holds the role's scopes while
        they're in the group.
      required:
      - id
      - etag
      - group_id
      - role_id
      - labels
      - managed_by
      - created_at
      - updated_at
      properties:
        id:
          $ref: '#/components/schemas/RoleAssignmentId'
          description: Role assignment ID.
        etag:
          $ref: '#/components/schemas/ETag'
          description: Current version.
        group_id:
          $ref: '#/components/schemas/GroupId'
          description: The group whose members hold the role.
        role_id:
          $ref: '#/components/schemas/RoleId'
          description: The role.
        labels:
          $ref: '#/components/schemas/Labels'
          description: Labels.
        managed_by:
          type:
          - string
          - 'null'
          description: The tool that manages this resource, such as `terraform`.
          examples:
          - terraform
        created_at:
          $ref: '#/components/schemas/Timestamp'
          description: When it was created.
        updated_at:
          $ref: '#/components/schemas/Timestamp'
          description: When it last changed.
    RoleAssignmentCreate:
      type: object
      description: |-
        Body of `POST /v1/role-assignments`. The caller must already hold every
        scope the role gives.
      required:
      - group_id
      - role_id
      properties:
        group_id:
          $ref: '#/components/schemas/GroupId'
          description: The group whose members will hold the role.
        role_id:
          $ref: '#/components/schemas/RoleId'
          description: The role.
        labels:
          $ref: '#/components/schemas/Labels'
          description: Labels.
        managed_by:
          type: string
          description: The tool that manages this resource. Terraform sets `terraform`.
          examples:
          - terraform
          maxLength: 64
          pattern: ^[a-z0-9_-]{1,64}$
      additionalProperties: false
    RoleAssignmentId:
      type: string
      description: 'Role assignment ID: `rasg_` followed by 1 to 64 lowercase letters and digits.'
      examples:
      - rasg_01jd8k3m2v9x4q7r5t6w8y0z1a
      maxLength: 69
      pattern: ^rasg_[0-9a-z]{1,64}$
    RoleAssignmentList:
      type: object
      required:
      - data
      - next_page_token
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/RoleAssignment'
        next_page_token:
          type:
          - string
          - 'null'
          description: Pass as `page_token` to get the next page; `null` on the last page.
    RoleAssignmentUpdate:
      type: object
      description: |-
        Body of `PATCH /v1/role-assignments/{role_assignment_id}`, a JSON merge
        patch. The group and role are fixed: to change either, delete the
        assignment and make another.
      properties:
        labels:
          oneOf:
          - $ref: '#/components/schemas/LabelsPatch'
            description: Labels to set or remove, or `null` to remove every label.
          - type: 'null'
        managed_by:
          type:
          - string
          - 'null'
          description: New managing tool, or `null` to clear it.
          maxLength: 64
          pattern: ^[a-z0-9_-]{1,64}$
      additionalProperties: false
    RoleCreate:
      type: object
      description: |-
        Body of `POST /v1/roles`: a role of the organization's own. The caller
        must hold every scope it gives. To start from a built-in role, copy its
        `scopes`.
      required:
      - name
      - scopes
      properties:
        name:
          type: string
          description: |-
            Display name, unique among the organization's roles and the built-in
            ones.
          examples:
          - Help desk
          maxLength: 128
          minLength: 1
        description:
          type: string
          description: What it's for.
          maxLength: 1024
        scopes:
          type: array
          items:
            type: string
          description: 'The scopes it gives: exactly these, now and later.'
          minItems: 1
      additionalProperties: false
    RoleGrant:
      type: object
      description: A role a person holds through a group.
      required:
      - group_id
      - role_id
      - break_glass
      properties:
        group_id:
          $ref: '#/components/schemas/GroupId'
          description: The group.
        role_id:
          $ref: '#/components/schemas/RoleId'
          description: The role.
        break_glass:
          type: boolean
          description: |-
            Whether it comes from the break-glass group, which is always
            `role_admin`.
    RoleHolder:
      type: object
      description: Someone who holds a role now, and through which group.
      required:
      - person_id
      - group_id
      - break_glass
      properties:
        person_id:
          $ref: '#/components/schemas/PersonId'
          description: The person.
        group_id:
          $ref: '#/components/schemas/GroupId'
          description: The group that gives them the role.
        break_glass:
          type: boolean
          description: Whether it's the break-glass group, which always gives `role_admin`.
    RoleHolders:
      type: object
      description: Response to `GET /v1/roles/{role_id}/holders`.
      required:
      - role_id
      - holders
      properties:
        role_id:
          $ref: '#/components/schemas/RoleId'
          description: The role.
        holders:
          type: array
          items:
            $ref: '#/components/schemas/RoleHolder'
          description: |-
            Everyone who holds it now, by person, then group. Only active
            people, in the group now.
    RoleId:
      type: string
      description: 'Role ID: `role_` followed by 1 to 64 lowercase letters and digits.'
      examples:
      - role_01jd8k3m2v9x4q7r5t6w8y0z1a
      maxLength: 69
      pattern: ^role_[0-9a-z]{1,64}$
    RoleList:
      type: object
      required:
      - data
      - next_page_token
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/Role'
        next_page_token:
          type:
          - string
          - 'null'
          description: Pass as `page_token` to get the next page; `null` on the last page.
    RoleUpdate:
      type: object
      description: |-
        Body of `PATCH /v1/roles/{role_id}`, a JSON merge patch. `scopes`
        replaces every scope. Built-in roles can't be changed. The caller must
        hold every scope the role gives, before and after.
      properties:
        name:
          type: string
          description: New name.
          maxLength: 128
          minLength: 1
        description:
          type: string
          description: New description.
          maxLength: 1024
        scopes:
          type: array
          items:
            type: string
          description: The scopes, replacing the current ones.
          minItems: 1
      additionalProperties: false
    RuleCondition:
      type: object
      description: One test of a person's details.
      required:
      - attribute
      - operator
      properties:
        attribute:
          type: string
          description: |-
            What to test: `user_type`, `email_domain` (what follows the `@`),
            `source` (`manual`, `scim` or `connector`), `connector_id`, one of the
            person's `attributes` (`department`, `division`, `organization`,
            `cost_center`, `employee_number`, `title`, `location`), a label as
            `labels.<key>`, or `inside`: where their last passage through a door
            took them, within the hours occupancy looks back. `inside` compares
            with area and site IDs, an area counting as inside the areas and
            site above it.
          examples:
          - department
          - labels.team
        operator:
          $ref: '#/components/schemas/RuleOperator'
          description: How to compare.
        values:
          type: array
          items:
            type: string
          description: |-
            What to compare with: one or more for `in`, `not_in` and
            `starts_with`, none for `present` and `absent`.
          maxItems: 100
      additionalProperties: false
    RuleMatch:
      type: string
      description: Whether every condition of a rule must hold, or any one.
      enum:
      - all
      - any
    RuleOperator:
      type: string
      description: |-
        How a condition compares a person's attribute with its values. Text
        compares ignoring case, and surrounding spaces don't count.
      enum:
      - in
      - not_in
      - starts_with
      - present
      - absent
    Schedule:
      type: object
      description: Weekly time windows. Access is allowed while any rule matches.
      required:
      - id
      - etag
      - name
      - description
      - time_zone
      - rules
      - labels
      - managed_by
      - created_at
      - updated_at
      properties:
        id:
          $ref: '#/components/schemas/ScheduleId'
          description: Schedule ID.
        etag:
          $ref: '#/components/schemas/ETag'
          description: Current version.
        name:
          type: string
          description: Display name, unique within the organization.
          examples:
          - weekdays
        description:
          type: string
          description: Free text.
        time_zone:
          oneOf:
          - $ref: '#/components/schemas/TimeZone'
            description: Time zone for the rules. `null` means each door's site time zone.
          - type: 'null'
        rules:
          type: array
          items:
            $ref: '#/components/schemas/ScheduleRule'
          description: The windows.
        labels:
          $ref: '#/components/schemas/Labels'
          description: Labels.
        managed_by:
          type:
          - string
          - 'null'
          description: The tool that manages this resource, such as `terraform`.
          examples:
          - terraform
        created_at:
          $ref: '#/components/schemas/Timestamp'
          description: When the schedule was created.
        updated_at:
          $ref: '#/components/schemas/Timestamp'
          description: When the schedule last changed.
    ScheduleCreate:
      type: object
      description: Body of `POST /v1/schedules`.
      required:
      - name
      - rules
      properties:
        name:
          type: string
          description: Display name, unique within the organization.
          examples:
          - weekdays
          maxLength: 128
          minLength: 1
        description:
          type: string
          description: Free text.
          maxLength: 1024
        time_zone:
          $ref: '#/components/schemas/TimeZone'
          description: Time zone for the rules. Leave out to use each door's site time zone.
        rules:
          type: array
          items:
            $ref: '#/components/schemas/ScheduleRule'
          description: The windows, 1 to 32.
          maxItems: 32
          minItems: 1
        labels:
          $ref: '#/components/schemas/Labels'
          description: Labels.
        managed_by:
          type: string
          description: The tool that manages this resource. Terraform sets `terraform`.
          examples:
          - terraform
          maxLength: 64
          pattern: ^[a-z0-9_-]{1,64}$
      additionalProperties: false
    ScheduleId:
      type: string
      description: 'Schedule ID: `sch_` followed by 1 to 64 lowercase letters and digits.'
      examples:
      - sch_01jd8k3m2v9x4q7r5t6w8y0z1a
      maxLength: 68
      pattern: ^sch_[0-9a-z]{1,64}$
    ScheduleList:
      type: object
      required:
      - data
      - next_page_token
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/Schedule'
        next_page_token:
          type:
          - string
          - 'null'
          description: Pass as `page_token` to get the next page; `null` on the last page.
    ScheduleRule:
      type: object
      description: |-
        One weekly window: on these days, from `from` until `to`.

        A window cannot cross midnight; use two rules (`22:00`–`24:00` and
        `00:00`–`06:00` on the next day) for an overnight shift.
      required:
      - days
      - from
      - to
      properties:
        days:
          type: array
          items:
            $ref: '#/components/schemas/Weekday'
          description: Days the window applies to.
          maxItems: 7
          minItems: 1
        from:
          $ref: '#/components/schemas/TimeOfDay'
          description: Start of the window, inclusive.
        to:
          $ref: '#/components/schemas/TimeOfDay'
          description: End of the window, exclusive. `24:00` runs to midnight.
      additionalProperties: false
    ScheduleUpdate:
      type: object
      description: |-
        Body of `PATCH /v1/schedules/{schedule_id}`, a JSON merge patch. `rules`
        replaces every rule.
      properties:
        name:
          type: string
          description: New name.
          maxLength: 128
          minLength: 1
        description:
          type: string
          description: New description.
          maxLength: 1024
        time_zone:
          oneOf:
          - $ref: '#/components/schemas/TimeZone'
            description: New time zone, or `null` to use each door's site time zone.
          - type: 'null'
        rules:
          type: array
          items:
            $ref: '#/components/schemas/ScheduleRule'
          description: New rules, replacing the current ones.
          maxItems: 32
          minItems: 1
        labels:
          oneOf:
          - $ref: '#/components/schemas/LabelsPatch'
            description: Labels to set or remove, or `null` to remove every label.
          - type: 'null'
        managed_by:
          type:
          - string
          - 'null'
          description: New managing tool, or `null` to clear it.
          maxLength: 64
          pattern: ^[a-z0-9_-]{1,64}$
      additionalProperties: false
    ScopeSource:
      type: object
      description: One scope a person holds, and every role and group it comes from.
      required:
      - scope
      - from
      properties:
        scope:
          type: string
          description: The scope.
          examples:
          - people:read
        from:
          type: array
          items:
            $ref: '#/components/schemas/RoleGrant'
          description: The roles that give it, and the groups that give those.
    ServiceAccountKeySet:
      type: object
      description: Body of `POST /v1/connectors/{connector_id}:set-service-account-key`.
      required:
      - service_account_key
      properties:
        service_account_key:
          type: string
          description: |-
            The service account's JSON key file, as a string. Kept sealed;
            never returned.
          writeOnly: true
          maxLength: 16384
          minLength: 1
      additionalProperties: false
    Severity:
      type: string
      description: How much an item matters. Red in the console means `critical` only.
      enum:
      - critical
      - warning
      - info
    Site:
      type: object
      description: |-
        A building or campus. Areas, doors and access points belong to one site,
        and schedules run in the site's time zone unless they set their own.
      required:
      - id
      - etag
      - name
      - description
      - time_zone
      - address
      - labels
      - managed_by
      - created_at
      - updated_at
      properties:
        id:
          $ref: '#/components/schemas/SiteId'
          description: Site ID.
        etag:
          $ref: '#/components/schemas/ETag'
          description: Current version.
        name:
          type: string
          description: Display name, unique within the organization.
          examples:
          - HQ
        description:
          type: string
          description: Free text.
        time_zone:
          $ref: '#/components/schemas/TimeZone'
          description: Time zone the site's schedules use.
        address:
          oneOf:
          - $ref: '#/components/schemas/Address'
            description: Street address, if set.
          - type: 'null'
        labels:
          $ref: '#/components/schemas/Labels'
          description: Labels.
        managed_by:
          type:
          - string
          - 'null'
          description: |-
            The tool that manages this resource, such as `terraform`. The console
            warns before editing a resource another tool manages.
          examples:
          - terraform
        created_at:
          $ref: '#/components/schemas/Timestamp'
          description: When the site was created.
        updated_at:
          $ref: '#/components/schemas/Timestamp'
          description: When the site last changed.
    SiteCreate:
      type: object
      description: Body of `POST /v1/sites`.
      required:
      - name
      - time_zone
      properties:
        name:
          type: string
          description: Display name, unique within the organization.
          examples:
          - HQ
          maxLength: 128
          minLength: 1
        description:
          type: string
          description: Free text.
          maxLength: 1024
        time_zone:
          $ref: '#/components/schemas/TimeZone'
          description: Time zone the site's schedules use.
        address:
          $ref: '#/components/schemas/Address'
          description: Street address.
        labels:
          $ref: '#/components/schemas/Labels'
          description: Labels.
        managed_by:
          type: string
          description: The tool that manages this resource. Terraform sets `terraform`.
          examples:
          - terraform
          maxLength: 64
          pattern: ^[a-z0-9_-]{1,64}$
      additionalProperties: false
    SiteId:
      type: string
      description: 'Site ID: `site_` followed by 1 to 64 lowercase letters and digits.'
      examples:
      - site_01jd8k3m2v9x4q7r5t6w8y0z1a
      maxLength: 69
      pattern: ^site_[0-9a-z]{1,64}$
    SiteList:
      type: object
      required:
      - data
      - next_page_token
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/Site'
        next_page_token:
          type:
          - string
          - 'null'
          description: Pass as `page_token` to get the next page; `null` on the last page.
    SiteUpdate:
      type: object
      description: Body of `PATCH /v1/sites/{site_id}`, a JSON merge patch.
      properties:
        name:
          type: string
          description: New name.
          maxLength: 128
          minLength: 1
        description:
          type: string
          description: New description.
          maxLength: 1024
        time_zone:
          $ref: '#/components/schemas/TimeZone'
          description: New time zone.
        address:
          oneOf:
          - $ref: '#/components/schemas/AddressPatch'
            description: Changes to the address, merged into the current one, or `null` to remove it.
          - type: 'null'
        labels:
          oneOf:
          - $ref: '#/components/schemas/LabelsPatch'
            description: Labels to set or remove, or `null` to remove every label.
          - type: 'null'
        managed_by:
          type:
          - string
          - 'null'
          description: New managing tool, or `null` to clear it.
          maxLength: 64
          pattern: ^[a-z0-9_-]{1,64}$
      additionalProperties: false
    Source:
      type: object
      description: |-
        Where a person or group comes from. Only that source may change it;
        writes from anywhere else return `409` with `/problems/wrong-writer`.
      required:
      - type
      - connector_id
      properties:
        type:
          $ref: '#/components/schemas/SourceKind'
          description: The writing system.
        connector_id:
          oneOf:
          - $ref: '#/components/schemas/ConnectorId'
            description: The connector, when `type` is `connector`.
          - type: 'null'
    SourceKind:
      type: string
      description: Which system writes a person or group.
      enum:
      - manual
      - scim
      - connector
    SummaryBucket:
      type: object
      description: One bucket of an [`EventSummary`].
      required:
      - start
      - counts
      - granted
      - denied
      properties:
        start:
          type: string
          description: When it starts, in the summary's time zone, with its offset.
          examples:
          - 2026-12-02T00:00:00-05:00
        counts:
          $ref: '#/components/schemas/CategoryCounts'
          description: Events by category.
        granted:
          type: integer
          format: int64
          description: Doors opened.
          minimum: 0
        denied:
          type: integer
          format: int64
          description: People turned away.
          minimum: 0
    SuspendedBy:
      type: string
      description: Who suspended a credential.
      enum:
      - administrator
      - identity_provider
    TimeOfDay:
      type: string
      description: Time of day, `HH:MM`. `24:00` is the end of the day and is only valid as the end of a window.
      examples:
      - 07:30
      pattern: ^(([01][0-9]|2[0-3]):[0-5][0-9]|24:00)$
    TimePunch:
      type: object
      description: One punch.
      required:
      - event_id
      - at
      - person_id
      - access_point_id
      - site_id
      - reader_id
      - direction
      properties:
        event_id:
          $ref: '#/components/schemas/EventId'
          description: The `com.passway.time.punch` event.
        at:
          $ref: '#/components/schemas/Timestamp'
          description: When, by the reader's clock.
        person_id:
          $ref: '#/components/schemas/PersonId'
          description: Who.
        access_point_id:
          $ref: '#/components/schemas/AccessPointId'
          description: Where.
        site_id:
          $ref: '#/components/schemas/SiteId'
          description: Its site.
        reader_id:
          $ref: '#/components/schemas/ReaderId'
          description: The reader.
        direction:
          oneOf:
          - $ref: '#/components/schemas/PunchDirection'
            description: '`in`, `out`, or `null` between two areas of the site.'
          - type: 'null'
    TimePunches:
      type: object
      description: Response to `GET /v1/time-punches`.
      required:
      - punches
      - truncated
      properties:
        punches:
          type: array
          items:
            $ref: '#/components/schemas/TimePunch'
          description: The punches, earliest first.
        truncated:
          type: boolean
          description: |-
            Whether there were more than 10,000, so only the earliest are here:
            ask again from the last one's time.
    TimeZone:
      type: string
      description: IANA time zone name, such as `America/New_York`, or `UTC`. A name of the wrong shape is refused with `400`, and one not in the IANA time zone database with `422`.
      examples:
      - America/New_York
      maxLength: 64
    Timestamp:
      type: string
      format: date-time
      description: RFC 3339 timestamp, in years 0000 to 9999 once converted to UTC. Passway always returns UTC.
      examples:
      - 2026-11-30T14:02:11Z
    Via:
      type: string
      description: How a change reached Passway.
      enum:
      - console
      - api
      - terraform
      - mcp
      - cli
      - scim
      - connector
      - reader
      - system
    Wallet:
      type: string
      description: The wallet holding the credential.
      enum:
      - apple
      - google
      - samsung
      - passway
    Weekday:
      type: string
      description: A day of the week.
      enum:
      - mon
      - tue
      - wed
      - thu
      - fri
      - sat
      - sun
    Zone:
      type: object
      description: A named group of areas, which may be at different sites.
      required:
      - id
      - etag
      - name
      - description
      - area_ids
      - labels
      - managed_by
      - created_at
      - updated_at
      properties:
        id:
          $ref: '#/components/schemas/ZoneId'
          description: Zone ID.
        etag:
          $ref: '#/components/schemas/ETag'
          description: Current version.
        name:
          type: string
          description: Display name, unique within the organization.
          examples:
          - Amenities
        description:
          type: string
          description: Free text.
        area_ids:
          type: array
          items:
            $ref: '#/components/schemas/AreaId'
          description: The areas in the zone.
        labels:
          $ref: '#/components/schemas/Labels'
          description: Labels.
        managed_by:
          type:
          - string
          - 'null'
          description: The tool that manages this resource, such as `terraform`.
          examples:
          - terraform
        created_at:
          $ref: '#/components/schemas/Timestamp'
          description: When the zone was created.
        updated_at:
          $ref: '#/components/schemas/Timestamp'
          description: When the zone last changed.
    ZoneCreate:
      type: object
      description: Body of `POST /v1/zones`.
      required:
      - name
      - area_ids
      properties:
        name:
          type: string
          description: Display name, unique within the organization.
          examples:
          - Amenities
          maxLength: 128
          minLength: 1
        description:
          type: string
          description: Free text.
          maxLength: 1024
        area_ids:
          type: array
          items:
            $ref: '#/components/schemas/AreaId'
          description: The areas in the zone, 1 to 1000.
          maxItems: 1000
          minItems: 1
        labels:
          $ref: '#/components/schemas/Labels'
          description: Labels.
        managed_by:
          type: string
          description: The tool that manages this resource. Terraform sets `terraform`.
          examples:
          - terraform
          maxLength: 64
          pattern: ^[a-z0-9_-]{1,64}$
      additionalProperties: false
    ZoneId:
      type: string
      description: 'Zone ID: `zone_` followed by 1 to 64 lowercase letters and digits.'
      examples:
      - zone_01jd8k3m2v9x4q7r5t6w8y0z1a
      maxLength: 69
      pattern: ^zone_[0-9a-z]{1,64}$
    ZoneList:
      type: object
      required:
      - data
      - next_page_token
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/Zone'
        next_page_token:
          type:
          - string
          - 'null'
          description: Pass as `page_token` to get the next page; `null` on the last page.
    ZoneUpdate:
      type: object
      description: |-
        Body of `PATCH /v1/zones/{zone_id}`, a JSON merge patch. `area_ids`
        replaces the whole list.
      properties:
        name:
          type: string
          description: New name.
          maxLength: 128
          minLength: 1
        description:
          type: string
          description: New description.
          maxLength: 1024
        area_ids:
          type: array
          items:
            $ref: '#/components/schemas/AreaId'
          description: New areas, replacing the current ones.
          maxItems: 1000
          minItems: 1
        labels:
          oneOf:
          - $ref: '#/components/schemas/LabelsPatch'
            description: Labels to set or remove, or `null` to remove every label.
          - type: 'null'
        managed_by:
          type:
          - string
          - 'null'
          description: New managing tool, or `null` to clear it.
          maxLength: 64
          pattern: ^[a-z0-9_-]{1,64}$
      additionalProperties: false
  responses:
    BadRequest:
      description: The request could not be read (`/problems/bad-request`).
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/Problem'
    Conflict:
      description: 'The request conflicts with the current state: a duplicate name (`/problems/conflict`), resources that still depend on this one (`/problems/has-dependents`), or a resource another source manages (`/problems/wrong-writer`).'
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/Problem'
    Forbidden:
      description: The access token lacks the required scope.
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/Problem'
    NotFound:
      description: No such resource.
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/Problem'
    PreconditionFailed:
      description: The resource changed since you read it. Get it again and retry.
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/Problem'
    PreconditionRequired:
      description: '`If-Match` is required.'
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/Problem'
    TooManyRequests:
      description: Rate limited.
      headers:
        Retry-After:
          $ref: '#/components/headers/RetryAfter'
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/Problem'
    Unauthorized:
      description: Missing or invalid access token.
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/Problem'
    UnprocessableContent:
      description: The request has invalid fields (`/problems/validation`, with `errors`), or an `Idempotency-Key` was reused for a different request.
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/Problem'
  parameters:
    IdempotencyKey:
      name: Idempotency-Key
      in: header
      description: A unique key, such as a UUID. Repeating a successful request with the same key within 24 hours returns the original response; reusing it for a different request returns `422`; repeating it while the first is still running returns `409` with `Retry-After`.
      required: false
      schema:
        type: string
        maxLength: 255
        minLength: 1
    IfMatch:
      name: If-Match
      in: header
      description: The resource's current `etag`, in double quotes.
      required: true
      schema:
        type: string
        examples:
        - '"3f9a"'
    IfMatchOptional:
      name: If-Match
      in: header
      description: If set, the action only runs if the resource's `etag` still matches.
      required: false
      schema:
        type: string
        examples:
        - '"3f9a"'
    PageSize:
      name: page_size
      in: query
      description: Results per page, 1 to 200. `0` or absent means 50; more than 200 means 200 (AIP-158).
      required: false
      schema:
        type: integer
        default: 50
        minimum: 0
    PageToken:
      name: page_token
      in: query
      description: '`next_page_token` from the previous page.'
      required: false
      schema:
        type: string
    UpdatedSince:
      name: updated_since
      in: query
      description: Only resources changed at or after this time.
      required: false
      schema:
        $ref: '#/components/schemas/Timestamp'
  headers:
    ETag:
      schema:
        type: string
      description: The resource's `etag`, in double quotes.
    RetryAfter:
      schema:
        type: integer
        minimum: 0
      description: Seconds to wait before retrying.
  securitySchemes:
    oauth2:
      type: oauth2
      flows:
        authorizationCode:
          authorizationUrl: /oauth/authorize
          tokenUrl: /oauth/token
          scopes:
            access-assignments:read: Read access assignments
            access-assignments:write: Create, change and delete access assignments
            access-points:read: Read access points
            access-points:write: Create, change and delete access points
            access-profiles:read: Read access profiles
            access-profiles:write: Create, change and delete access profiles
            agents:read: Read agents
            agents:write: Create, change and delete agents
            api-clients:read: Read api clients
            api-clients:write: Create, change and delete api clients
            apps:read: Read apps
            apps:write: Create, change and delete apps
            areas:read: Read areas
            areas:write: Create, change and delete areas
            cameras:read: Read cameras
            cameras:write: Create, change and delete cameras
            connectors:read: Read connectors
            connectors:write: Create, change and delete connectors
            credentials:read: Read credentials
            credentials:revoke: Revoke credentials
            credentials:write: Suspend and resume credentials
            domains:read: Read domains
            domains:write: Create, change and delete domains
            doors:read: Read doors
            doors:write: Create, change and delete doors
            events:read: Read events
            groups:read: Read groups
            groups:write: Create, change and delete groups
            identity-providers:read: Read identity providers
            identity-providers:write: Create, change and delete identity providers
            log-streams:read: Read log streams
            log-streams:write: Create, change and delete log streams
            membership-requests:read: Read membership requests
            membership-requests:write: Create, change and delete membership requests
            musters:read: Read musters
            musters:write: Create, change and delete musters
            organization:read: 'Read the organization: data location, issuer, retention'
            organization:write: Change the organization's kind, event retention and legal hold
            people:read: Read people
            people:write: Create, change and delete people
            reader-groups:read: Read reader groups
            reader-groups:write: Create, change and delete reader groups
            readers:read: Read readers
            readers:write: Create, change and delete readers
            role-assignments:read: Read role assignments
            role-assignments:write: Create, change and delete role assignments
            roles:read: Read the roles
            roles:write: Make, change and delete the organization's own roles
            schedules:read: Read schedules
            schedules:write: Create, change and delete schedules
            sites:read: Read sites
            sites:write: Create, change and delete sites
            time-punches:read: Read time clock punches, without the rest of the event log
            zones:read: Read zones
            zones:write: Create, change and delete zones
        clientCredentials:
          tokenUrl: /oauth/token
          scopes:
            access-assignments:read: Read access assignments
            access-assignments:write: Create, change and delete access assignments
            access-points:read: Read access points
            access-points:write: Create, change and delete access points
            access-profiles:read: Read access profiles
            access-profiles:write: Create, change and delete access profiles
            agents:read: Read agents
            agents:write: Create, change and delete agents
            api-clients:read: Read api clients
            api-clients:write: Create, change and delete api clients
            apps:read: Read apps
            apps:write: Create, change and delete apps
            areas:read: Read areas
            areas:write: Create, change and delete areas
            cameras:read: Read cameras
            cameras:write: Create, change and delete cameras
            connectors:read: Read connectors
            connectors:write: Create, change and delete connectors
            credentials:read: Read credentials
            credentials:revoke: Revoke credentials
            credentials:write: Suspend and resume credentials
            domains:read: Read domains
            domains:write: Create, change and delete domains
            doors:read: Read doors
            doors:write: Create, change and delete doors
            events:read: Read events
            groups:read: Read groups
            groups:write: Create, change and delete groups
            identity-providers:read: Read identity providers
            identity-providers:write: Create, change and delete identity providers
            log-streams:read: Read log streams
            log-streams:write: Create, change and delete log streams
            membership-requests:read: Read membership requests
            membership-requests:write: Create, change and delete membership requests
            musters:read: Read musters
            musters:write: Create, change and delete musters
            organization:read: 'Read the organization: data location, issuer, retention'
            organization:write: Change the organization's kind, event retention and legal hold
            people:read: Read people
            people:write: Create, change and delete people
            reader-groups:read: Read reader groups
            reader-groups:write: Create, change and delete reader groups
            readers:read: Read readers
            readers:write: Create, change and delete readers
            role-assignments:read: Read role assignments
            role-assignments:write: Create, change and delete role assignments
            roles:read: Read the roles
            roles:write: Make, change and delete the organization's own roles
            schedules:read: Read schedules
            schedules:write: Create, change and delete schedules
            sites:read: Read sites
            sites:write: Create, change and delete sites
            time-punches:read: Read time clock punches, without the rest of the event log
            zones:read: Read zones
            zones:write: Create, change and delete zones
      description: Client credentials for machines; authorization code with PKCE for people. The endpoints are on the organization's own host, which is its issuer.
tags:
- name: Organization
  description: 'The organization itself: where its data lives, its issuer, and its event log''s retention and legal hold.'
- name: Sites
  description: A building or campus (IFC site). Areas, doors and access points belong to one site, and schedules run in its time zone.
- name: Areas
  description: 'Places at a site: buildings, floors, rooms and units, in a tree (ONVIF area; IFC building, storey and space).'
- name: Zones
  description: Named groups of areas that need not be adjacent and may be at different sites (IFC zone), such as every lobby.
- name: Doors
  description: 'Physical openings and their lock timings (ONVIF door): doors, turnstiles, barriers and mantraps.'
- name: Access points
  description: 'One controlled way from one area into another (ONVIF access point). Readers serve access points, and access profiles grant access to them. A door with a reader on each side has two; an elevator has one per floor. An access point with `timekeeping` is a time clock: its grants are punches (`GET /v1/time-punches`). An access point''s `policy_mode` follows Kubernetes Pod Security admission: `enforce` (the default) keeps out whoever the access policies don''t allow; `audit` lets in anyone with a working credential of the organization, and `com.passway.access.granted` says whether the policies allowed them (`permitted`); `warn` does the same and raises `com.passway.access.policy_warning`.'
- name: Reader groups
  description: Readers that trust the same issuer keys and share one revocation list.
- name: Readers
  description: Aliro and retrofit readers. The API creates a reader and returns a one-time enrolment token; the device completes enrolment on the device API with mutual TLS.
- name: Cameras
  description: 'Cameras that watch access points (#382). A camera agent on site reads the camera''s analytics (ONVIF Profile M: the line crossing counter and face recognition) and reports what it saw to `:observe`, where Passway matches it with the doors'' grants: more people than grants is tailgating, and a recognized face is checked against the credential that opened the door. Passway keeps no images and no face data. Face recognition needs the organization''s `face_recognition` on, which should wait for counsel: face geometry is biometric information under laws such as Illinois''s BIPA.'
- name: Musters
  description: 'Roll calls at a site, as in an evacuation (#75). Creating one starts it: the people inside the site then, by their last passage through an access point in the 24 hours before, are expected. They are counted off as they tap at a muster point (a reader at the assembly point, granted or not), go out of the site through a reader, or are marked safe by a warden (`:account`). `missing` is who is left. A site has one muster going at a time; `:end` stops counting and keeps the roll as it stood.'
- name: Schedules
  description: Weekly time windows that access policies refer to.
- name: Access profiles
  description: 'Where and when (ONVIF access profile): a set of access policies, each naming access points, areas, zones or sites, a schedule and Aliro capabilities. Passway compiles each profile into Aliro access levels.'
- name: Access assignments
  description: 'Who: an access profile given to groups and people, optionally for a time window. Every change re-issues the affected credentials'' Access Documents.'
- name: People
  description: People who can hold credentials, with SCIM core field names. Most arrive from the identity provider over SCIM or from a connector, and only that source can change them.
- name: Groups
  description: Groups of people. Groups synced from the identity provider are read-only here; manual groups are managed through the API.
- name: Membership requests
  description: Requests to add someone to a group whose `manual_members` is `approval`. Someone other than whoever asked, and other than the person joining, approves or denies each one; approving adds them, until the request's `valid_to`. A group's `approver_group_id` limits approving to its members. Requests nobody decides expire after 7 days. Every step is an event.
- name: Roles
  description: 'Roles for the organization''s own administrators. A role is a named set of scopes; `viewer`, `security` and `admin` are built in and can''t be changed. A role assignment gives a role to a group, never to a person: what someone signed in may do is the union of their groups'' roles, worked out on every request. The break-glass group (a group with `break_glass`) is always `admin`.'
- name: Apps
  description: Other applications people sign in to with Passway, through OpenID Connect. Only members of an app's groups can sign in to it; an app with no groups lets nobody in.
- name: API clients
  description: Programs that call the API with credentials of their own, such as Terraform, CI, connectors and agents. Each gets access tokens from its organization's token endpoint with the client credentials grant, limited to its scopes.
- name: Connectors
  description: 'Where people and groups come from when the organization''s identity provider is the source of truth. A `scim` connector is a SCIM 2.0 endpoint (RFC 7643, 7644) at `/scim/v2` on the organization''s host that Okta, Microsoft Entra ID and others push people and groups to, with a token of its own. A `google_workspace` connector reads users and groups from Google Workspace''s Admin SDK Directory API, with a service account granted read-only domain-wide delegation, every 15 minutes and on `:sync`. Suspended users are inactive people; a user deleted in Google is deactivated and handed to the organization; group membership is flattened. A sync that would remove more than a quarter of the people or groups it manages (and more than 10) applies everything else and holds the removals until `:sync` confirms them. What a connector creates is its own: `/v1` refuses changes to the fields it writes with `409` `/problems/wrong-writer`.'
- name: Agents
  description: Software agents and robots that act for the organization. Each has a human sponsor, an operator, an expiry (90 days unless set, at most 365) and keys of its own. It gets an access token by signing a client assertion with one of them (`private_key_jwt`, RFC 7523) and binding the token to a key of its choice with DPoP (RFC 9449), so a stolen token is useless. An agent can never hold a scope that changes who has access, such as `people:write` or `access-assignments:write`. Deactivating or deleting the sponsor suspends their agents, and `/v1/agents:suspend` stops a sponsor's, an operator's, or every agent at once.
- name: Identity providers
  description: 'The organization''s own identity providers (Okta, Microsoft Entra ID, Google), which administrators sign in with over OpenID Connect at `/sign-in`. Role rules give each person a role from their ID token''s claims: `admin`, `security` or `viewer`. Nobody matches, nobody gets in.'
- name: Domains
  description: Hosts the organization owns, such as `login.acme.com`, for its sign-in pages and links. Prove ownership with the TXT record in `verification`, and route the host with a CNAME to `cname_target`, the organization's own host. `:verify` checks both now; Passway rechecks every ten minutes, and a verified host whose CNAME goes is `unrouted` until it returns. `com.passway.domain.verified`, `.unrouted` and `.rerouted` events record each change.
- name: Log streams
  description: 'The event log, delivered as it is sealed to storage the organization controls, in its own region: an HTTPS endpoint such as a SIEM, or a bucket in Amazon S3, Google Cloud Storage or Azure Blob Storage. Delivery is at least once and in chain order. An `https` stream posts CloudEvents JSON batches (`application/cloudevents-batch+json`). A bucket stream writes each batch as one object of gzipped JSON Lines, named `PREFIX/YYYY/MM/DD/FIRST-LAST.jsonl.gz` by the UTC date of its first event and the `chainseq` of its first and last links, so names sort in chain order. Each event carries `chainseq` and `chainhash`, and the signed checkpoints are events too, so the copy can be checked against `/.well-known/jwks.json` without Passway. A batch counts as delivered on a `2xx`; failures are retried with backoff up to five minutes. `status` says how a stream is doing, and `com.passway.log_stream.behind` and `.recovered` events say when that changes.'
- name: Credentials
  description: Credentials in phone and watch wallets. Enrolment creates them; the API can suspend, resume and revoke them.
- name: Events
  description: 'The event feed: every change and every tap, as CloudEvents, hash-chained with signed checkpoints. Webhooks and streams carry the same events.'
