{
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "bearerFormat": "session token",
        "scheme": "bearer",
        "type": "http"
      }
    },
    "schemas": {
      "AccessEventBundleWireResponse": {
        "type": "object",
        "properties": {
          "body": {
            "description": "Event-type-specific body the signature commits to."
          },
          "event": {
            "type": "object",
            "properties": {},
            "additionalProperties": {}
          },
          "eventHash": {
            "type": "string",
            "minLength": 1,
            "description": "Hash of the canonical signed event."
          }
        },
        "required": [
          "body",
          "event",
          "eventHash"
        ],
        "additionalProperties": {},
        "description": "A signed access event as stored: the event, its typed body, and its hash, which clients verify before trusting."
      },
      "AccessManifestBundleWireResponse": {
        "type": "object",
        "properties": {
          "event": {
            "$ref": "#/components/schemas/AccessEventBundleWireResponse"
          },
          "manifest": {
            "type": "object",
            "properties": {},
            "additionalProperties": {}
          },
          "manifestHash": {
            "type": "string",
            "minLength": 1,
            "description": "Hash of the canonical manifest; other responses cite the manifest by this value."
          },
          "state": {
            "type": "object",
            "properties": {},
            "additionalProperties": {},
            "description": "Derived structural state the manifest commits to."
          }
        },
        "required": [
          "event",
          "manifest",
          "manifestHash",
          "state"
        ],
        "additionalProperties": {},
        "description": "A signed access manifest with the event that produced it, exactly as the API stores it."
      },
      "BillingErrorResponse": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string",
            "enum": [
              "billing_checkout_no_active_members",
              "billing_roster_over_capacity"
            ],
            "description": "Machine-readable reason, such as an empty roster or a roster larger than any plan."
          },
          "error": {
            "type": "string"
          }
        },
        "required": [
          "error"
        ],
        "additionalProperties": {},
        "description": "A refused billing request."
      },
      "BlobAttachmentBindRequest": {
        "type": "object",
        "properties": {
          "authorizingContainerPathRefs": {
            "$ref": "#/components/schemas/ContainerManifestRefArrayArray",
            "description": "Container paths that authorize the write; the API resolves the document link-set manifest itself."
          },
          "body": {
            "description": "Signed bind body naming the binding, blob, document, slot, replaced binding, and document manifest hash."
          },
          "containerRekeys": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ContainerMutationRequest"
            },
            "maxItems": 16,
            "description": "Container rekeys to commit first in the same transaction."
          },
          "contentKeyBundle": {
            "$ref": "#/components/schemas/BlobContentKeyBundleRequest"
          },
          "documentSync": {
            "$ref": "#/components/schemas/DocumentSyncRequest",
            "description": "The document's first queued update, committed with the bind under every check a standalone sync makes."
          },
          "event": {
            "type": "object",
            "properties": {},
            "additionalProperties": {}
          },
          "stagedBlob": {
            "$ref": "#/components/schemas/BlobStagedBlobRequest",
            "description": "The blob stage to promote; absent when binding a blob that is already committed."
          }
        },
        "required": [
          "authorizingContainerPathRefs",
          "body",
          "contentKeyBundle",
          "event"
        ],
        "additionalProperties": {},
        "description": "A signed `attachment.bind`: puts a blob in a document slot, optionally completing a blob stage and committing the document's first update."
      },
      "BlobAttachmentBindResponse": {
        "type": "object",
        "properties": {
          "bindingId": {
            "type": "string"
          },
          "blobId": {
            "type": "string"
          },
          "blobKekTargets": {
            "$ref": "#/components/schemas/BlobKekTargetsResponse"
          },
          "contentKeyEpoch": {
            "exclusiveMinimum": 0,
            "maximum": 1.7976931348623157e+308,
            "type": "integer",
            "description": "Content-key epoch the API stored for the blob."
          },
          "documentId": {
            "type": "string"
          },
          "documentManifestHash": {
            "type": "string",
            "description": "Document link-set manifest head the bind was checked against."
          },
          "eventHash": {
            "type": "string",
            "minLength": 1,
            "description": "Hash of the signed bind event."
          },
          "previousBindingId": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Binding this one replaced in the slot, or null."
          },
          "slotId": {
            "type": "string"
          },
          "writeHeaderHash": {
            "type": "string",
            "description": "Hash of the stored blob write header."
          },
          "documentSync": {
            "type": "object",
            "properties": {
              "acceptedOutgoingUpdateIds": {
                "type": "array",
                "items": {
                  "type": "string",
                  "minLength": 1
                },
                "maxItems": 1
              },
              "commitLsn": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "commitLsnMode": {
                "anyOf": [
                  {
                    "type": "string",
                    "const": "tracked"
                  },
                  {
                    "type": "string",
                    "const": "untracked"
                  }
                ]
              }
            },
            "required": [
              "acceptedOutgoingUpdateIds",
              "commitLsn",
              "commitLsnMode"
            ],
            "additionalProperties": {},
            "description": "Present exactly when the request carried `documentSync`; names the accepted update."
          }
        },
        "required": [
          "bindingId",
          "blobId",
          "blobKekTargets",
          "contentKeyEpoch",
          "documentId",
          "documentManifestHash",
          "eventHash",
          "previousBindingId",
          "slotId",
          "writeHeaderHash"
        ],
        "additionalProperties": {},
        "description": "Acknowledges a bind by hash, so the client can compare it with what it signed."
      },
      "BlobAttachmentDetachRequest": {
        "type": "object",
        "properties": {
          "authorizingContainerPathRefs": {
            "$ref": "#/components/schemas/ContainerManifestRefArrayArray",
            "description": "Container paths that authorize the write."
          },
          "body": {},
          "containerRekeys": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ContainerMutationRequest"
            },
            "maxItems": 16,
            "description": "Container rekeys to commit first in the same transaction."
          },
          "event": {
            "type": "object",
            "properties": {},
            "additionalProperties": {}
          }
        },
        "required": [
          "authorizingContainerPathRefs",
          "body",
          "event"
        ],
        "additionalProperties": {},
        "description": "A signed `attachment.detach` that removes an active binding from its slot."
      },
      "BlobAttachmentDetachResponse": {
        "type": "object",
        "properties": {
          "bindingId": {
            "type": "string"
          },
          "blobId": {
            "type": "string"
          },
          "documentId": {
            "type": "string"
          },
          "slotId": {
            "type": "string"
          }
        },
        "required": [
          "bindingId",
          "blobId",
          "documentId",
          "slotId"
        ],
        "additionalProperties": {},
        "description": "Confirms which binding was detached."
      },
      "BlobAttachmentSummary": {
        "type": "object",
        "properties": {
          "bindingEvent": {
            "$ref": "#/components/schemas/AccessEventBundleWireResponse",
            "description": "The signed `attachment.bind` event."
          },
          "bindingId": {
            "type": "string"
          },
          "blobId": {
            "type": "string"
          },
          "blobKekTargets": {
            "$ref": "#/components/schemas/BlobKekTargetsResponse"
          },
          "contentKeyBundle": {
            "$ref": "#/components/schemas/BlobContentKeyBundleResponse"
          },
          "documentManifestHash": {
            "type": "string",
            "description": "Document link-set manifest head the binding was made under."
          },
          "previousBindingId": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Binding this one replaced, or null."
          },
          "slotId": {
            "type": "string"
          },
          "writeAuthorization": {
            "$ref": "#/components/schemas/BlobKekTargetsResponse",
            "description": "Key targets the blob's write was authorized against."
          },
          "writeHeader": {
            "type": "object",
            "properties": {},
            "additionalProperties": {},
            "description": "The blob's signed write header."
          }
        },
        "required": [
          "bindingEvent",
          "bindingId",
          "blobId",
          "blobKekTargets",
          "contentKeyBundle",
          "documentManifestHash",
          "previousBindingId",
          "slotId",
          "writeAuthorization",
          "writeHeader"
        ],
        "additionalProperties": {},
        "description": "One active attachment binding with everything a reader needs to verify and decrypt its blob."
      },
      "BlobContentKeyBundleRequest": {
        "type": "object",
        "properties": {
          "contentKeyEpoch": {
            "exclusiveMinimum": 0,
            "maximum": 1.7976931348623157e+308,
            "type": "integer"
          },
          "targetHash": {
            "type": "string",
            "minLength": 1,
            "description": "Target hash the wraps must match; the API derives it from verified access state."
          },
          "targets": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BlobContentKeyTargetEnvelopeRequest"
            }
          }
        },
        "required": [
          "contentKeyEpoch",
          "targetHash",
          "targets"
        ],
        "additionalProperties": {},
        "description": "A blob content-key bundle: the blob content key wrapped to every container KEK target of the new binding."
      },
      "BlobContentKeyBundleResponse": {
        "type": "object",
        "properties": {
          "blobId": {
            "type": "string"
          },
          "contentKeyEpoch": {
            "exclusiveMinimum": 0,
            "maximum": 1.7976931348623157e+308,
            "type": "integer"
          },
          "targetHash": {
            "type": "string",
            "description": "Hash of the key target set the wraps cover."
          },
          "targets": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BlobContentKeyTargetEnvelopeResponse"
            }
          }
        },
        "required": [
          "blobId",
          "contentKeyEpoch",
          "targetHash",
          "targets"
        ],
        "additionalProperties": {},
        "description": "A blob content-key bundle: the blob content key wrapped to the container KEKs of its active attachment bindings."
      },
      "BlobContentKeyTargetEnvelopeRequest": {
        "type": "object",
        "properties": {
          "bindingId": {
            "type": "string",
            "minLength": 1
          },
          "containerId": {
            "type": "string",
            "minLength": 1
          },
          "containerKeyEpoch": {
            "exclusiveMinimum": 0,
            "maximum": 1.7976931348623157e+308,
            "type": "integer",
            "description": "Epoch of the container KEK that wraps the key."
          },
          "containerKeyEpochId": {
            "type": "string",
            "minLength": 1,
            "description": "Id of that container KEK epoch."
          },
          "containerManifestHash": {
            "type": "string",
            "minLength": 1,
            "description": "Container manifest head the wrap was made under."
          },
          "documentId": {
            "type": "string",
            "minLength": 1
          },
          "wrappedKey": {
            "type": "string",
            "minLength": 64,
            "maxLength": 64,
            "pattern": "^[A-Za-z0-9+/]{64}$",
            "description": "The content key encrypted under the container KEK."
          },
          "wrappingMetadata": {
            "type": "object",
            "properties": {
              "suite": {
                "type": "string",
                "const": "tearleads.blob.content-key-wrap.aes-256-gcm-container-kek"
              },
              "iv": {
                "type": "string",
                "minLength": 16,
                "maxLength": 16,
                "pattern": "^[A-Za-z0-9+/]{16}$"
              }
            },
            "required": [
              "suite",
              "iv"
            ],
            "additionalProperties": false,
            "description": "Wrapping suite and IV needed to unwrap `wrappedKey`."
          }
        },
        "required": [
          "bindingId",
          "containerId",
          "containerKeyEpoch",
          "containerKeyEpochId",
          "containerManifestHash",
          "documentId",
          "wrappedKey",
          "wrappingMetadata"
        ],
        "additionalProperties": {},
        "description": "The blob content key wrapped to one container KEK for one attachment binding."
      },
      "BlobContentKeyTargetEnvelopeResponse": {
        "type": "object",
        "properties": {
          "bindingId": {
            "type": "string"
          },
          "containerId": {
            "type": "string"
          },
          "containerKeyEpoch": {
            "exclusiveMinimum": 0,
            "maximum": 1.7976931348623157e+308,
            "type": "integer"
          },
          "containerKeyEpochId": {
            "type": "string",
            "description": "Id of the container KEK epoch that wraps the key."
          },
          "containerManifestHash": {
            "type": "string",
            "description": "Container manifest head the wrap was made under."
          },
          "documentId": {
            "type": "string"
          },
          "wrappedKey": {
            "type": "string",
            "description": "The content key encrypted under the container KEK."
          },
          "wrappingMetadata": {
            "type": "object",
            "properties": {},
            "additionalProperties": {},
            "description": "Wrapping suite and IV needed to unwrap `wrappedKey`."
          }
        },
        "required": [
          "bindingId",
          "containerId",
          "containerKeyEpoch",
          "containerKeyEpochId",
          "containerManifestHash",
          "documentId",
          "wrappedKey",
          "wrappingMetadata"
        ],
        "additionalProperties": {},
        "description": "A stored wrap of a blob content key to one container KEK for one attachment binding."
      },
      "BlobKekTargetsResponse": {
        "type": "object",
        "properties": {
          "activeBindingIds": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Attachment bindings currently referencing the blob."
          },
          "blobAccessManifestHash": {
            "type": "string",
            "description": "Access manifest hash the blob's writes are bound to."
          },
          "blobId": {
            "type": "string"
          },
          "blobKeyTargetHash": {
            "type": "string",
            "description": "Hash of the derived target set."
          },
          "documentManifestHashes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "linkedContainerKeyEpochIds": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Current container KEK epochs of the linked containers."
          },
          "linkedContainerManifestHashes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "organizationId": {
            "type": "string"
          },
          "targets": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {},
              "additionalProperties": {}
            }
          }
        },
        "required": [
          "activeBindingIds",
          "blobAccessManifestHash",
          "blobId",
          "blobKeyTargetHash",
          "documentManifestHashes",
          "linkedContainerKeyEpochIds",
          "linkedContainerManifestHashes",
          "organizationId",
          "targets"
        ],
        "additionalProperties": {},
        "description": "The key targets the API derived for a blob from its active attachment bindings and their documents' linked containers."
      },
      "BlobMutationFailureResponse": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string",
            "const": "container_unavailable",
            "description": "`container_unavailable` when a container the write depends on no longer exists."
          },
          "error": {
            "type": "string",
            "minLength": 1
          }
        },
        "required": [
          "error"
        ],
        "additionalProperties": {},
        "description": "A refused attachment bind or detach."
      },
      "BlobStagedBlobRequest": {
        "type": "object",
        "properties": {
          "stageId": {
            "type": "string",
            "minLength": 1
          },
          "writeHeader": {
            "type": "object",
            "properties": {},
            "additionalProperties": {},
            "description": "Signed write header committing to the blob id, access manifest, content-key epoch, target hash, and ciphertext hash."
          }
        },
        "required": [
          "stageId",
          "writeHeader"
        ],
        "additionalProperties": {},
        "description": "Names the blob stage an attachment bind completes, with the blob's signed write header."
      },
      "ChallengeRequest": {
        "type": "object",
        "properties": {
          "fingerprint": {
            "maxLength": 64,
            "minLength": 64,
            "pattern": "^[0-9a-f]+$",
            "type": "string",
            "description": "Lowercase hex SHA-256 fingerprint of the identity's ML-DSA-87 signing public key."
          }
        },
        "required": [
          "fingerprint"
        ],
        "additionalProperties": {},
        "description": "Asks for a sign-in challenge for a registered identity."
      },
      "ChallengeResponse": {
        "type": "object",
        "properties": {
          "challenge": {
            "maxLength": 64,
            "minLength": 64,
            "pattern": "^[0-9a-f]+$",
            "type": "string",
            "description": "Random hex challenge; it expires after a short time and can be verified once."
          }
        },
        "required": [
          "challenge"
        ],
        "additionalProperties": {},
        "description": "A one-time sign-in challenge that the client signs and returns to `POST /auth/verify`."
      },
      "CitedContainerKekLevel": {
        "type": "object",
        "properties": {
          "levelDigest": {
            "maxLength": 64,
            "minLength": 64,
            "pattern": "^[0-9a-f]+$",
            "type": "string",
            "description": "Domain-separated SHA-256 of the level's canonical wire bytes."
          },
          "containerManifestHistory": {
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1
            },
            "description": "Manifest citations of the level, kept so the response's bundle bookkeeping stays exact."
          }
        },
        "required": [
          "levelDigest",
          "containerManifestHistory"
        ],
        "additionalProperties": false,
        "description": "A KEK level the client said it already holds, replaced by a digest of its bytes; the client fills it back in from its own copy."
      },
      "CommitOrganizationGroupPolicyConflictResponse": {
        "anyOf": [
          {
            "$ref": "#/components/schemas/BillingErrorResponse"
          },
          {
            "type": "object",
            "properties": {
              "code": {
                "type": "string",
                "const": "container_descendant_rekeys_required"
              },
              "error": {
                "type": "string",
                "minLength": 1
              },
              "requiredContainerIds": {
                "type": "array",
                "items": {
                  "type": "string",
                  "minLength": 1
                },
                "maxItems": 64
              }
            },
            "required": [
              "code",
              "error",
              "requiredContainerIds"
            ],
            "additionalProperties": {}
          },
          {
            "type": "object",
            "properties": {
              "code": {
                "type": "string",
                "const": "container_mutation_state_stale"
              },
              "error": {
                "type": "string",
                "minLength": 1
              }
            },
            "required": [
              "code",
              "error"
            ],
            "additionalProperties": {}
          }
        ],
        "description": "A group policy commit refused because the container mutations it carries are stale."
      },
      "CommitOrganizationGroupPolicyRequest": {
        "type": "object",
        "properties": {
          "groupPolicy": {
            "$ref": "#/components/schemas/PutPrincipalPolicyRequest",
            "description": "The group's next signed state."
          },
          "memberPolicy": {
            "$ref": "#/components/schemas/PutPrincipalPolicyRequest",
            "description": "Successor of the reserved `Members` group, when the change also enrolls users in the organization."
          },
          "organizationPolicy": {
            "$ref": "#/components/schemas/OrganizationPrincipalPolicyRequest",
            "description": "The organization's next signed state, whose directory names the group's new head."
          }
        },
        "required": [
          "groupPolicy",
          "organizationPolicy"
        ],
        "additionalProperties": {},
        "description": "A group's next policy state committed together with the organization policy successor that records its new head."
      },
      "CommitOrganizationGroupPolicyResponse": {
        "type": "object",
        "properties": {
          "groupPolicy": {
            "$ref": "#/components/schemas/PrincipalPolicyMutationResponse"
          },
          "memberPolicy": {
            "$ref": "#/components/schemas/PrincipalPolicyMutationResponse"
          },
          "organizationPolicy": {
            "$ref": "#/components/schemas/PrincipalPolicyMutationResponse"
          }
        },
        "required": [
          "groupPolicy",
          "organizationPolicy"
        ],
        "additionalProperties": {},
        "description": "Acknowledges a group policy commit with every policy it advanced."
      },
      "ContainerCreateWithMetadataDocumentRequest": {
        "type": "object",
        "properties": {
          "container": {
            "$ref": "#/components/schemas/ContainerMutationRequest"
          },
          "metadataDocument": {
            "type": "object",
            "properties": {
              "authorizingContainerPathRefs": {
                "$ref": "#/components/schemas/ContainerManifestRefArrayArray"
              },
              "body": {},
              "containerRekeys": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/ContainerMutationRequest"
                },
                "maxItems": 16
              },
              "contentKeyBundle": {
                "$ref": "#/components/schemas/DocumentContentKeyBundleRequest"
              },
              "event": {
                "type": "object",
                "properties": {},
                "additionalProperties": {}
              },
              "expectedManifestHash": {
                "type": "string",
                "minLength": 1
              },
              "manifest": {
                "type": "object",
                "properties": {},
                "additionalProperties": {}
              },
              "targetContainerPathRefs": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/ContainerManifestRef"
                },
                "maxItems": 100,
                "minItems": 1
              }
            },
            "required": [
              "body",
              "contentKeyBundle",
              "event",
              "expectedManifestHash",
              "manifest"
            ],
            "additionalProperties": {}
          },
          "systemSlot": {
            "anyOf": [
              {
                "pattern": "^sys_v1_[A-Za-z0-9_-]{43}$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "initialMetadataSync": {
            "$ref": "#/components/schemas/DocumentSyncRequest",
            "description": "The metadata document's first queued update, committed in the same transaction."
          }
        },
        "required": [
          "container",
          "metadataDocument"
        ],
        "additionalProperties": {},
        "description": "Creates a container together with its encrypted metadata document."
      },
      "ContainerCreateWithMetadataDocumentResponse": {
        "type": "object",
        "properties": {
          "container": {
            "$ref": "#/components/schemas/ContainerMutationResponse"
          },
          "metadataDocument": {
            "$ref": "#/components/schemas/DocumentCreateResponse"
          }
        },
        "required": [
          "container",
          "metadataDocument"
        ],
        "additionalProperties": {},
        "description": "Acknowledges a container and its metadata document."
      },
      "ContainerDeleteResponse": {
        "type": "object",
        "properties": {
          "containerId": {
            "type": "string"
          },
          "deletedAt": {
            "type": "string"
          }
        },
        "required": [
          "containerId",
          "deletedAt"
        ],
        "additionalProperties": {},
        "description": "Confirms a container deletion."
      },
      "ContainerDocumentSummaryResponse": {
        "type": "object",
        "properties": {
          "createdAt": {
            "type": "string"
          },
          "currentAccessEpoch": {
            "type": "number",
            "minimum": -1.7976931348623157e+308,
            "maximum": 1.7976931348623157e+308,
            "description": "Epoch of the document's current link-set manifest."
          },
          "currentAccessStateHash": {
            "type": "string",
            "minLength": 1,
            "description": "Hash of the document's current link-set manifest."
          },
          "effectiveAccessLevel": {
            "type": "string",
            "enum": [
              "admin",
              "read",
              "write"
            ],
            "description": "The caller's access, derived from signed grants along the linked container paths."
          },
          "id": {
            "type": "string"
          },
          "linkedContainerIds": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Containers the document is linked into."
          },
          "referencedPrincipals": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ReferencedPrincipalStateResponse"
            },
            "description": "Principal policy heads the document's access depends on."
          },
          "updatedAt": {
            "type": "string"
          }
        },
        "required": [
          "createdAt",
          "currentAccessEpoch",
          "currentAccessStateHash",
          "effectiveAccessLevel",
          "id",
          "linkedContainerIds",
          "referencedPrincipals",
          "updatedAt"
        ],
        "additionalProperties": {},
        "description": "One document in a container listing, with the caller's effective access to it."
      },
      "ContainerDocumentSyncTombstoneResponse": {
        "type": "object",
        "properties": {
          "containerId": {
            "type": "string"
          },
          "documentId": {
            "type": "string"
          },
          "updatedAt": {
            "type": "string"
          }
        },
        "required": [
          "containerId",
          "documentId",
          "updatedAt"
        ],
        "additionalProperties": {},
        "description": "A document that left a container's listing since the last page."
      },
      "ContainerKekKeyringWireRecord": {
        "type": "object",
        "properties": {
          "containerId": {
            "type": "string"
          },
          "containerKeyEpochId": {
            "type": "string",
            "description": "Container KEK epoch whose key seals the keyring."
          },
          "iv": {
            "maxLength": 16,
            "type": "string",
            "description": "Base64 AES-GCM initialization vector."
          },
          "sealed": {
            "maxLength": 5592352,
            "type": "string",
            "description": "Base64 ciphertext; its length is an exact function of the epoch number."
          },
          "sealingSuite": {
            "type": "string",
            "description": "Cipher suite used to seal the keyring."
          },
          "version": {
            "const": 1,
            "type": "number"
          }
        },
        "required": [
          "containerId",
          "containerKeyEpochId",
          "iv",
          "sealed",
          "sealingSuite",
          "version"
        ],
        "additionalProperties": {},
        "description": "A container KEK keyring: every predecessor KEK of a container, sealed under the KEK of one epoch."
      },
      "ContainerKekLogEpochResponse": {
        "type": "object",
        "properties": {
          "accessManifestHash": {
            "type": "string",
            "minLength": 1,
            "description": "Container manifest head that introduced the epoch."
          },
          "bridge": {
            "anyOf": [
              {
                "type": "object",
                "properties": {},
                "additionalProperties": {}
              },
              {
                "type": "null"
              }
            ],
            "description": "The predecessor bridge: the previous epoch's KEK encrypted under this one, or null for the first epoch."
          },
          "containerKeyEpoch": {
            "exclusiveMinimum": 0,
            "maximum": 1.7976931348623157e+308,
            "type": "integer"
          },
          "containerKeyEpochId": {
            "type": "string",
            "minLength": 1
          },
          "keyring": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/ContainerKekKeyringWireRecord"
              },
              {
                "type": "null"
              }
            ],
            "description": "Keyring sealed under this epoch's KEK, served only for the epoch the request names in `keyringForEpoch` (a page carries at most one); null otherwise and for the first epoch."
          },
          "parentContainerKeyEpochId": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The parent container's KEK epoch at this epoch, or null for a container with no parent."
          },
          "wraps": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {},
              "additionalProperties": {}
            },
            "maxItems": 16,
            "description": "Recipient wraps issued at this epoch, retained so a member present then can recover the KEK if a bridge is damaged."
          }
        },
        "required": [
          "accessManifestHash",
          "bridge",
          "containerKeyEpoch",
          "containerKeyEpochId",
          "keyring",
          "parentContainerKeyEpochId",
          "wraps"
        ],
        "additionalProperties": {},
        "description": "One epoch of a container's KEK rotation log."
      },
      "ContainerKekLogResponse": {
        "type": "object",
        "properties": {
          "containerId": {
            "type": "string",
            "minLength": 1
          },
          "epochs": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ContainerKekLogEpochResponse"
            },
            "maxItems": 256
          },
          "hasMore": {
            "type": "boolean",
            "description": "True when later epochs remain."
          }
        },
        "required": [
          "containerId",
          "epochs",
          "hasMore"
        ],
        "additionalProperties": {},
        "description": "One page of a container's KEK rotation log, oldest epoch first."
      },
      "ContainerManifestRef": {
        "type": "object",
        "properties": {
          "containerId": {
            "type": "string",
            "minLength": 1,
            "description": "Advisory; the API keys the lookup off the stored bundle's own container and rejects a mismatch."
          },
          "manifestHash": {
            "type": "string",
            "minLength": 1,
            "description": "Hash of the cited manifest. Path and previous-manifest citations must name current heads; history citations name earlier manifests."
          }
        },
        "required": [
          "containerId",
          "manifestHash"
        ],
        "additionalProperties": {},
        "description": "Cites a container access manifest the API already stores, instead of resending the signed bundle."
      },
      "ContainerManifestRefArrayArray": {
        "type": "array",
        "items": {
          "type": "array",
          "items": {
            "$ref": "#/components/schemas/ContainerManifestRef"
          },
          "maxItems": 100,
          "minItems": 1
        },
        "maxItems": 64,
        "description": "A list of authorizing container paths, each a root-to-leaf chain of container manifest citations."
      },
      "ContainerMutationErrorCode": {
        "anyOf": [
          {
            "type": "string",
            "enum": [
              "container_ancestor_rekeys_required",
              "container_descendant_rekeys_required",
              "container_descendant_rekeys_inaccessible",
              "container_manifest_already_exists",
              "container_path_too_deep",
              "container_mutation_state_stale"
            ]
          },
          {
            "$ref": "#/components/schemas/DocumentMutationErrorCode"
          }
        ],
        "description": "A machine-readable reason a container mutation was refused, which tells the client whether to replan, adopt, or stop."
      },
      "ContainerMutationFailureResponse": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "code": {
                "$ref": "#/components/schemas/ContainerMutationErrorCode"
              },
              "error": {
                "type": "string",
                "minLength": 1
              },
              "requiredContainerIds": {
                "type": "array",
                "items": {
                  "type": "string",
                  "minLength": 1
                },
                "maxItems": 64
              }
            },
            "required": [
              "error"
            ],
            "additionalProperties": {}
          },
          {
            "$ref": "#/components/schemas/PrincipalPolicyStaleErrorResponse"
          }
        ],
        "description": "A refused container mutation: a coded conflict, or a stale principal policy with the current heads."
      },
      "ContainerMutationRequest": {
        "type": "object",
        "properties": {
          "body": {
            "description": "Event-type-specific body the signature commits to."
          },
          "containerManifestHistoryRefs": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ContainerManifestRef"
            },
            "maxItems": 4096,
            "description": "Earlier manifests of this container the verifier needs, cited by hash."
          },
          "destinationParentContainerPathRefs": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ContainerManifestRef"
            },
            "maxItems": 100,
            "description": "Current path to the new parent, for a move."
          },
          "event": {
            "type": "object",
            "properties": {},
            "additionalProperties": {}
          },
          "expectedManifestHash": {
            "type": "string",
            "minLength": 1,
            "description": "Hash of the manifest this mutation derives; the API derives it independently and must agree."
          },
          "keyEpoch": {
            "type": "object",
            "properties": {},
            "additionalProperties": {},
            "description": "The container KEK epoch this mutation leaves current."
          },
          "keyring": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/ContainerKekKeyringWireRecord"
              },
              {
                "type": "null"
              }
            ],
            "description": "For a KEK rotation, every predecessor KEK sealed under the new KEK; null otherwise."
          },
          "manifest": {
            "type": "object",
            "properties": {},
            "additionalProperties": {}
          },
          "parentContainerPathRefs": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ContainerManifestRef"
            },
            "maxItems": 100,
            "description": "Current path to the parent container."
          },
          "parentKekRef": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "containerId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "containerKeyEpochId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "keyEpochHash": {
                    "maxLength": 64,
                    "minLength": 64,
                    "pattern": "^[0-9a-f]+$",
                    "type": "string"
                  }
                },
                "required": [
                  "containerId",
                  "containerKeyEpochId",
                  "keyEpochHash"
                ],
                "additionalProperties": {}
              },
              {
                "type": "null"
              }
            ],
            "description": "The parent's current KEK epoch, for a child container; any other epoch is refused as stale."
          },
          "predecessorBridge": {
            "anyOf": [
              {
                "type": "object",
                "properties": {},
                "additionalProperties": {}
              },
              {
                "type": "null"
              }
            ],
            "description": "For a KEK rotation, the retiring KEK encrypted under the new one; null otherwise."
          },
          "previousContainerPathRefs": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ContainerManifestRef"
            },
            "maxItems": 100,
            "description": "Current path to the mutated container, from its root."
          },
          "previousManifestRef": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/ContainerManifestRef"
              },
              {
                "type": "null"
              }
            ],
            "description": "The container's current manifest head; absent for a create."
          },
          "principalPolicyRefs": {
            "$ref": "#/components/schemas/PrincipalPolicyRefList",
            "description": "Heads of the principal policies the mutation was planned against."
          },
          "userRecipientKeys": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {},
              "additionalProperties": {}
            },
            "description": "Public keys of users the container KEK is wrapped to directly."
          },
          "wraps": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {},
              "additionalProperties": {}
            },
            "description": "The container KEK wrapped to each derived recipient target."
          }
        },
        "required": [
          "body",
          "event",
          "expectedManifestHash",
          "keyEpoch",
          "keyring",
          "manifest",
          "predecessorBridge",
          "principalPolicyRefs",
          "wraps"
        ],
        "additionalProperties": {},
        "description": "A signed container mutation (create, share, or the container part of a larger write): the event, the manifest it derives, and the KEK material, citing stored heads instead of resending them."
      },
      "ContainerMutationResponse": {
        "type": "object",
        "properties": {
          "containerId": {
            "type": "string"
          },
          "createdAt": {
            "type": "string"
          },
          "eventHash": {
            "type": "string",
            "minLength": 1,
            "description": "Hash of the signed event the API stored."
          },
          "manifestHead": {
            "type": "object",
            "properties": {
              "epoch": {
                "type": "number",
                "minimum": -1.7976931348623157e+308,
                "maximum": 1.7976931348623157e+308
              },
              "manifestHash": {
                "type": "string"
              }
            },
            "required": [
              "epoch",
              "manifestHash"
            ],
            "additionalProperties": {},
            "description": "Epoch and hash of the container's new manifest head."
          },
          "organizationId": {
            "type": "string"
          },
          "parentId": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "systemSlot": {
            "anyOf": [
              {
                "pattern": "^sys_v1_[A-Za-z0-9_-]{43}$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Opaque id of a system container's role, or null for an ordinary container."
          },
          "updatedAt": {
            "type": "string"
          },
          "containerKek": {
            "type": "object",
            "properties": {
              "containerKeyEpoch": {
                "exclusiveMinimum": 0,
                "maximum": 1.7976931348623157e+308,
                "type": "integer"
              },
              "containerKeyEpochId": {
                "type": "string",
                "minLength": 1
              },
              "keyEpochHash": {
                "type": "string",
                "minLength": 1
              },
              "keyringHash": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "keyTargetHash": {
                "type": "string",
                "minLength": 1
              },
              "parentContainerKeyEpochId": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "containerKeyEpoch",
              "containerKeyEpochId",
              "keyEpochHash",
              "keyringHash",
              "keyTargetHash",
              "parentContainerKeyEpochId"
            ],
            "additionalProperties": {},
            "description": "Identity and hashes of the container's current KEK epoch."
          }
        },
        "required": [
          "containerId",
          "createdAt",
          "eventHash",
          "manifestHead",
          "organizationId",
          "parentId",
          "updatedAt",
          "containerKek"
        ],
        "additionalProperties": {},
        "description": "Acknowledges a container mutation by hash; the client compares each value with the plan it signed and refuses any mismatch."
      },
      "ContainerNotFoundErrorResponse": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string",
            "const": "container_not_found"
          },
          "error": {
            "type": "string",
            "minLength": 1
          }
        },
        "required": [
          "code",
          "error"
        ],
        "additionalProperties": {},
        "description": "The container does not exist. Clients may treat only this exact coded 404 as permanent absence."
      },
      "ContainerReciteRequest": {
        "type": "object",
        "properties": {
          "body": {},
          "event": {
            "type": "object",
            "properties": {},
            "additionalProperties": {}
          },
          "expectedManifestHash": {
            "type": "string",
            "minLength": 1,
            "description": "Hash of the manifest this re-citation derives."
          },
          "manifest": {
            "type": "object",
            "properties": {},
            "additionalProperties": {}
          },
          "previousContainerPathRefs": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ContainerManifestRef"
            },
            "maxItems": 100,
            "minItems": 1,
            "description": "The container's current path, from its root."
          },
          "previousManifestRef": {
            "$ref": "#/components/schemas/ContainerManifestRef",
            "description": "The container's current manifest head."
          },
          "principalPolicyRefs": {
            "$ref": "#/components/schemas/PrincipalPolicyRefList",
            "description": "Heads of the principal policies the re-citation was planned against."
          }
        },
        "required": [
          "body",
          "event",
          "expectedManifestHash",
          "manifest",
          "previousContainerPathRefs",
          "previousManifestRef",
          "principalPolicyRefs"
        ],
        "additionalProperties": {},
        "description": "A signed `container.recite` that advances a container's manifest to cite its ancestors' current heads, changing nothing else."
      },
      "ContainerReciteResponse": {
        "type": "object",
        "properties": {
          "containerId": {
            "type": "string"
          },
          "createdAt": {
            "type": "string"
          },
          "eventHash": {
            "type": "string",
            "minLength": 1
          },
          "manifestHead": {
            "type": "object",
            "properties": {
              "epoch": {
                "type": "number",
                "minimum": -1.7976931348623157e+308,
                "maximum": 1.7976931348623157e+308
              },
              "manifestHash": {
                "type": "string"
              }
            },
            "required": [
              "epoch",
              "manifestHash"
            ],
            "additionalProperties": {}
          },
          "organizationId": {
            "type": "string"
          },
          "parentId": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "systemSlot": {
            "anyOf": [
              {
                "pattern": "^sys_v1_[A-Za-z0-9_-]{43}$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "updatedAt": {
            "type": "string"
          }
        },
        "required": [
          "containerId",
          "createdAt",
          "eventHash",
          "manifestHead",
          "organizationId",
          "parentId",
          "updatedAt"
        ],
        "additionalProperties": {},
        "description": "Acknowledges a re-citation by its event hash and new manifest head; keys are unchanged."
      },
      "ContainerRotationRequest": {
        "type": "object",
        "properties": {
          "body": {},
          "containerManifestHistoryRefs": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ContainerManifestRef"
            },
            "maxItems": 4096
          },
          "destinationParentContainerPathRefs": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ContainerManifestRef"
            },
            "maxItems": 100
          },
          "event": {
            "type": "object",
            "properties": {},
            "additionalProperties": {}
          },
          "expectedManifestHash": {
            "type": "string",
            "minLength": 1
          },
          "keyEpoch": {
            "type": "object",
            "properties": {},
            "additionalProperties": {}
          },
          "keyring": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/ContainerKekKeyringWireRecord"
              },
              {
                "type": "null"
              }
            ]
          },
          "manifest": {
            "type": "object",
            "properties": {},
            "additionalProperties": {}
          },
          "parentContainerPathRefs": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ContainerManifestRef"
            },
            "maxItems": 100
          },
          "parentKekRef": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "containerId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "containerKeyEpochId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "keyEpochHash": {
                    "maxLength": 64,
                    "minLength": 64,
                    "pattern": "^[0-9a-f]+$",
                    "type": "string"
                  }
                },
                "required": [
                  "containerId",
                  "containerKeyEpochId",
                  "keyEpochHash"
                ],
                "additionalProperties": {}
              },
              {
                "type": "null"
              }
            ]
          },
          "predecessorBridge": {
            "anyOf": [
              {
                "type": "object",
                "properties": {},
                "additionalProperties": {}
              },
              {
                "type": "null"
              }
            ]
          },
          "previousContainerPathRefs": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ContainerManifestRef"
            },
            "maxItems": 100
          },
          "previousManifestRef": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/ContainerManifestRef"
              },
              {
                "type": "null"
              }
            ]
          },
          "principalPolicyRefs": {
            "$ref": "#/components/schemas/PrincipalPolicyRefList"
          },
          "userRecipientKeys": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {},
              "additionalProperties": {}
            }
          },
          "wraps": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {},
              "additionalProperties": {}
            }
          },
          "containerRekeys": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ContainerMutationRequest"
            },
            "maxItems": 64,
            "description": "Descendant rekeys, parent first; they commit with the rotation or not at all."
          }
        },
        "required": [
          "body",
          "event",
          "expectedManifestHash",
          "keyEpoch",
          "keyring",
          "manifest",
          "predecessorBridge",
          "principalPolicyRefs",
          "wraps"
        ],
        "additionalProperties": {},
        "description": "A rekey, revoke, or move, which rotates the container KEK, plus the descendant rekeys that must commit with it."
      },
      "ContainerRotationResponse": {
        "type": "object",
        "properties": {
          "containerId": {
            "type": "string"
          },
          "createdAt": {
            "type": "string"
          },
          "eventHash": {
            "type": "string",
            "minLength": 1
          },
          "manifestHead": {
            "type": "object",
            "properties": {
              "epoch": {
                "type": "number",
                "minimum": -1.7976931348623157e+308,
                "maximum": 1.7976931348623157e+308
              },
              "manifestHash": {
                "type": "string"
              }
            },
            "required": [
              "epoch",
              "manifestHash"
            ],
            "additionalProperties": {}
          },
          "organizationId": {
            "type": "string"
          },
          "parentId": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "systemSlot": {
            "anyOf": [
              {
                "pattern": "^sys_v1_[A-Za-z0-9_-]{43}$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "updatedAt": {
            "type": "string"
          },
          "containerKek": {
            "type": "object",
            "properties": {
              "containerKeyEpoch": {
                "exclusiveMinimum": 0,
                "maximum": 1.7976931348623157e+308,
                "type": "integer"
              },
              "containerKeyEpochId": {
                "type": "string",
                "minLength": 1
              },
              "keyEpochHash": {
                "type": "string",
                "minLength": 1
              },
              "keyringHash": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "keyTargetHash": {
                "type": "string",
                "minLength": 1
              },
              "parentContainerKeyEpochId": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "containerKeyEpoch",
              "containerKeyEpochId",
              "keyEpochHash",
              "keyringHash",
              "keyTargetHash",
              "parentContainerKeyEpochId"
            ],
            "additionalProperties": {}
          },
          "containerRekeys": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ContainerMutationResponse"
            }
          }
        },
        "required": [
          "containerId",
          "createdAt",
          "eventHash",
          "manifestHead",
          "organizationId",
          "parentId",
          "updatedAt",
          "containerKek"
        ],
        "additionalProperties": {},
        "description": "Acknowledges a rotation, plus one acknowledgement per carried descendant rekey in request order."
      },
      "ContainerSummaryResponse": {
        "type": "object",
        "properties": {
          "createdAt": {
            "type": "string"
          },
          "depth": {
            "maximum": 1.7976931348623157e+308,
            "minimum": 0,
            "type": "integer",
            "description": "Position in the container tree, counted from the organization's root container."
          },
          "effectiveAccessLevel": {
            "type": "string",
            "enum": [
              "admin",
              "read",
              "write"
            ],
            "description": "The caller's access, derived from signed grants along the container path."
          },
          "id": {
            "type": "string"
          },
          "metadataAccessEpoch": {
            "type": "number",
            "minimum": -1.7976931348623157e+308,
            "maximum": 1.7976931348623157e+308,
            "description": "Access epoch of the container's metadata document."
          },
          "metadataAccessStateHash": {
            "type": "string",
            "minLength": 1,
            "description": "Access state hash of the metadata document."
          },
          "metadataDocumentId": {
            "type": "string",
            "description": "Encrypted document that holds the container's name and other metadata."
          },
          "metadataReferencedPrincipals": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ReferencedPrincipalStateResponse"
            },
            "description": "Principal policy heads the metadata document's access depends on."
          },
          "organizationId": {
            "type": "string"
          },
          "parentId": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "systemSlot": {
            "anyOf": [
              {
                "pattern": "^sys_v1_[A-Za-z0-9_-]{43}$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Opaque id of a system container's role, such as Trash, or null for an ordinary container."
          },
          "updatedAt": {
            "type": "string"
          }
        },
        "required": [
          "createdAt",
          "depth",
          "effectiveAccessLevel",
          "id",
          "metadataAccessEpoch",
          "metadataAccessStateHash",
          "metadataDocumentId",
          "metadataReferencedPrincipals",
          "organizationId",
          "parentId",
          "updatedAt"
        ],
        "additionalProperties": {},
        "description": "One container in a listing, with the caller's effective access to it."
      },
      "ContainerSyncTombstoneResponse": {
        "type": "object",
        "properties": {
          "containerId": {
            "type": "string"
          },
          "depth": {
            "maximum": 1.7976931348623157e+308,
            "minimum": 0,
            "type": "integer"
          },
          "parentId": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "reason": {
            "type": "string",
            "enum": [
              "access_revoked",
              "deleted"
            ],
            "description": "`deleted` when the container was deleted; `access_revoked` when the caller lost access."
          },
          "updatedAt": {
            "type": "string"
          }
        },
        "required": [
          "containerId",
          "depth",
          "parentId",
          "reason",
          "updatedAt"
        ],
        "additionalProperties": {},
        "description": "A container that left the caller's view since the last listing page."
      },
      "ContainerWriterProjectionErrorResponse": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string",
            "const": "container_projection_state_invalid"
          },
          "error": {
            "type": "string"
          }
        },
        "required": [
          "code",
          "error"
        ],
        "additionalProperties": {},
        "description": "The API's stored state for the projection failed its own consistency checks."
      },
      "ContainerWriterProjectionWireResponse": {
        "type": "object",
        "properties": {
          "bundles": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {
              "$ref": "#/components/schemas/AccessManifestBundleWireResponse"
            },
            "description": "Signed manifest bundles keyed by manifest hash."
          },
          "omittedBundles": {
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1
            },
            "description": "Cited hashes left out because the request said the client holds them."
          },
          "containerId": {
            "type": "string"
          },
          "containerKeks": {
            "type": "array",
            "items": {
              "anyOf": [
                {
                  "$ref": "#/components/schemas/CitedContainerKekLevel"
                },
                {
                  "type": "object",
                  "properties": {
                    "accessManifestHash": {
                      "type": "string",
                      "minLength": 1
                    },
                    "containerId": {
                      "type": "string"
                    },
                    "containerKeyEpoch": {
                      "exclusiveMinimum": 0,
                      "maximum": 1.7976931348623157e+308,
                      "type": "integer"
                    },
                    "containerKeyEpochId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "containerManifestHistory": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "minLength": 1
                      }
                    },
                    "keyEpoch": {
                      "type": "object",
                      "properties": {},
                      "additionalProperties": {}
                    },
                    "keyEpochHash": {
                      "type": "string",
                      "minLength": 1
                    },
                    "keyring": {
                      "anyOf": [
                        {
                          "$ref": "#/components/schemas/ContainerKekKeyringWireRecord"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "keyTargetHash": {
                      "type": "string",
                      "minLength": 1
                    },
                    "parentContainerKeyEpochId": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "recipientTargets": {
                      "minItems": 1,
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {},
                        "additionalProperties": {}
                      }
                    },
                    "wraps": {
                      "minItems": 1,
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {},
                        "additionalProperties": {}
                      }
                    }
                  },
                  "required": [
                    "accessManifestHash",
                    "containerId",
                    "containerKeyEpoch",
                    "containerKeyEpochId",
                    "containerManifestHistory",
                    "keyEpoch",
                    "keyEpochHash",
                    "keyring",
                    "keyTargetHash",
                    "parentContainerKeyEpochId",
                    "recipientTargets",
                    "wraps"
                  ],
                  "additionalProperties": {}
                }
              ]
            },
            "description": "One KEK level for each manifest in `path`."
          },
          "organizationId": {
            "type": "string"
          },
          "path": {
            "minItems": 1,
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1
            },
            "description": "Manifest hashes from the organization's root to this container."
          },
          "policyEvidence": {
            "$ref": "#/components/schemas/ProjectionPolicyEvidenceResponse",
            "description": "Public principal policy history the cited manifests depend on."
          }
        },
        "required": [
          "bundles",
          "omittedBundles",
          "containerId",
          "containerKeks",
          "organizationId",
          "path",
          "policyEvidence"
        ],
        "additionalProperties": {},
        "description": "A container writer projection: the signed manifests on its path and the KEK levels a client needs to read and write under it. Every manifest is carried once in `bundles` and cited by hash."
      },
      "CreateOrganizationGroupRequest": {
        "type": "object",
        "properties": {
          "groupId": {
            "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
            "type": "string"
          },
          "initialGroupPolicy": {
            "$ref": "#/components/schemas/PutPrincipalPolicyRequest"
          }
        },
        "required": [
          "groupId",
          "initialGroupPolicy"
        ],
        "additionalProperties": false,
        "description": "A new group's id and first signed policy."
      },
      "CreateOrganizationGroupResponse": {
        "type": "object",
        "properties": {
          "group": {
            "$ref": "#/components/schemas/OrganizationGroupSummaryResponse"
          },
          "organizationPolicy": {
            "$ref": "#/components/schemas/PrincipalPolicyMutationResponse"
          }
        },
        "required": [
          "group",
          "organizationPolicy"
        ],
        "additionalProperties": {},
        "description": "Acknowledges a new group and the organization policy that lists it."
      },
      "CreateOrganizationGroupWithPolicyRequest": {
        "type": "object",
        "properties": {
          "groupId": {
            "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
            "type": "string"
          },
          "initialGroupPolicy": {
            "$ref": "#/components/schemas/PutPrincipalPolicyRequest"
          },
          "organizationPolicy": {
            "$ref": "#/components/schemas/OrganizationPrincipalPolicyRequest"
          }
        },
        "required": [
          "groupId",
          "initialGroupPolicy",
          "organizationPolicy"
        ],
        "additionalProperties": false,
        "description": "A new group with its first signed policy and the organization policy successor that adds it to the directory."
      },
      "CreateOrganizationRequest": {
        "type": "object",
        "properties": {
          "initialAdminGroup": {
            "$ref": "#/components/schemas/CreateOrganizationGroupRequest"
          },
          "initialMemberGroup": {
            "$ref": "#/components/schemas/CreateOrganizationGroupRequest"
          },
          "initialOrganizationMetadataContainer": {
            "$ref": "#/components/schemas/ProvisionedSystemContainerRequest"
          },
          "initialOrganizationPolicy": {
            "$ref": "#/components/schemas/OrganizationPrincipalPolicyRequest"
          },
          "initialOrganizationProfileDocument": {
            "$ref": "#/components/schemas/ProvisionedDocumentRequest"
          },
          "initialRootContainer": {
            "$ref": "#/components/schemas/ContainerMutationRequest"
          },
          "initialRootMetadataDocument": {
            "$ref": "#/components/schemas/ProvisionedDocumentRequest"
          },
          "initialRosterProfileContainer": {
            "$ref": "#/components/schemas/ProvisionedSystemContainerRequest"
          },
          "initialRosterProfileDocument": {
            "$ref": "#/components/schemas/ProvisionedDocumentRequest"
          },
          "initialSystemContainers": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ProvisionedSystemContainerRequest"
            }
          },
          "organizationId": {
            "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
            "type": "string"
          },
          "rootContainerId": {
            "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
            "type": "string"
          },
          "userId": {
            "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
            "type": "string"
          },
          "replacementAuthorization": {
            "$ref": "#/components/schemas/OrganizationReplacementAuthorization",
            "description": "Identity-signed authorization for the new organization to replace a purged personal organization."
          },
          "nativeSubscriptionRestore": {
            "type": "boolean",
            "const": true,
            "description": "Marks the new organization as the destination of a native store subscription restore."
          },
          "finalizeReplacement": {
            "type": "boolean",
            "description": "Completes an earlier replacement after the client reset its local copy, moving the user's default organization to it."
          },
          "replacesOrganizationId": {
            "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
            "type": "string",
            "description": "Purged personal organization this one replaces; accepted only after that purge completed."
          }
        },
        "required": [
          "initialAdminGroup",
          "initialMemberGroup",
          "initialOrganizationMetadataContainer",
          "initialOrganizationPolicy",
          "initialRootContainer",
          "initialRootMetadataDocument",
          "organizationId",
          "rootContainerId",
          "userId"
        ],
        "additionalProperties": {},
        "description": "Every signed artifact of a new organization, signed with the caller's existing identity: the same set registration provisions."
      },
      "CreateOrganizationResponse": {
        "type": "object",
        "properties": {
          "committedCoreMetadataUpdateIds": {
            "type": "array",
            "items": {
              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
              "type": "string"
            },
            "description": "Ids of the seeded metadata updates the server committed."
          },
          "committedProfileUpdateIds": {
            "type": "array",
            "items": {
              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
              "type": "string"
            },
            "description": "Ids of the seeded profile updates the server committed."
          },
          "organizationId": {
            "type": "string"
          },
          "organizationMetadataContainer": {
            "$ref": "#/components/schemas/ContainerCreateWithMetadataDocumentResponse"
          },
          "organizationMetadataContainerId": {
            "type": "string"
          },
          "organizationProfileDocument": {
            "$ref": "#/components/schemas/DocumentCreateResponse"
          },
          "organizationProfileDocumentId": {
            "type": "string"
          },
          "rootContainerId": {
            "type": "string"
          },
          "rootMetadataAccessEpoch": {
            "type": "number",
            "minimum": -1.7976931348623157e+308,
            "maximum": 1.7976931348623157e+308,
            "description": "Access epoch of the root container's metadata document."
          },
          "rootMetadataAccessStateHash": {
            "type": "string",
            "minLength": 1,
            "description": "Access state hash of the root container's metadata document."
          },
          "rootMetadataDocument": {
            "$ref": "#/components/schemas/DocumentCreateResponse"
          },
          "rootMetadataDocumentId": {
            "type": "string"
          },
          "rosterProfileContainer": {
            "$ref": "#/components/schemas/ContainerCreateWithMetadataDocumentResponse"
          },
          "rosterProfileContainerId": {
            "type": "string"
          },
          "rosterProfileDocument": {
            "$ref": "#/components/schemas/DocumentCreateResponse"
          },
          "rosterProfileDocumentId": {
            "type": "string"
          },
          "systemContainers": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ContainerCreateWithMetadataDocumentResponse"
            }
          },
          "userId": {
            "type": "string"
          },
          "replacementAuthorization": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/OrganizationReplacementAuthorization"
              },
              {
                "type": "null"
              }
            ],
            "description": "For a replacement, the identity-signed authorization clients verify before following it."
          }
        },
        "required": [
          "committedCoreMetadataUpdateIds",
          "committedProfileUpdateIds",
          "organizationId",
          "organizationMetadataContainer",
          "organizationMetadataContainerId",
          "rootContainerId",
          "rootMetadataAccessEpoch",
          "rootMetadataAccessStateHash",
          "rootMetadataDocument",
          "rootMetadataDocumentId",
          "systemContainers",
          "userId",
          "replacementAuthorization"
        ],
        "additionalProperties": {},
        "description": "Acknowledges a new organization by the ids and hashes of what it created."
      },
      "CurrentPrincipalMemberEnvelopesResponse": {
        "type": "object",
        "properties": {
          "envelopes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PrincipalMemberEnvelopeResponse"
            }
          },
          "epoch": {
            "maximum": 9007199254740991,
            "minimum": 1,
            "type": "integer"
          },
          "principalId": {
            "type": "string"
          },
          "principalType": {
            "type": "string",
            "enum": [
              "group",
              "organization"
            ]
          },
          "stateHash": {
            "type": "string"
          }
        },
        "required": [
          "envelopes",
          "epoch",
          "principalId",
          "principalType",
          "stateHash"
        ],
        "additionalProperties": {},
        "description": "Every member envelope of a principal's current key epoch."
      },
      "DeleteOrganizationGroupRequest": {
        "type": "object",
        "properties": {
          "organizationPolicy": {
            "$ref": "#/components/schemas/OrganizationPrincipalPolicyRequest"
          }
        },
        "required": [
          "organizationPolicy"
        ],
        "additionalProperties": {},
        "description": "The organization policy successor that drops a group from the directory."
      },
      "DeleteOrganizationGroupResponse": {
        "type": "object",
        "properties": {
          "deleted": {
            "type": "boolean",
            "const": true
          },
          "groupId": {
            "type": "string"
          },
          "organizationPolicy": {
            "$ref": "#/components/schemas/PrincipalPolicyMutationResponse"
          },
          "organizationId": {
            "type": "string"
          }
        },
        "required": [
          "deleted",
          "groupId",
          "organizationPolicy",
          "organizationId"
        ],
        "additionalProperties": {},
        "description": "Confirms a group deletion and the organization policy that recorded it."
      },
      "DestroySessionResponse": {
        "type": "object",
        "properties": {
          "message": {
            "type": "string",
            "const": "ok"
          }
        },
        "required": [
          "message"
        ],
        "additionalProperties": {},
        "description": "Confirms that a session was signed out."
      },
      "DocumentContentKeyBundleRequest": {
        "type": "object",
        "properties": {
          "contentKeyEpoch": {
            "exclusiveMinimum": 0,
            "maximum": 1.7976931348623157e+308,
            "type": "integer"
          },
          "linkSetManifestHash": {
            "type": "string",
            "minLength": 1,
            "description": "Document link-set manifest the targets were derived from."
          },
          "targetHash": {
            "type": "string",
            "minLength": 1,
            "description": "Target hash the wraps must match; the API derives it from verified access state."
          },
          "targets": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DocumentContentKeyTargetEnvelope"
            },
            "maxItems": 64
          }
        },
        "required": [
          "contentKeyEpoch",
          "linkSetManifestHash",
          "targetHash",
          "targets"
        ],
        "additionalProperties": {},
        "description": "A content-key bundle: one document content-key epoch wrapped to every linked container's KEK."
      },
      "DocumentContentKeyBundleResponse": {
        "type": "object",
        "properties": {
          "contentKeyEpoch": {
            "exclusiveMinimum": 0,
            "maximum": 1.7976931348623157e+308,
            "type": "integer"
          },
          "documentId": {
            "type": "string"
          },
          "linkSetManifestHash": {
            "type": "string",
            "minLength": 1,
            "description": "Document link-set manifest the targets were derived from."
          },
          "targetHash": {
            "type": "string",
            "minLength": 1,
            "description": "Hash of the key target set the wraps cover."
          },
          "targets": {
            "minItems": 1,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DocumentContentKeyTargetEnvelopeResponse"
            }
          }
        },
        "required": [
          "contentKeyEpoch",
          "documentId",
          "linkSetManifestHash",
          "targetHash",
          "targets"
        ],
        "additionalProperties": {},
        "description": "A stored content-key bundle for one document content-key epoch."
      },
      "DocumentContentKeyTargetEnvelope": {
        "type": "object",
        "properties": {
          "containerId": {
            "type": "string",
            "minLength": 1
          },
          "containerKeyEpoch": {
            "exclusiveMinimum": 0,
            "maximum": 1.7976931348623157e+308,
            "type": "integer"
          },
          "containerKeyEpochId": {
            "type": "string",
            "minLength": 1,
            "description": "Id of the container KEK epoch that wraps the key."
          },
          "containerManifestHash": {
            "type": "string",
            "minLength": 1,
            "description": "Container manifest head the wrap was made under."
          },
          "wrappedKey": {
            "type": "string",
            "minLength": 64,
            "maxLength": 64,
            "pattern": "^[A-Za-z0-9+/]{64}$",
            "description": "The content key encrypted under the container KEK."
          },
          "wrappingMetadata": {
            "type": "object",
            "properties": {
              "suite": {
                "type": "string",
                "const": "tearleads.document.content-key-wrap.aes-256-gcm-container-kek"
              },
              "iv": {
                "type": "string",
                "minLength": 16,
                "maxLength": 16,
                "pattern": "^[A-Za-z0-9+/]{16}$"
              }
            },
            "required": [
              "suite",
              "iv"
            ],
            "additionalProperties": false,
            "description": "Wrapping suite and IV needed to unwrap `wrappedKey`."
          }
        },
        "required": [
          "containerId",
          "containerKeyEpoch",
          "containerKeyEpochId",
          "containerManifestHash",
          "wrappedKey",
          "wrappingMetadata"
        ],
        "additionalProperties": {},
        "description": "A document content key wrapped to one container KEK."
      },
      "DocumentContentKeyTargetEnvelopeResponse": {
        "type": "object",
        "properties": {
          "containerId": {
            "type": "string",
            "minLength": 1
          },
          "containerKeyEpoch": {
            "exclusiveMinimum": 0,
            "maximum": 1.7976931348623157e+308,
            "type": "integer"
          },
          "containerKeyEpochId": {
            "type": "string",
            "minLength": 1,
            "description": "Id of the container KEK epoch that wraps the key."
          },
          "containerManifestHash": {
            "type": "string",
            "minLength": 1,
            "description": "Container manifest head the wrap was made under."
          },
          "wrappedKey": {
            "type": "string",
            "minLength": 1,
            "description": "The content key encrypted under the container KEK."
          },
          "wrappingMetadata": {
            "type": "object",
            "properties": {},
            "additionalProperties": {},
            "description": "Wrapping suite and IV needed to unwrap `wrappedKey`."
          }
        },
        "required": [
          "containerId",
          "containerKeyEpoch",
          "containerKeyEpochId",
          "containerManifestHash",
          "wrappedKey",
          "wrappingMetadata"
        ],
        "additionalProperties": {},
        "description": "A stored wrap of a document content key to one container KEK."
      },
      "DocumentCreateRequest": {
        "type": "object",
        "properties": {
          "authorizingContainerPathRefs": {
            "$ref": "#/components/schemas/ContainerManifestRefArrayArray"
          },
          "body": {},
          "containerRekeys": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ContainerMutationRequest"
            },
            "maxItems": 16
          },
          "contentKeyBundle": {
            "$ref": "#/components/schemas/DocumentContentKeyBundleRequest"
          },
          "event": {
            "type": "object",
            "properties": {},
            "additionalProperties": {}
          },
          "expectedManifestHash": {
            "type": "string",
            "minLength": 1
          },
          "manifest": {
            "type": "object",
            "properties": {},
            "additionalProperties": {}
          },
          "targetContainerPathRefs": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ContainerManifestRef"
            },
            "maxItems": 100,
            "minItems": 1
          },
          "initialSync": {
            "$ref": "#/components/schemas/DocumentSyncRequest",
            "description": "The document's first queued update, committed in the create transaction under every check a sync makes."
          }
        },
        "required": [
          "body",
          "contentKeyBundle",
          "event",
          "expectedManifestHash",
          "manifest"
        ],
        "additionalProperties": {},
        "description": "A signed document create: the document's first link-set manifest, its content-key bundle, and optionally its first encrypted update."
      },
      "DocumentCreateResponse": {
        "type": "object",
        "properties": {
          "contentKeyEpoch": {
            "exclusiveMinimum": 0,
            "maximum": 1.7976931348623157e+308,
            "type": "integer",
            "description": "Content-key epoch the API stored."
          },
          "eventHash": {
            "type": "string",
            "minLength": 1,
            "description": "Hash of the signed event."
          },
          "id": {
            "type": "string"
          },
          "manifestHash": {
            "type": "string",
            "minLength": 1,
            "description": "Hash of the committed document link-set manifest."
          },
          "targetHash": {
            "type": "string",
            "minLength": 1,
            "description": "Key target hash the API derived."
          },
          "createdAt": {
            "type": "string"
          },
          "initialSync": {
            "type": "object",
            "properties": {
              "acceptedOutgoingUpdateIds": {
                "type": "array",
                "items": {
                  "type": "string",
                  "minLength": 1
                },
                "maxItems": 1
              },
              "commitLsn": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "commitLsnMode": {
                "anyOf": [
                  {
                    "type": "string",
                    "const": "tracked"
                  },
                  {
                    "type": "string",
                    "const": "untracked"
                  }
                ]
              }
            },
            "required": [
              "acceptedOutgoingUpdateIds",
              "commitLsn",
              "commitLsnMode"
            ],
            "additionalProperties": {},
            "description": "Present exactly when the request carried a seed; names the accepted update and its commit position."
          }
        },
        "required": [
          "contentKeyEpoch",
          "eventHash",
          "id",
          "manifestHash",
          "targetHash",
          "createdAt"
        ],
        "additionalProperties": {},
        "description": "Acknowledges a document create by hash."
      },
      "DocumentEditAttributionRangeResponse": {
        "type": "object",
        "properties": {
          "authorityKind": {
            "type": "string",
            "enum": [
              "direct",
              "baseline"
            ]
          },
          "endCounter": {
            "maximum": 9007199254740991,
            "minimum": 0,
            "type": "integer"
          },
          "peerId": {
            "type": "string",
            "minLength": 1
          },
          "startCounter": {
            "maximum": 9007199254740991,
            "minimum": 0,
            "type": "integer"
          },
          "writerKeyFingerprint": {
            "type": "string",
            "minLength": 1
          },
          "writerUserId": {
            "type": "string",
            "minLength": 1
          },
          "updateId": {
            "type": "string",
            "minLength": 1
          }
        },
        "required": [
          "authorityKind",
          "endCounter",
          "peerId",
          "startCounter",
          "writerKeyFingerprint",
          "writerUserId",
          "updateId"
        ],
        "additionalProperties": {}
      },
      "DocumentEditAttributionResponse": {
        "type": "object",
        "properties": {
          "attributionRevision": {
            "maximum": 9007199254740991,
            "minimum": 0,
            "type": "integer",
            "description": "Changes whenever new updates change the attribution."
          },
          "documentId": {
            "type": "string",
            "minLength": 1
          },
          "segments": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DocumentEditAttributionSegmentResponse"
            }
          },
          "truncated": {
            "type": "boolean",
            "description": "True when the run list hit the response limit; page the rest through the ranges route."
          }
        },
        "required": [
          "attributionRevision",
          "documentId",
          "segments"
        ],
        "additionalProperties": {},
        "description": "Who first uploaded each part of a document, as compact runs derived from the signed write headers of its updates."
      },
      "DocumentEditAttributionSegmentResponse": {
        "type": "object",
        "properties": {
          "authorityKind": {
            "type": "string",
            "enum": [
              "direct",
              "baseline"
            ],
            "description": "`direct` when the earliest update that delivered the run is an ordinary update, whose writer is the first uploader rather than proven author; `baseline` when it is a rotation baseline, which only re-asserts existing operations."
          },
          "endCounter": {
            "maximum": 9007199254740991,
            "minimum": 0,
            "type": "integer",
            "description": "End of the run in the peer's operation counter."
          },
          "peerId": {
            "type": "string",
            "minLength": 1,
            "description": "Loro peer id of the writing device."
          },
          "startCounter": {
            "maximum": 9007199254740991,
            "minimum": 0,
            "type": "integer",
            "description": "Start of the run in the peer's operation counter."
          },
          "writerKeyFingerprint": {
            "type": "string",
            "minLength": 1,
            "description": "Signing key fingerprint from the update's write header."
          },
          "writerUserId": {
            "type": "string",
            "minLength": 1
          }
        },
        "required": [
          "authorityKind",
          "endCounter",
          "peerId",
          "startCounter",
          "writerKeyFingerprint",
          "writerUserId"
        ],
        "additionalProperties": {},
        "description": "A run of Loro operations attributed to the writer of the earliest signed update that delivered them."
      },
      "DocumentKekTargetsResponse": {
        "type": "object",
        "properties": {
          "documentId": {
            "type": "string"
          },
          "documentKeyTargetHash": {
            "type": "string",
            "minLength": 1,
            "description": "Hash of the derived target set; write headers and bundles must match it."
          },
          "linkedContainerKeyEpochIds": {
            "minItems": 1,
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1
            },
            "description": "Current KEK epochs of the linked containers."
          },
          "linkedContainerManifestHashes": {
            "minItems": 1,
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1
            },
            "description": "Current manifest heads of the linked containers."
          },
          "linkSetManifestHash": {
            "type": "string",
            "minLength": 1
          },
          "targets": {
            "minItems": 1,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {},
              "additionalProperties": {}
            }
          }
        },
        "required": [
          "documentId",
          "documentKeyTargetHash",
          "linkedContainerKeyEpochIds",
          "linkedContainerManifestHashes",
          "linkSetManifestHash",
          "targets"
        ],
        "additionalProperties": {},
        "description": "The key targets the API derived for a document from its link set: one per linked container KEK."
      },
      "DocumentLinkSetMutationRequest": {
        "type": "object",
        "properties": {
          "authorizingContainerPathRefs": {
            "$ref": "#/components/schemas/ContainerManifestRefArrayArray",
            "description": "Paths through which the caller may write the document now."
          },
          "body": {},
          "containerRekeys": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ContainerMutationRequest"
            },
            "maxItems": 16,
            "description": "Container rekeys to commit first in the same transaction."
          },
          "contentKeyBundle": {
            "$ref": "#/components/schemas/DocumentContentKeyBundleRequest",
            "description": "Content-key bundle for the new link set's targets."
          },
          "event": {
            "type": "object",
            "properties": {},
            "additionalProperties": {}
          },
          "expectedManifestHash": {
            "type": "string",
            "minLength": 1,
            "description": "Hash of the link-set manifest this mutation derives."
          },
          "manifest": {
            "type": "object",
            "properties": {},
            "additionalProperties": {}
          },
          "rotationBaseline": {
            "$ref": "#/components/schemas/DocumentOutgoingUpdate",
            "description": "For an unlink, a rotation baseline covering every committed update; omitted only when the document has none, and never sent with a link."
          },
          "targetContainerPathRefs": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ContainerManifestRef"
            },
            "maxItems": 100,
            "minItems": 1,
            "description": "Path to the container being linked or unlinked."
          }
        },
        "required": [
          "authorizingContainerPathRefs",
          "body",
          "contentKeyBundle",
          "event",
          "expectedManifestHash",
          "manifest",
          "targetContainerPathRefs"
        ],
        "additionalProperties": {},
        "description": "A signed `document.link` or `document.unlink` that changes the containers a document is linked into."
      },
      "DocumentLinkSetMutationResponse": {
        "type": "object",
        "properties": {
          "contentKeyEpoch": {
            "exclusiveMinimum": 0,
            "maximum": 1.7976931348623157e+308,
            "type": "integer"
          },
          "eventHash": {
            "type": "string",
            "minLength": 1
          },
          "id": {
            "type": "string"
          },
          "manifestHash": {
            "type": "string",
            "minLength": 1,
            "description": "Hash of the new document link-set manifest head."
          },
          "targetHash": {
            "type": "string",
            "minLength": 1,
            "description": "Key target hash the API derived for the new link set."
          }
        },
        "required": [
          "contentKeyEpoch",
          "eventHash",
          "id",
          "manifestHash",
          "targetHash"
        ],
        "additionalProperties": {},
        "description": "Acknowledges a link or unlink by hash."
      },
      "DocumentMutationErrorCode": {
        "anyOf": [
          {
            "type": "string",
            "const": "document_manifest_already_exists"
          },
          {
            "type": "string",
            "enum": [
              "document_sync_checkpoint_coverage_conflict",
              "document_sync_conflict",
              "document_sync_descendant_rekeys_required",
              "document_sync_state_stale",
              "document_sync_update_id_conflict"
            ]
          },
          {
            "type": "string",
            "const": "document_not_found"
          },
          {
            "type": "string",
            "const": "container_unavailable"
          }
        ],
        "description": "A machine-readable reason a document mutation was refused."
      },
      "DocumentMutationFailureResponse": {
        "type": "object",
        "properties": {
          "code": {
            "$ref": "#/components/schemas/DocumentMutationErrorCode"
          },
          "error": {
            "type": "string",
            "minLength": 1
          }
        },
        "required": [
          "error"
        ],
        "additionalProperties": {},
        "description": "A refused document create, link, unlink, or purge."
      },
      "DocumentNotFoundErrorResponse": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string",
            "const": "document_not_found"
          },
          "error": {
            "type": "string",
            "minLength": 1
          }
        },
        "required": [
          "code",
          "error"
        ],
        "additionalProperties": {},
        "description": "The document does not exist; clients treat only this coded 404 as deletion."
      },
      "DocumentOutgoingUpdate": {
        "type": "object",
        "properties": {
          "checkpointKind": {
            "type": "string",
            "const": "rotate_baseline",
            "description": "`rotate_baseline` when the update is a rotation baseline; absent for an ordinary update."
          },
          "checkpointPayloadKind": {
            "type": "string",
            "const": "full_history_snapshot",
            "description": "`full_history_snapshot` for a rotation baseline; absent otherwise."
          },
          "encryptedData": {
            "type": "string",
            "minLength": 1,
            "description": "Base64 ciphertext of the update under the document content key."
          },
          "id": {
            "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
            "type": "string",
            "description": "Client-chosen update id; a retry with the same id is accepted only if the ciphertext and header are identical."
          },
          "partialEndVersionVector": {
            "type": "string",
            "minLength": 1,
            "description": "Version vector the update brings the document to."
          },
          "partialStartVersionVector": {
            "type": "string",
            "minLength": 1,
            "description": "Version vector the update starts from."
          },
          "plaintextHash": {
            "type": "string",
            "minLength": 1,
            "description": "Hash of the plaintext update, committed by the write header."
          },
          "sourceVersionVector": {
            "type": "string",
            "minLength": 1,
            "description": "For a rotation baseline, the frontier its snapshot covers."
          },
          "writeHeader": {
            "type": "object",
            "properties": {},
            "additionalProperties": {},
            "description": "Signed write header binding the ciphertext to the document, access manifest, content-key epoch, target hash, and writer."
          }
        },
        "required": [
          "encryptedData",
          "id",
          "partialEndVersionVector",
          "partialStartVersionVector",
          "plaintextHash",
          "writeHeader"
        ],
        "additionalProperties": {},
        "description": "One encrypted Loro update a client uploads, with its signed write header."
      },
      "DocumentPurgeProofResponse": {
        "type": "object",
        "properties": {
          "authorizingContainerPath": {
            "minItems": 1,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AccessManifestBundleWireResponse"
            },
            "description": "Container path that authorized the purge."
          },
          "documentContainerManifestHistory": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AccessManifestBundleWireResponse"
            }
          },
          "documentId": {
            "type": "string",
            "minLength": 1
          },
          "documentManifest": {
            "$ref": "#/components/schemas/AccessManifestBundleWireResponse",
            "description": "The document's last link-set manifest."
          },
          "documentManifestContainerPaths": {
            "type": "array",
            "items": {
              "type": "array",
              "items": {
                "$ref": "#/components/schemas/AccessManifestBundleWireResponse"
              }
            }
          },
          "documentManifestPredecessors": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AccessManifestBundleWireResponse"
            },
            "description": "Earlier link-set manifests of the document."
          },
          "purgeEvent": {
            "$ref": "#/components/schemas/AccessEventBundleWireResponse",
            "description": "The signed `document.purge` event."
          },
          "purgedAt": {
            "type": "string",
            "minLength": 1
          },
          "policyEvidence": {
            "$ref": "#/components/schemas/ProjectionPolicyEvidenceResponse"
          }
        },
        "required": [
          "authorizingContainerPath",
          "documentContainerManifestHistory",
          "documentId",
          "documentManifest",
          "documentManifestContainerPaths",
          "documentManifestPredecessors",
          "purgeEvent",
          "purgedAt",
          "policyEvidence"
        ],
        "additionalProperties": {},
        "description": "The signed proof that a document was purged, with the manifests and policy history a client needs to verify it."
      },
      "DocumentPurgeRequest": {
        "type": "object",
        "properties": {
          "authorizingContainerPathRefs": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ContainerManifestRef"
            },
            "maxItems": 100,
            "minItems": 1,
            "description": "Root-to-container path of the document's only linked container."
          },
          "body": {},
          "event": {
            "type": "object",
            "properties": {},
            "additionalProperties": {}
          }
        },
        "required": [
          "authorizingContainerPathRefs",
          "body",
          "event"
        ],
        "additionalProperties": {},
        "description": "A signed `document.purge` citing the exact current path that authorizes it."
      },
      "DocumentPurgeResponse": {
        "type": "object",
        "properties": {
          "authorizingContainerPath": {
            "minItems": 1,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AccessManifestBundleWireResponse"
            }
          },
          "documentContainerManifestHistory": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AccessManifestBundleWireResponse"
            }
          },
          "documentId": {
            "type": "string",
            "minLength": 1
          },
          "documentManifest": {
            "$ref": "#/components/schemas/AccessManifestBundleWireResponse"
          },
          "documentManifestContainerPaths": {
            "type": "array",
            "items": {
              "type": "array",
              "items": {
                "$ref": "#/components/schemas/AccessManifestBundleWireResponse"
              }
            }
          },
          "documentManifestPredecessors": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AccessManifestBundleWireResponse"
            }
          },
          "purgeEvent": {
            "$ref": "#/components/schemas/AccessEventBundleWireResponse"
          },
          "purgedAt": {
            "type": "string",
            "minLength": 1
          },
          "policyEvidence": {
            "$ref": "#/components/schemas/ProjectionPolicyEvidenceResponse"
          },
          "reclaimedBlobStorageKeys": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Object-store keys reclaimed during the request; currently always empty, because reclamation is deferred."
          }
        },
        "required": [
          "authorizingContainerPath",
          "documentContainerManifestHistory",
          "documentId",
          "documentManifest",
          "documentManifestContainerPaths",
          "documentManifestPredecessors",
          "purgeEvent",
          "purgedAt",
          "policyEvidence",
          "reclaimedBlobStorageKeys"
        ],
        "additionalProperties": {},
        "description": "The purge proof. Blobs only this document referenced are soft-deleted and reclaimed later by garbage collection."
      },
      "DocumentSyncErrorResponse": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string",
            "enum": [
              "document_sync_checkpoint_coverage_conflict",
              "document_sync_conflict",
              "document_sync_descendant_rekeys_required",
              "document_sync_state_stale",
              "document_sync_update_id_conflict"
            ]
          },
          "error": {
            "type": "string",
            "minLength": 1
          },
          "principalHeads": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ReferencedPrincipalStateResponse"
            },
            "maxItems": 16,
            "description": "With `document_sync_state_stale` from a carried rekey, up to 16 current principal heads to recover before replanning; advisory only."
          }
        },
        "required": [
          "code",
          "error"
        ],
        "additionalProperties": {},
        "description": "A refused sync. The code tells the client what to do: regenerate a rotation checkpoint, commit rekeys first, replan, recover update ids, or stop."
      },
      "DocumentSyncPullPageResponse": {
        "type": "object",
        "properties": {
          "hasMore": {
            "type": "boolean",
            "description": "True exactly when `nextCursor` is set."
          },
          "nextCursor": {
            "anyOf": [
              {
                "maxLength": 512,
                "minLength": 1,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Opaque cursor for the next page, or null on the last page; it grants nothing, and each page is reauthorized."
          }
        },
        "required": [
          "hasMore",
          "nextCursor"
        ],
        "additionalProperties": {},
        "description": "Whether more updates remain in this pull."
      },
      "DocumentSyncRequest": {
        "type": "object",
        "properties": {
          "authorizingContainerPathRefs": {
            "$ref": "#/components/schemas/ContainerManifestRefArrayArray",
            "description": "Container paths that authorize a write; reads may omit them."
          },
          "containerRekeys": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "body": {},
                "containerManifestHistoryRefs": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/ContainerManifestRef"
                  },
                  "maxItems": 4096
                },
                "destinationParentContainerPathRefs": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/ContainerManifestRef"
                  },
                  "maxItems": 100
                },
                "event": {
                  "type": "object",
                  "properties": {},
                  "additionalProperties": {}
                },
                "expectedManifestHash": {
                  "type": "string",
                  "minLength": 1
                },
                "keyEpoch": {
                  "type": "object",
                  "properties": {},
                  "additionalProperties": {}
                },
                "keyring": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {},
                      "additionalProperties": {}
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "manifest": {
                  "type": "object",
                  "properties": {},
                  "additionalProperties": {}
                },
                "parentContainerPathRefs": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/ContainerManifestRef"
                  },
                  "maxItems": 100
                },
                "parentKekRef": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "containerId": {
                          "type": "string",
                          "minLength": 1
                        },
                        "containerKeyEpochId": {
                          "type": "string",
                          "minLength": 1
                        },
                        "keyEpochHash": {
                          "maxLength": 64,
                          "minLength": 64,
                          "pattern": "^[0-9a-f]+$",
                          "type": "string"
                        }
                      },
                      "required": [
                        "containerId",
                        "containerKeyEpochId",
                        "keyEpochHash"
                      ],
                      "additionalProperties": {}
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "predecessorBridge": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {},
                      "additionalProperties": {}
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "previousContainerPathRefs": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/ContainerManifestRef"
                  },
                  "maxItems": 100
                },
                "previousManifestRef": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/ContainerManifestRef"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "principalPolicyRefs": {
                  "$ref": "#/components/schemas/PrincipalPolicyRefList"
                },
                "userRecipientKeys": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {},
                    "additionalProperties": {}
                  }
                },
                "wraps": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {},
                    "additionalProperties": {}
                  }
                }
              },
              "required": [
                "body",
                "event",
                "expectedManifestHash",
                "keyEpoch",
                "keyring",
                "manifest",
                "predecessorBridge",
                "principalPolicyRefs",
                "wraps"
              ],
              "additionalProperties": {}
            },
            "maxItems": 16,
            "description": "Container rekeys to commit first in the same transaction."
          },
          "contentKeyBundle": {
            "$ref": "#/components/schemas/DocumentContentKeyBundleRequest",
            "description": "A new content-key bundle, when the write advances the content-key epoch."
          },
          "contentKeyEpoch": {
            "exclusiveMinimum": 0,
            "maximum": 1.7976931348623157e+308,
            "type": "integer",
            "description": "Content-key epoch the client is writing and reading at."
          },
          "expectedLinkSetManifestHash": {
            "type": "string",
            "minLength": 1,
            "description": "The document link-set manifest head the client planned against; a different current head is refused as stale."
          },
          "expectedTargetHash": {
            "type": "string",
            "minLength": 1,
            "description": "The key target hash the client planned against."
          },
          "historyMode": {
            "type": "string",
            "const": "raw",
            "description": "`raw` asks for every retained update missing from the frontier, bypassing rotation baselines; read-only."
          },
          "inlineRekeyCommitId": {
            "maxLength": 64,
            "minLength": 64,
            "pattern": "^[0-9a-f]+$",
            "type": "string",
            "description": "Marker that makes carried rekeys and the write replay-safe as one transaction; present exactly when `containerRekeys` is non-empty."
          },
          "localVersionVector": {
            "anyOf": [
              {
                "maxLength": 16777216,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The client's current version vector; the response returns updates it does not cover."
          },
          "minLsn": {
            "pattern": "^[0-9A-Fa-f]{1,8}\\/[0-9A-Fa-f]{1,8}$",
            "type": "string",
            "description": "Commit LSN the server must have reached before answering, for read-after-write consistency."
          },
          "outgoingUpdates": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "checkpointKind": {
                  "type": "string",
                  "const": "rotate_baseline"
                },
                "checkpointPayloadKind": {
                  "type": "string",
                  "const": "full_history_snapshot"
                },
                "encryptedData": {
                  "maxLength": 16777216,
                  "minLength": 1,
                  "type": "string"
                },
                "id": {
                  "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
                  "type": "string"
                },
                "partialEndVersionVector": {
                  "maxLength": 16777216,
                  "minLength": 1,
                  "type": "string"
                },
                "partialStartVersionVector": {
                  "maxLength": 16777216,
                  "minLength": 1,
                  "type": "string"
                },
                "plaintextHash": {
                  "type": "string",
                  "minLength": 1
                },
                "sourceVersionVector": {
                  "maxLength": 16777216,
                  "minLength": 1,
                  "type": "string"
                },
                "writeHeader": {
                  "type": "object",
                  "properties": {},
                  "additionalProperties": {}
                }
              },
              "required": [
                "encryptedData",
                "id",
                "partialEndVersionVector",
                "partialStartVersionVector",
                "plaintextHash",
                "writeHeader"
              ],
              "additionalProperties": {}
            },
            "maxItems": 64,
            "description": "Encrypted updates to upload."
          },
          "pullCursor": {
            "maxLength": 512,
            "minLength": 1,
            "type": "string",
            "description": "Continuation cursor from the previous page; a continuation is read-only."
          },
          "supportsPullPagination": {
            "type": "boolean",
            "const": true,
            "description": "Always true; every response is paged."
          }
        },
        "required": [
          "contentKeyEpoch",
          "expectedLinkSetManifestHash",
          "expectedTargetHash",
          "localVersionVector",
          "outgoingUpdates",
          "supportsPullPagination"
        ],
        "additionalProperties": {},
        "description": "A document sync: uploads encrypted updates and asks for the ones the client is missing, one page at a time."
      },
      "DocumentSyncResponse": {
        "type": "object",
        "properties": {
          "acceptedOutgoingUpdateIds": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "maxItems": 64,
            "description": "Ids of uploaded updates that are now committed."
          },
          "commitLsn": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Commit LSN after the request; pass it as `minLsn` to read your own writes from a replica."
          },
          "commitLsnMode": {
            "anyOf": [
              {
                "type": "string",
                "const": "tracked"
              },
              {
                "type": "string",
                "const": "untracked"
              }
            ],
            "description": "`tracked` for a durable backend position; `untracked` with the `0/0` sentinel when the backend cannot report one."
          },
          "contentKeyBundle": {
            "$ref": "#/components/schemas/DocumentContentKeyBundleResponse",
            "description": "Content-key bundle of the current epoch."
          },
          "contentKeyBundles": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DocumentContentKeyBundleResponse"
            },
            "description": "Bundles of older epochs that this page's updates were written at; never the current epoch."
          },
          "documentId": {
            "type": "string"
          },
          "documentKekTargets": {
            "$ref": "#/components/schemas/DocumentKekTargetsResponse",
            "description": "The document's current key targets."
          },
          "pullPage": {
            "$ref": "#/components/schemas/DocumentSyncPullPageResponse"
          },
          "updates": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DocumentSyncUpdateResponse"
            },
            "maxItems": 64,
            "description": "Encrypted updates the client's version vector does not cover."
          }
        },
        "required": [
          "acceptedOutgoingUpdateIds",
          "commitLsn",
          "commitLsnMode",
          "contentKeyBundle",
          "contentKeyBundles",
          "documentId",
          "documentKekTargets",
          "pullPage",
          "updates"
        ],
        "additionalProperties": {},
        "description": "The result of a sync: which uploads were accepted, one page of missing updates, and the key material to decrypt them."
      },
      "DocumentSyncUpdateResponse": {
        "type": "object",
        "properties": {
          "accessEpoch": {
            "exclusiveMinimum": 0,
            "maximum": 1.7976931348623157e+308,
            "type": "integer",
            "description": "Content-key epoch the update was written at."
          },
          "authorizationTargets": {
            "minItems": 1,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "containerId": {
                  "type": "string",
                  "minLength": 1
                },
                "containerKeyEpoch": {
                  "exclusiveMinimum": 0,
                  "maximum": 1.7976931348623157e+308,
                  "type": "integer"
                },
                "containerKeyEpochId": {
                  "type": "string",
                  "minLength": 1
                },
                "containerManifestHash": {
                  "type": "string",
                  "minLength": 1
                }
              },
              "required": [
                "containerId",
                "containerKeyEpoch",
                "containerKeyEpochId",
                "containerManifestHash"
              ],
              "additionalProperties": {}
            },
            "description": "Container KEK targets the write was authorized against."
          },
          "authorFingerprint": {
            "type": "string",
            "description": "Signing key fingerprint of the writer."
          },
          "checkpointKind": {
            "type": "string",
            "const": "rotate_baseline",
            "description": "`rotate_baseline` when the update is a rotation baseline."
          },
          "checkpointPayloadKind": {
            "type": "string",
            "const": "full_history_snapshot",
            "description": "`full_history_snapshot` for a rotation baseline."
          },
          "createdAt": {
            "type": "string"
          },
          "documentId": {
            "type": "string"
          },
          "encryptedData": {
            "type": "string",
            "description": "Base64 ciphertext of the update."
          },
          "id": {
            "type": "string"
          },
          "partialEndVersionVector": {
            "type": "string",
            "description": "Version vector the update brings the document to."
          },
          "partialStartVersionVector": {
            "type": "string",
            "description": "Version vector the update starts from."
          },
          "plaintextHash": {
            "type": "string",
            "minLength": 1,
            "description": "Hash of the plaintext update, committed by the write header."
          },
          "sourceVersionVector": {
            "type": "string",
            "minLength": 1,
            "description": "For a rotation baseline, the frontier its snapshot covers."
          },
          "writeHeader": {
            "type": "object",
            "properties": {},
            "additionalProperties": {},
            "description": "The update's signed write header."
          }
        },
        "required": [
          "accessEpoch",
          "authorizationTargets",
          "authorFingerprint",
          "createdAt",
          "documentId",
          "encryptedData",
          "id",
          "partialEndVersionVector",
          "partialStartVersionVector",
          "plaintextHash",
          "writeHeader"
        ],
        "additionalProperties": {},
        "description": "One stored encrypted update returned by a sync."
      },
      "DocumentWriterProjectionErrorResponse": {
        "type": "object",
        "properties": {
          "code": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "document_projection_container_conflict",
                  "document_projection_container_unavailable",
                  "document_projection_content_key_bundle_missing",
                  "document_projection_head_missing",
                  "document_projection_kek_targets_unavailable",
                  "document_projection_state_invalid"
                ]
              },
              {
                "type": "string",
                "enum": [
                  "document_sync_conflict",
                  "document_sync_state_stale",
                  "document_sync_update_id_conflict"
                ]
              }
            ]
          },
          "error": {
            "type": "string",
            "minLength": 1
          }
        },
        "required": [
          "code",
          "error"
        ],
        "additionalProperties": {},
        "description": "A refused document writer projection; a missing container is reported as a conflict, never as the document's absence."
      },
      "DocumentWriterProjectionWireResponse": {
        "type": "object",
        "properties": {
          "bundles": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {
              "$ref": "#/components/schemas/AccessManifestBundleWireResponse"
            },
            "description": "Signed manifest bundles keyed by manifest hash."
          },
          "omittedBundles": {
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1
            },
            "description": "Cited hashes left out because the request said the client holds them."
          },
          "policyEvidence": {
            "$ref": "#/components/schemas/ProjectionPolicyEvidenceResponse",
            "description": "Public principal policy history the cited manifests depend on."
          },
          "authorizingContainerPaths": {
            "minItems": 1,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "containerId": {
                  "type": "string"
                },
                "containerKeks": {
                  "type": "array",
                  "items": {
                    "anyOf": [
                      {
                        "$ref": "#/components/schemas/CitedContainerKekLevel"
                      },
                      {
                        "type": "object",
                        "properties": {
                          "accessManifestHash": {
                            "type": "string",
                            "minLength": 1
                          },
                          "containerId": {
                            "type": "string"
                          },
                          "containerKeyEpoch": {
                            "exclusiveMinimum": 0,
                            "maximum": 1.7976931348623157e+308,
                            "type": "integer"
                          },
                          "containerKeyEpochId": {
                            "type": "string",
                            "minLength": 1
                          },
                          "containerManifestHistory": {
                            "type": "array",
                            "items": {
                              "type": "string",
                              "minLength": 1
                            }
                          },
                          "keyEpoch": {
                            "type": "object",
                            "properties": {},
                            "additionalProperties": {}
                          },
                          "keyEpochHash": {
                            "type": "string",
                            "minLength": 1
                          },
                          "keyring": {
                            "anyOf": [
                              {
                                "$ref": "#/components/schemas/ContainerKekKeyringWireRecord"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "keyTargetHash": {
                            "type": "string",
                            "minLength": 1
                          },
                          "parentContainerKeyEpochId": {
                            "anyOf": [
                              {
                                "type": "string"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "recipientTargets": {
                            "minItems": 1,
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {},
                              "additionalProperties": {}
                            }
                          },
                          "wraps": {
                            "minItems": 1,
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {},
                              "additionalProperties": {}
                            }
                          }
                        },
                        "required": [
                          "accessManifestHash",
                          "containerId",
                          "containerKeyEpoch",
                          "containerKeyEpochId",
                          "containerManifestHistory",
                          "keyEpoch",
                          "keyEpochHash",
                          "keyring",
                          "keyTargetHash",
                          "parentContainerKeyEpochId",
                          "recipientTargets",
                          "wraps"
                        ],
                        "additionalProperties": {}
                      }
                    ]
                  }
                },
                "organizationId": {
                  "type": "string"
                },
                "path": {
                  "minItems": 1,
                  "type": "array",
                  "items": {
                    "type": "string",
                    "minLength": 1
                  }
                }
              },
              "required": [
                "containerId",
                "containerKeks",
                "organizationId",
                "path"
              ],
              "additionalProperties": {}
            },
            "description": "Each linked container's path from the root, with one KEK level per manifest."
          },
          "contentKeyBundle": {
            "$ref": "#/components/schemas/DocumentContentKeyBundleResponse"
          },
          "contentKeyBundleStale": {
            "type": "boolean",
            "const": true,
            "description": "Present only when the stored content-key bundle targets superseded KEKs and must be rewrapped."
          },
          "documentContainerManifestHistory": {
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1
            }
          },
          "documentId": {
            "type": "string"
          },
          "documentKekTargets": {
            "$ref": "#/components/schemas/DocumentKekTargetsResponse"
          },
          "documentManifest": {
            "type": "string",
            "minLength": 1,
            "description": "Hash of the current document link-set manifest."
          },
          "documentManifestContainerPaths": {
            "type": "array",
            "items": {
              "type": "array",
              "items": {
                "type": "string",
                "minLength": 1
              }
            }
          },
          "documentManifestHistory": {
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1
            },
            "description": "Hashes of earlier document link-set manifests."
          }
        },
        "required": [
          "bundles",
          "omittedBundles",
          "policyEvidence",
          "authorizingContainerPaths",
          "contentKeyBundle",
          "documentContainerManifestHistory",
          "documentId",
          "documentKekTargets",
          "documentManifest",
          "documentManifestContainerPaths",
          "documentManifestHistory"
        ],
        "additionalProperties": {},
        "description": "A document writer projection: its link-set history, authorizing container paths with KEK levels, and key targets. Every manifest is carried once in `bundles` and cited by hash."
      },
      "ErrorResponse": {
        "type": "object",
        "properties": {
          "error": {
            "type": "string"
          }
        },
        "required": [
          "error"
        ],
        "additionalProperties": {},
        "description": "The plain error envelope: a human-readable message for diagnostics, never for program decisions."
      },
      "HealthResponse": {
        "type": "object",
        "properties": {
          "message": {
            "type": "string"
          }
        },
        "required": [
          "message"
        ],
        "additionalProperties": {},
        "description": "The health check answer."
      },
      "InitiateMultipartBlobStageRequest": {
        "type": "object",
        "properties": {
          "organizationId": {
            "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
            "type": "string",
            "description": "Organization the blob will belong to; it must match the destination document's organization at bind time."
          },
          "byteLength": {
            "exclusiveMinimum": 0,
            "maximum": 1.7976931348623157e+308,
            "type": "integer",
            "description": "Exact size of the complete encrypted object."
          },
          "firstParts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MultipartBlobPartDescriptor"
            },
            "maxItems": 4,
            "minItems": 1,
            "description": "The one to four parts the client sends first, so the response can carry their upload sources."
          },
          "sha256": {
            "type": "string",
            "minLength": 1,
            "description": "SHA-256 of the complete encrypted object, checked when the bind assembles it."
          }
        },
        "required": [
          "organizationId",
          "byteLength",
          "firstParts",
          "sha256"
        ],
        "additionalProperties": {},
        "description": "Opens a blob stage for one encrypted object."
      },
      "InitiateMultipartBlobStageResponse": {
        "type": "object",
        "properties": {
          "organizationId": {
            "type": "string",
            "minLength": 1
          },
          "byteLength": {
            "exclusiveMinimum": 0,
            "maximum": 1.7976931348623157e+308,
            "type": "integer"
          },
          "expiresAt": {
            "type": "string",
            "description": "When the stage expires; an attachment bind must complete it before then."
          },
          "partUploads": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MultipartBlobPartUpload"
            },
            "description": "One upload source per requested first part, in request order."
          },
          "sha256": {
            "type": "string",
            "minLength": 1
          },
          "stageId": {
            "type": "string"
          },
          "uploadedParts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MultipartBlobStagePart"
            },
            "description": "Parts already uploaded."
          },
          "uploadId": {
            "type": "string",
            "description": "Object-store multipart upload id; later part authorizations name it."
          }
        },
        "required": [
          "organizationId",
          "byteLength",
          "expiresAt",
          "partUploads",
          "sha256",
          "stageId",
          "uploadedParts",
          "uploadId"
        ],
        "additionalProperties": {},
        "description": "A new blob stage and the upload sources for its first parts."
      },
      "ListContainerDocumentLanesRequest": {
        "type": "object",
        "properties": {
          "lanes": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "containerId": {
                  "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
                  "type": "string"
                },
                "laneId": {
                  "maxLength": 64,
                  "minLength": 1,
                  "type": "string"
                },
                "limit": {
                  "maximum": 500,
                  "minimum": 1,
                  "type": "integer"
                },
                "watermark": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "minLength": 1
                        },
                        "updatedAt": {
                          "minLength": 1,
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "updatedAt"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              },
              "required": [
                "containerId",
                "laneId",
                "watermark"
              ],
              "additionalProperties": false
            },
            "maxItems": 32,
            "minItems": 1
          }
        },
        "required": [
          "lanes"
        ],
        "additionalProperties": false,
        "description": "Up to 32 container lanes to list documents for, each with its own watermark and page size (500 rows in total)."
      },
      "ListContainerDocumentsResponse": {
        "type": "object",
        "properties": {
          "hasMore": {
            "type": "boolean"
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ContainerDocumentSummaryResponse"
            }
          },
          "nextWatermark": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/SyncWatermark"
              },
              {
                "type": "null"
              }
            ],
            "description": "Position after this page's last row, or the request's watermark when the page is empty; keep it for the next incremental poll. `hasMore` says whether rows remain now."
          },
          "tombstones": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ContainerDocumentSyncTombstoneResponse"
            },
            "description": "Documents removed from the container in this page's range."
          }
        },
        "required": [
          "hasMore",
          "items",
          "nextWatermark",
          "tombstones"
        ],
        "additionalProperties": {},
        "description": "One page of a container lane's documents."
      },
      "ListContainerParentLanesRequest": {
        "type": "object",
        "properties": {
          "lanes": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "laneId": {
                  "maxLength": 64,
                  "minLength": 1,
                  "type": "string"
                },
                "limit": {
                  "maximum": 500,
                  "minimum": 1,
                  "type": "integer"
                },
                "parentId": {
                  "anyOf": [
                    {
                      "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "watermark": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "minLength": 1
                        },
                        "updatedAt": {
                          "minLength": 1,
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "updatedAt"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              },
              "required": [
                "laneId",
                "parentId",
                "watermark"
              ],
              "additionalProperties": false
            },
            "maxItems": 4,
            "minItems": 1
          }
        },
        "required": [
          "lanes"
        ],
        "additionalProperties": false,
        "description": "Up to four parent lanes to list, each with its own watermark and page size."
      },
      "ListContainerParentLanesResponse": {
        "type": "object",
        "properties": {
          "results": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "laneId": {
                  "maxLength": 64,
                  "minLength": 1,
                  "type": "string"
                },
                "page": {
                  "$ref": "#/components/schemas/ListContainersResponse"
                }
              },
              "required": [
                "laneId",
                "page"
              ],
              "additionalProperties": false
            },
            "maxItems": 4,
            "minItems": 1
          }
        },
        "required": [
          "results"
        ],
        "additionalProperties": false,
        "description": "One page per requested parent lane, in request order."
      },
      "ListContainersResponse": {
        "type": "object",
        "properties": {
          "hasMore": {
            "type": "boolean"
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ContainerSummaryResponse"
            }
          },
          "nextWatermark": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/SyncWatermark"
              },
              {
                "type": "null"
              }
            ],
            "description": "Position after this page's last row, or the request's watermark when the page is empty; keep it for the next incremental poll. `hasMore` says whether rows remain now."
          },
          "tombstones": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ContainerSyncTombstoneResponse"
            },
            "description": "Containers removed from the caller's view in this page's range."
          }
        },
        "required": [
          "hasMore",
          "items",
          "nextWatermark",
          "tombstones"
        ],
        "additionalProperties": {},
        "description": "One page of a parent lane's containers."
      },
      "ListDocumentAttachmentsResponse": {
        "type": "array",
        "items": {
          "$ref": "#/components/schemas/BlobAttachmentSummary"
        },
        "description": "A document's active attachment bindings."
      },
      "ListDocumentEditAttributionRangesResponse": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "attributionRevision": {
                "maximum": 9007199254740991,
                "minimum": 0,
                "type": "integer"
              },
              "documentId": {
                "type": "string",
                "minLength": 1
              },
              "items": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/DocumentEditAttributionRangeResponse"
                },
                "maxItems": 500
              },
              "hasMore": {
                "type": "boolean",
                "const": true
              },
              "nextCursor": {
                "type": "string",
                "minLength": 1
              }
            },
            "required": [
              "attributionRevision",
              "documentId",
              "items",
              "hasMore",
              "nextCursor"
            ],
            "additionalProperties": {}
          },
          {
            "type": "object",
            "properties": {
              "attributionRevision": {
                "maximum": 9007199254740991,
                "minimum": 0,
                "type": "integer"
              },
              "documentId": {
                "type": "string",
                "minLength": 1
              },
              "items": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/DocumentEditAttributionRangeResponse"
                },
                "maxItems": 500
              },
              "hasMore": {
                "type": "boolean",
                "const": false
              },
              "nextCursor": {
                "type": "null"
              }
            },
            "required": [
              "attributionRevision",
              "documentId",
              "items",
              "hasMore",
              "nextCursor"
            ],
            "additionalProperties": {}
          }
        ],
        "description": "One page of a document's complete edit attribution."
      },
      "ListSessionsResponse": {
        "type": "object",
        "properties": {
          "sessions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/UserSessionResponse"
            }
          }
        },
        "required": [
          "sessions"
        ],
        "additionalProperties": {},
        "description": "The signed-in user's live sessions."
      },
      "MultipartBlobPartDescriptor": {
        "type": "object",
        "properties": {
          "byteLength": {
            "maximum": 33554432,
            "minimum": 1,
            "type": "integer"
          },
          "contentMd5": {
            "type": "string",
            "pattern": "^[A-Za-z0-9+/]{21}[AQgw]==$",
            "description": "Base64 MD5 of the part's bytes; a signed upload URL is bound to it."
          },
          "partNumber": {
            "maximum": 10000,
            "minimum": 1,
            "type": "integer"
          }
        },
        "required": [
          "byteLength",
          "contentMd5",
          "partNumber"
        ],
        "additionalProperties": false,
        "description": "One encrypted part as the client will send it."
      },
      "MultipartBlobPartUpload": {
        "type": "object",
        "properties": {
          "byteLength": {
            "maximum": 33554432,
            "minimum": 1,
            "type": "integer"
          },
          "contentMd5": {
            "type": "string",
            "pattern": "^[A-Za-z0-9+/]{21}[AQgw]==$"
          },
          "partNumber": {
            "maximum": 10000,
            "minimum": 1,
            "type": "integer"
          },
          "source": {
            "$ref": "#/components/schemas/MultipartBlobPartUploadSource"
          }
        },
        "required": [
          "byteLength",
          "contentMd5",
          "partNumber",
          "source"
        ],
        "additionalProperties": false,
        "description": "One part's descriptor and where to send its bytes."
      },
      "MultipartBlobPartUploadSource": {
        "description": "Where a part's bytes go: the API byte route (`kind: api`) for stores that cannot sign, or a short-lived URL that accepts exactly this part.",
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "const": "api"
              }
            },
            "required": [
              "kind"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "const": "signed-url"
              },
              "url": {
                "type": "string",
                "pattern": "^https?:\\/\\/"
              },
              "expiresAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
              }
            },
            "required": [
              "kind",
              "url",
              "expiresAt"
            ],
            "additionalProperties": false
          }
        ]
      },
      "MultipartBlobStageConflictErrorResponse": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string",
            "const": "multipart_blob_stage_expired",
            "description": "`multipart_blob_stage_expired` when the stage expired, which permits starting a fresh one; uncoded conflicts are terminal."
          },
          "error": {
            "type": "string",
            "minLength": 1
          }
        },
        "required": [
          "error"
        ],
        "additionalProperties": {},
        "description": "A 409 for a blob stage."
      },
      "MultipartBlobStageNotFoundErrorResponse": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string",
            "const": "multipart_blob_stage_not_found"
          },
          "error": {
            "type": "string",
            "minLength": 1
          }
        },
        "required": [
          "code",
          "error"
        ],
        "additionalProperties": {},
        "description": "The blob stage, its upload, or its staged object no longer exists; only this coded 404 permits starting a fresh stage."
      },
      "MultipartBlobStagePart": {
        "type": "object",
        "properties": {
          "byteLength": {
            "exclusiveMinimum": 0,
            "maximum": 1.7976931348623157e+308,
            "type": "integer"
          },
          "etag": {
            "type": "string",
            "minLength": 1,
            "description": "Object-store ETag confirming the part's bytes."
          },
          "partNumber": {
            "exclusiveMinimum": 0,
            "maximum": 1.7976931348623157e+308,
            "type": "integer"
          }
        },
        "required": [
          "byteLength",
          "etag",
          "partNumber"
        ],
        "additionalProperties": {},
        "description": "One uploaded part of a blob stage."
      },
      "MultipartBlobStageStatusResponse": {
        "type": "object",
        "properties": {
          "organizationId": {
            "type": "string",
            "minLength": 1
          },
          "byteLength": {
            "exclusiveMinimum": 0,
            "maximum": 1.7976931348623157e+308,
            "type": "integer"
          },
          "completed": {
            "type": "boolean",
            "description": "True once an attachment bind assembled and verified the object."
          },
          "expiresAt": {
            "type": "string"
          },
          "sha256": {
            "type": "string",
            "minLength": 1
          },
          "stageId": {
            "type": "string"
          },
          "uploadedParts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MultipartBlobStagePart"
            },
            "description": "Parts uploaded so far, with their ETags."
          },
          "uploadId": {
            "type": "string"
          }
        },
        "required": [
          "organizationId",
          "byteLength",
          "completed",
          "expiresAt",
          "sha256",
          "stageId",
          "uploadedParts",
          "uploadId"
        ],
        "additionalProperties": {},
        "description": "A blob stage's progress, used to resume an interrupted upload."
      },
      "OrganizationBillingHistoryEntry": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "category": {
            "type": "string",
            "enum": [
              "lifecycle",
              "seat",
              "invoice"
            ]
          },
          "provider": {
            "type": "string",
            "enum": [
              "revenuecat",
              "stripe",
              "internal"
            ]
          },
          "environment": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "sandbox",
                  "production"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "eventType": {
            "type": "string"
          },
          "outcome": {
            "type": "string",
            "enum": [
              "applied",
              "ignored"
            ]
          },
          "occurredAt": {
            "type": "string"
          },
          "productId": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "transactionId": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "invoiceId": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "subscriptionId": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "billingReason": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "seatCount": {
            "anyOf": [
              {
                "maximum": 9007199254740991,
                "minimum": 0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ]
          },
          "seatDelta": {
            "anyOf": [
              {
                "maximum": 9007199254740991,
                "minimum": -9007199254740991,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "Change in seats this event caused; negative for a reduction."
          },
          "activeSeatCount": {
            "anyOf": [
              {
                "maximum": 9007199254740991,
                "minimum": 0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ]
          },
          "priceId": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "unitAmount": {
            "anyOf": [
              {
                "maximum": 9007199254740991,
                "minimum": 0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "Price per billing period; for a recognized native grant, its canonical monthly USD list price."
          },
          "currency": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "interval": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "intervalCount": {
            "anyOf": [
              {
                "maximum": 9007199254740991,
                "minimum": 1,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ]
          },
          "totalAmount": {
            "anyOf": [
              {
                "maximum": 9007199254740991,
                "minimum": 0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "Amount actually charged, in `totalCurrency`."
          },
          "totalCurrency": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "periodStartsAt": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "periodEndsAt": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "category",
          "provider",
          "environment",
          "eventType",
          "outcome",
          "occurredAt",
          "productId",
          "transactionId",
          "invoiceId",
          "subscriptionId",
          "billingReason",
          "seatCount",
          "seatDelta",
          "activeSeatCount",
          "priceId",
          "unitAmount",
          "currency",
          "interval",
          "intervalCount",
          "totalAmount",
          "totalCurrency",
          "periodStartsAt",
          "periodEndsAt"
        ],
        "additionalProperties": {},
        "description": "One recorded billing event of an organization. Amounts are in the currency's minor unit as the provider reported them."
      },
      "OrganizationBillingHistoryResponse": {
        "type": "object",
        "properties": {
          "organizationId": {
            "type": "string"
          },
          "entries": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OrganizationBillingHistoryEntry"
            }
          }
        },
        "required": [
          "organizationId",
          "entries"
        ],
        "additionalProperties": {},
        "description": "An organization's billing events, newest first."
      },
      "OrganizationBillingManagementUrlResponse": {
        "type": "object",
        "properties": {
          "managementUrl": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "App Store or Google Play management page, or null when there is no native subscription or the lookup failed."
          }
        },
        "required": [
          "managementUrl"
        ],
        "additionalProperties": {},
        "description": "Where an administrator manages a native store subscription."
      },
      "OrganizationBillingResponse": {
        "type": "object",
        "properties": {
          "organizationId": {
            "type": "string"
          },
          "activeMemberCount": {
            "maximum": 9007199254740991,
            "minimum": 0,
            "type": "integer",
            "description": "Members reachable through the signed `Members` group, as the server counts them."
          },
          "assignedSeatCount": {
            "maximum": 9007199254740991,
            "minimum": 0,
            "type": "integer",
            "description": "Members who hold a sync seat; always the length of `assignedUserIds`."
          },
          "assignedUserIds": {
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1
            },
            "description": "Members who may sync within the licensed seat count."
          },
          "currentUserHasSyncSeat": {
            "type": "boolean",
            "description": "True when the caller holds one of the sync seats."
          },
          "status": {
            "type": "string",
            "enum": [
              "local",
              "trialing",
              "active",
              "disabled",
              "deleting",
              "purged"
            ],
            "description": "Billing state; it decides whether the organization may sync at all. A `local` organization is free and syncs nothing."
          },
          "trialEndsAt": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "provider": {
            "anyOf": [
              {
                "type": "string",
                "const": "revenuecat"
              },
              {
                "type": "null"
              }
            ]
          },
          "canCancelDirectly": {
            "type": "boolean",
            "description": "True when a Stripe subscription can be cancelled from the app, even while a native store owns billing."
          },
          "subscriptionSource": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "native",
                  "stripe"
                ]
              },
              {
                "type": "null"
              }
            ],
            "description": "Store of record for the current or lapsed subscription, or null when nothing would conflict with a new purchase."
          },
          "currentPeriodStartsAt": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "currentPeriodEndsAt": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "seatCount": {
            "maximum": 9007199254740991,
            "minimum": 0,
            "type": "integer",
            "description": "Licensed seats in the current paid period."
          },
          "pendingSeatCount": {
            "anyOf": [
              {
                "maximum": 9007199254740991,
                "minimum": 1,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "Seat count of a native plan change the store scheduled but has not applied yet."
          },
          "disabledAt": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "When sync stopped because billing lapsed."
          },
          "purgeAfter": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "When a disabled organization's synced data becomes eligible for purge."
          }
        },
        "required": [
          "organizationId",
          "activeMemberCount",
          "assignedSeatCount",
          "assignedUserIds",
          "currentUserHasSyncSeat",
          "status",
          "trialEndsAt",
          "provider",
          "canCancelDirectly",
          "subscriptionSource",
          "currentPeriodStartsAt",
          "currentPeriodEndsAt",
          "seatCount",
          "pendingSeatCount",
          "disabledAt",
          "purgeAfter"
        ],
        "additionalProperties": {},
        "description": "An organization's sync billing snapshot: whether it may sync, its plan period, and its seats."
      },
      "OrganizationDataUsageResponse": {
        "type": "object",
        "properties": {
          "organizationId": {
            "type": "string",
            "minLength": 1
          },
          "blobs": {
            "type": "object",
            "properties": {
              "blobCount": {
                "maximum": 9007199254740991,
                "minimum": 0,
                "type": "integer"
              },
              "byteLength": {
                "maximum": 9007199254740991,
                "minimum": 0,
                "type": "integer"
              }
            },
            "required": [
              "blobCount",
              "byteLength"
            ],
            "additionalProperties": false
          },
          "documents": {
            "type": "object",
            "properties": {
              "breakdown": {
                "items": {
                  "type": "object",
                  "properties": {
                    "byteLength": {
                      "maximum": 9007199254740991,
                      "minimum": 0,
                      "type": "integer"
                    },
                    "category": {
                      "type": "string",
                      "enum": [
                        "containerMetadata",
                        "rosterProfiles",
                        "organizationMetadata",
                        "user"
                      ]
                    },
                    "documentCount": {
                      "maximum": 9007199254740991,
                      "minimum": 0,
                      "type": "integer"
                    },
                    "updateCount": {
                      "maximum": 9007199254740991,
                      "minimum": 0,
                      "type": "integer"
                    }
                  },
                  "required": [
                    "byteLength",
                    "category",
                    "documentCount",
                    "updateCount"
                  ],
                  "additionalProperties": false
                },
                "maxItems": 4,
                "minItems": 4,
                "type": "array"
              },
              "byteLength": {
                "maximum": 9007199254740991,
                "minimum": 0,
                "type": "integer"
              },
              "documentCount": {
                "maximum": 9007199254740991,
                "minimum": 0,
                "type": "integer"
              },
              "updateCount": {
                "maximum": 9007199254740991,
                "minimum": 0,
                "type": "integer"
              }
            },
            "required": [
              "breakdown",
              "byteLength",
              "documentCount",
              "updateCount"
            ],
            "additionalProperties": false
          },
          "totalByteLength": {
            "maximum": 9007199254740991,
            "minimum": 0,
            "type": "integer",
            "description": "Document plus blob bytes."
          }
        },
        "required": [
          "organizationId",
          "blobs",
          "documents",
          "totalByteLength"
        ],
        "additionalProperties": false,
        "description": "How much an organization stores, by documents and blobs."
      },
      "OrganizationDirectoryUserResponse": {
        "type": "object",
        "properties": {
          "createdAt": {
            "type": "string"
          },
          "disabledAt": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "disabledByUserId": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Administrator who disabled the entry, or null."
          },
          "encapsulationKeyFingerprint": {
            "type": "string"
          },
          "encapsulationPublicKey": {
            "type": "string"
          },
          "isPersonalOrganizationOwner": {
            "type": "boolean",
            "description": "True for the user whose personal organization this is; they cannot be removed from it."
          },
          "isSelf": {
            "type": "boolean",
            "description": "True for the caller's own entry."
          },
          "joinedAt": {
            "type": "string"
          },
          "leaveRequest": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/OrganizationLeaveRequest"
              },
              {
                "type": "null"
              }
            ],
            "description": "The member's pending signed request to leave, shown only to administrators and the member."
          },
          "profileDocumentId": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Encrypted roster profile document, or null."
          },
          "signingKeyFingerprint": {
            "type": "string"
          },
          "signingPublicKey": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "disabled"
            ],
            "description": "`active` members have access; `disabled` entries stay visible without access."
          },
          "updatedAt": {
            "type": "string"
          },
          "userId": {
            "type": "string"
          }
        },
        "required": [
          "createdAt",
          "disabledAt",
          "disabledByUserId",
          "encapsulationKeyFingerprint",
          "encapsulationPublicKey",
          "isPersonalOrganizationOwner",
          "isSelf",
          "joinedAt",
          "leaveRequest",
          "profileDocumentId",
          "signingKeyFingerprint",
          "signingPublicKey",
          "status",
          "updatedAt",
          "userId"
        ],
        "additionalProperties": {},
        "description": "One organization roster entry with the user's registered keys. Display names live in the encrypted profile document."
      },
      "OrganizationGroupCurrentStateResponse": {
        "type": "object",
        "properties": {
          "keyEpoch": {
            "maximum": 9007199254740991,
            "minimum": 1,
            "type": "integer"
          },
          "keyFingerprint": {
            "type": "string",
            "minLength": 1
          },
          "memberCount": {
            "maximum": 1.7976931348623157e+308,
            "minimum": 0,
            "type": "integer"
          },
          "stateHash": {
            "type": "string"
          },
          "version": {
            "maximum": 9007199254740991,
            "minimum": 1,
            "type": "integer"
          }
        },
        "required": [
          "keyEpoch",
          "keyFingerprint",
          "memberCount",
          "stateHash",
          "version"
        ],
        "additionalProperties": {},
        "description": "A group's current policy head."
      },
      "OrganizationGroupMemberResponse": {
        "type": "object",
        "properties": {
          "encapsulationKeyFingerprint": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "encapsulationPublicKey": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "role": {
            "type": "string",
            "enum": [
              "member",
              "admin"
            ]
          },
          "signingKeyFingerprint": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "signingPublicKey": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "userId": {
            "type": "string"
          }
        },
        "required": [
          "encapsulationKeyFingerprint",
          "encapsulationPublicKey",
          "role",
          "signingKeyFingerprint",
          "signingPublicKey",
          "userId"
        ],
        "additionalProperties": {},
        "description": "One member of a group, with their registered keys when known."
      },
      "OrganizationGroupMembersResponse": {
        "type": "object",
        "properties": {
          "groupId": {
            "type": "string"
          },
          "members": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OrganizationGroupMemberResponse"
            }
          },
          "organizationId": {
            "type": "string"
          }
        },
        "required": [
          "groupId",
          "members",
          "organizationId"
        ],
        "additionalProperties": {},
        "description": "The members of a group from its current signed policy."
      },
      "OrganizationGroupSummaryResponse": {
        "type": "object",
        "properties": {
          "createdAt": {
            "type": "string"
          },
          "currentState": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/OrganizationGroupCurrentStateResponse"
              },
              {
                "type": "null"
              }
            ]
          },
          "groupId": {
            "type": "string"
          },
          "isBuiltin": {
            "type": "boolean",
            "description": "True for the reserved `Admins` and `Members` groups."
          },
          "organizationId": {
            "type": "string"
          }
        },
        "required": [
          "createdAt",
          "currentState",
          "groupId",
          "isBuiltin",
          "organizationId"
        ],
        "additionalProperties": {},
        "description": "A group of an organization and its current head."
      },
      "OrganizationLeaveRequest": {
        "type": "object",
        "properties": {
          "organizationId": {
            "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
            "type": "string"
          },
          "userId": {
            "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
            "type": "string"
          },
          "requestedAt": {
            "pattern": "^(?:19[7-9]\\d|[2-9]\\d{3})-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{3}Z$",
            "type": "string"
          },
          "membersHead": {
            "type": "object",
            "properties": {
              "principalId": {
                "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
                "type": "string"
              },
              "version": {
                "maximum": 9007199254740991,
                "minimum": 1,
                "type": "integer"
              },
              "keyEpoch": {
                "maximum": 9007199254740991,
                "minimum": 1,
                "type": "integer"
              },
              "stateHash": {
                "type": "string",
                "minLength": 1
              },
              "keyFingerprint": {
                "type": "string",
                "minLength": 1
              }
            },
            "required": [
              "principalId",
              "version",
              "keyEpoch",
              "stateHash",
              "keyFingerprint"
            ],
            "additionalProperties": false
          },
          "signature": {
            "type": "string",
            "minLength": 1
          }
        },
        "required": [
          "organizationId",
          "userId",
          "requestedAt",
          "membersHead",
          "signature"
        ],
        "additionalProperties": false
      },
      "OrganizationMembershipResponse": {
        "type": "object",
        "properties": {
          "isPersonalOrganizationOwner": {
            "type": "boolean",
            "description": "True for the caller's personal organization, which can be neither paused nor left."
          },
          "leaveRequestedAt": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "When the caller asked to leave, or null."
          },
          "organizationId": {
            "type": "string"
          },
          "syncPaused": {
            "type": "boolean",
            "description": "True when the caller paused this organization's sync to their devices."
          }
        },
        "required": [
          "isPersonalOrganizationOwner",
          "leaveRequestedAt",
          "organizationId",
          "syncPaused"
        ],
        "additionalProperties": {},
        "description": "One organization the caller belongs to, as the caller's own settings for it; it grants nothing."
      },
      "OrganizationMembershipsResponse": {
        "type": "object",
        "properties": {
          "memberships": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OrganizationMembershipResponse"
            }
          }
        },
        "required": [
          "memberships"
        ],
        "additionalProperties": {},
        "description": "Every organization where the caller has an active roster entry."
      },
      "OrganizationNativePurchaseEligibilityResponse": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "eligible": {
                "type": "boolean",
                "const": true
              },
              "reason": {
                "type": "null"
              }
            },
            "required": [
              "eligible",
              "reason"
            ],
            "additionalProperties": {}
          },
          {
            "type": "object",
            "properties": {
              "eligible": {
                "type": "boolean",
                "const": false
              },
              "reason": {
                "type": "string",
                "enum": [
                  "organization_admin_required",
                  "personal_organization_required",
                  "terminal_organization",
                  "stripe_subscription_conflict",
                  "existing_subscription_conflict",
                  "native_subscription_buyer_mismatch"
                ]
              }
            },
            "required": [
              "eligible",
              "reason"
            ],
            "additionalProperties": {}
          }
        ],
        "description": "Whether the caller may start a native store purchase for the organization, and why not when refused."
      },
      "OrganizationPolicyHistoryResponse": {
        "type": "object",
        "properties": {
          "organizationId": {
            "type": "string",
            "minLength": 1
          },
          "stateHash": {
            "type": "string",
            "minLength": 1,
            "description": "The organization head the history ends at."
          },
          "beforeVersion": {
            "type": "integer",
            "minimum": 2,
            "maximum": 9007199254740991
          },
          "nextBeforeVersion": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": 2,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ],
            "description": "Cursor for the next page, or null on the last page."
          },
          "evidence": {
            "$ref": "#/components/schemas/ProjectionPolicyEvidenceResponse"
          }
        },
        "required": [
          "organizationId",
          "stateHash",
          "beforeVersion",
          "nextBeforeVersion",
          "evidence"
        ],
        "additionalProperties": {},
        "description": "A page of an organization's signed policy history up to an exact head. Signed evidence only; clients resolve display names themselves."
      },
      "OrganizationPresentationFailureResponse": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string",
            "const": "organization_presentation_access_denied"
          },
          "error": {
            "type": "string",
            "minLength": 1
          }
        },
        "required": [
          "code",
          "error"
        ],
        "additionalProperties": {},
        "description": "The caller may not see this organization's data."
      },
      "OrganizationPrincipalPolicyRequest": {
        "type": "object",
        "properties": {
          "containerMutations": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ContainerMutationRequest"
            },
            "maxItems": 0,
            "description": "Container mutations committed atomically with the state."
          },
          "encryptedPayload": {
            "type": "object",
            "properties": {
              "cipherSuite": {
                "type": "string",
                "const": "aes-256-gcm"
              },
              "ciphertext": {
                "type": "string"
              },
              "ciphertextHash": {
                "type": "string"
              }
            },
            "required": [
              "cipherSuite",
              "ciphertext",
              "ciphertextHash"
            ],
            "additionalProperties": {}
          },
          "grants": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PrincipalContainerGrantRequest"
            }
          },
          "memberEnvelopes": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "kemCipherText": {
                  "type": "string"
                },
                "memberKeyFingerprint": {
                  "type": "string"
                },
                "userId": {
                  "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
                  "type": "string"
                },
                "wrappedKey": {
                  "type": "string"
                }
              },
              "required": [
                "kemCipherText",
                "memberKeyFingerprint",
                "userId",
                "wrappedKey"
              ],
              "additionalProperties": {}
            },
            "description": "The new key epoch's key, encapsulated to each member."
          },
          "projection": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "role": {
                  "type": "string",
                  "enum": [
                    "member",
                    "admin"
                  ]
                },
                "userId": {
                  "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
                  "type": "string"
                }
              },
              "required": [
                "role",
                "userId"
              ],
              "additionalProperties": {}
            },
            "description": "The complete membership with roles after this state."
          },
          "state": {
            "type": "object",
            "properties": {
              "encapsulationPublicKey": {
                "type": "string"
              },
              "externalAuthority": {
                "anyOf": [
                  {
                    "type": "object",
                    "properties": {
                      "keyEpoch": {
                        "maximum": 9007199254740991,
                        "minimum": 1,
                        "type": "integer"
                      },
                      "keyFingerprint": {
                        "type": "string"
                      },
                      "principalId": {
                        "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
                        "type": "string"
                      },
                      "principalType": {
                        "type": "string",
                        "const": "group"
                      },
                      "stateHash": {
                        "type": "string"
                      },
                      "version": {
                        "maximum": 9007199254740991,
                        "minimum": 1,
                        "type": "integer"
                      }
                    },
                    "required": [
                      "keyEpoch",
                      "keyFingerprint",
                      "principalId",
                      "principalType",
                      "stateHash",
                      "version"
                    ],
                    "additionalProperties": {}
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "grantCount": {
                "maximum": 1.7976931348623157e+308,
                "minimum": 0,
                "type": "integer"
              },
              "grantRoot": {
                "type": "string"
              },
              "keyEpoch": {
                "maximum": 9007199254740991,
                "minimum": 1,
                "type": "integer"
              },
              "keyFingerprint": {
                "type": "string"
              },
              "memberCount": {
                "maximum": 1.7976931348623157e+308,
                "minimum": 0,
                "type": "integer"
              },
              "memberEnvelopesRoot": {
                "type": "string"
              },
              "membershipMode": {
                "type": "string",
                "const": "projection"
              },
              "membershipRoot": {
                "type": "string"
              },
              "payloadCiphertextHash": {
                "type": "string"
              },
              "prevStateHash": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "principalId": {
                "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
                "type": "string"
              },
              "principalType": {
                "type": "string",
                "enum": [
                  "group",
                  "organization"
                ]
              },
              "projectionRoot": {
                "type": "string"
              },
              "signature": {
                "type": "string"
              },
              "signedAt": {
                "pattern": "^(?:19[7-9]\\d|[2-9]\\d{3})-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{3}Z$",
                "type": "string"
              },
              "signerUserId": {
                "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
                "type": "string"
              },
              "signerUserKeyFingerprint": {
                "type": "string"
              },
              "version": {
                "maximum": 9007199254740991,
                "minimum": 1,
                "type": "integer"
              }
            },
            "required": [
              "encapsulationPublicKey",
              "externalAuthority",
              "grantCount",
              "grantRoot",
              "keyEpoch",
              "keyFingerprint",
              "memberCount",
              "memberEnvelopesRoot",
              "membershipMode",
              "membershipRoot",
              "payloadCiphertextHash",
              "prevStateHash",
              "principalId",
              "principalType",
              "projectionRoot",
              "signature",
              "signedAt",
              "signerUserId",
              "signerUserKeyFingerprint",
              "version"
            ],
            "additionalProperties": {}
          }
        },
        "required": [
          "encryptedPayload",
          "grants",
          "memberEnvelopes",
          "projection",
          "state"
        ],
        "additionalProperties": {},
        "description": "The organization's next signed principal policy state, including its signed directory of group heads."
      },
      "OrganizationProfileResponse": {
        "type": "object",
        "properties": {
          "organizationId": {
            "type": "string"
          },
          "profileDocumentId": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "organizationId",
          "profileDocumentId"
        ],
        "additionalProperties": {},
        "description": "The organization's encrypted profile document binding."
      },
      "OrganizationReadModelFailureResponse": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string",
            "const": "organization_read_model_cursor_invalid",
            "description": "Present only when the API identified the cursor as invalid, which lets the client discard it and request a snapshot."
          },
          "error": {
            "type": "string",
            "minLength": 1
          }
        },
        "required": [
          "error"
        ],
        "additionalProperties": {},
        "description": "A refused read-model request."
      },
      "OrganizationReadModelResponse": {
        "oneOf": [
          {
            "type": "object",
            "properties": {
              "currentUser": {
                "type": "object",
                "properties": {
                  "isOrgAdmin": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "isOrgAdmin"
                ],
                "additionalProperties": false
              },
              "hasMore": {
                "type": "boolean"
              },
              "nextCursor": {
                "type": "string",
                "minLength": 1
              },
              "organizationId": {
                "type": "string"
              },
              "version": {
                "type": "number",
                "const": 6
              },
              "lanes": {
                "type": "object",
                "properties": {
                  "directory": {
                    "type": "object",
                    "properties": {
                      "organizationId": {
                        "type": "string"
                      },
                      "profileDocumentId": {
                        "anyOf": [
                          {
                            "type": "string"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "users": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "createdAt": {
                              "type": "string"
                            },
                            "disabledAt": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "disabledByUserId": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "encapsulationKeyFingerprint": {
                              "type": "string"
                            },
                            "encapsulationPublicKey": {
                              "type": "string"
                            },
                            "isPersonalOrganizationOwner": {
                              "type": "boolean"
                            },
                            "isSelf": {
                              "type": "boolean"
                            },
                            "joinedAt": {
                              "type": "string"
                            },
                            "leaveRequest": {
                              "anyOf": [
                                {
                                  "$ref": "#/components/schemas/OrganizationLeaveRequest"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "profileDocumentId": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "signingKeyFingerprint": {
                              "type": "string"
                            },
                            "signingPublicKey": {
                              "type": "string"
                            },
                            "status": {
                              "type": "string",
                              "enum": [
                                "active",
                                "disabled"
                              ]
                            },
                            "updatedAt": {
                              "type": "string"
                            },
                            "userId": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "createdAt",
                            "disabledAt",
                            "disabledByUserId",
                            "encapsulationKeyFingerprint",
                            "encapsulationPublicKey",
                            "isPersonalOrganizationOwner",
                            "isSelf",
                            "joinedAt",
                            "leaveRequest",
                            "profileDocumentId",
                            "signingKeyFingerprint",
                            "signingPublicKey",
                            "status",
                            "updatedAt",
                            "userId"
                          ],
                          "additionalProperties": false
                        }
                      }
                    },
                    "required": [
                      "organizationId",
                      "profileDocumentId",
                      "users"
                    ],
                    "additionalProperties": false
                  },
                  "grants": {
                    "type": "object",
                    "properties": {
                      "grants": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "accessLevel": {
                              "type": "string",
                              "enum": [
                                "admin",
                                "read",
                                "write"
                              ]
                            },
                            "containerId": {
                              "type": "string"
                            },
                            "createdAt": {
                              "type": "string"
                            },
                            "depth": {
                              "maximum": 1.7976931348623157e+308,
                              "minimum": 0,
                              "type": "integer"
                            },
                            "isBuiltin": {
                              "type": "boolean"
                            },
                            "metadataAccessEpoch": {
                              "exclusiveMinimum": 0,
                              "maximum": 1.7976931348623157e+308,
                              "type": "integer"
                            },
                            "metadataAccessStateHash": {
                              "type": "string",
                              "minLength": 1
                            },
                            "metadataDocumentId": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "parentId": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "updatedAt": {
                              "type": "string"
                            },
                            "groupId": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "signingKeyFingerprint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "subjectId": {
                              "type": "string"
                            },
                            "subjectType": {
                              "type": "string",
                              "enum": [
                                "group",
                                "user"
                              ]
                            },
                            "userId": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            }
                          },
                          "required": [
                            "accessLevel",
                            "containerId",
                            "createdAt",
                            "depth",
                            "isBuiltin",
                            "metadataAccessEpoch",
                            "metadataAccessStateHash",
                            "metadataDocumentId",
                            "parentId",
                            "updatedAt",
                            "groupId",
                            "signingKeyFingerprint",
                            "subjectId",
                            "subjectType",
                            "userId"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "organizationId": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "grants",
                      "organizationId"
                    ],
                    "additionalProperties": false
                  },
                  "groupMemberships": {
                    "type": "object",
                    "properties": {
                      "deletedGroupIds": {
                        "type": "array",
                        "items": {
                          "type": "string",
                          "minLength": 1
                        }
                      },
                      "groups": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "groupId": {
                              "type": "string"
                            },
                            "members": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "role": {
                                    "type": "string",
                                    "enum": [
                                      "member",
                                      "admin"
                                    ]
                                  },
                                  "userId": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "role",
                                  "userId"
                                ],
                                "additionalProperties": false
                              }
                            },
                            "stateHash": {
                              "type": "string",
                              "minLength": 1
                            }
                          },
                          "required": [
                            "groupId",
                            "members",
                            "stateHash"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "organizationId": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "deletedGroupIds",
                      "groups",
                      "organizationId"
                    ],
                    "additionalProperties": false
                  },
                  "groups": {
                    "type": "object",
                    "properties": {
                      "groups": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "createdAt": {
                              "type": "string"
                            },
                            "currentState": {
                              "anyOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "keyEpoch": {
                                      "maximum": 9007199254740991,
                                      "minimum": 1,
                                      "type": "integer"
                                    },
                                    "keyFingerprint": {
                                      "type": "string",
                                      "minLength": 1
                                    },
                                    "memberCount": {
                                      "maximum": 1.7976931348623157e+308,
                                      "minimum": 0,
                                      "type": "integer"
                                    },
                                    "stateHash": {
                                      "type": "string"
                                    },
                                    "version": {
                                      "maximum": 9007199254740991,
                                      "minimum": 1,
                                      "type": "integer"
                                    }
                                  },
                                  "required": [
                                    "keyEpoch",
                                    "keyFingerprint",
                                    "memberCount",
                                    "stateHash",
                                    "version"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "groupId": {
                              "type": "string"
                            },
                            "isBuiltin": {
                              "type": "boolean"
                            },
                            "organizationId": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "createdAt",
                            "currentState",
                            "groupId",
                            "isBuiltin",
                            "organizationId"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "memberGroupId": {
                        "type": "string"
                      },
                      "organizationId": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "groups",
                      "memberGroupId",
                      "organizationId"
                    ],
                    "additionalProperties": false
                  },
                  "organizationPolicy": {
                    "type": "object",
                    "properties": {
                      "currentState": {
                        "type": "object",
                        "properties": {
                          "keyEpoch": {
                            "maximum": 9007199254740991,
                            "minimum": 1,
                            "type": "integer"
                          },
                          "keyFingerprint": {
                            "type": "string",
                            "minLength": 1
                          },
                          "memberCount": {
                            "maximum": 1.7976931348623157e+308,
                            "minimum": 0,
                            "type": "integer"
                          },
                          "stateHash": {
                            "type": "string",
                            "minLength": 1
                          },
                          "version": {
                            "maximum": 9007199254740991,
                            "minimum": 1,
                            "type": "integer"
                          }
                        },
                        "required": [
                          "keyEpoch",
                          "keyFingerprint",
                          "memberCount",
                          "stateHash",
                          "version"
                        ],
                        "additionalProperties": false
                      },
                      "organizationId": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "currentState",
                      "organizationId"
                    ],
                    "additionalProperties": false
                  }
                },
                "additionalProperties": false
              },
              "mode": {
                "type": "string",
                "const": "delta"
              }
            },
            "required": [
              "currentUser",
              "hasMore",
              "nextCursor",
              "organizationId",
              "version",
              "lanes",
              "mode"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "currentUser": {
                "type": "object",
                "properties": {
                  "isOrgAdmin": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "isOrgAdmin"
                ],
                "additionalProperties": false
              },
              "hasMore": {
                "type": "boolean",
                "const": false
              },
              "nextCursor": {
                "type": "string",
                "minLength": 1
              },
              "organizationId": {
                "type": "string"
              },
              "version": {
                "type": "number",
                "const": 6
              },
              "lanes": {
                "type": "object",
                "properties": {
                  "directory": {
                    "type": "object",
                    "properties": {
                      "organizationId": {
                        "type": "string"
                      },
                      "profileDocumentId": {
                        "anyOf": [
                          {
                            "type": "string"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "users": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "createdAt": {
                              "type": "string"
                            },
                            "disabledAt": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "disabledByUserId": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "encapsulationKeyFingerprint": {
                              "type": "string"
                            },
                            "encapsulationPublicKey": {
                              "type": "string"
                            },
                            "isPersonalOrganizationOwner": {
                              "type": "boolean"
                            },
                            "isSelf": {
                              "type": "boolean"
                            },
                            "joinedAt": {
                              "type": "string"
                            },
                            "leaveRequest": {
                              "anyOf": [
                                {
                                  "$ref": "#/components/schemas/OrganizationLeaveRequest"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "profileDocumentId": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "signingKeyFingerprint": {
                              "type": "string"
                            },
                            "signingPublicKey": {
                              "type": "string"
                            },
                            "status": {
                              "type": "string",
                              "enum": [
                                "active",
                                "disabled"
                              ]
                            },
                            "updatedAt": {
                              "type": "string"
                            },
                            "userId": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "createdAt",
                            "disabledAt",
                            "disabledByUserId",
                            "encapsulationKeyFingerprint",
                            "encapsulationPublicKey",
                            "isPersonalOrganizationOwner",
                            "isSelf",
                            "joinedAt",
                            "leaveRequest",
                            "profileDocumentId",
                            "signingKeyFingerprint",
                            "signingPublicKey",
                            "status",
                            "updatedAt",
                            "userId"
                          ],
                          "additionalProperties": false
                        }
                      }
                    },
                    "required": [
                      "organizationId",
                      "profileDocumentId",
                      "users"
                    ],
                    "additionalProperties": false
                  },
                  "grants": {
                    "type": "object",
                    "properties": {
                      "grants": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "accessLevel": {
                              "type": "string",
                              "enum": [
                                "admin",
                                "read",
                                "write"
                              ]
                            },
                            "containerId": {
                              "type": "string"
                            },
                            "createdAt": {
                              "type": "string"
                            },
                            "depth": {
                              "maximum": 1.7976931348623157e+308,
                              "minimum": 0,
                              "type": "integer"
                            },
                            "isBuiltin": {
                              "type": "boolean"
                            },
                            "metadataAccessEpoch": {
                              "exclusiveMinimum": 0,
                              "maximum": 1.7976931348623157e+308,
                              "type": "integer"
                            },
                            "metadataAccessStateHash": {
                              "type": "string",
                              "minLength": 1
                            },
                            "metadataDocumentId": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "parentId": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "updatedAt": {
                              "type": "string"
                            },
                            "groupId": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "signingKeyFingerprint": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "subjectId": {
                              "type": "string"
                            },
                            "subjectType": {
                              "type": "string",
                              "enum": [
                                "group",
                                "user"
                              ]
                            },
                            "userId": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            }
                          },
                          "required": [
                            "accessLevel",
                            "containerId",
                            "createdAt",
                            "depth",
                            "isBuiltin",
                            "metadataAccessEpoch",
                            "metadataAccessStateHash",
                            "metadataDocumentId",
                            "parentId",
                            "updatedAt",
                            "groupId",
                            "signingKeyFingerprint",
                            "subjectId",
                            "subjectType",
                            "userId"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "organizationId": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "grants",
                      "organizationId"
                    ],
                    "additionalProperties": false
                  },
                  "groupMemberships": {
                    "type": "object",
                    "properties": {
                      "deletedGroupIds": {
                        "type": "array",
                        "items": {
                          "type": "string",
                          "minLength": 1
                        }
                      },
                      "groups": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "groupId": {
                              "type": "string"
                            },
                            "members": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "role": {
                                    "type": "string",
                                    "enum": [
                                      "member",
                                      "admin"
                                    ]
                                  },
                                  "userId": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "role",
                                  "userId"
                                ],
                                "additionalProperties": false
                              }
                            },
                            "stateHash": {
                              "type": "string",
                              "minLength": 1
                            }
                          },
                          "required": [
                            "groupId",
                            "members",
                            "stateHash"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "organizationId": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "deletedGroupIds",
                      "groups",
                      "organizationId"
                    ],
                    "additionalProperties": false
                  },
                  "groups": {
                    "type": "object",
                    "properties": {
                      "groups": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "createdAt": {
                              "type": "string"
                            },
                            "currentState": {
                              "anyOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "keyEpoch": {
                                      "maximum": 9007199254740991,
                                      "minimum": 1,
                                      "type": "integer"
                                    },
                                    "keyFingerprint": {
                                      "type": "string",
                                      "minLength": 1
                                    },
                                    "memberCount": {
                                      "maximum": 1.7976931348623157e+308,
                                      "minimum": 0,
                                      "type": "integer"
                                    },
                                    "stateHash": {
                                      "type": "string"
                                    },
                                    "version": {
                                      "maximum": 9007199254740991,
                                      "minimum": 1,
                                      "type": "integer"
                                    }
                                  },
                                  "required": [
                                    "keyEpoch",
                                    "keyFingerprint",
                                    "memberCount",
                                    "stateHash",
                                    "version"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "groupId": {
                              "type": "string"
                            },
                            "isBuiltin": {
                              "type": "boolean"
                            },
                            "organizationId": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "createdAt",
                            "currentState",
                            "groupId",
                            "isBuiltin",
                            "organizationId"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "memberGroupId": {
                        "type": "string"
                      },
                      "organizationId": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "groups",
                      "memberGroupId",
                      "organizationId"
                    ],
                    "additionalProperties": false
                  },
                  "organizationPolicy": {
                    "type": "object",
                    "properties": {
                      "currentState": {
                        "type": "object",
                        "properties": {
                          "keyEpoch": {
                            "maximum": 9007199254740991,
                            "minimum": 1,
                            "type": "integer"
                          },
                          "keyFingerprint": {
                            "type": "string",
                            "minLength": 1
                          },
                          "memberCount": {
                            "maximum": 1.7976931348623157e+308,
                            "minimum": 0,
                            "type": "integer"
                          },
                          "stateHash": {
                            "type": "string",
                            "minLength": 1
                          },
                          "version": {
                            "maximum": 9007199254740991,
                            "minimum": 1,
                            "type": "integer"
                          }
                        },
                        "required": [
                          "keyEpoch",
                          "keyFingerprint",
                          "memberCount",
                          "stateHash",
                          "version"
                        ],
                        "additionalProperties": false
                      },
                      "organizationId": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "currentState",
                      "organizationId"
                    ],
                    "additionalProperties": false
                  }
                },
                "required": [
                  "directory",
                  "grants",
                  "groupMemberships",
                  "groups",
                  "organizationPolicy"
                ],
                "additionalProperties": false
              },
              "mode": {
                "type": "string",
                "const": "snapshot"
              }
            },
            "required": [
              "currentUser",
              "hasMore",
              "nextCursor",
              "organizationId",
              "version",
              "lanes",
              "mode"
            ],
            "additionalProperties": false
          }
        ],
        "description": "A page of the organization read model: an atomic snapshot when the request had no cursor, otherwise only the lanes changed since it. Display data only, never authority."
      },
      "OrganizationReplacementAuthorization": {
        "type": "object",
        "properties": {
          "replacesOrganizationId": {
            "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
            "type": "string"
          },
          "organizationId": {
            "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
            "type": "string"
          },
          "rootContainerId": {
            "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
            "type": "string"
          },
          "userId": {
            "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
            "type": "string"
          },
          "organizationStateHash": {
            "maxLength": 64,
            "minLength": 64,
            "pattern": "^[0-9a-f]+$",
            "type": "string"
          },
          "adminGroupId": {
            "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
            "type": "string"
          },
          "adminGroupStateHash": {
            "maxLength": 64,
            "minLength": 64,
            "pattern": "^[0-9a-f]+$",
            "type": "string"
          },
          "memberGroupId": {
            "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
            "type": "string"
          },
          "memberGroupStateHash": {
            "maxLength": 64,
            "minLength": 64,
            "pattern": "^[0-9a-f]+$",
            "type": "string"
          },
          "rootManifestHash": {
            "maxLength": 64,
            "minLength": 64,
            "pattern": "^[0-9a-f]+$",
            "type": "string"
          },
          "rootMetadataDocumentId": {
            "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
            "type": "string"
          },
          "signature": {
            "type": "string",
            "minLength": 1,
            "description": "The identity's ML-DSA-87 signature over the other fields."
          }
        },
        "required": [
          "replacesOrganizationId",
          "organizationId",
          "rootContainerId",
          "userId",
          "organizationStateHash",
          "adminGroupId",
          "adminGroupStateHash",
          "memberGroupId",
          "memberGroupStateHash",
          "rootManifestHash",
          "rootMetadataDocumentId",
          "signature"
        ],
        "additionalProperties": false,
        "description": "An identity's signed statement that one fresh personal organization replaces a purged one, binding the new organization's root and reserved group heads."
      },
      "PaymentRequiredErrorResponse": {
        "type": "object",
        "properties": {
          "error": {
            "type": "string"
          },
          "organizationId": {
            "type": "string",
            "minLength": 1,
            "description": "Organization whose billing refused the write."
          },
          "reason": {
            "type": "string",
            "enum": [
              "billing_inactive",
              "sync_seat_unassigned"
            ],
            "description": "`billing_inactive` when the organization has no active plan; `sync_seat_unassigned` when the caller holds no sync seat."
          }
        },
        "required": [
          "error",
          "organizationId",
          "reason"
        ],
        "additionalProperties": {},
        "description": "The 402 a sync write gets when its organization cannot sync."
      },
      "PrincipalContainerGrantRequest": {
        "type": "object",
        "properties": {
          "accessLevel": {
            "type": "string",
            "enum": [
              "admin",
              "read",
              "write"
            ]
          },
          "containerId": {
            "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
            "type": "string"
          }
        },
        "required": [
          "accessLevel",
          "containerId"
        ],
        "additionalProperties": {},
        "description": "One container grant in a principal's grant list."
      },
      "PrincipalContainerGrantResponse": {
        "type": "object",
        "properties": {
          "accessLevel": {
            "type": "string",
            "enum": [
              "admin",
              "read",
              "write"
            ]
          },
          "containerId": {
            "type": "string"
          }
        },
        "required": [
          "accessLevel",
          "containerId"
        ],
        "additionalProperties": {},
        "description": "One container grant a principal holds."
      },
      "PrincipalHistoryPreparationFailureResponse": {
        "type": "object",
        "properties": {
          "error": {
            "type": "string"
          },
          "code": {
            "type": "string",
            "enum": [
              "billing_checkout_no_active_members",
              "billing_roster_over_capacity",
              "principal_history_preparation_unavailable"
            ]
          },
          "committed": {
            "type": "boolean"
          }
        },
        "required": [
          "error"
        ],
        "additionalProperties": {},
        "description": "A 503. Only with code `principal_history_preparation_unavailable` and `committed: false` does it prove nothing was written; any other 503 has an unknown outcome."
      },
      "PrincipalHistoryPreparationResponse": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string",
            "const": "principal_history_preparation_pending"
          },
          "committed": {
            "type": "boolean",
            "const": false
          },
          "progressToken": {
            "maxLength": 64,
            "minLength": 64,
            "pattern": "^[0-9a-f]+$",
            "type": "string",
            "description": "Changes when preparation advances; clients stop after three identical tokens in a row."
          }
        },
        "required": [
          "code",
          "committed",
          "progressToken"
        ],
        "additionalProperties": false,
        "description": "A 202: the operation rolled back while the server prepares principal history. Retry the identical request."
      },
      "PrincipalMemberEnvelopeResponse": {
        "type": "object",
        "properties": {
          "kemCipherText": {
            "type": "string",
            "description": "ML-KEM-1024 encapsulation to the member's public key."
          },
          "memberKeyFingerprint": {
            "type": "string",
            "description": "Fingerprint of the member key the envelope targets."
          },
          "userId": {
            "type": "string"
          },
          "wrappedKey": {
            "type": "string",
            "description": "The principal's key for this epoch, encrypted under the encapsulated secret."
          }
        },
        "required": [
          "kemCipherText",
          "memberKeyFingerprint",
          "userId",
          "wrappedKey"
        ],
        "additionalProperties": {},
        "description": "A member envelope: the principal's key for one key epoch, encapsulated to one member's key."
      },
      "PrincipalPolicyHistorySourceResponse": {
        "type": "object",
        "properties": {
          "head": {
            "$ref": "#/components/schemas/ReferencedPrincipalStateResponse"
          },
          "grant": {
            "maxLength": 4096,
            "minLength": 1,
            "type": "string",
            "description": "Opaque read grant bound to the caller, an object they can read, and this head; it is not verification evidence."
          }
        },
        "required": [
          "head",
          "grant"
        ],
        "additionalProperties": {},
        "description": "Where a client may read one principal's public history: a head and the opaque grant that authorizes the read."
      },
      "PrincipalPolicyMutationResponse": {
        "type": "object",
        "properties": {
          "currentGrants": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PrincipalContainerGrantResponse"
            }
          },
          "currentMemberEnvelopes": {
            "$ref": "#/components/schemas/CurrentPrincipalMemberEnvelopesResponse"
          },
          "currentPayload": {
            "$ref": "#/components/schemas/PrincipalStatePayloadResponse"
          },
          "currentProjection": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PrincipalProjectionMemberResponse"
            }
          },
          "currentState": {
            "$ref": "#/components/schemas/PrincipalStateResponse"
          },
          "containerMutations": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ContainerMutationResponse"
            }
          }
        },
        "required": [
          "currentGrants",
          "currentMemberEnvelopes",
          "currentPayload",
          "currentProjection",
          "currentState",
          "containerMutations"
        ],
        "additionalProperties": {},
        "description": "A principal's current policy after a write, with acknowledgements of the container mutations committed with it."
      },
      "PrincipalPolicyPageResponse": {
        "type": "object",
        "properties": {
          "currentGrants": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PrincipalContainerGrantResponse"
            }
          },
          "currentMemberEnvelopes": {
            "$ref": "#/components/schemas/CurrentPrincipalMemberEnvelopesResponse"
          },
          "currentPayload": {
            "$ref": "#/components/schemas/PrincipalStatePayloadResponse"
          },
          "currentProjection": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PrincipalProjectionMemberResponse"
            }
          },
          "currentState": {
            "$ref": "#/components/schemas/PrincipalStateResponse"
          },
          "previousStates": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PrincipalPolicyStateChainEntryResponse"
            },
            "maxItems": 32
          },
          "historyPage": {
            "type": "object",
            "properties": {
              "afterVersion": {
                "maximum": 9007199254740991,
                "minimum": 0,
                "type": "integer"
              },
              "nextAfterVersion": {
                "anyOf": [
                  {
                    "maximum": 9007199254740991,
                    "minimum": 0,
                    "type": "integer"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "afterVersion",
              "nextAfterVersion"
            ],
            "additionalProperties": {},
            "description": "Which predecessor versions this page covers and where the next page starts."
          }
        },
        "required": [
          "currentGrants",
          "currentMemberEnvelopes",
          "currentPayload",
          "currentProjection",
          "currentState",
          "previousStates",
          "historyPage"
        ],
        "additionalProperties": {},
        "description": "A page of one principal policy chain: the current state with its payload, membership, grants, and member envelopes, plus predecessor states."
      },
      "PrincipalPolicyReadResponse": {
        "anyOf": [
          {
            "$ref": "#/components/schemas/PrincipalPolicyPageResponse"
          },
          {
            "$ref": "#/components/schemas/PrincipalPolicyUnchangedResponse"
          }
        ],
        "description": "A principal policy page, or the short unchanged reply to a conditional read."
      },
      "PrincipalPolicyRef": {
        "type": "object",
        "properties": {
          "principalType": {
            "type": "string",
            "enum": [
              "group",
              "organization"
            ]
          },
          "principalId": {
            "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
            "type": "string"
          },
          "version": {
            "maximum": 9007199254740991,
            "minimum": 1,
            "type": "integer"
          },
          "stateHash": {
            "type": "string",
            "minLength": 1,
            "description": "Hash of the signed state, which commits to its membership projection and grants."
          }
        },
        "required": [
          "principalType",
          "principalId",
          "version",
          "stateHash"
        ],
        "additionalProperties": {},
        "description": "Cites the principal policy head a mutation was planned against, instead of resending the signed policy; the API refuses it as stale unless it is the current head."
      },
      "PrincipalPolicyRefList": {
        "type": "array",
        "items": {
          "$ref": "#/components/schemas/PrincipalPolicyRef"
        },
        "maxItems": 4096,
        "description": "The principal policy heads a container mutation was planned against."
      },
      "PrincipalPolicySnapshotPageResponse": {
        "type": "object",
        "properties": {
          "currentGrants": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PrincipalContainerGrantResponse"
            }
          },
          "currentProjection": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PrincipalProjectionMemberResponse"
            }
          },
          "currentState": {
            "$ref": "#/components/schemas/PrincipalStateResponse"
          },
          "previousStates": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PrincipalPolicyStateChainEntryResponse"
            },
            "maxItems": 32
          },
          "historyPage": {
            "type": "object",
            "properties": {
              "afterVersion": {
                "maximum": 9007199254740991,
                "minimum": 0,
                "type": "integer"
              },
              "nextAfterVersion": {
                "anyOf": [
                  {
                    "maximum": 9007199254740991,
                    "minimum": 0,
                    "type": "integer"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "afterVersion",
              "nextAfterVersion"
            ],
            "additionalProperties": {},
            "description": "Which predecessor versions this page covers and where the next page starts."
          }
        },
        "required": [
          "currentGrants",
          "currentProjection",
          "currentState",
          "previousStates",
          "historyPage"
        ],
        "additionalProperties": {},
        "description": "A page of public signed policy history, without encrypted payloads or member envelopes."
      },
      "PrincipalPolicyStaleErrorResponse": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string",
            "const": "principal_policy_stale"
          },
          "error": {
            "type": "string",
            "minLength": 1
          },
          "principalHeads": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ReferencedPrincipalStateResponse"
            },
            "maxItems": 16,
            "description": "Current heads of the cited principals that the caller may read."
          }
        },
        "required": [
          "code",
          "error",
          "principalHeads"
        ],
        "additionalProperties": {},
        "description": "A 409 because a cited principal policy is no longer current."
      },
      "PrincipalPolicyStateChainEntryResponse": {
        "type": "object",
        "properties": {
          "grants": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PrincipalContainerGrantResponse"
            }
          },
          "projection": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PrincipalProjectionMemberResponse"
            }
          },
          "state": {
            "$ref": "#/components/schemas/PrincipalStateResponse"
          }
        },
        "required": [
          "grants",
          "projection",
          "state"
        ],
        "additionalProperties": {},
        "description": "A predecessor state with its membership and grants, so clients can verify the chain step by step."
      },
      "PrincipalPolicyUnchangedResponse": {
        "type": "object",
        "properties": {
          "unchanged": {
            "type": "boolean",
            "const": true
          },
          "head": {
            "$ref": "#/components/schemas/ReferencedPrincipalStateResponse"
          }
        },
        "required": [
          "unchanged",
          "head"
        ],
        "additionalProperties": false,
        "description": "The answer to a conditional read whose named head is still current. It is not evidence; the client verifies the head it already holds."
      },
      "PrincipalProjectionMemberResponse": {
        "type": "object",
        "properties": {
          "role": {
            "type": "string",
            "enum": [
              "member",
              "admin"
            ]
          },
          "userId": {
            "type": "string"
          }
        },
        "required": [
          "role",
          "userId"
        ],
        "additionalProperties": {},
        "description": "One member of a principal and their role."
      },
      "PrincipalStateExternalAuthorityResponse": {
        "type": "object",
        "properties": {
          "keyEpoch": {
            "maximum": 9007199254740991,
            "minimum": 1,
            "type": "integer"
          },
          "keyFingerprint": {
            "type": "string"
          },
          "principalId": {
            "type": "string"
          },
          "principalType": {
            "type": "string",
            "const": "group"
          },
          "stateHash": {
            "type": "string"
          },
          "version": {
            "maximum": 9007199254740991,
            "minimum": 1,
            "type": "integer"
          }
        },
        "required": [
          "keyEpoch",
          "keyFingerprint",
          "principalId",
          "principalType",
          "stateHash",
          "version"
        ],
        "additionalProperties": {},
        "description": "Cites the exact `Admins` group head that authorized a state of an organization-administered group."
      },
      "PrincipalStatePayloadResponse": {
        "type": "object",
        "properties": {
          "cipherSuite": {
            "type": "string",
            "const": "aes-256-gcm"
          },
          "ciphertext": {
            "type": "string"
          },
          "ciphertextHash": {
            "type": "string",
            "description": "Hash of `ciphertext`; the signed state commits to it."
          },
          "createdAt": {
            "type": "string"
          },
          "principalId": {
            "type": "string"
          },
          "principalType": {
            "type": "string",
            "enum": [
              "group",
              "organization"
            ]
          },
          "stateHash": {
            "type": "string"
          }
        },
        "required": [
          "cipherSuite",
          "ciphertext",
          "ciphertextHash",
          "createdAt",
          "principalId",
          "principalType",
          "stateHash"
        ],
        "additionalProperties": {},
        "description": "A principal state's encrypted payload, which only members can read; the signed state commits to its hash."
      },
      "PrincipalStateResponse": {
        "type": "object",
        "properties": {
          "createdAt": {
            "type": "string"
          },
          "encapsulationPublicKey": {
            "type": "string",
            "description": "The principal's public key at this key epoch; key material for the principal is wrapped to it."
          },
          "externalAuthority": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/PrincipalStateExternalAuthorityResponse"
              },
              {
                "type": "null"
              }
            ],
            "description": "For a group administered by the organization, the exact `Admins` head that authorized this state; null when the state's own policy authorized it."
          },
          "grantCount": {
            "maximum": 1.7976931348623157e+308,
            "minimum": 0,
            "type": "integer",
            "description": "Number of container grants the principal holds."
          },
          "grantRoot": {
            "type": "string",
            "description": "Digest of the sorted container grants; with `grantCount` it authenticates the complete grant list."
          },
          "keyEpoch": {
            "maximum": 9007199254740991,
            "minimum": 1,
            "type": "integer",
            "description": "The principal's key epoch; envelopes and wraps name the epoch they were made for."
          },
          "keyFingerprint": {
            "type": "string",
            "description": "Fingerprint of `encapsulationPublicKey`."
          },
          "memberCount": {
            "maximum": 1.7976931348623157e+308,
            "minimum": 0,
            "type": "integer"
          },
          "memberEnvelopesRoot": {
            "type": "string",
            "description": "Digest committing to every member envelope of this key epoch."
          },
          "membershipMode": {
            "type": "string",
            "const": "projection",
            "description": "Always `projection`: membership is the signed projection list."
          },
          "membershipRoot": {
            "type": "string"
          },
          "payloadCiphertextHash": {
            "type": "string",
            "description": "Hash of the state's encrypted payload."
          },
          "prevStateHash": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Hash of the previous state, or null for the first."
          },
          "principalId": {
            "type": "string"
          },
          "principalType": {
            "type": "string",
            "enum": [
              "group",
              "organization"
            ]
          },
          "projectionRoot": {
            "type": "string"
          },
          "signature": {
            "type": "string",
            "description": "ML-DSA-87 signature over the canonical state."
          },
          "signedAt": {
            "type": "string"
          },
          "signerUserId": {
            "type": "string"
          },
          "signerUserKeyFingerprint": {
            "type": "string",
            "description": "Signing key fingerprint of the signer."
          },
          "stateHash": {
            "type": "string",
            "description": "Hash of this signed state; other objects cite the head by it."
          },
          "version": {
            "maximum": 9007199254740991,
            "minimum": 1,
            "type": "integer",
            "description": "Position in the chain, starting at 1."
          }
        },
        "required": [
          "createdAt",
          "encapsulationPublicKey",
          "externalAuthority",
          "grantCount",
          "grantRoot",
          "keyEpoch",
          "keyFingerprint",
          "memberCount",
          "memberEnvelopesRoot",
          "membershipMode",
          "membershipRoot",
          "payloadCiphertextHash",
          "prevStateHash",
          "principalId",
          "principalType",
          "projectionRoot",
          "signature",
          "signedAt",
          "signerUserId",
          "signerUserKeyFingerprint",
          "stateHash",
          "version"
        ],
        "additionalProperties": {},
        "description": "One signed state in a principal policy chain: it commits to the principal's membership, grants, key epoch, encrypted payload, signer, and predecessor."
      },
      "ProjectionPolicyEvidenceResponse": {
        "type": "object",
        "properties": {
          "organization": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/PrincipalPolicyHistorySourceResponse"
              },
              {
                "type": "null"
              }
            ]
          },
          "organizationPayloads": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "reference": {
                  "$ref": "#/components/schemas/ReferencedPrincipalStateResponse"
                },
                "payload": {
                  "$ref": "#/components/schemas/PrincipalStatePayloadResponse"
                }
              },
              "required": [
                "reference",
                "payload"
              ],
              "additionalProperties": {}
            }
          },
          "groups": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PrincipalPolicyHistorySourceResponse"
            }
          }
        },
        "required": [
          "organization",
          "organizationPayloads",
          "groups"
        ],
        "additionalProperties": {},
        "description": "Public principal policy history that a projection's manifests depend on, as read sources plus the signed directory payloads they need."
      },
      "ProvisionedDocumentRequest": {
        "type": "object",
        "properties": {
          "authorizingContainerPathRefs": {
            "$ref": "#/components/schemas/ContainerManifestRefArrayArray"
          },
          "body": {},
          "containerRekeys": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ContainerMutationRequest"
            },
            "maxItems": 16
          },
          "contentKeyBundle": {
            "$ref": "#/components/schemas/DocumentContentKeyBundleRequest"
          },
          "event": {
            "type": "object",
            "properties": {},
            "additionalProperties": {}
          },
          "expectedManifestHash": {
            "type": "string",
            "minLength": 1
          },
          "manifest": {
            "type": "object",
            "properties": {},
            "additionalProperties": {}
          },
          "targetContainerPathRefs": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ContainerManifestRef"
            },
            "maxItems": 100,
            "minItems": 1
          },
          "initialSync": {
            "$ref": "#/components/schemas/DocumentSyncRequest",
            "description": "The document's first update, committed with the provisioning."
          }
        },
        "required": [
          "body",
          "contentKeyBundle",
          "event",
          "expectedManifestHash",
          "manifest",
          "initialSync"
        ],
        "additionalProperties": {},
        "description": "A document created during provisioning, with its first update."
      },
      "ProvisionedSystemContainerRequest": {
        "type": "object",
        "properties": {
          "container": {
            "$ref": "#/components/schemas/ContainerMutationRequest"
          },
          "metadataDocument": {
            "type": "object",
            "properties": {
              "authorizingContainerPathRefs": {
                "$ref": "#/components/schemas/ContainerManifestRefArrayArray"
              },
              "body": {},
              "containerRekeys": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/ContainerMutationRequest"
                },
                "maxItems": 16
              },
              "contentKeyBundle": {
                "$ref": "#/components/schemas/DocumentContentKeyBundleRequest"
              },
              "event": {
                "type": "object",
                "properties": {},
                "additionalProperties": {}
              },
              "expectedManifestHash": {
                "type": "string",
                "minLength": 1
              },
              "manifest": {
                "type": "object",
                "properties": {},
                "additionalProperties": {}
              },
              "targetContainerPathRefs": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/ContainerManifestRef"
                },
                "maxItems": 100,
                "minItems": 1
              }
            },
            "required": [
              "body",
              "contentKeyBundle",
              "event",
              "expectedManifestHash",
              "manifest"
            ],
            "additionalProperties": {}
          },
          "systemSlot": {
            "anyOf": [
              {
                "pattern": "^sys_v1_[A-Za-z0-9_-]{43}$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Opaque id of the container's system role."
          },
          "initialMetadataSync": {
            "$ref": "#/components/schemas/DocumentSyncRequest",
            "description": "The metadata document's first update, committed with the provisioning."
          }
        },
        "required": [
          "container",
          "metadataDocument",
          "initialMetadataSync"
        ],
        "additionalProperties": {},
        "description": "A system container created during provisioning, with its metadata document."
      },
      "PutPrincipalPolicyRequest": {
        "type": "object",
        "properties": {
          "containerMutations": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ContainerMutationRequest"
            },
            "description": "Container mutations that move the principal's grants to the new key epoch, committed atomically with it."
          },
          "encryptedPayload": {
            "type": "object",
            "properties": {
              "cipherSuite": {
                "type": "string",
                "const": "aes-256-gcm"
              },
              "ciphertext": {
                "type": "string"
              },
              "ciphertextHash": {
                "type": "string"
              }
            },
            "required": [
              "cipherSuite",
              "ciphertext",
              "ciphertextHash"
            ],
            "additionalProperties": {},
            "description": "Encrypted payload, such as the group's name."
          },
          "grants": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PrincipalContainerGrantRequest"
            },
            "description": "The principal's complete container grant list after this state."
          },
          "memberEnvelopes": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "kemCipherText": {
                  "type": "string"
                },
                "memberKeyFingerprint": {
                  "type": "string"
                },
                "userId": {
                  "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
                  "type": "string"
                },
                "wrappedKey": {
                  "type": "string"
                }
              },
              "required": [
                "kemCipherText",
                "memberKeyFingerprint",
                "userId",
                "wrappedKey"
              ],
              "additionalProperties": {}
            },
            "description": "The new key epoch's key, encapsulated to each member."
          },
          "projection": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "role": {
                  "type": "string",
                  "enum": [
                    "member",
                    "admin"
                  ]
                },
                "userId": {
                  "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
                  "type": "string"
                }
              },
              "required": [
                "role",
                "userId"
              ],
              "additionalProperties": {}
            },
            "description": "The complete membership with roles after this state."
          },
          "state": {
            "type": "object",
            "properties": {
              "encapsulationPublicKey": {
                "type": "string"
              },
              "externalAuthority": {
                "anyOf": [
                  {
                    "type": "object",
                    "properties": {
                      "keyEpoch": {
                        "maximum": 9007199254740991,
                        "minimum": 1,
                        "type": "integer"
                      },
                      "keyFingerprint": {
                        "type": "string"
                      },
                      "principalId": {
                        "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
                        "type": "string"
                      },
                      "principalType": {
                        "type": "string",
                        "const": "group"
                      },
                      "stateHash": {
                        "type": "string"
                      },
                      "version": {
                        "maximum": 9007199254740991,
                        "minimum": 1,
                        "type": "integer"
                      }
                    },
                    "required": [
                      "keyEpoch",
                      "keyFingerprint",
                      "principalId",
                      "principalType",
                      "stateHash",
                      "version"
                    ],
                    "additionalProperties": {}
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "grantCount": {
                "maximum": 1.7976931348623157e+308,
                "minimum": 0,
                "type": "integer"
              },
              "grantRoot": {
                "type": "string"
              },
              "keyEpoch": {
                "maximum": 9007199254740991,
                "minimum": 1,
                "type": "integer"
              },
              "keyFingerprint": {
                "type": "string"
              },
              "memberCount": {
                "maximum": 1.7976931348623157e+308,
                "minimum": 0,
                "type": "integer"
              },
              "memberEnvelopesRoot": {
                "type": "string"
              },
              "membershipMode": {
                "type": "string",
                "const": "projection"
              },
              "membershipRoot": {
                "type": "string"
              },
              "payloadCiphertextHash": {
                "type": "string"
              },
              "prevStateHash": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "principalId": {
                "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
                "type": "string"
              },
              "principalType": {
                "type": "string",
                "enum": [
                  "group",
                  "organization"
                ]
              },
              "projectionRoot": {
                "type": "string"
              },
              "signature": {
                "type": "string"
              },
              "signedAt": {
                "pattern": "^(?:19[7-9]\\d|[2-9]\\d{3})-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{3}Z$",
                "type": "string"
              },
              "signerUserId": {
                "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
                "type": "string"
              },
              "signerUserKeyFingerprint": {
                "type": "string"
              },
              "version": {
                "maximum": 9007199254740991,
                "minimum": 1,
                "type": "integer"
              }
            },
            "required": [
              "encapsulationPublicKey",
              "externalAuthority",
              "grantCount",
              "grantRoot",
              "keyEpoch",
              "keyFingerprint",
              "memberCount",
              "memberEnvelopesRoot",
              "membershipMode",
              "membershipRoot",
              "payloadCiphertextHash",
              "prevStateHash",
              "principalId",
              "principalType",
              "projectionRoot",
              "signature",
              "signedAt",
              "signerUserId",
              "signerUserKeyFingerprint",
              "version"
            ],
            "additionalProperties": {},
            "description": "The signed state."
          }
        },
        "required": [
          "encryptedPayload",
          "grants",
          "memberEnvelopes",
          "projection",
          "state"
        ],
        "additionalProperties": {},
        "description": "The next signed state of a principal policy with everything it commits to."
      },
      "ReferencedPrincipalStateResponse": {
        "type": "object",
        "properties": {
          "keyEpoch": {
            "maximum": 9007199254740991,
            "minimum": 1,
            "type": "integer"
          },
          "keyFingerprint": {
            "type": "string"
          },
          "principalId": {
            "type": "string"
          },
          "principalType": {
            "type": "string",
            "enum": [
              "group",
              "organization"
            ]
          },
          "stateHash": {
            "type": "string"
          },
          "version": {
            "maximum": 9007199254740991,
            "minimum": 1,
            "type": "integer"
          }
        },
        "required": [
          "keyEpoch",
          "keyFingerprint",
          "principalId",
          "principalType",
          "stateHash",
          "version"
        ],
        "additionalProperties": {},
        "description": "Identifies one principal policy head by version, state hash, and key epoch."
      },
      "RegistrationRequest": {
        "type": "object",
        "properties": {
          "initialAdminGroup": {
            "$ref": "#/components/schemas/CreateOrganizationGroupRequest"
          },
          "initialMemberGroup": {
            "$ref": "#/components/schemas/CreateOrganizationGroupRequest"
          },
          "initialOrganizationMetadataContainer": {
            "$ref": "#/components/schemas/ProvisionedSystemContainerRequest"
          },
          "initialOrganizationPolicy": {
            "$ref": "#/components/schemas/OrganizationPrincipalPolicyRequest"
          },
          "initialOrganizationProfileDocument": {
            "$ref": "#/components/schemas/ProvisionedDocumentRequest"
          },
          "initialRootContainer": {
            "$ref": "#/components/schemas/ContainerMutationRequest"
          },
          "initialRootMetadataDocument": {
            "$ref": "#/components/schemas/ProvisionedDocumentRequest"
          },
          "initialRosterProfileContainer": {
            "$ref": "#/components/schemas/ProvisionedSystemContainerRequest"
          },
          "initialRosterProfileDocument": {
            "$ref": "#/components/schemas/ProvisionedDocumentRequest"
          },
          "initialSystemContainers": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ProvisionedSystemContainerRequest"
            },
            "description": "The organization's other system containers, such as Trash, each with its metadata document."
          },
          "organizationId": {
            "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
            "type": "string"
          },
          "rootContainerId": {
            "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
            "type": "string"
          },
          "userId": {
            "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
            "type": "string"
          },
          "encapsulationPublicKey": {
            "maxLength": 2092,
            "minLength": 2092,
            "pattern": "^(?:[A-Za-z0-9+/]{4}){522}[A-Za-z0-9+/]{2}[AEIMQUYcgkosw048]=$",
            "type": "string",
            "description": "Base64 ML-KEM-1024 public key that key material is wrapped to."
          },
          "signingPublicKey": {
            "maxLength": 3456,
            "minLength": 3456,
            "pattern": "^(?:[A-Za-z0-9+/]{4}){864}$",
            "type": "string",
            "description": "Base64 ML-DSA-87 public key that signs the identity's events and sign-in challenges."
          }
        },
        "required": [
          "initialAdminGroup",
          "initialMemberGroup",
          "initialOrganizationMetadataContainer",
          "initialOrganizationPolicy",
          "initialRootContainer",
          "initialRootMetadataDocument",
          "organizationId",
          "rootContainerId",
          "userId",
          "encapsulationPublicKey",
          "signingPublicKey"
        ],
        "additionalProperties": {},
        "description": "A new identity's public keys plus every signed artifact that bootstraps its personal organization, all created atomically."
      },
      "RegistrationResponse": {
        "type": "object",
        "properties": {
          "committedCoreMetadataUpdateIds": {
            "type": "array",
            "items": {
              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
              "type": "string"
            },
            "description": "Ids of the seeded metadata updates the server committed with the provisioning."
          },
          "committedProfileUpdateIds": {
            "type": "array",
            "items": {
              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
              "type": "string"
            },
            "description": "Ids of the seeded profile updates the server committed with the provisioning."
          },
          "organizationId": {
            "type": "string"
          },
          "organizationMetadataContainer": {
            "$ref": "#/components/schemas/ContainerCreateWithMetadataDocumentResponse"
          },
          "organizationMetadataContainerId": {
            "type": "string"
          },
          "organizationProfileDocument": {
            "$ref": "#/components/schemas/DocumentCreateResponse"
          },
          "organizationProfileDocumentId": {
            "type": "string"
          },
          "rootContainerId": {
            "type": "string"
          },
          "rootMetadataAccessEpoch": {
            "type": "number",
            "minimum": -1.7976931348623157e+308,
            "maximum": 1.7976931348623157e+308,
            "description": "Access epoch of the root container's metadata document."
          },
          "rootMetadataAccessStateHash": {
            "type": "string",
            "minLength": 1,
            "description": "Access state hash of the root container's metadata document."
          },
          "rootMetadataDocument": {
            "$ref": "#/components/schemas/DocumentCreateResponse"
          },
          "rootMetadataDocumentId": {
            "type": "string"
          },
          "rosterProfileContainer": {
            "$ref": "#/components/schemas/ContainerCreateWithMetadataDocumentResponse"
          },
          "rosterProfileContainerId": {
            "type": "string"
          },
          "rosterProfileDocument": {
            "$ref": "#/components/schemas/DocumentCreateResponse"
          },
          "rosterProfileDocumentId": {
            "type": "string"
          },
          "systemContainers": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ContainerCreateWithMetadataDocumentResponse"
            }
          },
          "userId": {
            "type": "string"
          },
          "challenge": {
            "maxLength": 64,
            "minLength": 64,
            "pattern": "^[0-9a-f]+$",
            "type": "string",
            "description": "Sign-in challenge to sign and send to `POST /auth/verify`, so the new identity can sign in without another request."
          }
        },
        "required": [
          "committedCoreMetadataUpdateIds",
          "committedProfileUpdateIds",
          "organizationId",
          "organizationMetadataContainer",
          "organizationMetadataContainerId",
          "rootContainerId",
          "rootMetadataAccessEpoch",
          "rootMetadataAccessStateHash",
          "rootMetadataDocument",
          "rootMetadataDocumentId",
          "systemContainers",
          "userId",
          "challenge"
        ],
        "additionalProperties": {},
        "description": "Acknowledges a registration by the ids and hashes of what it created, plus a sign-in challenge."
      },
      "RevenueCatIncomingWebhookEvent": {
        "anyOf": [
          {
            "$ref": "#/components/schemas/RevenueCatTransferWebhookEvent"
          },
          {
            "$ref": "#/components/schemas/RevenueCatWebhookEvent"
          }
        ],
        "description": "A RevenueCat event: either a subscription lifecycle event or a receipt transfer."
      },
      "RevenueCatSubscriberAttribute": {
        "type": "object",
        "properties": {
          "value": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "value"
        ],
        "additionalProperties": {},
        "description": "One RevenueCat subscriber attribute; a cleared value is null."
      },
      "RevenueCatTransferWebhookEvent": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "type": {
            "type": "string",
            "const": "TRANSFER"
          },
          "event_timestamp_ms": {
            "maximum": 8640000000000000,
            "minimum": 0,
            "type": "integer"
          },
          "transferred_from": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "App User IDs that held the purchase before."
          },
          "transferred_to": {
            "minItems": 1,
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "App User IDs that hold the purchase now."
          },
          "store": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "environment": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "type",
          "event_timestamp_ms",
          "transferred_from",
          "transferred_to"
        ],
        "additionalProperties": {},
        "description": "A RevenueCat receipt transfer, which moves a store purchase between App User IDs."
      },
      "RevenueCatWebhookEvent": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "RevenueCat event id; a repeated delivery of the same id is a duplicate."
          },
          "type": {
            "not": {
              "const": "TRANSFER"
            },
            "type": "string"
          },
          "app_user_id": {
            "type": "string",
            "description": "RevenueCat App User ID, which is the Tearleads user id that made the purchase."
          },
          "event_timestamp_ms": {
            "maximum": 8640000000000000,
            "minimum": 0,
            "type": "integer"
          },
          "purchased_at_ms": {
            "anyOf": [
              {
                "maximum": 8640000000000000,
                "minimum": 0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ]
          },
          "expiration_at_ms": {
            "anyOf": [
              {
                "maximum": 8640000000000000,
                "minimum": 0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ]
          },
          "product_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "new_product_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "transaction_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "original_transaction_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "entitlement_ids": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "store": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "environment": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "currency": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "price_in_purchased_currency": {
            "anyOf": [
              {
                "type": "number",
                "minimum": -1.7976931348623157e+308,
                "maximum": 1.7976931348623157e+308
              },
              {
                "type": "null"
              }
            ]
          },
          "period_type": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "subscriber_attributes": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {
              "$ref": "#/components/schemas/RevenueCatSubscriberAttribute"
            },
            "description": "RevenueCat subscriber attributes; the server does not trust them to choose an organization."
          },
          "metadata": {
            "anyOf": [
              {
                "type": "object",
                "propertyNames": {
                  "type": "string"
                },
                "additionalProperties": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "number",
                      "minimum": -1.7976931348623157e+308,
                      "maximum": 1.7976931348623157e+308
                    },
                    {
                      "type": "boolean"
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "type",
          "app_user_id",
          "event_timestamp_ms"
        ],
        "additionalProperties": {},
        "description": "A RevenueCat subscription lifecycle event, as far as organization billing reads it."
      },
      "RevenueCatWebhookRequest": {
        "type": "object",
        "properties": {
          "api_version": {
            "type": "string"
          },
          "event": {
            "$ref": "#/components/schemas/RevenueCatIncomingWebhookEvent"
          }
        },
        "required": [
          "event"
        ],
        "additionalProperties": {},
        "description": "The envelope RevenueCat posts to the billing webhook."
      },
      "RevenueCatWebhookResponse": {
        "type": "object",
        "properties": {
          "received": {
            "type": "boolean",
            "const": true
          },
          "outcome": {
            "type": "string",
            "enum": [
              "applied",
              "duplicate",
              "ignored"
            ],
            "description": "`applied` when billing changed, `duplicate` for an event id already handled, `ignored` when it needed no change."
          }
        },
        "required": [
          "received",
          "outcome"
        ],
        "additionalProperties": {},
        "description": "Acknowledges a RevenueCat delivery."
      },
      "RootAuditEventResponse": {
        "type": "object",
        "properties": {
          "action": {
            "type": "string",
            "minLength": 1,
            "x-extensible-enum": [
              "root.access.grant",
              "root.access.revoke",
              "root.auditEvents.list",
              "root.identities.get",
              "root.identities.list",
              "root.identities.organizations.list",
              "root.identities.suspension.delete",
              "root.identities.suspension.put",
              "root.organizations.dataUsage.get",
              "root.organizations.get",
              "root.organizations.identities.list",
              "root.organizations.list",
              "root.organizations.revenuecatEvents.list",
              "root.reports.dataUsage.list",
              "root.reports.opsHealth.get",
              "root.reports.revenuecatEvents.list"
            ],
            "description": "Operation id of the request, or the CLI action that changed an operator flag."
          },
          "actorSigningKeyFingerprint": {
            "anyOf": [
              {
                "maxLength": 64,
                "minLength": 64,
                "pattern": "^[0-9a-f]+$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Signing key of the acting operator; null when the API CLI acted."
          },
          "actorUserId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1
              },
              {
                "type": "null"
              }
            ],
            "description": "The acting operator; null when the API CLI acted."
          },
          "filter": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Listing filters as a sorted query string; null when none applied."
          },
          "id": {
            "type": "string",
            "minLength": 1
          },
          "occurredAt": {
            "type": "string"
          },
          "sourceIpAddress": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "targetOrganizationId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1
              },
              {
                "type": "null"
              }
            ],
            "description": "Organization the action looked up or changed, when it named one."
          },
          "targetUserId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1
              },
              {
                "type": "null"
              }
            ],
            "description": "Identity the action looked up or changed, when it named one."
          }
        },
        "required": [
          "action",
          "actorSigningKeyFingerprint",
          "actorUserId",
          "filter",
          "id",
          "occurredAt",
          "sourceIpAddress",
          "targetOrganizationId",
          "targetUserId"
        ],
        "additionalProperties": {},
        "description": "One recorded operator action."
      },
      "RootAuditEventsResponse": {
        "type": "object",
        "properties": {
          "events": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RootAuditEventResponse"
            }
          },
          "nextCursor": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Opaque cursor for the next page, or null at the end."
          }
        },
        "required": [
          "events",
          "nextCursor"
        ],
        "additionalProperties": {},
        "description": "A page of recorded operator actions, newest first."
      },
      "RootDataUsageReportResponse": {
        "type": "object",
        "properties": {
          "organizations": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "organization": {
                  "$ref": "#/components/schemas/RootOrganizationSummaryResponse"
                },
                "dataUsage": {
                  "$ref": "#/components/schemas/OrganizationDataUsageResponse"
                }
              },
              "required": [
                "organization",
                "dataUsage"
              ],
              "additionalProperties": {}
            }
          },
          "nextCursor": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Opaque cursor for the next page, or null at the end."
          }
        },
        "required": [
          "organizations",
          "nextCursor"
        ],
        "additionalProperties": {},
        "description": "A page of stored data usage by organization."
      },
      "RootIdentitiesResponse": {
        "type": "object",
        "properties": {
          "identities": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RootIdentitySummaryResponse"
            }
          },
          "nextCursor": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Opaque cursor for the next page, or null at the end."
          }
        },
        "required": [
          "identities",
          "nextCursor"
        ],
        "additionalProperties": {},
        "description": "A page of registered identities, newest first."
      },
      "RootIdentityDetailResponse": {
        "type": "object",
        "properties": {
          "identity": {
            "$ref": "#/components/schemas/RootIdentitySummaryResponse"
          },
          "sessions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RootIdentitySessionResponse"
            }
          }
        },
        "required": [
          "identity",
          "sessions"
        ],
        "additionalProperties": {},
        "description": "One identity with its live sessions."
      },
      "RootIdentityOrganizationBillingResponse": {
        "type": "object",
        "properties": {
          "currentPeriodEndsAt": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "disabledAt": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "provider": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "purgeAfter": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "purgedAt": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "seatCount": {
            "maximum": 1.7976931348623157e+308,
            "minimum": 0,
            "type": "integer"
          },
          "status": {
            "type": "string",
            "enum": [
              "local",
              "trialing",
              "active",
              "disabled",
              "deleting",
              "purged"
            ]
          },
          "trialEndsAt": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "currentPeriodEndsAt",
          "disabledAt",
          "provider",
          "purgeAfter",
          "purgedAt",
          "seatCount",
          "status",
          "trialEndsAt"
        ],
        "additionalProperties": {},
        "description": "The billing standing of one organization in an identity's list."
      },
      "RootIdentityOrganizationResponse": {
        "type": "object",
        "properties": {
          "billing": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/RootIdentityOrganizationBillingResponse"
              },
              {
                "type": "null"
              }
            ],
            "description": "The organization's billing standing; null only when it has no billing row."
          },
          "createdAt": {
            "type": "string"
          },
          "isDefaultOrganization": {
            "type": "boolean",
            "description": "True for the identity's personal organization."
          },
          "organizationId": {
            "type": "string",
            "minLength": 1
          },
          "roster": {
            "type": "object",
            "properties": {
              "disabledAt": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "holdsSeat": {
                "type": "boolean"
              },
              "joinedAt": {
                "type": "string"
              },
              "status": {
                "type": "string",
                "enum": [
                  "active",
                  "disabled"
                ]
              },
              "syncPausedAt": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "disabledAt",
              "holdsSeat",
              "joinedAt",
              "status",
              "syncPausedAt"
            ],
            "additionalProperties": {}
          }
        },
        "required": [
          "billing",
          "createdAt",
          "isDefaultOrganization",
          "organizationId",
          "roster"
        ],
        "additionalProperties": {},
        "description": "One organization of an inspected identity, with the identity's roster entry there."
      },
      "RootIdentityOrganizationsResponse": {
        "type": "object",
        "properties": {
          "organizations": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RootIdentityOrganizationResponse"
            }
          }
        },
        "required": [
          "organizations"
        ],
        "additionalProperties": {},
        "description": "The organizations an identity belongs to."
      },
      "RootIdentitySessionResponse": {
        "type": "object",
        "properties": {
          "createdAt": {
            "type": "string"
          },
          "id": {
            "maxLength": 64,
            "minLength": 64,
            "pattern": "^[0-9a-f]+$",
            "type": "string"
          },
          "ipAddresses": {
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1
            }
          },
          "lastActiveAt": {
            "type": "string"
          },
          "lastActiveIp": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1
              },
              {
                "type": "null"
              }
            ]
          },
          "signingKeyFingerprint": {
            "type": "string"
          }
        },
        "required": [
          "createdAt",
          "id",
          "ipAddresses",
          "lastActiveAt",
          "lastActiveIp",
          "signingKeyFingerprint"
        ],
        "additionalProperties": {},
        "description": "A live session of the inspected identity."
      },
      "RootIdentitySummaryResponse": {
        "type": "object",
        "properties": {
          "createdAt": {
            "type": "string"
          },
          "defaultOrganizationId": {
            "type": "string",
            "minLength": 1,
            "description": "The identity's personal organization."
          },
          "isRoot": {
            "type": "boolean",
            "description": "True for a platform operator."
          },
          "lastActiveAt": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "registrationSourceIpAddress": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "IP address the identity registered from, when recorded."
          },
          "signingKeyFingerprint": {
            "maxLength": 64,
            "minLength": 64,
            "pattern": "^[0-9a-f]+$",
            "type": "string"
          },
          "suspendedAt": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "When an operator suspended the identity, or null."
          },
          "userId": {
            "type": "string",
            "minLength": 1
          }
        },
        "required": [
          "createdAt",
          "defaultOrganizationId",
          "isRoot",
          "lastActiveAt",
          "registrationSourceIpAddress",
          "signingKeyFingerprint",
          "suspendedAt",
          "userId"
        ],
        "additionalProperties": {},
        "description": "An operator's view of one registered identity."
      },
      "RootIdentitySuspensionResponse": {
        "type": "object",
        "properties": {
          "identity": {
            "$ref": "#/components/schemas/RootIdentitySummaryResponse"
          }
        },
        "required": [
          "identity"
        ],
        "additionalProperties": {},
        "description": "The identity after a suspension was placed or lifted."
      },
      "RootOpsHealthReportResponse": {
        "type": "object",
        "properties": {
          "generatedAt": {
            "type": "string"
          },
          "seatSync": {
            "type": "object",
            "properties": {
              "rows": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "organizationId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "conditions": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "enum": [
                          "failing",
                          "stalled",
                          "leaseExpired"
                        ]
                      },
                      "maxItems": 3
                    },
                    "attemptCount": {
                      "maximum": 1.7976931348623157e+308,
                      "minimum": 0,
                      "type": "integer"
                    },
                    "appliedRevision": {
                      "maximum": 1.7976931348623157e+308,
                      "minimum": 0,
                      "type": "integer"
                    },
                    "desiredRevision": {
                      "maximum": 1.7976931348623157e+308,
                      "minimum": 0,
                      "type": "integer"
                    },
                    "lastError": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "lastSyncedAt": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "leaseExpiresAt": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "nextAttemptAt": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "organizationId",
                    "conditions",
                    "attemptCount",
                    "appliedRevision",
                    "desiredRevision",
                    "lastError",
                    "lastSyncedAt",
                    "leaseExpiresAt",
                    "nextAttemptAt"
                  ],
                  "additionalProperties": {}
                },
                "maxItems": 50
              },
              "truncated": {
                "type": "boolean"
              }
            },
            "required": [
              "rows",
              "truncated"
            ],
            "additionalProperties": {},
            "description": "Stripe seat syncs that are failing, overdue, or hold a lapsed lease, in retry order."
          },
          "trialExpiry": {
            "type": "object",
            "properties": {
              "rows": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "organizationId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "trialEndsAt": {
                      "type": "string"
                    },
                    "attemptCount": {
                      "maximum": 1.7976931348623157e+308,
                      "minimum": 0,
                      "type": "integer"
                    },
                    "lastError": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "nextAttemptAt": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "requiresAttention": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "organizationId",
                    "trialEndsAt",
                    "attemptCount",
                    "lastError",
                    "nextAttemptAt",
                    "requiresAttention"
                  ],
                  "additionalProperties": {}
                },
                "maxItems": 50
              },
              "truncated": {
                "type": "boolean"
              }
            },
            "required": [
              "rows",
              "truncated"
            ],
            "additionalProperties": {},
            "description": "Ended trials the expiry sweep failed on or has not reached in time."
          },
          "purges": {
            "type": "object",
            "properties": {
              "rows": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "organizationId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "disabled",
                        "deleting"
                      ]
                    },
                    "purgeAfter": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "purgeStartedAt": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "organizationId",
                    "status",
                    "purgeAfter",
                    "purgeStartedAt"
                  ],
                  "additionalProperties": {}
                },
                "maxItems": 50
              },
              "truncated": {
                "type": "boolean"
              }
            },
            "required": [
              "rows",
              "truncated"
            ],
            "additionalProperties": {},
            "description": "Purges past due to start, or started with a lapsed lease."
          },
          "trialsEnding": {
            "type": "object",
            "properties": {
              "rows": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "organizationId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "trialEndsAt": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "organizationId",
                    "trialEndsAt"
                  ],
                  "additionalProperties": {}
                },
                "maxItems": 50
              },
              "truncated": {
                "type": "boolean"
              }
            },
            "required": [
              "rows",
              "truncated"
            ],
            "additionalProperties": {},
            "description": "Trials ending soon, soonest first."
          },
          "purgesDue": {
            "type": "object",
            "properties": {
              "rows": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "organizationId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "disabledAt": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "purgeAfter": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "organizationId",
                    "disabledAt",
                    "purgeAfter"
                  ],
                  "additionalProperties": {}
                },
                "maxItems": 50
              },
              "truncated": {
                "type": "boolean"
              }
            },
            "required": [
              "rows",
              "truncated"
            ],
            "additionalProperties": {},
            "description": "Disabled organizations whose purge falls due soon."
          }
        },
        "required": [
          "generatedAt",
          "seatSync",
          "trialExpiry",
          "purges",
          "trialsEnding",
          "purgesDue"
        ],
        "additionalProperties": {},
        "description": "Billing maintenance trouble across organizations. Each section lists at most a bounded number of rows and says when it was truncated."
      },
      "RootOrganizationDetailResponse": {
        "type": "object",
        "properties": {
          "organization": {
            "$ref": "#/components/schemas/RootOrganizationSummaryResponse"
          },
          "overview": {
            "type": "object",
            "properties": {
              "adminGroupId": {
                "type": "string",
                "minLength": 1
              },
              "memberGroupId": {
                "type": "string",
                "minLength": 1
              },
              "activeMemberCount": {
                "maximum": 1.7976931348623157e+308,
                "minimum": 0,
                "type": "integer"
              },
              "disabledMemberCount": {
                "maximum": 1.7976931348623157e+308,
                "minimum": 0,
                "type": "integer"
              },
              "syncPausedMemberCount": {
                "maximum": 1.7976931348623157e+308,
                "minimum": 0,
                "type": "integer"
              },
              "openSeatAssignmentCount": {
                "maximum": 1.7976931348623157e+308,
                "minimum": 0,
                "type": "integer"
              }
            },
            "required": [
              "adminGroupId",
              "memberGroupId",
              "activeMemberCount",
              "disabledMemberCount",
              "syncPausedMemberCount",
              "openSeatAssignmentCount"
            ],
            "additionalProperties": {}
          },
          "billing": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "currentPeriodEndsAt": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "disabledAt": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "provider": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "purgeAfter": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "purgedAt": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "seatCount": {
                    "maximum": 1.7976931348623157e+308,
                    "minimum": 0,
                    "type": "integer"
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "local",
                      "trialing",
                      "active",
                      "disabled",
                      "deleting",
                      "purged"
                    ]
                  },
                  "trialEndsAt": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "currentPeriodStartsAt": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "providerCustomerId": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "providerSubscriptionId": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "providerProductId": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "providerTransactionId": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "entitlementId": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "purgeStartedAt": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "createdAt": {
                    "type": "string"
                  },
                  "updatedAt": {
                    "type": "string"
                  }
                },
                "required": [
                  "currentPeriodEndsAt",
                  "disabledAt",
                  "provider",
                  "purgeAfter",
                  "purgedAt",
                  "seatCount",
                  "status",
                  "trialEndsAt",
                  "currentPeriodStartsAt",
                  "providerCustomerId",
                  "providerSubscriptionId",
                  "providerProductId",
                  "providerTransactionId",
                  "entitlementId",
                  "purgeStartedAt",
                  "createdAt",
                  "updatedAt"
                ],
                "additionalProperties": {}
              },
              {
                "type": "null"
              }
            ]
          },
          "stripe": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "customerId": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "subscriptionId": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "subscriptionItemId": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "priceId": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "lastInvoiceId": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "desiredPaidCapacity": {
                    "maximum": 1.7976931348623157e+308,
                    "minimum": 0,
                    "type": "integer"
                  },
                  "desiredRenewalQuantity": {
                    "maximum": 1.7976931348623157e+308,
                    "minimum": 0,
                    "type": "integer"
                  },
                  "appliedPaidCapacity": {
                    "maximum": 1.7976931348623157e+308,
                    "minimum": 0,
                    "type": "integer"
                  },
                  "observedQuantity": {
                    "anyOf": [
                      {
                        "maximum": 1.7976931348623157e+308,
                        "minimum": 0,
                        "type": "integer"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "lastSyncedAt": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "nextAttemptAt": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "attemptCount": {
                    "maximum": 1.7976931348623157e+308,
                    "minimum": 0,
                    "type": "integer"
                  },
                  "lastError": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "customerId",
                  "subscriptionId",
                  "subscriptionItemId",
                  "priceId",
                  "lastInvoiceId",
                  "desiredPaidCapacity",
                  "desiredRenewalQuantity",
                  "appliedPaidCapacity",
                  "observedQuantity",
                  "lastSyncedAt",
                  "nextAttemptAt",
                  "attemptCount",
                  "lastError"
                ],
                "additionalProperties": {}
              },
              {
                "type": "null"
              }
            ]
          },
          "history": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OrganizationBillingHistoryEntry"
            },
            "description": "The 50 most recent billing events."
          }
        },
        "required": [
          "organization",
          "overview",
          "billing",
          "stripe",
          "history"
        ],
        "additionalProperties": {},
        "description": "One organization's group bindings, roster counts, stored billing, Stripe binding, and recent billing events."
      },
      "RootOrganizationIdentitiesResponse": {
        "type": "object",
        "properties": {
          "identities": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RootOrganizationIdentityResponse"
            }
          },
          "nextCursor": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Opaque cursor for the next page, or null at the end."
          }
        },
        "required": [
          "identities",
          "nextCursor"
        ],
        "additionalProperties": {},
        "description": "A page of an organization's roster identities, disabled entries included."
      },
      "RootOrganizationIdentityResponse": {
        "type": "object",
        "properties": {
          "identity": {
            "$ref": "#/components/schemas/RootIdentitySummaryResponse"
          },
          "roster": {
            "type": "object",
            "properties": {
              "disabledAt": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "holdsSeat": {
                "type": "boolean"
              },
              "joinedAt": {
                "type": "string"
              },
              "status": {
                "type": "string",
                "enum": [
                  "active",
                  "disabled"
                ]
              },
              "syncPausedAt": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "disabledAt",
              "holdsSeat",
              "joinedAt",
              "status",
              "syncPausedAt"
            ],
            "additionalProperties": {}
          }
        },
        "required": [
          "identity",
          "roster"
        ],
        "additionalProperties": {},
        "description": "One roster identity of an inspected organization."
      },
      "RootOrganizationRevenuecatEventResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1
          },
          "eventId": {
            "type": "string",
            "minLength": 1
          },
          "eventType": {
            "type": "string",
            "minLength": 1
          },
          "outcome": {
            "type": "string",
            "minLength": 1
          },
          "appUserId": {
            "type": "string"
          },
          "organizationId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1
              },
              {
                "type": "null"
              }
            ]
          },
          "sourceOrganizationId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1
              },
              {
                "type": "null"
              }
            ]
          },
          "store": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "environment": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "productId": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "periodType": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "transactionId": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "originalTransactionId": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "currency": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "priceInPurchasedCurrencyMinor": {
            "anyOf": [
              {
                "maximum": 9007199254740991,
                "minimum": -9007199254740991,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ]
          },
          "purchasedAt": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "expirationAt": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "eventTimestamp": {
            "type": "string"
          },
          "createdAt": {
            "type": "string"
          },
          "role": {
            "type": "string",
            "enum": [
              "target",
              "source"
            ],
            "description": "`target` when the delivery resolved to this organization; `source` when a transfer moved the purchase away from it."
          }
        },
        "required": [
          "id",
          "eventId",
          "eventType",
          "outcome",
          "appUserId",
          "organizationId",
          "sourceOrganizationId",
          "store",
          "environment",
          "productId",
          "periodType",
          "transactionId",
          "originalTransactionId",
          "currency",
          "priceInPurchasedCurrencyMinor",
          "purchasedAt",
          "expirationAt",
          "eventTimestamp",
          "createdAt",
          "role"
        ],
        "additionalProperties": {},
        "description": "One RevenueCat delivery as an organization saw it."
      },
      "RootOrganizationRevenuecatEventsResponse": {
        "type": "object",
        "properties": {
          "events": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RootOrganizationRevenuecatEventResponse"
            }
          },
          "nextCursor": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Opaque cursor for the next page, or null at the end."
          }
        },
        "required": [
          "events",
          "nextCursor"
        ],
        "additionalProperties": {},
        "description": "A page of an organization's RevenueCat deliveries, newest first by event time."
      },
      "RootOrganizationSummaryResponse": {
        "type": "object",
        "properties": {
          "organizationId": {
            "type": "string",
            "minLength": 1
          },
          "createdAt": {
            "type": "string"
          },
          "billingStatus": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "local",
                  "trialing",
                  "active",
                  "disabled",
                  "deleting",
                  "purged"
                ]
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "organizationId",
          "createdAt",
          "billingStatus"
        ],
        "additionalProperties": {},
        "description": "An operator's view of one organization; names are encrypted, so none is shown."
      },
      "RootOrganizationsResponse": {
        "type": "object",
        "properties": {
          "organizations": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RootOrganizationSummaryResponse"
            }
          },
          "nextCursor": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Opaque cursor for the next page, or null at the end."
          }
        },
        "required": [
          "organizations",
          "nextCursor"
        ],
        "additionalProperties": {},
        "description": "A page of organizations, newest first."
      },
      "RootRevenuecatEventResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1
          },
          "eventId": {
            "type": "string",
            "minLength": 1
          },
          "eventType": {
            "type": "string",
            "minLength": 1
          },
          "outcome": {
            "type": "string",
            "minLength": 1,
            "description": "What the handler did with it."
          },
          "appUserId": {
            "type": "string"
          },
          "organizationId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1
              },
              {
                "type": "null"
              }
            ],
            "description": "Organization the delivery resolved to, or null when it matched none."
          },
          "sourceOrganizationId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1
              },
              {
                "type": "null"
              }
            ],
            "description": "For a transfer, the organization the purchase moved away from."
          },
          "store": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "environment": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "productId": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "periodType": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "transactionId": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "originalTransactionId": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "currency": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "priceInPurchasedCurrencyMinor": {
            "anyOf": [
              {
                "maximum": 9007199254740991,
                "minimum": -9007199254740991,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "Price in the purchase currency's minor unit."
          },
          "purchasedAt": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "expirationAt": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "eventTimestamp": {
            "type": "string"
          },
          "createdAt": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "eventId",
          "eventType",
          "outcome",
          "appUserId",
          "organizationId",
          "sourceOrganizationId",
          "store",
          "environment",
          "productId",
          "periodType",
          "transactionId",
          "originalTransactionId",
          "currency",
          "priceInPurchasedCurrencyMinor",
          "purchasedAt",
          "expirationAt",
          "eventTimestamp",
          "createdAt"
        ],
        "additionalProperties": {},
        "description": "One stored RevenueCat webhook delivery."
      },
      "RootRevenuecatEventsReportResponse": {
        "type": "object",
        "properties": {
          "events": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RootRevenuecatEventResponse"
            }
          },
          "nextCursor": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Opaque cursor for the next page, or null at the end."
          }
        },
        "required": [
          "events",
          "nextCursor"
        ],
        "additionalProperties": {},
        "description": "A page of RevenueCat deliveries that matched no organization or that the handler ignored."
      },
      "SessionFailureResponse": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string",
            "const": "session_refresh_required",
            "description": "`session_refresh_required` only when the server positively identified a stale or invalid session; other 401s carry no code."
          },
          "error": {
            "type": "string",
            "minLength": 1
          }
        },
        "required": [
          "error"
        ],
        "additionalProperties": {},
        "description": "A 401 from a route that needs a session."
      },
      "StripeCancelResponse": {
        "type": "object",
        "properties": {
          "cancelAt": {
            "anyOf": [
              {
                "type": "number",
                "minimum": -1.7976931348623157e+308,
                "maximum": 1.7976931348623157e+308
              },
              {
                "type": "null"
              }
            ],
            "description": "Unix time in seconds when sync ends, or null when the subscription was already cancelling."
          }
        },
        "required": [
          "cancelAt"
        ],
        "additionalProperties": {},
        "description": "The result of cancelling a Stripe subscription at period end."
      },
      "StripeCheckoutIntentResponse": {
        "type": "object",
        "properties": {
          "subscriptionId": {
            "type": "string",
            "minLength": 1
          },
          "clientSecret": {
            "type": "string",
            "minLength": 1,
            "description": "Stripe PaymentIntent client secret; pass it only to Stripe.js."
          }
        },
        "required": [
          "subscriptionId",
          "clientSecret"
        ],
        "additionalProperties": {},
        "description": "What Stripe's Payment Element needs to confirm one subscription purchase."
      },
      "StripeCheckoutOptionsResponse": {
        "type": "object",
        "properties": {
          "options": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/StripeSyncOptionResponse"
            }
          }
        },
        "required": [
          "options"
        ],
        "additionalProperties": {},
        "description": "The Stripe plans offered for the organization's current roster size."
      },
      "StripeCheckoutSessionResponse": {
        "type": "object",
        "properties": {
          "url": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Checkout URL, or null when Stripe checkout is not configured."
          }
        },
        "required": [
          "url"
        ],
        "additionalProperties": {},
        "description": "A hosted Stripe Checkout page."
      },
      "StripePortalResponse": {
        "type": "object",
        "properties": {
          "portalUrl": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Portal URL, or null when Stripe is not configured or the organization has no live Stripe subscription."
          }
        },
        "required": [
          "portalUrl"
        ],
        "additionalProperties": {},
        "description": "A Stripe customer portal page."
      },
      "StripeReturnUrlRequest": {
        "type": "object",
        "properties": {
          "returnUrl": {
            "type": "string",
            "description": "Absolute HTTP(S) URL on one of the app origins the server allows."
          }
        },
        "required": [
          "returnUrl"
        ],
        "additionalProperties": {},
        "description": "Where Stripe sends the browser back after a hosted flow."
      },
      "StripeSyncOptionResponse": {
        "type": "object",
        "properties": {
          "tierId": {
            "type": "string",
            "enum": [
              "solo",
              "team_5",
              "team_10"
            ]
          },
          "seatLimit": {
            "maximum": 9007199254740991,
            "minimum": 1,
            "type": "integer",
            "description": "Most members the plan covers."
          },
          "priceId": {
            "type": "string",
            "minLength": 1
          },
          "productName": {
            "type": "string",
            "minLength": 1
          },
          "currency": {
            "type": "string",
            "minLength": 1
          },
          "unitAmount": {
            "anyOf": [
              {
                "type": "number",
                "minimum": -1.7976931348623157e+308,
                "maximum": 1.7976931348623157e+308
              },
              {
                "type": "null"
              }
            ],
            "description": "Price in the currency's minor unit, or null when Stripe has no price."
          },
          "interval": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "intervalCount": {
            "anyOf": [
              {
                "maximum": 9007199254740991,
                "minimum": 1,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "Number of intervals in one billing period, or null when Stripe omits it."
          }
        },
        "required": [
          "tierId",
          "seatLimit",
          "priceId",
          "productName",
          "currency",
          "unitAmount",
          "interval",
          "intervalCount"
        ],
        "additionalProperties": {},
        "description": "One Stripe plan the organization can buy, shaped for the billing panel."
      },
      "StripeWebhookResponse": {
        "type": "object",
        "properties": {
          "received": {
            "type": "boolean",
            "const": true
          },
          "outcome": {
            "type": "string",
            "enum": [
              "associated",
              "ignored",
              "reconciled"
            ],
            "description": "`associated` when a first paid invoice bound the subscription, `reconciled` when a renewal refreshed it, `ignored` otherwise."
          }
        },
        "required": [
          "received",
          "outcome"
        ],
        "additionalProperties": {},
        "description": "Acknowledges a Stripe delivery."
      },
      "SyncWatermark": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "updatedAt": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "updatedAt"
        ],
        "additionalProperties": {},
        "description": "The last row a listing page returned, by update time and id; the next page starts after it."
      },
      "UpdateOrganizationMembershipRequest": {
        "type": "object",
        "properties": {
          "syncPaused": {
            "type": "boolean",
            "description": "True to stop this organization's content syncing to the caller's devices; access and keys are unchanged."
          }
        },
        "required": [
          "syncPaused"
        ],
        "additionalProperties": false,
        "description": "The caller's own setting for one organization they belong to."
      },
      "UpdateOrganizationProfileRequest": {
        "type": "object",
        "properties": {
          "profileDocumentId": {
            "anyOf": [
              {
                "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "profileDocumentId"
        ],
        "additionalProperties": {},
        "description": "Binds or clears the organization's encrypted profile document."
      },
      "UpdateOrganizationRosterEntryRequest": {
        "type": "object",
        "properties": {
          "profileDocumentId": {
            "anyOf": [
              {
                "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "profileDocumentId"
        ],
        "additionalProperties": {},
        "description": "Binds or clears a roster entry's encrypted profile document."
      },
      "UploadMultipartBlobPartResponse": {
        "type": "object",
        "properties": {
          "part": {
            "$ref": "#/components/schemas/MultipartBlobStagePart"
          },
          "stageId": {
            "type": "string"
          },
          "uploadId": {
            "type": "string"
          }
        },
        "required": [
          "part",
          "stageId",
          "uploadId"
        ],
        "additionalProperties": {},
        "description": "Confirms a part uploaded through the API byte route."
      },
      "UserIdentityResponse": {
        "type": "object",
        "properties": {
          "encapsulationKeyFingerprint": {
            "maxLength": 64,
            "minLength": 64,
            "pattern": "^[0-9a-f]+$",
            "type": "string",
            "description": "SHA-256 fingerprint of `encapsulationPublicKey`."
          },
          "encapsulationPublicKey": {
            "type": "string",
            "description": "Base64 ML-KEM-1024 public key."
          },
          "signingKeyFingerprint": {
            "maxLength": 64,
            "minLength": 64,
            "pattern": "^[0-9a-f]+$",
            "type": "string",
            "description": "SHA-256 fingerprint of `signingPublicKey`."
          },
          "signingPublicKey": {
            "type": "string",
            "description": "Base64 ML-DSA-87 public key."
          },
          "userId": {
            "type": "string"
          }
        },
        "required": [
          "encapsulationKeyFingerprint",
          "encapsulationPublicKey",
          "signingKeyFingerprint",
          "signingPublicKey",
          "userId"
        ],
        "additionalProperties": {},
        "description": "A user's registered public keys. Clients trust them only after matching an identity link or an existing identity pin."
      },
      "UserSessionResponse": {
        "type": "object",
        "properties": {
          "createdAt": {
            "type": "string"
          },
          "id": {
            "maxLength": 64,
            "minLength": 64,
            "pattern": "^[0-9a-f]+$",
            "type": "string",
            "description": "Session id, used to sign the session out."
          },
          "ipAddresses": {
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1
            },
            "description": "IP addresses the session has been used from."
          },
          "isCurrent": {
            "type": "boolean",
            "description": "True for the session that made this request."
          },
          "lastActiveAt": {
            "type": "string"
          },
          "lastActiveIp": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1
              },
              {
                "type": "null"
              }
            ]
          },
          "signingKeyFingerprint": {
            "type": "string",
            "description": "Fingerprint of the signing key that opened the session."
          }
        },
        "required": [
          "createdAt",
          "id",
          "ipAddresses",
          "isCurrent",
          "lastActiveAt",
          "lastActiveIp",
          "signingKeyFingerprint"
        ],
        "additionalProperties": {},
        "description": "One of the signed-in user's live sessions."
      },
      "VerifyFailureResponse": {
        "type": "object",
        "properties": {
          "authenticated": {
            "type": "boolean",
            "const": false
          },
          "code": {
            "type": "string",
            "const": "account_suspended",
            "description": "`account_suspended` when the signature was valid but an operator suspended the account; treat it as terminal."
          },
          "error": {
            "type": "string"
          },
          "isRoot": {
            "not": {}
          },
          "organizationId": {
            "not": {}
          },
          "rootContainerId": {
            "not": {}
          },
          "token": {
            "not": {}
          },
          "userId": {
            "not": {}
          },
          "wsTicket": {
            "not": {}
          }
        },
        "required": [
          "authenticated"
        ],
        "additionalProperties": {},
        "description": "A refused sign-in."
      },
      "VerifyRequest": {
        "type": "object",
        "properties": {
          "fingerprint": {
            "maxLength": 64,
            "minLength": 64,
            "pattern": "^[0-9a-f]+$",
            "type": "string",
            "description": "Fingerprint the challenge was issued for."
          },
          "signature": {
            "maxLength": 6172,
            "minLength": 6172,
            "pattern": "^(?:[A-Za-z0-9+/]{4}){1542}[A-Za-z0-9+/][AQgw]==$",
            "type": "string",
            "description": "Base64 ML-DSA-87 signature over the challenge, bound to the API origin and fingerprint."
          }
        },
        "required": [
          "fingerprint",
          "signature"
        ],
        "additionalProperties": {},
        "description": "Proves possession of an identity's signing key by signing the sign-in challenge."
      },
      "VerifySuccessResponse": {
        "type": "object",
        "properties": {
          "authenticated": {
            "type": "boolean",
            "const": true
          },
          "code": {
            "not": {}
          },
          "error": {
            "not": {}
          },
          "isRoot": {
            "type": "boolean",
            "description": "True for a platform operator; it only reveals the root console, and the API enforces root access itself."
          },
          "organizationId": {
            "type": "string",
            "minLength": 1,
            "description": "The user's default organization."
          },
          "rootContainerId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1
              },
              {
                "type": "null"
              }
            ],
            "description": "Root container of the default organization, or null after that organization was purged; clients verify its role from signed state."
          },
          "token": {
            "type": "string",
            "minLength": 1,
            "description": "Bearer token for the `Authorization` header of later requests."
          },
          "userId": {
            "type": "string",
            "minLength": 1
          },
          "wsTicket": {
            "type": "string",
            "minLength": 1,
            "description": "Single-use ticket for this session's first WebSocket connection."
          }
        },
        "required": [
          "authenticated",
          "isRoot",
          "organizationId",
          "rootContainerId",
          "token",
          "userId",
          "wsTicket"
        ],
        "additionalProperties": {},
        "description": "A successful sign-in: the new session's bearer token and where the user's data starts."
      },
      "WebSocketTicketResponse": {
        "type": "object",
        "properties": {
          "ticket": {
            "type": "string",
            "description": "Opaque ticket, passed in the WebSocket upgrade URL and deleted on first use."
          }
        },
        "required": [
          "ticket"
        ],
        "additionalProperties": {},
        "description": "A single-use ticket for one WebSocket connection to the realtime hint gateway."
      }
    }
  },
  "info": {
    "description": "The HTTP API behind Tearleads clients. Document and key material is\nend-to-end encrypted, so request bodies carry ciphertext, signed manifests,\nand key envelopes that only the client SDK can produce or open.\n\nThis document is generated from the Zod operation registry in\n`@tearleads/validators`, which remains the runtime authority. Rules that\nJSON Schema cannot express are listed per operation under\n`x-tearleads-runtime-refinements`. See the protocol specification for\nmessage semantics, proofs, and failure handling.",
    "title": "Tearleads Protocol API",
    "version": "0.1.0"
  },
  "jsonSchemaDialect": "https://json-schema.org/draft/2020-12/schema",
  "openapi": "3.1.0",
  "paths": {
    "/": {
      "get": {
        "operationId": "health.get",
        "summary": "Health check",
        "description": "Returns `ok` when the API process is serving requests; load balancers and clients use it as a liveness probe. It needs no session, and a request that carries a body is refused with 413.",
        "tags": [
          "Health"
        ],
        "parameters": [],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HealthResponse"
                }
              }
            },
            "description": "OK"
          },
          "413": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Content Too Large"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": []
      }
    },
    "/auth/challenge": {
      "post": {
        "operationId": "auth.challenge",
        "summary": "Request an auth challenge",
        "description": "Starts sign-in for a registered identity: the server stores a short-lived random challenge for the signing key fingerprint, and the client signs it and sends the signature to `POST /auth/verify`. No session is needed; an unknown fingerprint returns 404.",
        "tags": [
          "Auth"
        ],
        "parameters": [],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ChallengeRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ChallengeResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": []
      }
    },
    "/auth/logout": {
      "post": {
        "operationId": "auth.logout",
        "summary": "Destroy the current session",
        "description": "Ends the session that made the request, so its bearer token stops working. Any signed-in user may call it.",
        "tags": [
          "Auth"
        ],
        "parameters": [],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DestroySessionResponse"
                }
              }
            },
            "description": "OK"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionFailureResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/auth/register": {
      "post": {
        "operationId": "auth.register",
        "summary": "Register an identity and bootstrap its root state",
        "description": "Creates a new identity from its signing and encapsulation public keys and, in one transaction, provisions its personal organization: the reserved `Admins` and `Members` groups, the root container, and their signed policies and metadata documents. The response carries a fresh login challenge, so the client signs in next with `POST /auth/verify`. A signing key that is already registered returns 409.",
        "tags": [
          "Auth"
        ],
        "parameters": [],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RegistrationRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegistrationResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Forbidden"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Conflict"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [],
        "x-tearleads-runtime-refinements": [
          {
            "description": "inlineRekeyCommitId must be present exactly when containerRekeys is non-empty",
            "id": "request.inline-rekey-commit-marker"
          },
          {
            "description": "authorizingContainerPathRefs is required when outgoingUpdates is non-empty",
            "id": "request.authorizing-paths-for-writes"
          },
          {
            "description": "containerRekeys may be non-empty only when outgoingUpdates is non-empty",
            "id": "request.container-rekeys-require-write"
          },
          {
            "description": "outgoing update ids must be unique within the request",
            "id": "request.unique-outgoing-update-ids"
          },
          {
            "description": "a request carrying pullCursor must not contain outgoing updates, container rekeys, a content-key bundle, or authorizing paths",
            "id": "request.pull-continuation-read-only"
          },
          {
            "description": "historyMode \"raw\" must not be combined with outgoing updates, container rekeys, a content-key bundle, or authorizing paths",
            "id": "request.raw-history-read-only"
          },
          {
            "description": "historyMode \"raw\" requires localVersionVector to be null so the complete retained history is requested",
            "id": "request.raw-history-null-frontier"
          },
          {
            "description": "checkpointKind, checkpointPayloadKind, and sourceVersionVector must be absent together or form a rotation baseline",
            "id": "request.rotation-checkpoint-fields"
          },
          {
            "description": "each provisioned system-container metadata seed must contain exactly one outgoing update and no container rekeys",
            "id": "request.organization-provisioning-container-seed"
          },
          {
            "description": "each provisioned document seed must contain exactly one outgoing update and no container rekeys",
            "id": "request.organization-provisioning-document-seed"
          },
          {
            "description": "core and profile metadata update id arrays contain no duplicates",
            "id": "response.organization-provisioning-unique-update-ids"
          },
          {
            "description": "a container response keyring is null exactly for container key epoch 1",
            "id": "response.organization-provisioning-container-keyring"
          }
        ]
      }
    },
    "/auth/sessions/{sessionId}": {
      "delete": {
        "operationId": "auth.sessions.destroy",
        "summary": "Destroy a user session",
        "description": "Signs out one of the caller's own sessions, for example a lost device. A session id that is unknown or belongs to another user returns 404.",
        "tags": [
          "Auth"
        ],
        "parameters": [
          {
            "explode": false,
            "in": "path",
            "name": "sessionId",
            "required": true,
            "schema": {
              "maxLength": 64,
              "minLength": 64,
              "pattern": "^[0-9a-f]+$",
              "type": "string"
            },
            "style": "simple"
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DestroySessionResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionFailureResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/auth/sessions": {
      "get": {
        "operationId": "auth.sessions.list",
        "summary": "List auth sessions",
        "description": "Lists the signed-in user's live sessions with their creation time, last activity, IP addresses, and signing key fingerprint, flagging the one that made the request. It only ever returns the caller's own sessions.",
        "tags": [
          "Auth"
        ],
        "parameters": [],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListSessionsResponse"
                }
              }
            },
            "description": "OK"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionFailureResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/auth/user-identity/{userId}": {
      "get": {
        "operationId": "auth.userIdentity",
        "summary": "Get a complete user identity",
        "description": "Returns a user's registered signing and encapsulation public keys and fingerprints. Clients never trust the answer alone: they compare it with an identity link or an existing identity pin before using the keys. Any signed-in user may call it; an unknown user returns 404.",
        "tags": [
          "Auth"
        ],
        "parameters": [
          {
            "explode": false,
            "in": "path",
            "name": "userId",
            "required": true,
            "schema": {
              "type": "string"
            },
            "style": "simple"
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserIdentityResponse"
                }
              }
            },
            "description": "OK"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionFailureResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/auth/verify": {
      "post": {
        "operationId": "auth.verify",
        "summary": "Verify an auth challenge",
        "description": "Completes sign-in by checking the challenge signature, bound to the API origin, against the identity's registered signing key, then opens a session and returns its bearer token plus the first WebSocket ticket. Each challenge can be used once. A suspended identity's valid signature is refused with 403 and code `account_suspended`, which clients treat as terminal.",
        "tags": [
          "Auth"
        ],
        "parameters": [],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/VerifyRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VerifySuccessResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VerifyFailureResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VerifyFailureResponse"
                }
              }
            },
            "description": "Forbidden"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VerifyFailureResponse"
                }
              }
            },
            "description": "Not Found"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": []
      }
    },
    "/auth/ws-ticket": {
      "post": {
        "operationId": "auth.webSocketTicket",
        "summary": "Mint a one-time WebSocket ticket",
        "description": "Issues a single-use, short-lived ticket that authenticates one WebSocket upgrade to the realtime hint gateway, because browsers cannot attach an `Authorization` header to a WebSocket handshake. Clients call it before each reconnect; sign-in already returns the first ticket.",
        "tags": [
          "Auth"
        ],
        "parameters": [],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebSocketTicketResponse"
                }
              }
            },
            "description": "OK"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionFailureResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/billing/revenuecat/webhook": {
      "post": {
        "operationId": "billing.revenuecat.webhook.receive",
        "summary": "Receive a RevenueCat webhook",
        "description": "Receives subscription lifecycle events from RevenueCat and applies them to organization billing. The caller is RevenueCat, authenticated by the shared secret in the `Authorization` header rather than by a session. An event the server cannot apply yet is answered with 503 and left unclaimed, so RevenueCat redelivers it.",
        "tags": [
          "Billing webhooks"
        ],
        "parameters": [
          {
            "explode": false,
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "type": "string"
            },
            "style": "simple"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RevenueCatWebhookRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RevenueCatWebhookResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [],
        "x-tearleads-runtime-refinements": [
          {
            "description": "Authorization must match the configured RevenueCat webhook secret in constant time",
            "id": "request.revenuecat-webhook-authorization"
          }
        ]
      }
    },
    "/billing/stripe/webhook": {
      "post": {
        "operationId": "billing.stripe.webhook.receive",
        "summary": "Receive a Stripe webhook",
        "description": "Receives Stripe events and, for paid invoices, records the subscription binding for the organization and links it to RevenueCat. The caller is Stripe, authenticated by the `Stripe-Signature` header over the exact raw body rather than by a session. The server re-fetches the subscription from Stripe instead of trusting the event body.",
        "tags": [
          "Billing webhooks"
        ],
        "parameters": [
          {
            "explode": false,
            "in": "header",
            "name": "stripe-signature",
            "required": false,
            "schema": {
              "type": "string"
            },
            "style": "simple"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {},
                "additionalProperties": {}
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StripeWebhookResponse"
                }
              }
            },
            "description": "OK"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [],
        "x-tearleads-runtime-refinements": [
          {
            "description": "Stripe-Signature must authenticate the exact raw request body within the replay tolerance",
            "id": "request.stripe-webhook-signature"
          }
        ]
      }
    },
    "/blobs/stages/multipart/{stageId}/parts/{partNumber}/bytes": {
      "put": {
        "operationId": "blobs.multipartStages.parts.upload",
        "summary": "Upload multipart blob part bytes through the API",
        "description": "Uploads one part's encrypted bytes through the API, for object stores that cannot sign direct upload URLs. Only the stage's owner may call it, and stores that do sign URLs reject this route. The part's declared byte length and SHA-256 headers must match the bytes sent.",
        "tags": [
          "Blobs"
        ],
        "parameters": [
          {
            "explode": false,
            "in": "path",
            "name": "stageId",
            "required": true,
            "schema": {
              "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-5][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$",
              "type": "string"
            },
            "style": "simple"
          },
          {
            "explode": false,
            "in": "path",
            "name": "partNumber",
            "required": true,
            "schema": {
              "maximum": 9007199254740991,
              "minimum": 1,
              "type": "integer"
            },
            "style": "simple"
          },
          {
            "explode": false,
            "in": "header",
            "name": "x-tearleads-blob-part-byte-length",
            "required": true,
            "schema": {
              "maxLength": 9,
              "minLength": 1,
              "pattern": "^[0-9]+$",
              "type": "string"
            },
            "style": "simple"
          },
          {
            "explode": false,
            "in": "header",
            "name": "x-tearleads-blob-part-sha256",
            "required": true,
            "schema": {
              "maxLength": 64,
              "minLength": 64,
              "pattern": "^[0-9a-f]+$",
              "type": "string"
            },
            "style": "simple"
          },
          {
            "explode": false,
            "in": "header",
            "name": "x-tearleads-blob-upload-id",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "style": "simple"
          }
        ],
        "requestBody": {
          "content": {
            "application/octet-stream": {
              "schema": {
                "format": "binary",
                "type": "string"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UploadMultipartBlobPartResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionFailureResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Forbidden"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Conflict"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-tearleads-runtime-refinements": [
          {
            "description": "Declared multipart part byte length is at most 33554432",
            "id": "blobs.multipartPart.declaredByteLengthMax"
          }
        ]
      }
    },
    "/blobs/stages/multipart/{stageId}/parts/{partNumber}/upload": {
      "post": {
        "operationId": "blobs.multipartStages.parts.authorize",
        "summary": "Authorize a direct multipart blob part upload",
        "description": "Returns a short-lived signed URL for uploading one part of a blob stage directly to object storage, for parts after the first batch or to renew an expired URL. Only the stage's owner may call it. The URL is scoped to the exact part number, byte length, and Content-MD5, and expiry never invalidates parts already uploaded.",
        "tags": [
          "Blobs"
        ],
        "parameters": [
          {
            "explode": false,
            "in": "path",
            "name": "stageId",
            "required": true,
            "schema": {
              "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-5][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$",
              "type": "string"
            },
            "style": "simple"
          },
          {
            "explode": false,
            "in": "path",
            "name": "partNumber",
            "required": true,
            "schema": {
              "maximum": 9007199254740991,
              "minimum": 1,
              "type": "integer"
            },
            "style": "simple"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "byteLength": {
                    "maximum": 33554432,
                    "minimum": 1,
                    "type": "integer"
                  },
                  "contentMd5": {
                    "type": "string",
                    "pattern": "^[A-Za-z0-9+/]{21}[AQgw]==$"
                  },
                  "uploadId": {
                    "type": "string",
                    "minLength": 1
                  }
                },
                "required": [
                  "byteLength",
                  "contentMd5",
                  "uploadId"
                ],
                "additionalProperties": false
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "byteLength": {
                      "maximum": 33554432,
                      "minimum": 1,
                      "type": "integer"
                    },
                    "contentMd5": {
                      "type": "string",
                      "pattern": "^[A-Za-z0-9+/]{21}[AQgw]==$"
                    },
                    "partNumber": {
                      "maximum": 10000,
                      "minimum": 1,
                      "type": "integer"
                    },
                    "source": {
                      "$ref": "#/components/schemas/MultipartBlobPartUploadSource"
                    },
                    "stageId": {
                      "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-5][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$",
                      "type": "string"
                    },
                    "uploadId": {
                      "type": "string",
                      "minLength": 1
                    }
                  },
                  "required": [
                    "byteLength",
                    "contentMd5",
                    "partNumber",
                    "source",
                    "stageId",
                    "uploadId"
                  ],
                  "additionalProperties": false
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionFailureResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Forbidden"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Conflict"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/blobs/stages/multipart/{stageId}": {
      "get": {
        "operationId": "blobs.multipartStages.get",
        "summary": "Get multipart blob stage status",
        "description": "Returns a blob stage's status so a client can resume an interrupted upload. Only the exact 404 `multipart_blob_stage_not_found` or 409 `multipart_blob_stage_expired` responses prove the stage is gone and permit starting a fresh one; any other failure means the client should keep its resumable state.",
        "tags": [
          "Blobs"
        ],
        "parameters": [
          {
            "explode": false,
            "in": "path",
            "name": "stageId",
            "required": true,
            "schema": {
              "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-5][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$",
              "type": "string"
            },
            "style": "simple"
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MultipartBlobStageStatusResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionFailureResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Forbidden"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MultipartBlobStageNotFoundErrorResponse"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MultipartBlobStageConflictErrorResponse"
                }
              }
            },
            "description": "Conflict"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/blobs/stages/multipart": {
      "post": {
        "operationId": "blobs.multipartStages.initiate",
        "summary": "Initiate a multipart blob stage",
        "description": "Opens a blob stage for an encrypted upload, declaring the final byte length, SHA-256 digest, and organization, and returns upload sources for the first parts so they can start at once. The caller must belong to the organization. The stage expires after one hour; nothing becomes readable until an attachment bind promotes it.",
        "tags": [
          "Blobs"
        ],
        "parameters": [],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/InitiateMultipartBlobStageRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InitiateMultipartBlobStageResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionFailureResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Forbidden"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Conflict"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/blobs/{blobId}/attachment-bindings/{bindingId}/detach": {
      "post": {
        "operationId": "blobs.attachmentBindings.detach",
        "summary": "Detach a blob attachment",
        "description": "Removes an active attachment binding from its document slot through a signed `attachment.detach` event. Requires write access through an authorizing container path. A blob left with no active binding is kept for the attachment-retention grace period before garbage collection.",
        "tags": [
          "Blobs"
        ],
        "parameters": [
          {
            "explode": false,
            "in": "path",
            "name": "blobId",
            "required": true,
            "schema": {
              "type": "string"
            },
            "style": "simple"
          },
          {
            "explode": false,
            "in": "path",
            "name": "bindingId",
            "required": true,
            "schema": {
              "type": "string"
            },
            "style": "simple"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BlobAttachmentDetachRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BlobAttachmentDetachResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionFailureResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "402": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaymentRequiredErrorResponse"
                }
              }
            },
            "description": "Payment Required"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Forbidden"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BlobMutationFailureResponse"
                }
              }
            },
            "description": "Conflict"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/blobs/{blobId}/attachment-bindings": {
      "post": {
        "operationId": "blobs.attachmentBindings.bind",
        "summary": "Bind or replace a blob attachment",
        "description": "Attaches an encrypted blob to an attachment slot in a document, or replaces the slot's current binding, through a signed `attachment.bind` event. When it names a blob stage, the server assembles and verifies the staged upload and promotes it to committed blob storage; this is the only way to complete an upload. Requires write access through an authorizing container path; a stale binding or path head returns 409, and an organization without active billing returns 402.",
        "tags": [
          "Blobs"
        ],
        "parameters": [
          {
            "explode": false,
            "in": "path",
            "name": "blobId",
            "required": true,
            "schema": {
              "type": "string"
            },
            "style": "simple"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BlobAttachmentBindRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BlobAttachmentBindResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionFailureResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "402": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaymentRequiredErrorResponse"
                }
              }
            },
            "description": "Payment Required"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Forbidden"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BlobMutationFailureResponse"
                }
              }
            },
            "description": "Conflict"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-tearleads-runtime-refinements": [
          {
            "description": "an attachment bind's document sync must contain exactly one outgoing update and no container rekeys, and serialize within the document sync request limit",
            "id": "request.attachment-bind-document-sync"
          },
          {
            "description": "inlineRekeyCommitId must be present exactly when containerRekeys is non-empty",
            "id": "request.inline-rekey-commit-marker"
          },
          {
            "description": "authorizingContainerPathRefs is required when outgoingUpdates is non-empty",
            "id": "request.authorizing-paths-for-writes"
          },
          {
            "description": "containerRekeys may be non-empty only when outgoingUpdates is non-empty",
            "id": "request.container-rekeys-require-write"
          },
          {
            "description": "outgoing update ids must be unique within the request",
            "id": "request.unique-outgoing-update-ids"
          },
          {
            "description": "a request carrying pullCursor must not contain outgoing updates, container rekeys, a content-key bundle, or authorizing paths",
            "id": "request.pull-continuation-read-only"
          },
          {
            "description": "historyMode \"raw\" must not be combined with outgoing updates, container rekeys, a content-key bundle, or authorizing paths",
            "id": "request.raw-history-read-only"
          },
          {
            "description": "historyMode \"raw\" requires localVersionVector to be null so the complete retained history is requested",
            "id": "request.raw-history-null-frontier"
          },
          {
            "description": "checkpointKind, checkpointPayloadKind, and sourceVersionVector must be absent together or form a rotation baseline",
            "id": "request.rotation-checkpoint-fields"
          }
        ]
      }
    },
    "/blobs/{blobId}/bytes": {
      "get": {
        "operationId": "blobs.bytes.get",
        "summary": "Get committed blob bytes",
        "description": "Streams a committed blob's encrypted bytes, with its byte length and SHA-256 digest in response headers so the client can verify them. Requires read access through at least one active attachment binding's document.",
        "tags": [
          "Blobs"
        ],
        "parameters": [
          {
            "explode": false,
            "in": "path",
            "name": "blobId",
            "required": true,
            "schema": {
              "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-5][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$",
              "type": "string"
            },
            "style": "simple"
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/octet-stream": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              }
            },
            "description": "OK",
            "headers": {
              "x-tearleads-blob-byte-length": {
                "required": true,
                "schema": {
                  "maxLength": 16,
                  "pattern": "^[0-9]+$",
                  "type": "string"
                }
              },
              "x-tearleads-blob-id": {
                "required": true,
                "schema": {
                  "type": "string",
                  "minLength": 1
                }
              },
              "x-tearleads-blob-sha256": {
                "required": true,
                "schema": {
                  "type": "string",
                  "minLength": 1
                }
              },
              "content-length": {
                "required": false,
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionFailureResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Forbidden"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Conflict"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-tearleads-runtime-refinements": [
          {
            "description": "Blob byte length headers decode to JavaScript safe integers",
            "id": "blobs.bytes.safeIntegerHeader"
          }
        ]
      }
    },
    "/blobs/{blobId}/download": {
      "get": {
        "operationId": "blobs.download.get",
        "summary": "Get a blob download source",
        "description": "Returns a committed blob's byte length, SHA-256 digest, and where to fetch its encrypted bytes: a five-minute signed object-store URL, or this API's `/bytes` route when the store cannot sign. Requires read access through at least one active attachment binding's document. Key material comes from the attachment listing, never from this response.",
        "tags": [
          "Blobs"
        ],
        "parameters": [
          {
            "explode": false,
            "in": "path",
            "name": "blobId",
            "required": true,
            "schema": {
              "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-5][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$",
              "type": "string"
            },
            "style": "simple"
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "blobId": {
                      "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-5][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$",
                      "type": "string"
                    },
                    "byteLength": {
                      "maximum": 9007199254740991,
                      "minimum": 0,
                      "type": "integer"
                    },
                    "sha256": {
                      "maxLength": 64,
                      "minLength": 64,
                      "pattern": "^[0-9a-f]+$",
                      "type": "string"
                    },
                    "source": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "kind": {
                              "type": "string",
                              "const": "api"
                            }
                          },
                          "required": [
                            "kind"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "kind": {
                              "type": "string",
                              "const": "signed-url"
                            },
                            "url": {
                              "type": "string",
                              "pattern": "^https?:\\/\\/"
                            },
                            "expiresAt": {
                              "type": "string",
                              "format": "date-time",
                              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                            }
                          },
                          "required": [
                            "kind",
                            "url",
                            "expiresAt"
                          ],
                          "additionalProperties": false
                        }
                      ]
                    }
                  },
                  "required": [
                    "blobId",
                    "byteLength",
                    "sha256",
                    "source"
                  ],
                  "additionalProperties": false
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionFailureResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Forbidden"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Conflict"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/containers/documents/query": {
      "post": {
        "operationId": "containers.documentLanes.query",
        "summary": "List container documents by lane",
        "description": "Lists the documents linked into up to 32 containers, each lane with its own watermark and page size (500 rows in total). Each lane needs read access to its container; a lane that fails reports its own failure while the others still list, and only the container's absence is reported as `container_not_found`.",
        "tags": [
          "Containers"
        ],
        "parameters": [],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ListContainerDocumentLanesRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "results": {
                      "type": "array",
                      "items": {
                        "anyOf": [
                          {
                            "type": "object",
                            "properties": {
                              "laneId": {
                                "maxLength": 64,
                                "minLength": 1,
                                "type": "string"
                              },
                              "page": {
                                "$ref": "#/components/schemas/ListContainerDocumentsResponse"
                              }
                            },
                            "required": [
                              "laneId",
                              "page"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "failure": {
                                "type": "object",
                                "properties": {
                                  "code": {
                                    "type": "string",
                                    "const": "container_not_found"
                                  },
                                  "error": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "status": {
                                    "type": "number",
                                    "enum": [
                                      403,
                                      404,
                                      409
                                    ]
                                  }
                                },
                                "required": [
                                  "error",
                                  "status"
                                ],
                                "additionalProperties": false
                              },
                              "laneId": {
                                "maxLength": 64,
                                "minLength": 1,
                                "type": "string"
                              }
                            },
                            "required": [
                              "failure",
                              "laneId"
                            ],
                            "additionalProperties": false
                          }
                        ]
                      },
                      "maxItems": 32,
                      "minItems": 1
                    }
                  },
                  "required": [
                    "results"
                  ],
                  "additionalProperties": false
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionFailureResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-tearleads-runtime-refinements": [
          {
            "description": "container document-lane request lane ids must be unique",
            "id": "request.container-document-lane-unique-ids"
          },
          {
            "description": "container document-lane request page limits must total at most 500",
            "id": "request.container-document-lane-page-total"
          },
          {
            "description": "container document-lane response lane ids must be unique",
            "id": "response.container-document-lane-unique-ids"
          }
        ]
      }
    },
    "/containers/parent-lanes/query": {
      "post": {
        "operationId": "containers.parentLanes.query",
        "summary": "List containers by parent lane",
        "description": "Lists the containers the caller can reach through direct grants or managed-principal membership, one bounded page for each of up to four requested parent lanes, each with its own watermark. Clients use it to discover and incrementally refresh the folder tree. Any signed-in user may call it; access is checked per container.",
        "tags": [
          "Containers"
        ],
        "parameters": [],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ListContainerParentLanesRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListContainerParentLanesResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionFailureResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-tearleads-runtime-refinements": [
          {
            "description": "container parent-lane request lane ids must be unique",
            "id": "request.container-parent-lane-unique-ids"
          },
          {
            "description": "container parent-lane request page limits must total at most 500",
            "id": "request.container-parent-lane-page-total"
          },
          {
            "description": "container parent-lane response lane ids must be unique",
            "id": "response.container-parent-lane-unique-ids"
          }
        ]
      }
    },
    "/containers/with-metadata-document": {
      "post": {
        "operationId": "containers.withMetadataDocument.create",
        "summary": "Create a container with its metadata document",
        "description": "Creates a container and its encrypted metadata document in one transaction, optionally seeding the document's first update. Authorization and conflicts are those of `POST /containers` and `POST /documents`; a 409 `document_manifest_already_exists` may have rolled the new container back, so clients treat it as terminal unless they verify both artifacts.",
        "tags": [
          "Containers"
        ],
        "parameters": [],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ContainerCreateWithMetadataDocumentRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ContainerCreateWithMetadataDocumentResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionFailureResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "402": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaymentRequiredErrorResponse"
                }
              }
            },
            "description": "Payment Required"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Forbidden"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ContainerMutationFailureResponse"
                }
              }
            },
            "description": "Conflict"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-tearleads-runtime-refinements": [
          {
            "description": "a container response keyring is null exactly for container key epoch 1",
            "id": "response.organization-provisioning-container-keyring"
          },
          {
            "description": "a container create metadata seed must contain exactly one outgoing update and no container rekeys, and serialize within the document sync request limit",
            "id": "request.container-create-metadata-seed"
          },
          {
            "description": "inlineRekeyCommitId must be present exactly when containerRekeys is non-empty",
            "id": "request.inline-rekey-commit-marker"
          },
          {
            "description": "authorizingContainerPathRefs is required when outgoingUpdates is non-empty",
            "id": "request.authorizing-paths-for-writes"
          },
          {
            "description": "containerRekeys may be non-empty only when outgoingUpdates is non-empty",
            "id": "request.container-rekeys-require-write"
          },
          {
            "description": "outgoing update ids must be unique within the request",
            "id": "request.unique-outgoing-update-ids"
          },
          {
            "description": "a request carrying pullCursor must not contain outgoing updates, container rekeys, a content-key bundle, or authorizing paths",
            "id": "request.pull-continuation-read-only"
          },
          {
            "description": "historyMode \"raw\" must not be combined with outgoing updates, container rekeys, a content-key bundle, or authorizing paths",
            "id": "request.raw-history-read-only"
          },
          {
            "description": "historyMode \"raw\" requires localVersionVector to be null so the complete retained history is requested",
            "id": "request.raw-history-null-frontier"
          },
          {
            "description": "checkpointKind, checkpointPayloadKind, and sourceVersionVector must be absent together or form a rotation baseline",
            "id": "request.rotation-checkpoint-fields"
          }
        ]
      }
    },
    "/containers/{containerId}/kek-log": {
      "get": {
        "operationId": "containers.kekLog.get",
        "summary": "Page a container's KEK rotation log",
        "description": "Pages a container's append-only KEK rotation log: every epoch with its write-once predecessor bridge and retained wraps, plus the sealed keyring of one epoch the request names. Clients use it to rebuild or repair a damaged container KEK keyring. Any current reader of the container may page the whole log, because current read access includes retained history.",
        "tags": [
          "Containers"
        ],
        "parameters": [
          {
            "explode": false,
            "in": "path",
            "name": "containerId",
            "required": true,
            "schema": {
              "type": "string"
            },
            "style": "simple"
          },
          {
            "explode": true,
            "in": "query",
            "name": "keyringForEpoch",
            "required": false,
            "schema": {
              "maximum": 65536,
              "minimum": 1,
              "type": "integer"
            },
            "style": "form"
          },
          {
            "explode": true,
            "in": "query",
            "name": "afterKeyEpoch",
            "required": false,
            "schema": {
              "maximum": 65536,
              "minimum": 1,
              "type": "integer"
            },
            "style": "form"
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ContainerKekLogResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionFailureResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Forbidden"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Conflict"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-tearleads-runtime-refinements": [
          {
            "description": "a container KEK log page contains at most one sealed keyring",
            "id": "response.container-kek-log-single-keyring"
          }
        ]
      }
    },
    "/containers/{containerId}/move": {
      "post": {
        "operationId": "containers.move",
        "summary": "Move a container",
        "description": "Moves a container under a new parent through a signed `container.move` event and rotates its container KEK. Requires admin access at the source and write access at the destination; root and system containers cannot move. Moving into Trash is an ordinary move and can be undone.",
        "tags": [
          "Containers"
        ],
        "parameters": [
          {
            "explode": false,
            "in": "path",
            "name": "containerId",
            "required": true,
            "schema": {
              "type": "string"
            },
            "style": "simple"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ContainerRotationRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ContainerRotationResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionFailureResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "402": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaymentRequiredErrorResponse"
                }
              }
            },
            "description": "Payment Required"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Forbidden"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ContainerMutationFailureResponse"
                }
              }
            },
            "description": "Conflict"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-tearleads-runtime-refinements": [
          {
            "description": "a container response keyring is null exactly for container key epoch 1",
            "id": "response.organization-provisioning-container-keyring"
          }
        ]
      }
    },
    "/containers/{containerId}/recite": {
      "post": {
        "operationId": "containers.recite",
        "summary": "Re-cite a held container's current ancestor path",
        "description": "Advances a container's access manifest so it cites its ancestors' current heads, without changing grants, keys, or parent. Clients call it after changing an ancestor so descendants they already hold stop citing superseded heads. Requires admin access; after 512 epochs the container no longer accepts re-citations.",
        "tags": [
          "Containers"
        ],
        "parameters": [
          {
            "explode": false,
            "in": "path",
            "name": "containerId",
            "required": true,
            "schema": {
              "type": "string"
            },
            "style": "simple"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ContainerReciteRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ContainerReciteResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionFailureResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "402": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaymentRequiredErrorResponse"
                }
              }
            },
            "description": "Payment Required"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Forbidden"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ContainerMutationFailureResponse"
                }
              }
            },
            "description": "Conflict"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/containers/{containerId}/rekey": {
      "post": {
        "operationId": "containers.rekey",
        "summary": "Rekey a container",
        "description": "Rotates a container's KEK to a new epoch without changing grants, carrying the predecessor bridge and the re-sealed container KEK keyring. Requires write access. Stale cited heads return 409, and epochs above 65536 are refused.",
        "tags": [
          "Containers"
        ],
        "parameters": [
          {
            "explode": false,
            "in": "path",
            "name": "containerId",
            "required": true,
            "schema": {
              "type": "string"
            },
            "style": "simple"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ContainerRotationRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ContainerRotationResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionFailureResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "402": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaymentRequiredErrorResponse"
                }
              }
            },
            "description": "Payment Required"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Forbidden"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ContainerMutationFailureResponse"
                }
              }
            },
            "description": "Conflict"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-tearleads-runtime-refinements": [
          {
            "description": "a container response keyring is null exactly for container key epoch 1",
            "id": "response.organization-provisioning-container-keyring"
          }
        ]
      }
    },
    "/containers/{containerId}/replacement-authorizations/{replacesOrganizationId}": {
      "get": {
        "operationId": "containers.replacementAuthorizations.get",
        "summary": "Get a re-shared container's replacement lineage",
        "description": "Returns the signed chain that lets a container in a replacement organization stand in for a held container from a purged organization, so a client can rebind its local copy and queued edits. Only a current reader of the destination container is served it, so former members cannot discover replacement ids through the old roster.",
        "tags": [
          "Containers"
        ],
        "parameters": [
          {
            "explode": false,
            "in": "path",
            "name": "containerId",
            "required": true,
            "schema": {
              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
              "type": "string"
            },
            "style": "simple"
          },
          {
            "explode": false,
            "in": "path",
            "name": "replacesOrganizationId",
            "required": true,
            "schema": {
              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
              "type": "string"
            },
            "style": "simple"
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "authorizations": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/OrganizationReplacementAuthorization"
                      }
                    }
                  },
                  "required": [
                    "authorizations"
                  ]
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionFailureResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Forbidden"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Conflict"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/containers/{containerId}/revoke": {
      "post": {
        "operationId": "containers.revoke",
        "summary": "Revoke a container grant",
        "description": "Removes a grant from a container through a signed `container.revoke` event and rotates the container KEK so the removed principal cannot read later content. The request carries the new KEK epoch, its predecessor bridge, and the re-sealed container KEK keyring. Requires admin access; stale cited heads return 409.",
        "tags": [
          "Containers"
        ],
        "parameters": [
          {
            "explode": false,
            "in": "path",
            "name": "containerId",
            "required": true,
            "schema": {
              "type": "string"
            },
            "style": "simple"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ContainerRotationRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ContainerRotationResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionFailureResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "402": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaymentRequiredErrorResponse"
                }
              }
            },
            "description": "Payment Required"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Forbidden"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ContainerMutationFailureResponse"
                }
              }
            },
            "description": "Conflict"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-tearleads-runtime-refinements": [
          {
            "description": "a container response keyring is null exactly for container key epoch 1",
            "id": "response.organization-provisioning-container-keyring"
          }
        ]
      }
    },
    "/containers/{containerId}/share": {
      "post": {
        "operationId": "containers.share",
        "summary": "Share a container",
        "description": "Adds or changes a user or group grant on a container through a signed `container.grant` event, wrapping the current container KEK to the new recipients. Requires admin access through the container's path. Cited heads must be current: a stale container head returns 409 `container_mutation_state_stale`, and a stale principal policy returns 409 `principal_policy_stale` with the current heads.",
        "tags": [
          "Containers"
        ],
        "parameters": [
          {
            "explode": false,
            "in": "path",
            "name": "containerId",
            "required": true,
            "schema": {
              "type": "string"
            },
            "style": "simple"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ContainerMutationRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ContainerMutationResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionFailureResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "402": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaymentRequiredErrorResponse"
                }
              }
            },
            "description": "Payment Required"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Forbidden"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ContainerMutationFailureResponse"
                }
              }
            },
            "description": "Conflict"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-tearleads-runtime-refinements": [
          {
            "description": "a container response keyring is null exactly for container key epoch 1",
            "id": "response.organization-provisioning-container-keyring"
          }
        ]
      }
    },
    "/containers/{containerId}/writer-projection": {
      "get": {
        "operationId": "containers.writerProjection.get",
        "summary": "Get a container writer projection",
        "description": "Returns everything a client needs to read and write under a container: the signed manifests on its authorizing container path, each path level's container KEK wraps and keyring, and the key targets. Requires current read access; write authority is checked again when a write commits. A 202 asks the client to retry the identical request after the server prepares policy history, and the `x-known-manifests` header lets a client skip manifests it already holds.",
        "tags": [
          "Containers"
        ],
        "parameters": [
          {
            "explode": false,
            "in": "path",
            "name": "containerId",
            "required": true,
            "schema": {
              "type": "string"
            },
            "style": "simple"
          },
          {
            "explode": false,
            "in": "header",
            "name": "x-known-manifests",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 3215,
              "description": "Comma-separated typed digests the device holds verified: m:<manifest hash> for an access-manifest bundle, k:<level digest> for a container KEK level; at most 48, unique"
            },
            "style": "simple"
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ContainerWriterProjectionWireResponse"
                }
              }
            },
            "description": "OK"
          },
          "202": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PrincipalHistoryPreparationResponse"
                }
              }
            },
            "description": "Accepted"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionFailureResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Forbidden"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ContainerNotFoundErrorResponse"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ContainerWriterProjectionErrorResponse"
                }
              }
            },
            "description": "Conflict"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-tearleads-runtime-refinements": [
          {
            "description": "containerKeks must contain exactly one entry for every manifest in path",
            "id": "response.container-writer-projection-path-kek-count"
          },
          {
            "description": "a container response keyring is null exactly for container key epoch 1",
            "id": "response.organization-provisioning-container-keyring"
          },
          {
            "description": "every cited manifest hash names one bundles entry, every bundles key equals its bundle's manifestHash, and every bundle is cited",
            "id": "response.writer-projection-manifest-bundles"
          },
          {
            "id": "request.known-manifest-hints",
            "description": "x-known-manifests must list at most 48 unique typed digests, each m: or k: followed by a lowercase SHA-256 hex digest"
          }
        ]
      }
    },
    "/containers/{containerId}": {
      "delete": {
        "operationId": "containers.delete",
        "summary": "Delete a container",
        "description": "Deletes an empty folder: a container with no child containers and no linked user documents, along with its own metadata document. Requires admin access; root and system containers cannot be deleted. Peers learn of the deletion from a sync tombstone, and an unknown container returns 404 `container_not_found`.",
        "tags": [
          "Containers"
        ],
        "parameters": [
          {
            "explode": false,
            "in": "path",
            "name": "containerId",
            "required": true,
            "schema": {
              "type": "string"
            },
            "style": "simple"
          },
          {
            "explode": true,
            "in": "query",
            "name": "requiredAncestorId",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "style": "form"
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ContainerDeleteResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionFailureResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "402": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaymentRequiredErrorResponse"
                }
              }
            },
            "description": "Payment Required"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Forbidden"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ContainerNotFoundErrorResponse"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ContainerMutationFailureResponse"
                }
              }
            },
            "description": "Conflict"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/containers": {
      "post": {
        "operationId": "containers.create",
        "summary": "Create a container",
        "description": "Creates a container from a signed `container.create` event, its derived access manifest, and the container KEK wrapped to its recipients. Requires write access to the parent container, or admin access for a system container. A retry of a create that already committed returns 409 `container_manifest_already_exists`, which lets the client adopt it; a stale parent returns 409 `container_mutation_state_stale`.",
        "tags": [
          "Containers"
        ],
        "parameters": [],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ContainerMutationRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ContainerMutationResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionFailureResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "402": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaymentRequiredErrorResponse"
                }
              }
            },
            "description": "Payment Required"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Forbidden"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ContainerMutationFailureResponse"
                }
              }
            },
            "description": "Conflict"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-tearleads-runtime-refinements": [
          {
            "description": "a container response keyring is null exactly for container key epoch 1",
            "id": "response.organization-provisioning-container-keyring"
          }
        ]
      }
    },
    "/documents/{documentId}/attachments": {
      "get": {
        "operationId": "documents.attachments.list",
        "summary": "List active document attachments",
        "description": "Lists a document's active attachment bindings with each blob's signed binding event, signed write header, and blob content-key bundle, which clients need to decrypt the blob. Requires read access through a linked container path.",
        "tags": [
          "Documents"
        ],
        "parameters": [
          {
            "explode": false,
            "in": "path",
            "name": "documentId",
            "required": true,
            "schema": {
              "type": "string"
            },
            "style": "simple"
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListDocumentAttachmentsResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionFailureResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Forbidden"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Conflict"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/documents/{documentId}/attribution/ranges": {
      "get": {
        "operationId": "documents.attribution.ranges.list",
        "summary": "List document attribution ranges",
        "description": "Pages a document's complete edit attribution when the compact attribution response is truncated. Requires read access. A cursor or expected revision from before a later write returns 409, and the client restarts from the first page.",
        "tags": [
          "Documents"
        ],
        "parameters": [
          {
            "explode": false,
            "in": "path",
            "name": "documentId",
            "required": true,
            "schema": {
              "type": "string"
            },
            "style": "simple"
          },
          {
            "explode": true,
            "in": "query",
            "name": "cursor",
            "required": false,
            "schema": {
              "type": "string"
            },
            "style": "form"
          },
          {
            "explode": true,
            "in": "query",
            "name": "expectedRevision",
            "required": false,
            "schema": {
              "maximum": 9007199254740991,
              "minimum": 0,
              "type": "integer"
            },
            "style": "form"
          },
          {
            "explode": true,
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "maximum": 500,
              "minimum": 1,
              "type": "integer"
            },
            "style": "form"
          },
          {
            "explode": false,
            "in": "header",
            "name": "accept-encoding",
            "required": false,
            "schema": {
              "type": "string"
            },
            "style": "simple"
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListDocumentEditAttributionRangesResponse"
                }
              }
            },
            "description": "OK",
            "headers": {
              "cache-control": {
                "required": true,
                "schema": {
                  "type": "string",
                  "const": "private, no-cache"
                }
              },
              "content-encoding": {
                "required": false,
                "schema": {
                  "type": "string"
                }
              },
              "content-type": {
                "required": true,
                "schema": {
                  "type": "string",
                  "minLength": 1
                }
              },
              "vary": {
                "required": true,
                "schema": {
                  "pattern": "(?:^|,)\\s*(?:[Aa][Cc][Cc][Ee][Pp][Tt]-[Ee][Nn][Cc][Oo][Dd][Ii][Nn][Gg]|\\*)\\s*(?:,|$)",
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionFailureResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Forbidden"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Conflict"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-tearleads-runtime-refinements": [
          {
            "description": "document attribution segment start counters are less than end counters",
            "id": "response.document-attribution-counter-range"
          }
        ]
      }
    },
    "/documents/{documentId}/attribution": {
      "get": {
        "operationId": "documents.attribution.get",
        "summary": "Get document edit attribution",
        "description": "Returns which writer first uploaded each stretch of a document's history, derived from the signed write headers of its stored updates; it is not proof of authorship. Requires read access. Responses carry an `ETag`, so a client that sends `If-None-Match` gets 304 when nothing changed; long histories are truncated here and paged through the attribution ranges route.",
        "tags": [
          "Documents"
        ],
        "parameters": [
          {
            "explode": false,
            "in": "path",
            "name": "documentId",
            "required": true,
            "schema": {
              "type": "string"
            },
            "style": "simple"
          },
          {
            "explode": false,
            "in": "header",
            "name": "accept-encoding",
            "required": false,
            "schema": {
              "type": "string"
            },
            "style": "simple"
          },
          {
            "explode": false,
            "in": "header",
            "name": "if-none-match",
            "required": false,
            "schema": {
              "type": "string"
            },
            "style": "simple"
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentEditAttributionResponse"
                }
              }
            },
            "description": "OK",
            "headers": {
              "cache-control": {
                "required": true,
                "schema": {
                  "type": "string",
                  "const": "private, no-cache"
                }
              },
              "content-encoding": {
                "required": false,
                "schema": {
                  "type": "string"
                }
              },
              "content-type": {
                "required": true,
                "schema": {
                  "type": "string",
                  "minLength": 1
                }
              },
              "etag": {
                "required": true,
                "schema": {
                  "type": "string",
                  "minLength": 1
                }
              },
              "vary": {
                "required": true,
                "schema": {
                  "pattern": "(?:^|,)\\s*(?:[Aa][Cc][Cc][Ee][Pp][Tt]-[Ee][Nn][Cc][Oo][Dd][Ii][Nn][Gg]|\\*)\\s*(?:,|$)",
                  "type": "string"
                }
              }
            }
          },
          "304": {
            "description": "Not Modified",
            "headers": {
              "cache-control": {
                "required": true,
                "schema": {
                  "type": "string",
                  "const": "private, no-cache"
                }
              },
              "etag": {
                "required": true,
                "schema": {
                  "type": "string",
                  "minLength": 1
                }
              },
              "vary": {
                "required": true,
                "schema": {
                  "pattern": "(?:^|,)\\s*(?:[Aa][Cc][Cc][Ee][Pp][Tt]-[Ee][Nn][Cc][Oo][Dd][Ii][Nn][Gg]|\\*)\\s*(?:,|$)",
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionFailureResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Forbidden"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Conflict"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-tearleads-runtime-refinements": [
          {
            "description": "document attribution segment start counters are less than end counters",
            "id": "response.document-attribution-counter-range"
          }
        ]
      }
    },
    "/documents/{documentId}/link": {
      "post": {
        "operationId": "documents.link",
        "summary": "Link a document to a container",
        "description": "Links a document into another container through a signed `document.link` event, advancing its document link-set manifest and rewrapping the content keys of its attached blobs for the new container. Requires write access through the target and authorizing container paths. Stale heads or incomplete rewraps return 409 without changing the document.",
        "tags": [
          "Documents"
        ],
        "parameters": [
          {
            "explode": false,
            "in": "path",
            "name": "documentId",
            "required": true,
            "schema": {
              "type": "string"
            },
            "style": "simple"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DocumentLinkSetMutationRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentLinkSetMutationResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionFailureResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "402": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaymentRequiredErrorResponse"
                }
              }
            },
            "description": "Payment Required"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Forbidden"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentMutationFailureResponse"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentMutationFailureResponse"
                }
              }
            },
            "description": "Conflict"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-tearleads-runtime-refinements": [
          {
            "description": "authorizingContainerPathRefs and targetContainerPathRefs may contain at most 6400 references in total",
            "id": "request.post-link-authorization-path-total-references"
          },
          {
            "description": "checkpointKind, checkpointPayloadKind, and sourceVersionVector must be absent together or form a rotation baseline",
            "id": "request.rotation-checkpoint-fields"
          }
        ]
      }
    },
    "/documents/{documentId}/purge": {
      "get": {
        "operationId": "documents.purgeProof",
        "summary": "Get a document purge proof",
        "description": "Returns the retained signed proof that a document was purged, so a device can verify the deletion before removing its local copy. Only callers who were authorized through the purge-time container path are served it; a 202 asks the client to retry the identical request after policy history is prepared.",
        "tags": [
          "Documents"
        ],
        "parameters": [
          {
            "explode": false,
            "in": "path",
            "name": "documentId",
            "required": true,
            "schema": {
              "type": "string"
            },
            "style": "simple"
          },
          {
            "explode": true,
            "in": "query",
            "name": "documentCheckpointManifestHash",
            "required": false,
            "schema": {
              "maxLength": 6500,
              "minLength": 1,
              "type": "string"
            },
            "style": "form"
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentPurgeProofResponse"
                }
              }
            },
            "description": "OK"
          },
          "202": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PrincipalHistoryPreparationResponse"
                }
              }
            },
            "description": "The attempted operation rolled back. Retry the identical request to continue verification preparation."
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionFailureResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "402": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaymentRequiredErrorResponse"
                }
              }
            },
            "description": "Payment Required"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Forbidden"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentMutationFailureResponse"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentMutationFailureResponse"
                }
              }
            },
            "description": "Conflict"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PrincipalHistoryPreparationFailureResponse"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-tearleads-runtime-refinements": [
          {
            "id": "response.principal-history-preparation-rollback",
            "description": "A 503 with code principal_history_preparation_unavailable requires committed:false; other 503 responses do not guarantee rollback."
          }
        ]
      },
      "post": {
        "operationId": "documents.purge",
        "summary": "Purge a document",
        "description": "Permanently removes a document through a signed `document.purge` event that cites its exact current authorizing container path. Requires write access, a document linked to exactly one container, and a document that is not a container's metadata document. The server keeps the signed proof, and blobs only this document referenced enter the attachment-retention grace period; a 202 asks the client to retry the identical request after policy history is prepared.",
        "tags": [
          "Documents"
        ],
        "parameters": [
          {
            "explode": false,
            "in": "path",
            "name": "documentId",
            "required": true,
            "schema": {
              "type": "string"
            },
            "style": "simple"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DocumentPurgeRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentPurgeResponse"
                }
              }
            },
            "description": "OK"
          },
          "202": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PrincipalHistoryPreparationResponse"
                }
              }
            },
            "description": "The attempted operation rolled back. Retry the identical request to continue verification preparation."
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionFailureResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "402": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaymentRequiredErrorResponse"
                }
              }
            },
            "description": "Payment Required"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Forbidden"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentMutationFailureResponse"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentMutationFailureResponse"
                }
              }
            },
            "description": "Conflict"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PrincipalHistoryPreparationFailureResponse"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-tearleads-runtime-refinements": [
          {
            "id": "response.principal-history-preparation-rollback",
            "description": "A 503 with code principal_history_preparation_unavailable requires committed:false; other 503 responses do not guarantee rollback."
          }
        ]
      }
    },
    "/documents/{documentId}/sync": {
      "post": {
        "operationId": "documents.sync",
        "summary": "Sync encrypted Loro updates",
        "description": "Uploads encrypted Loro updates with their signed write headers and returns the updates the client is missing from its version vector, one bounded page at a time with a continuation cursor. Writing requires write access through an authorizing container path; reading requires read access. A retried update id is accepted only when its ciphertext and header are identical; 409 responses carry a code that tells the client whether to replan, regenerate, recover, or stop, and 413 means the request is too large.",
        "tags": [
          "Documents"
        ],
        "parameters": [
          {
            "explode": false,
            "in": "path",
            "name": "documentId",
            "required": true,
            "schema": {
              "type": "string"
            },
            "style": "simple"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DocumentSyncRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentSyncResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionFailureResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "402": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaymentRequiredErrorResponse"
                }
              }
            },
            "description": "Payment Required"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Forbidden"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentNotFoundErrorResponse"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentSyncErrorResponse"
                }
              }
            },
            "description": "Conflict"
          },
          "413": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Serialized document sync requests are limited to 16777216 bytes"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-tearleads-runtime-refinements": [
          {
            "description": "inlineRekeyCommitId must be present exactly when containerRekeys is non-empty",
            "id": "request.inline-rekey-commit-marker"
          },
          {
            "description": "authorizingContainerPathRefs is required when outgoingUpdates is non-empty",
            "id": "request.authorizing-paths-for-writes"
          },
          {
            "description": "containerRekeys may be non-empty only when outgoingUpdates is non-empty",
            "id": "request.container-rekeys-require-write"
          },
          {
            "description": "outgoing update ids must be unique within the request",
            "id": "request.unique-outgoing-update-ids"
          },
          {
            "description": "a request carrying pullCursor must not contain outgoing updates, container rekeys, a content-key bundle, or authorizing paths",
            "id": "request.pull-continuation-read-only"
          },
          {
            "description": "historyMode \"raw\" must not be combined with outgoing updates, container rekeys, a content-key bundle, or authorizing paths",
            "id": "request.raw-history-read-only"
          },
          {
            "description": "historyMode \"raw\" requires localVersionVector to be null so the complete retained history is requested",
            "id": "request.raw-history-null-frontier"
          },
          {
            "description": "checkpointKind, checkpointPayloadKind, and sourceVersionVector must be absent together or form a rotation baseline",
            "id": "request.rotation-checkpoint-fields"
          },
          {
            "description": "checkpointKind, checkpointPayloadKind, and sourceVersionVector must be absent together or form a rotation baseline",
            "id": "response.rotation-checkpoint-fields"
          },
          {
            "description": "commitLsnMode \"untracked\" requires the commitLsn \"0/0\" sentinel",
            "id": "response.untracked-commit-lsn-sentinel"
          },
          {
            "description": "commitLsn \"0/0\" requires commitLsnMode \"untracked\" in the same response",
            "id": "response.untracked-commit-lsn-mode"
          },
          {
            "description": "pullPage.hasMore is true exactly when pullPage.nextCursor is non-null",
            "id": "response.pull-page-continuation"
          },
          {
            "description": "contentKeyBundles carries each content-key epoch at most once, and only epochs older than contentKeyBundle.contentKeyEpoch",
            "id": "response.historical-content-key-bundles"
          }
        ]
      }
    },
    "/documents/{documentId}/unlink": {
      "post": {
        "operationId": "documents.unlink",
        "summary": "Unlink a document from a container",
        "description": "Removes a container from a document's link set through a signed `document.unlink` event and rotates the document content key. The request must carry a rotation baseline covering every committed update, unless the document has none. Requires write access; stale heads, a missing baseline, or incomplete rewraps return 409.",
        "tags": [
          "Documents"
        ],
        "parameters": [
          {
            "explode": false,
            "in": "path",
            "name": "documentId",
            "required": true,
            "schema": {
              "type": "string"
            },
            "style": "simple"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DocumentLinkSetMutationRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentLinkSetMutationResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionFailureResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "402": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaymentRequiredErrorResponse"
                }
              }
            },
            "description": "Payment Required"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Forbidden"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentMutationFailureResponse"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentMutationFailureResponse"
                }
              }
            },
            "description": "Conflict"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-tearleads-runtime-refinements": [
          {
            "description": "authorizingContainerPathRefs and targetContainerPathRefs may contain at most 6400 references in total",
            "id": "request.post-link-authorization-path-total-references"
          },
          {
            "description": "checkpointKind, checkpointPayloadKind, and sourceVersionVector must be absent together or form a rotation baseline",
            "id": "request.rotation-checkpoint-fields"
          }
        ]
      }
    },
    "/documents/{documentId}/writer-projection": {
      "get": {
        "operationId": "documents.writerProjection.get",
        "summary": "Get a document writer projection",
        "description": "Returns everything a client needs to read and write a document: its document link-set manifest history, the authorizing container paths with their KEK wraps and keyrings, and the key targets. Requires current read access; write authority is checked again when a write commits. A vanished container is reported as 409, never 404, because 404 here means the document itself was deleted.",
        "tags": [
          "Documents"
        ],
        "parameters": [
          {
            "explode": false,
            "in": "path",
            "name": "documentId",
            "required": true,
            "schema": {
              "type": "string"
            },
            "style": "simple"
          },
          {
            "explode": false,
            "in": "header",
            "name": "x-known-manifests",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 3215,
              "description": "Comma-separated typed digests the device holds verified: m:<manifest hash> for an access-manifest bundle, k:<level digest> for a container KEK level; at most 48, unique"
            },
            "style": "simple"
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentWriterProjectionWireResponse"
                }
              }
            },
            "description": "OK"
          },
          "202": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PrincipalHistoryPreparationResponse"
                }
              }
            },
            "description": "Accepted"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionFailureResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Forbidden"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentNotFoundErrorResponse"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentWriterProjectionErrorResponse"
                }
              }
            },
            "description": "Conflict"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-tearleads-runtime-refinements": [
          {
            "description": "containerKeks must contain exactly one entry for every manifest in path",
            "id": "response.container-writer-projection-path-kek-count"
          },
          {
            "description": "a container response keyring is null exactly for container key epoch 1",
            "id": "response.organization-provisioning-container-keyring"
          },
          {
            "description": "every cited manifest hash names one bundles entry, every bundles key equals its bundle's manifestHash, and every bundle is cited",
            "id": "response.writer-projection-manifest-bundles"
          },
          {
            "id": "request.known-manifest-hints",
            "description": "x-known-manifests must list at most 48 unique typed digests, each m: or k: followed by a lowercase SHA-256 hex digest"
          }
        ]
      }
    },
    "/documents": {
      "post": {
        "operationId": "documents.create",
        "summary": "Create a document",
        "description": "Creates a document from a signed document access event, its document link-set manifest, and its content-key bundle, optionally committing the document's first encrypted update in the same transaction. Requires write access to the target container through an authorizing container path. A retry of a create that already committed returns 409 `document_manifest_already_exists`, which lets the client adopt it.",
        "tags": [
          "Documents"
        ],
        "parameters": [],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DocumentCreateRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentCreateResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionFailureResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "402": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaymentRequiredErrorResponse"
                }
              }
            },
            "description": "Payment Required"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Forbidden"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentMutationFailureResponse"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentMutationFailureResponse"
                }
              }
            },
            "description": "Conflict"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-tearleads-runtime-refinements": [
          {
            "description": "a document create seed must contain exactly one outgoing update and no container rekeys, and serialize within the document sync request limit",
            "id": "request.document-create-seed"
          },
          {
            "description": "inlineRekeyCommitId must be present exactly when containerRekeys is non-empty",
            "id": "request.inline-rekey-commit-marker"
          },
          {
            "description": "authorizingContainerPathRefs is required when outgoingUpdates is non-empty",
            "id": "request.authorizing-paths-for-writes"
          },
          {
            "description": "containerRekeys may be non-empty only when outgoingUpdates is non-empty",
            "id": "request.container-rekeys-require-write"
          },
          {
            "description": "outgoing update ids must be unique within the request",
            "id": "request.unique-outgoing-update-ids"
          },
          {
            "description": "a request carrying pullCursor must not contain outgoing updates, container rekeys, a content-key bundle, or authorizing paths",
            "id": "request.pull-continuation-read-only"
          },
          {
            "description": "historyMode \"raw\" must not be combined with outgoing updates, container rekeys, a content-key bundle, or authorizing paths",
            "id": "request.raw-history-read-only"
          },
          {
            "description": "historyMode \"raw\" requires localVersionVector to be null so the complete retained history is requested",
            "id": "request.raw-history-null-frontier"
          },
          {
            "description": "checkpointKind, checkpointPayloadKind, and sourceVersionVector must be absent together or form a rotation baseline",
            "id": "request.rotation-checkpoint-fields"
          }
        ]
      }
    },
    "/organization-memberships/{organizationId}/leave-request": {
      "delete": {
        "operationId": "organizationMemberships.leaveRequest.delete",
        "summary": "Withdraw a request to leave an organization",
        "description": "Withdraws the caller's pending request to leave an organization. Returns 404 unless the caller has an active roster entry there.",
        "tags": [
          "Organization memberships"
        ],
        "parameters": [
          {
            "explode": false,
            "in": "path",
            "name": "organizationId",
            "required": true,
            "schema": {
              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
              "type": "string"
            },
            "style": "simple"
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrganizationMembershipResponse"
                }
              }
            },
            "description": "OK"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionFailureResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      },
      "put": {
        "operationId": "organizationMemberships.leaveRequest.put",
        "summary": "Request to leave an organization",
        "description": "Files the caller's signed request to leave an organization, which administrators see in the organization read model and act on; members cannot remove themselves. The request must be signed by the caller within the last ten minutes and cite a stored `Members` group head the caller has belonged to ever since. A personal organization, or a caller who is its only administrator, is refused.",
        "tags": [
          "Organization memberships"
        ],
        "parameters": [
          {
            "explode": false,
            "in": "path",
            "name": "organizationId",
            "required": true,
            "schema": {
              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
              "type": "string"
            },
            "style": "simple"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OrganizationLeaveRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrganizationMembershipResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionFailureResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Conflict"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/organization-memberships/{organizationId}": {
      "put": {
        "operationId": "organizationMemberships.update",
        "summary": "Update an organization membership",
        "description": "Changes the caller's own membership settings in an organization, such as pausing its sync to their devices. Pausing changes no grant, key, or policy. Returns 404 unless the caller's roster entry is active.",
        "tags": [
          "Organization memberships"
        ],
        "parameters": [
          {
            "explode": false,
            "in": "path",
            "name": "organizationId",
            "required": true,
            "schema": {
              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
              "type": "string"
            },
            "style": "simple"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateOrganizationMembershipRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrganizationMembershipResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionFailureResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Conflict"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/organization-memberships": {
      "get": {
        "operationId": "organizationMemberships.list",
        "summary": "List your organization memberships",
        "description": "Lists the organizations where the caller has an active roster entry, with whether each is their personal organization and whether they paused its sync. It reads only the caller's own rows.",
        "tags": [
          "Organization memberships"
        ],
        "parameters": [],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrganizationMembershipsResponse"
                }
              }
            },
            "description": "OK"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionFailureResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/organizations/{organizationId}/billing/history": {
      "get": {
        "operationId": "organizations.billing.history.get",
        "summary": "Get organization billing history",
        "description": "Lists the organization's recorded billing events. Only organization administrators may call it.",
        "tags": [
          "Organization billing"
        ],
        "parameters": [
          {
            "explode": false,
            "in": "path",
            "name": "organizationId",
            "required": true,
            "schema": {
              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
              "type": "string"
            },
            "style": "simple"
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrganizationBillingHistoryResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionFailureResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Forbidden"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/organizations/{organizationId}/billing/management-url": {
      "get": {
        "operationId": "organizations.billing.managementUrl.get",
        "summary": "Get the organization billing management URL",
        "description": "Returns the app store page where an administrator manages the organization's native App Store or Google Play subscription, or null when it has none or the store is unreachable. Only organization administrators may call it.",
        "tags": [
          "Organization billing"
        ],
        "parameters": [
          {
            "explode": false,
            "in": "path",
            "name": "organizationId",
            "required": true,
            "schema": {
              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
              "type": "string"
            },
            "style": "simple"
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrganizationBillingManagementUrlResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionFailureResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Forbidden"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/organizations/{organizationId}/billing/native/eligibility": {
      "get": {
        "operationId": "organizations.billing.native.eligibility.get",
        "summary": "Get native store purchase eligibility",
        "description": "Tells the client whether the caller may buy a native App Store or Google Play subscription for the organization and, when not, gives the reason. Any organization member may call it. The answer is a point-in-time decision; the claim and the store webhooks check eligibility again.",
        "tags": [
          "Organization billing"
        ],
        "parameters": [
          {
            "explode": false,
            "in": "path",
            "name": "organizationId",
            "required": true,
            "schema": {
              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
              "type": "string"
            },
            "style": "simple"
          },
          {
            "explode": true,
            "in": "query",
            "name": "store",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "app_store",
                "play_store",
                "test_store"
              ]
            },
            "style": "form"
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrganizationNativePurchaseEligibilityResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionFailureResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Forbidden"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Conflict"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/organizations/{organizationId}/billing/native/{store}/claim": {
      "post": {
        "operationId": "organizations.billing.native.claim",
        "summary": "Claim a native store subscription",
        "description": "Assigns the caller's active App Store or Google Play subscription, verified with RevenueCat, to a freshly provisioned restore organization; the client never supplies the product or seat count. Only that organization's administrator may call it. Retrying after a timeout is safe; no matching subscription returns 404 and more than one returns 409.",
        "tags": [
          "Organization billing"
        ],
        "parameters": [
          {
            "explode": false,
            "in": "path",
            "name": "organizationId",
            "required": true,
            "schema": {
              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
              "type": "string"
            },
            "style": "simple"
          },
          {
            "explode": false,
            "in": "path",
            "name": "store",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "app_store",
                "play_store",
                "test_store"
              ]
            },
            "style": "simple"
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrganizationBillingResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionFailureResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Forbidden"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Conflict"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-tearleads-runtime-refinements": [
          {
            "description": "assignedSeatCount equals the number of assignedUserIds in the response",
            "id": "response.organization-billing-assigned-seats"
          }
        ]
      }
    },
    "/organizations/{organizationId}/billing/stripe/cancel": {
      "post": {
        "operationId": "organizations.billing.stripe.cancel",
        "summary": "Cancel the Stripe subscription",
        "description": "Cancels the organization's Stripe subscription at the end of the paid period and returns when sync ends, or null when it was already cancelling. Only organization administrators may call it; 502 means Stripe could not be reached.",
        "tags": [
          "Organization billing"
        ],
        "parameters": [
          {
            "explode": false,
            "in": "path",
            "name": "organizationId",
            "required": true,
            "schema": {
              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
              "type": "string"
            },
            "style": "simple"
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StripeCancelResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionFailureResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Forbidden"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          },
          "502": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Bad Gateway"
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/organizations/{organizationId}/billing/stripe/checkout-session": {
      "post": {
        "operationId": "organizations.billing.stripe.checkoutSession.create",
        "summary": "Create an embedded Stripe checkout session",
        "description": "Creates a Stripe-hosted checkout session as a fallback to the inline form and returns its URL, or null when Stripe checkout is not configured; an ineligible organization gets an error instead. Only organization administrators may call it, and `returnUrl` must be on an approved app origin. It shares the inline checkout's attempt, so identical retries are safe and conflicting ones return 409.",
        "tags": [
          "Organization billing"
        ],
        "parameters": [
          {
            "explode": false,
            "in": "path",
            "name": "organizationId",
            "required": true,
            "schema": {
              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
              "type": "string"
            },
            "style": "simple"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/StripeReturnUrlRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StripeCheckoutSessionResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionFailureResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Forbidden"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BillingErrorResponse"
                }
              }
            },
            "description": "Conflict"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          },
          "502": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Bad Gateway"
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-tearleads-runtime-refinements": [
          {
            "description": "returnUrl parses as HTTP(S) and its origin matches the configured app origins",
            "id": "request.stripe-return-url-origin"
          }
        ]
      }
    },
    "/organizations/{organizationId}/billing/stripe/checkout": {
      "post": {
        "operationId": "organizations.billing.stripe.checkout.create",
        "summary": "Create a Stripe checkout",
        "description": "Starts or resumes an inline Stripe checkout and returns the client secret for Stripe's Payment Element. Only organization administrators may call it, and the seat count comes from the roster, not the client. Identical retries reuse the same attempt; a different buyer, mode, or seat count while one is open returns 409.",
        "tags": [
          "Organization billing"
        ],
        "parameters": [
          {
            "explode": false,
            "in": "path",
            "name": "organizationId",
            "required": true,
            "schema": {
              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
              "type": "string"
            },
            "style": "simple"
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StripeCheckoutIntentResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionFailureResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Forbidden"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BillingErrorResponse"
                }
              }
            },
            "description": "Conflict"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          },
          "502": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Bad Gateway"
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/organizations/{organizationId}/billing/stripe/options": {
      "get": {
        "operationId": "organizations.billing.stripe.options.get",
        "summary": "Get Stripe checkout options",
        "description": "Returns the Stripe plans the organization can subscribe to, selected for its current `Members` roster size. Only organization administrators may call it; 502 means Stripe could not be reached.",
        "tags": [
          "Organization billing"
        ],
        "parameters": [
          {
            "explode": false,
            "in": "path",
            "name": "organizationId",
            "required": true,
            "schema": {
              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
              "type": "string"
            },
            "style": "simple"
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StripeCheckoutOptionsResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionFailureResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Forbidden"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BillingErrorResponse"
                }
              }
            },
            "description": "Conflict"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          },
          "502": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Bad Gateway"
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/organizations/{organizationId}/billing/stripe/portal": {
      "post": {
        "operationId": "organizations.billing.stripe.portal.create",
        "summary": "Create a Stripe customer portal session",
        "description": "Creates a Stripe customer portal session where an administrator updates payment details or downloads invoices, and returns its URL, or null when Stripe is not configured or the organization has no live Stripe subscription. Only organization administrators may call it, and `returnUrl` must be on an approved app origin.",
        "tags": [
          "Organization billing"
        ],
        "parameters": [
          {
            "explode": false,
            "in": "path",
            "name": "organizationId",
            "required": true,
            "schema": {
              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
              "type": "string"
            },
            "style": "simple"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/StripeReturnUrlRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StripePortalResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionFailureResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Forbidden"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          },
          "502": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Bad Gateway"
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-tearleads-runtime-refinements": [
          {
            "description": "returnUrl parses as HTTP(S) and its origin matches the configured app origins",
            "id": "request.stripe-return-url-origin"
          }
        ]
      }
    },
    "/organizations/{organizationId}/billing/trial": {
      "post": {
        "operationId": "organizations.billing.trial.start",
        "summary": "Start an organization trial",
        "description": "Starts the organization's free trial, or returns the current billing state unchanged when a trial or subscription already exists, so retries are safe. Only organization administrators may call it.",
        "tags": [
          "Organization billing"
        ],
        "parameters": [
          {
            "explode": false,
            "in": "path",
            "name": "organizationId",
            "required": true,
            "schema": {
              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
              "type": "string"
            },
            "style": "simple"
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrganizationBillingResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionFailureResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Forbidden"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Conflict"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-tearleads-runtime-refinements": [
          {
            "description": "assignedSeatCount equals the number of assignedUserIds in the response",
            "id": "response.organization-billing-assigned-seats"
          }
        ]
      }
    },
    "/organizations/{organizationId}/billing": {
      "get": {
        "operationId": "organizations.billing.get",
        "summary": "Get organization billing",
        "description": "Returns the organization's billing state: plan status, billing period, seat counts, which members hold sync seats, and whether the subscription can be cancelled directly. Any organization member may call it.",
        "tags": [
          "Organization billing"
        ],
        "parameters": [
          {
            "explode": false,
            "in": "path",
            "name": "organizationId",
            "required": true,
            "schema": {
              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
              "type": "string"
            },
            "style": "simple"
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrganizationBillingResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionFailureResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Forbidden"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-tearleads-runtime-refinements": [
          {
            "description": "assignedSeatCount equals the number of assignedUserIds in the response",
            "id": "response.organization-billing-assigned-seats"
          }
        ]
      }
    },
    "/organizations/{organizationId}/data-usage": {
      "get": {
        "operationId": "organizations.dataUsage.get",
        "summary": "Get organization data usage",
        "description": "Returns how many bytes of documents and blobs an organization stores, broken down by document category. Any organization member may call it.",
        "tags": [
          "Organizations"
        ],
        "parameters": [
          {
            "explode": false,
            "in": "path",
            "name": "organizationId",
            "required": true,
            "schema": {
              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
              "type": "string"
            },
            "style": "simple"
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrganizationDataUsageResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionFailureResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrganizationPresentationFailureResponse"
                }
              }
            },
            "description": "Forbidden"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrganizationPresentationFailureResponse"
                }
              }
            },
            "description": "Not Found"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-tearleads-runtime-refinements": [
          {
            "description": "totalByteLength equals the sum of document and blob byte lengths",
            "id": "response.organization-data-usage-total-byte-length"
          },
          {
            "description": "the document usage breakdown contains each document category exactly once",
            "id": "response.organization-data-usage-document-categories"
          },
          {
            "description": "document usage totals equal the sums of the category breakdown",
            "id": "response.organization-data-usage-document-totals"
          }
        ]
      }
    },
    "/organizations/{organizationId}/groups/{groupId}/members": {
      "get": {
        "operationId": "organizations.groups.members.list",
        "summary": "List organization group members",
        "description": "Lists the members of an organization group from its current signed policy. Any organization member may call it.",
        "tags": [
          "Organizations"
        ],
        "parameters": [
          {
            "explode": false,
            "in": "path",
            "name": "organizationId",
            "required": true,
            "schema": {
              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
              "type": "string"
            },
            "style": "simple"
          },
          {
            "explode": false,
            "in": "path",
            "name": "groupId",
            "required": true,
            "schema": {
              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
              "type": "string"
            },
            "style": "simple"
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrganizationGroupMembersResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionFailureResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Forbidden"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/organizations/{organizationId}/groups/{groupId}/policy-commit": {
      "put": {
        "operationId": "organizations.groups.policy.commit",
        "summary": "Advance a group policy and its signed directory head",
        "description": "Commits a group's next signed principal policy, its member envelopes, the matching organization policy successor, and the container grant updates the change requires, all in one transaction. Only organization administrators may call it; a stale head returns 409. A 202 asks for the identical request to be retried after preparation, and only a 503 with `committed: false` and code `principal_history_preparation_unavailable` proves nothing was written.",
        "tags": [
          "Organizations"
        ],
        "parameters": [
          {
            "explode": false,
            "in": "path",
            "name": "organizationId",
            "required": true,
            "schema": {
              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
              "type": "string"
            },
            "style": "simple"
          },
          {
            "explode": false,
            "in": "path",
            "name": "groupId",
            "required": true,
            "schema": {
              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
              "type": "string"
            },
            "style": "simple"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CommitOrganizationGroupPolicyRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommitOrganizationGroupPolicyResponse"
                }
              }
            },
            "description": "OK"
          },
          "202": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PrincipalHistoryPreparationResponse"
                }
              }
            },
            "description": "The attempted operation rolled back. Retry the identical request to continue verification preparation."
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BillingErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionFailureResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "402": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaymentRequiredErrorResponse"
                }
              }
            },
            "description": "Payment Required"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BillingErrorResponse"
                }
              }
            },
            "description": "Forbidden"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BillingErrorResponse"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommitOrganizationGroupPolicyConflictResponse"
                }
              }
            },
            "description": "Conflict"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PrincipalHistoryPreparationFailureResponse"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-tearleads-runtime-refinements": [
          {
            "description": "a container response keyring is null exactly for container key epoch 1",
            "id": "response.organization-provisioning-container-keyring"
          },
          {
            "id": "response.principal-history-preparation-rollback",
            "description": "A 503 with code principal_history_preparation_unavailable requires committed:false; other 503 responses do not guarantee rollback."
          }
        ]
      }
    },
    "/organizations/{organizationId}/groups/{groupId}": {
      "delete": {
        "operationId": "organizations.groups.delete",
        "summary": "Delete an organization group",
        "description": "Deletes a group through a signed organization policy successor that drops it from the directory, leaving a tombstone so its id can never be reused. Only organization administrators may call it. A 202 asks for the identical request to be retried after preparation; a 503 with `committed: false` and code `principal_history_preparation_unavailable` proves nothing was written.",
        "tags": [
          "Organizations"
        ],
        "parameters": [
          {
            "explode": false,
            "in": "path",
            "name": "organizationId",
            "required": true,
            "schema": {
              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
              "type": "string"
            },
            "style": "simple"
          },
          {
            "explode": false,
            "in": "path",
            "name": "groupId",
            "required": true,
            "schema": {
              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
              "type": "string"
            },
            "style": "simple"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DeleteOrganizationGroupRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeleteOrganizationGroupResponse"
                }
              }
            },
            "description": "OK"
          },
          "202": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PrincipalHistoryPreparationResponse"
                }
              }
            },
            "description": "The attempted operation rolled back. Retry the identical request to continue verification preparation."
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionFailureResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "402": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaymentRequiredErrorResponse"
                }
              }
            },
            "description": "Payment Required"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Forbidden"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Conflict"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PrincipalHistoryPreparationFailureResponse"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-tearleads-runtime-refinements": [
          {
            "description": "a container response keyring is null exactly for container key epoch 1",
            "id": "response.organization-provisioning-container-keyring"
          },
          {
            "id": "response.principal-history-preparation-rollback",
            "description": "A 503 with code principal_history_preparation_unavailable requires committed:false; other 503 responses do not guarantee rollback."
          }
        ]
      }
    },
    "/organizations/{organizationId}/groups": {
      "post": {
        "operationId": "organizations.groups.create",
        "summary": "Create an organization group and advance its signed directory",
        "description": "Creates a group with its initial signed principal policy and, in the same transaction, the organization policy successor that adds it to the signed group directory. Only organization administrators may call it. A 202 asks for the identical request to be retried after preparation; a 503 with `committed: false` and code `principal_history_preparation_unavailable` proves nothing was written.",
        "tags": [
          "Organizations"
        ],
        "parameters": [
          {
            "explode": false,
            "in": "path",
            "name": "organizationId",
            "required": true,
            "schema": {
              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
              "type": "string"
            },
            "style": "simple"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateOrganizationGroupWithPolicyRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateOrganizationGroupResponse"
                }
              }
            },
            "description": "OK"
          },
          "202": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PrincipalHistoryPreparationResponse"
                }
              }
            },
            "description": "The attempted operation rolled back. Retry the identical request to continue verification preparation."
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionFailureResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "402": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaymentRequiredErrorResponse"
                }
              }
            },
            "description": "Payment Required"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Forbidden"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Conflict"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PrincipalHistoryPreparationFailureResponse"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-tearleads-runtime-refinements": [
          {
            "description": "a container response keyring is null exactly for container key epoch 1",
            "id": "response.organization-provisioning-container-keyring"
          },
          {
            "id": "response.principal-history-preparation-rollback",
            "description": "A 503 with code principal_history_preparation_unavailable requires committed:false; other 503 responses do not guarantee rollback."
          }
        ]
      }
    },
    "/organizations/{organizationId}/policy-history": {
      "get": {
        "operationId": "organizations.policyHistory.get",
        "summary": "Page organization policy history",
        "description": "Pages the organization's signed policy history up to an exact head, with public group policy snapshots, so clients can verify and display what changed and who signed it. Any organization member may call it. A 202 asks the client to retry the identical request after the server prepares that history.",
        "tags": [
          "Organizations"
        ],
        "parameters": [
          {
            "explode": false,
            "in": "path",
            "name": "organizationId",
            "required": true,
            "schema": {
              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
              "type": "string"
            },
            "style": "simple"
          },
          {
            "explode": true,
            "in": "query",
            "name": "stateHash",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "style": "form"
          },
          {
            "explode": true,
            "in": "query",
            "name": "beforeVersion",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 2,
              "maximum": 9007199254740991
            },
            "style": "form"
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrganizationPolicyHistoryResponse"
                }
              }
            },
            "description": "OK"
          },
          "202": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PrincipalHistoryPreparationResponse"
                }
              }
            },
            "description": "Accepted"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionFailureResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrganizationPresentationFailureResponse"
                }
              }
            },
            "description": "Forbidden"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrganizationPresentationFailureResponse"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Conflict"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PrincipalHistoryPreparationFailureResponse"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-tearleads-runtime-refinements": [
          {
            "id": "response.principal-history-preparation-rollback",
            "description": "A 503 with code principal_history_preparation_unavailable requires committed:false; other 503 responses do not guarantee rollback."
          }
        ]
      }
    },
    "/organizations/{organizationId}/profile": {
      "put": {
        "operationId": "organizations.profile.update",
        "summary": "Update the organization profile",
        "description": "Binds, or clears, the organization's encrypted profile document, which holds profile fields such as its name that the server cannot read. Only organization administrators may call it.",
        "tags": [
          "Organizations"
        ],
        "parameters": [
          {
            "explode": false,
            "in": "path",
            "name": "organizationId",
            "required": true,
            "schema": {
              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
              "type": "string"
            },
            "style": "simple"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateOrganizationProfileRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrganizationProfileResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionFailureResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "402": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaymentRequiredErrorResponse"
                }
              }
            },
            "description": "Payment Required"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Forbidden"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/organizations/{organizationId}/read-model": {
      "get": {
        "operationId": "organizations.readModel.get",
        "summary": "Reconcile the organization read model",
        "description": "Returns the organization read model: display and navigation data for the directory, groups, group memberships, grants, and organization policy. Without a cursor it returns an atomic snapshot; with one, only lanes changed since. Any organization member may call it; the read model is not authority, so clients still verify signed policies and manifests.",
        "tags": [
          "Organizations"
        ],
        "parameters": [
          {
            "explode": false,
            "in": "path",
            "name": "organizationId",
            "required": true,
            "schema": {
              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
              "type": "string"
            },
            "style": "simple"
          },
          {
            "explode": true,
            "in": "query",
            "name": "cursor",
            "required": false,
            "schema": {
              "type": "string"
            },
            "style": "form"
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrganizationReadModelResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrganizationReadModelFailureResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionFailureResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrganizationPresentationFailureResponse"
                }
              }
            },
            "description": "Forbidden"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrganizationPresentationFailureResponse"
                }
              }
            },
            "description": "Not Found"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-tearleads-runtime-refinements": [
          {
            "description": "read-model lanes match the response organization; grants and memberships are unambiguous; snapshot lanes are complete and contain no deletions",
            "id": "response.organization-read-model-consistency"
          }
        ]
      }
    },
    "/organizations/{organizationId}/roster/{userId}": {
      "put": {
        "operationId": "organizations.roster.update",
        "summary": "Bind an encrypted roster profile document",
        "description": "Binds a member's encrypted roster profile document to their organization roster entry. Members may bind their own profile; binding another member's requires organization administrator access.",
        "tags": [
          "Organizations"
        ],
        "parameters": [
          {
            "explode": false,
            "in": "path",
            "name": "organizationId",
            "required": true,
            "schema": {
              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
              "type": "string"
            },
            "style": "simple"
          },
          {
            "explode": false,
            "in": "path",
            "name": "userId",
            "required": true,
            "schema": {
              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
              "type": "string"
            },
            "style": "simple"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateOrganizationRosterEntryRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrganizationDirectoryUserResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionFailureResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "402": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaymentRequiredErrorResponse"
                }
              }
            },
            "description": "Payment Required"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Forbidden"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/organizations": {
      "post": {
        "operationId": "organizations.create",
        "summary": "Create an organization",
        "description": "Provisions an additional organization for the signed-in user, who becomes its founding administrator: reserved `Admins` and `Members` groups, root container, signed policies, and metadata documents in one transaction. It also creates the replacement for the caller's purged personal organization, which must use a fresh organization id.",
        "tags": [
          "Organizations"
        ],
        "parameters": [],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateOrganizationRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateOrganizationResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionFailureResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Forbidden"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Conflict"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-tearleads-runtime-refinements": [
          {
            "description": "inlineRekeyCommitId must be present exactly when containerRekeys is non-empty",
            "id": "request.inline-rekey-commit-marker"
          },
          {
            "description": "authorizingContainerPathRefs is required when outgoingUpdates is non-empty",
            "id": "request.authorizing-paths-for-writes"
          },
          {
            "description": "containerRekeys may be non-empty only when outgoingUpdates is non-empty",
            "id": "request.container-rekeys-require-write"
          },
          {
            "description": "outgoing update ids must be unique within the request",
            "id": "request.unique-outgoing-update-ids"
          },
          {
            "description": "a request carrying pullCursor must not contain outgoing updates, container rekeys, a content-key bundle, or authorizing paths",
            "id": "request.pull-continuation-read-only"
          },
          {
            "description": "historyMode \"raw\" must not be combined with outgoing updates, container rekeys, a content-key bundle, or authorizing paths",
            "id": "request.raw-history-read-only"
          },
          {
            "description": "historyMode \"raw\" requires localVersionVector to be null so the complete retained history is requested",
            "id": "request.raw-history-null-frontier"
          },
          {
            "description": "checkpointKind, checkpointPayloadKind, and sourceVersionVector must be absent together or form a rotation baseline",
            "id": "request.rotation-checkpoint-fields"
          },
          {
            "description": "each provisioned system-container metadata seed must contain exactly one outgoing update and no container rekeys",
            "id": "request.organization-provisioning-container-seed"
          },
          {
            "description": "each provisioned document seed must contain exactly one outgoing update and no container rekeys",
            "id": "request.organization-provisioning-document-seed"
          },
          {
            "description": "core and profile metadata update id arrays contain no duplicates",
            "id": "response.organization-provisioning-unique-update-ids"
          },
          {
            "description": "a container response keyring is null exactly for container key epoch 1",
            "id": "response.organization-provisioning-container-keyring"
          }
        ]
      }
    },
    "/principals/history": {
      "get": {
        "operationId": "principals.history.get",
        "summary": "Page projection policy history",
        "description": "Pages public signed policy snapshots, up to 32 predecessor states at a time, for a principal head cited by an object the caller can read. The opaque `grant` query value names that object and head, and every page rechecks current access to it. A 202 asks the client to retry the identical request after policy history is prepared.",
        "tags": [
          "Principals"
        ],
        "parameters": [
          {
            "explode": true,
            "in": "query",
            "name": "grant",
            "required": true,
            "schema": {
              "maxLength": 4096,
              "minLength": 1,
              "type": "string"
            },
            "style": "form"
          },
          {
            "explode": true,
            "in": "query",
            "name": "afterVersion",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            },
            "style": "form"
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PrincipalPolicySnapshotPageResponse"
                }
              }
            },
            "description": "OK"
          },
          "202": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PrincipalHistoryPreparationResponse"
                }
              }
            },
            "description": "Verification preparation is pending. Retry the identical authorized read."
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionFailureResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Forbidden"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Conflict"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/principals/{principalType}/{principalId}/policy": {
      "get": {
        "operationId": "principals.policy.get",
        "summary": "Get a principal policy bundle",
        "description": "Returns a page of a group or organization's signed principal policy chain with its current member envelopes, so the client can verify the chain and a member can unwrap the principal's key; a conditional read that names the still-current head gets a short unchanged reply instead. It is served only to callers who depend on it: active roster members, members of the principal, or holders of a grant whose path cites it. A 202 asks the client to retry the identical request after policy history is prepared.",
        "tags": [
          "Principals"
        ],
        "parameters": [
          {
            "explode": false,
            "in": "path",
            "name": "principalType",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "group",
                "organization"
              ]
            },
            "style": "simple"
          },
          {
            "explode": false,
            "in": "path",
            "name": "principalId",
            "required": true,
            "schema": {
              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
              "type": "string"
            },
            "style": "simple"
          },
          {
            "explode": true,
            "in": "query",
            "name": "afterVersion",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            },
            "style": "form"
          },
          {
            "explode": true,
            "in": "query",
            "name": "stateHash",
            "required": false,
            "schema": {
              "maxLength": 64,
              "minLength": 64,
              "pattern": "^[0-9a-f]+$",
              "type": "string"
            },
            "style": "form"
          },
          {
            "explode": true,
            "in": "query",
            "name": "ifVersion",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 9007199254740991
            },
            "style": "form"
          },
          {
            "explode": true,
            "in": "query",
            "name": "ifStateHash",
            "required": false,
            "schema": {
              "maxLength": 64,
              "minLength": 64,
              "pattern": "^[0-9a-f]+$",
              "type": "string"
            },
            "style": "form"
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PrincipalPolicyReadResponse"
                }
              }
            },
            "description": "OK"
          },
          "202": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PrincipalHistoryPreparationResponse"
                }
              }
            },
            "description": "The attempted operation rolled back. Retry the identical request to continue verification preparation."
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionFailureResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Forbidden"
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Conflict"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      },
      "put": {
        "operationId": "principals.policy.update",
        "summary": "Update a principal policy",
        "description": "Commits the organization's next signed principal policy and its member envelopes atomically; group policies change through the group policy commit route instead. It requires organization administrator authority, and a stale head returns 409. A 202 asks for the identical request to be retried after preparation, and only a 503 with `committed: false` and code `principal_history_preparation_unavailable` proves nothing was written.",
        "tags": [
          "Principals"
        ],
        "parameters": [
          {
            "explode": false,
            "in": "path",
            "name": "principalType",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "group",
                "organization"
              ]
            },
            "style": "simple"
          },
          {
            "explode": false,
            "in": "path",
            "name": "principalId",
            "required": true,
            "schema": {
              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
              "type": "string"
            },
            "style": "simple"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OrganizationPrincipalPolicyRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PrincipalPolicyMutationResponse"
                }
              }
            },
            "description": "OK"
          },
          "202": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PrincipalHistoryPreparationResponse"
                }
              }
            },
            "description": "The attempted operation rolled back. Retry the identical request to continue verification preparation."
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BillingErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionFailureResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "402": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaymentRequiredErrorResponse"
                }
              }
            },
            "description": "Payment Required"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BillingErrorResponse"
                }
              }
            },
            "description": "Forbidden"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BillingErrorResponse"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BillingErrorResponse"
                }
              }
            },
            "description": "Conflict"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PrincipalHistoryPreparationFailureResponse"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-tearleads-runtime-refinements": [
          {
            "description": "a container response keyring is null exactly for container key epoch 1",
            "id": "response.organization-provisioning-container-keyring"
          },
          {
            "id": "response.principal-history-preparation-rollback",
            "description": "A 503 with code principal_history_preparation_unavailable requires committed:false; other 503 responses do not guarantee rollback."
          }
        ]
      }
    },
    "/root/audit-events": {
      "get": {
        "operationId": "root.auditEvents.list",
        "summary": "Page recorded operator actions",
        "description": "Pages recorded root operator actions newest first, optionally only those involving one identity or organization. Only root operators may call it, and reading the trail is itself recorded.",
        "tags": [
          "Root operator"
        ],
        "parameters": [
          {
            "explode": true,
            "in": "query",
            "name": "cursor",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "style": "form"
          },
          {
            "explode": true,
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "maximum": 200,
              "minimum": 1,
              "type": "integer"
            },
            "style": "form"
          },
          {
            "explode": true,
            "in": "query",
            "name": "subjectId",
            "required": false,
            "schema": {
              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
              "type": "string"
            },
            "style": "form"
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RootAuditEventsResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionFailureResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Forbidden"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/root/identities/{userId}/organizations": {
      "get": {
        "operationId": "root.identities.organizations.list",
        "summary": "List an identity's organizations",
        "description": "Lists an identity's organizations with roster status, sync pause, seat holding, and billing standing. Only root operators may call it, and each request is recorded in the root audit trail.",
        "tags": [
          "Root operator"
        ],
        "parameters": [
          {
            "explode": false,
            "in": "path",
            "name": "userId",
            "required": true,
            "schema": {
              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
              "type": "string"
            },
            "style": "simple"
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RootIdentityOrganizationsResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionFailureResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Forbidden"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/root/identities/{userId}/suspension": {
      "delete": {
        "operationId": "root.identities.suspension.delete",
        "summary": "Lift an identity suspension",
        "description": "Lifts an identity's suspension so its devices can sign in again. Only root operators may call it, and each request is recorded in the root audit trail.",
        "tags": [
          "Root operator"
        ],
        "parameters": [
          {
            "explode": false,
            "in": "path",
            "name": "userId",
            "required": true,
            "schema": {
              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
              "type": "string"
            },
            "style": "simple"
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RootIdentitySuspensionResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionFailureResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Forbidden"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      },
      "put": {
        "operationId": "root.identities.suspension.put",
        "summary": "Suspend an identity",
        "description": "Suspends an identity: its sign-in is refused and every live session is revoked. Only root operators may call it; suspending another root operator returns 409, and every attempt is recorded in the root audit trail. A failed session sweep returns 500 and can be repeated.",
        "tags": [
          "Root operator"
        ],
        "parameters": [
          {
            "explode": false,
            "in": "path",
            "name": "userId",
            "required": true,
            "schema": {
              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
              "type": "string"
            },
            "style": "simple"
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RootIdentitySuspensionResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionFailureResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Forbidden"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Conflict"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/root/identities/{userId}": {
      "get": {
        "operationId": "root.identities.get",
        "summary": "Get an identity",
        "description": "Returns one identity with its last activity and live sessions. Only root operators may call it, and each request is recorded in the root audit trail.",
        "tags": [
          "Root operator"
        ],
        "parameters": [
          {
            "explode": false,
            "in": "path",
            "name": "userId",
            "required": true,
            "schema": {
              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
              "type": "string"
            },
            "style": "simple"
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RootIdentityDetailResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionFailureResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Forbidden"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/root/identities": {
      "get": {
        "operationId": "root.identities.list",
        "summary": "List identities",
        "description": "Pages every registered identity, newest first, optionally filtered by signing key fingerprint prefix, exact user id, or root operators only. Only root operators may call it, and each request is recorded in the root audit trail.",
        "tags": [
          "Root operator"
        ],
        "parameters": [
          {
            "explode": true,
            "in": "query",
            "name": "cursor",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "style": "form"
          },
          {
            "explode": true,
            "in": "query",
            "name": "fingerprint",
            "required": false,
            "schema": {
              "maxLength": 64,
              "minLength": 8,
              "pattern": "^[0-9a-f]+$",
              "type": "string"
            },
            "style": "form"
          },
          {
            "explode": true,
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "maximum": 200,
              "minimum": 1,
              "type": "integer"
            },
            "style": "form"
          },
          {
            "explode": true,
            "in": "query",
            "name": "rootOnly",
            "required": false,
            "schema": {
              "type": "boolean"
            },
            "style": "form"
          },
          {
            "explode": true,
            "in": "query",
            "name": "userId",
            "required": false,
            "schema": {
              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
              "type": "string"
            },
            "style": "form"
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RootIdentitiesResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionFailureResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Forbidden"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/root/organizations/{organizationId}/data-usage": {
      "get": {
        "operationId": "root.organizations.dataUsage.get",
        "summary": "Get an organization's data usage",
        "description": "Returns an organization's stored document and blob bytes by category. Only root operators may call it, and each request is recorded in the root audit trail.",
        "tags": [
          "Root operator"
        ],
        "parameters": [
          {
            "explode": false,
            "in": "path",
            "name": "organizationId",
            "required": true,
            "schema": {
              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
              "type": "string"
            },
            "style": "simple"
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrganizationDataUsageResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionFailureResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Forbidden"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-tearleads-runtime-refinements": [
          {
            "description": "totalByteLength equals the sum of document and blob byte lengths",
            "id": "response.organization-data-usage-total-byte-length"
          },
          {
            "description": "the document usage breakdown contains each document category exactly once",
            "id": "response.organization-data-usage-document-categories"
          },
          {
            "description": "document usage totals equal the sums of the category breakdown",
            "id": "response.organization-data-usage-document-totals"
          }
        ]
      }
    },
    "/root/organizations/{organizationId}/identities": {
      "get": {
        "operationId": "root.organizations.identities.list",
        "summary": "List an organization's identities",
        "description": "Pages an organization's roster identities, disabled entries included, with each member's sync pause and seat holding. Only root operators may call it, and each request is recorded in the root audit trail.",
        "tags": [
          "Root operator"
        ],
        "parameters": [
          {
            "explode": false,
            "in": "path",
            "name": "organizationId",
            "required": true,
            "schema": {
              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
              "type": "string"
            },
            "style": "simple"
          },
          {
            "explode": true,
            "in": "query",
            "name": "cursor",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "style": "form"
          },
          {
            "explode": true,
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "maximum": 200,
              "minimum": 1,
              "type": "integer"
            },
            "style": "form"
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RootOrganizationIdentitiesResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionFailureResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Forbidden"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/root/organizations/{organizationId}/revenuecat-events": {
      "get": {
        "operationId": "root.organizations.revenuecatEvents.list",
        "summary": "Page an organization's RevenueCat deliveries",
        "description": "Pages an organization's stored RevenueCat webhook deliveries, newest first by event time, whatever their outcome, including transfers that moved a purchase away from it. Only root operators may call it, and each request is recorded in the root audit trail.",
        "tags": [
          "Root operator"
        ],
        "parameters": [
          {
            "explode": false,
            "in": "path",
            "name": "organizationId",
            "required": true,
            "schema": {
              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
              "type": "string"
            },
            "style": "simple"
          },
          {
            "explode": true,
            "in": "query",
            "name": "cursor",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "style": "form"
          },
          {
            "explode": true,
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "maximum": 200,
              "minimum": 1,
              "type": "integer"
            },
            "style": "form"
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RootOrganizationRevenuecatEventsResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionFailureResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Forbidden"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/root/organizations/{organizationId}": {
      "get": {
        "operationId": "root.organizations.get",
        "summary": "Get an organization",
        "description": "Returns an organization's group bindings, roster and open-seat counts, stored billing and purge progress, Stripe binding, and its latest 50 billing events. Only root operators may call it, and each request is recorded in the root audit trail.",
        "tags": [
          "Root operator"
        ],
        "parameters": [
          {
            "explode": false,
            "in": "path",
            "name": "organizationId",
            "required": true,
            "schema": {
              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
              "type": "string"
            },
            "style": "simple"
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RootOrganizationDetailResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionFailureResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Forbidden"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/root/organizations": {
      "get": {
        "operationId": "root.organizations.list",
        "summary": "List organizations",
        "description": "Pages every organization, newest first, optionally narrowed to one exact organization id; names are encrypted, so there is no name search. Only root operators may call it, and each request is recorded in the root audit trail.",
        "tags": [
          "Root operator"
        ],
        "parameters": [
          {
            "explode": true,
            "in": "query",
            "name": "cursor",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "style": "form"
          },
          {
            "explode": true,
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "maximum": 200,
              "minimum": 1,
              "type": "integer"
            },
            "style": "form"
          },
          {
            "explode": true,
            "in": "query",
            "name": "search",
            "required": false,
            "schema": {
              "maxLength": 200,
              "type": "string"
            },
            "style": "form"
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RootOrganizationsResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionFailureResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Forbidden"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/root/reports/data-usage": {
      "get": {
        "operationId": "root.reports.dataUsage.list",
        "summary": "Page data usage by organization",
        "description": "Pages stored data usage by organization, newest organizations first, with the same exact-id filter as the organization list. Only root operators may call it, and each request is recorded in the root audit trail.",
        "tags": [
          "Root operator"
        ],
        "parameters": [
          {
            "explode": true,
            "in": "query",
            "name": "cursor",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "style": "form"
          },
          {
            "explode": true,
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "maximum": 200,
              "minimum": 1,
              "type": "integer"
            },
            "style": "form"
          },
          {
            "explode": true,
            "in": "query",
            "name": "search",
            "required": false,
            "schema": {
              "maxLength": 200,
              "type": "string"
            },
            "style": "form"
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RootDataUsageReportResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionFailureResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Forbidden"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-tearleads-runtime-refinements": [
          {
            "description": "totalByteLength equals the sum of document and blob byte lengths",
            "id": "response.organization-data-usage-total-byte-length"
          },
          {
            "description": "the document usage breakdown contains each document category exactly once",
            "id": "response.organization-data-usage-document-categories"
          },
          {
            "description": "document usage totals equal the sums of the category breakdown",
            "id": "response.organization-data-usage-document-totals"
          }
        ]
      }
    },
    "/root/reports/ops-health": {
      "get": {
        "operationId": "root.reports.opsHealth.get",
        "summary": "Report billing maintenance trouble",
        "description": "Reports billing maintenance trouble across organizations: failing or overdue Stripe seat syncs, failed or overdue trial expiries, overdue purges, and trials and purges coming due. Only root operators may call it, and each request is recorded in the root audit trail.",
        "tags": [
          "Root operator"
        ],
        "parameters": [],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RootOpsHealthReportResponse"
                }
              }
            },
            "description": "OK"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionFailureResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Forbidden"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/root/reports/revenuecat-events": {
      "get": {
        "operationId": "root.reports.revenuecatEvents.list",
        "summary": "Page unmatched or ignored RevenueCat deliveries",
        "description": "Pages RevenueCat deliveries across all organizations that matched no organization or that the handler ignored. Only root operators may call it, and each request is recorded in the root audit trail.",
        "tags": [
          "Root operator"
        ],
        "parameters": [
          {
            "explode": true,
            "in": "query",
            "name": "cursor",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "style": "form"
          },
          {
            "explode": true,
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "maximum": 200,
              "minimum": 1,
              "type": "integer"
            },
            "style": "form"
          },
          {
            "explode": true,
            "in": "query",
            "name": "disposition",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "unmatched",
                "ignored",
                "both"
              ]
            },
            "style": "form"
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RootRevenuecatEventsReportResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionFailureResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Forbidden"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    }
  }
}
