openapi: 3.1.0
info:
  title: VERA API
  version: 3.0.0
  description: >
    VERA control-plane API (Prepaire) for LIM work orders, instrument evidence custody,
    software assurance, validation, pipeline execution, DRS access, and governed
    knowledge-graph release. A successful HTTP response is not a clinical finding.
servers:
  - url: https://vera.example.com/api/v1
security:
  - bearerAuth: []
tags:
  - name: Platform
  - name: LIM
  - name: Custody
  - name: Software
  - name: Validation
  - name: Pipelines
  - name: Reference Stacks
  - name: Execution
  - name: Release
  - name: DRS
paths:
  /health:
    get:
      tags: [Platform]
      security: []
      operationId: getHealth
      responses:
        "200":
          description: Non-secret configuration health, the version the node runs, and its governed configuration loaded.
          content:
            application/json:
              schema: { $ref: "#/components/schemas/PlatformHealth" }
        "503":
          description: The copy is not healthy; problems names why (for example the governed configuration could not be read, and checks.governedConfigUnreadable names the files).
          content:
            application/json:
              schema: { $ref: "#/components/schemas/PlatformHealth" }
  /instruments:
    get:
      tags: [Platform]
      operationId: listInstruments
      parameters:
        - { name: role, in: query, schema: { type: string } }
        - { name: status, in: query, schema: { type: string } }
        - { name: q, in: query, schema: { type: string } }
      responses:
        "200":
          description: Governed instrument registry baseline.
          content:
            application/json:
              schema: { $ref: "#/components/schemas/InstrumentList" }
        "401": { $ref: "#/components/responses/Error" }
  /instruments/{assetId}/activation-attestations:
    get:
      tags: [Platform]
      operationId: listInstrumentActivationAttestations
      parameters:
        - name: assetId
          in: path
          required: true
          schema: { type: string }
      responses:
        "200": { description: Append-only quality and laboratory-director activation history. }
    post:
      tags: [Platform]
      operationId: recordInstrumentActivationAttestation
      description: >
        Records one authority's approval or revocation for the exact physical instrument,
        extraction profile, assay, and protocol version. Quality and laboratory-director
        approvals must be current and made by different identities before a run can start.
      parameters:
        - name: assetId
          in: path
          required: true
          schema: { type: string }
      requestBody:
        required: true
        content:
          application/json:
            schema: { $ref: "#/components/schemas/InstrumentActivationAttestation" }
      responses:
        "201": { description: Append-only activation attestation recorded. }
        "403": { $ref: "#/components/responses/Error" }
        "409": { $ref: "#/components/responses/Error" }
  /lims/events:
    post:
      tags: [LIM]
      operationId: acceptLimsEvent
      description: Requires the lims_service role. eventId is the idempotency key.
      requestBody:
        required: true
        content:
          application/json:
            schema: { $ref: "#/components/schemas/LimsEvent" }
      responses:
        "202":
          description: LIM event accepted.
          content:
            application/json:
              schema:
                type: object
                required: [contract, eventId, runId, state]
                properties:
                  contract: { const: PREPAIRE-LIMS-EVENT-RECEIPT@1.0.0 }
                  eventId: { type: string, format: uuid }
                  runId: { type: string }
                  state: { type: string }
        "409": { $ref: "#/components/responses/Error" }
        "422": { $ref: "#/components/responses/Error" }
  /ingestion-runs:
    post:
      tags: [Custody]
      operationId: createIngestionRun
      parameters:
        - $ref: "#/components/parameters/IdempotencyKey"
      requestBody:
        required: true
        content:
          application/json:
            schema: { $ref: "#/components/schemas/CreateRun" }
      responses:
        "201":
          description: Governed run created.
        "409": { $ref: "#/components/responses/Error" }
  /ingestion-runs/{runId}:
    get:
      tags: [Custody]
      operationId: getIngestionRun
      parameters:
        - $ref: "#/components/parameters/RunId"
      responses:
        "200": { description: Full run state and provenance. }
        "404": { $ref: "#/components/responses/Error" }
  /ingestion-runs/{runId}/artifacts:
    post:
      tags: [Custody]
      operationId: initiateArtifactUpload
      parameters:
        - $ref: "#/components/parameters/RunId"
      requestBody:
        required: true
        content:
          application/json:
            schema: { $ref: "#/components/schemas/InitiateArtifact" }
      responses:
        "201":
          description: Multipart custody upload initiated.
          content:
            application/json:
              schema: { $ref: "#/components/schemas/UploadInitiation" }
        "409": { $ref: "#/components/responses/Error" }
  /ingestion-runs/{runId}/capture-close:
    post:
      tags: [Custody]
      operationId: completeCaptureFileList
      summary: Declare the run's file list complete.
      description: >-
        States that every file of the capture has been declared. A run fed file by file stays open until this call and
        becomes CAPTURED only once every declared file is verified. Refused with CAPTURE_FILES_MISSING while a declared
        file's upload was abandoned and the file was neither sent again (declared under the same name after it, or
        held under that name with the same SHA-256) nor named in leftOut,
        with CAPTURE_EMPTY when no declared file stands, and with CAPTURE_FILE_COUNT_MISMATCH when expectedFiles
        differs from the number of files the run holds.
      parameters:
        - $ref: "#/components/parameters/RunId"
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: false
              properties:
                leftOut:
                  type: array
                  description: Artifact ids of declared files whose upload was abandoned and which are left out of the run. Accepted from instrument_operator, lab_scientist or platform_admin only.
                  items: { type: string }
                expectedFiles:
                  type: integer
                  minimum: 1
                  description: The number of files the caller's own list holds.
      responses:
        "200": { description: The file list is complete; closed is true when this call made the run CAPTURED. }
        "403": { $ref: "#/components/responses/Error" }
        "409": { $ref: "#/components/responses/Error" }
        "422": { $ref: "#/components/responses/Error" }
  /artifacts/{artifactId}/parts:
    post:
      tags: [Custody]
      operationId: presignArtifactParts
      parameters:
        - $ref: "#/components/parameters/ArtifactId"
      requestBody:
        required: true
        content:
          application/json:
            schema: { $ref: "#/components/schemas/PresignParts" }
      responses:
        "200": { description: Short-lived checksum-bound part URLs. }
        "409": { $ref: "#/components/responses/Error" }
  /artifacts/{artifactId}/complete:
    post:
      tags: [Custody]
      operationId: completeArtifactUpload
      parameters:
        - $ref: "#/components/parameters/ArtifactId"
      requestBody:
        required: true
        content:
          application/json:
            schema: { $ref: "#/components/schemas/CompleteUpload" }
      responses:
        "202":
          description: Object is retained but remains non-releaseable until independent full-object verification.
        "409": { $ref: "#/components/responses/Error" }
  /executions/{stepId}/artifacts:
    post:
      tags: [Execution, Custody]
      operationId: initiateExecutionOutputUpload
      description: >
        Registers one derived output from an actively running pipeline step. The caller
        must use an approved workload identity; the class must be declared by the
        approved stage and every parent must be verified evidence from the same run.
      parameters:
        - name: stepId
          in: path
          required: true
          schema: { type: string, pattern: "^STEP-" }
      requestBody:
        required: true
        content:
          application/json:
            schema: { $ref: "#/components/schemas/InitiateExecutionArtifact" }
      responses:
        "201":
          description: Checksum-bound multipart output upload initiated.
          content:
            application/json:
              schema: { $ref: "#/components/schemas/UploadInitiation" }
        "409": { $ref: "#/components/responses/Error" }
        "422": { $ref: "#/components/responses/Error" }
  /ingestion-runs/{runId}/submit:
    post:
      tags: [Pipelines]
      operationId: submitRun
      parameters:
        - $ref: "#/components/parameters/RunId"
      responses:
        "202": { description: Approved digest-pinned pipeline queued. }
        "409": { $ref: "#/components/responses/Error" }
  /ingestion-runs/{runId}/release:
    post:
      tags: [Release]
      operationId: releaseRunToKnowledgeGraph
      description: >-
        An independent quality manager or laboratory director releases a run in REVIEW_REQUIRED. A typed bundle is reconciled to the
        governed run and checked by typedReleaseFailures; 409 KG_BUNDLE_RECONCILIATION_FAILED lists every failure,
        including a protein observation (PREPAIRE-KG-SCHEMA 1.1.0) of an Olink lane that config/vera/release-lanes.v1.json
        keeps closed. Every Olink lane ships closed until a decision record opens it.
      parameters:
        - $ref: "#/components/parameters/RunId"
      responses:
        "201": { description: Evidence bundle released by an authorized independent reviewer. }
        "409": { $ref: "#/components/responses/Error" }
  /releases/{releaseId}/revoke:
    post:
      tags: [Release]
      operationId: revokeKnowledgeGraphRelease
      description: >-
        A quality manager or the laboratory director revokes an approved release. The signed identity must be scoped to
        this node, as for the release (matching vera_node_id and vera_jurisdiction claims): 403 NODE_SCOPE_REQUIRED
        otherwise, 503 NODE_SCOPE_NOT_CONFIGURED when the copy names no node, before the body or any record is read.
      parameters:
        - name: releaseId
          in: path
          required: true
          schema: { type: string, pattern: "^REL-" }
      requestBody:
        required: true
        content:
          application/json:
            schema: { $ref: "#/components/schemas/RevokeRelease" }
      responses:
        "201": { description: Append-only revocation record created and run blocked from further use. }
        "403": { $ref: "#/components/responses/Error" }
        "404": { $ref: "#/components/responses/Error" }
        "409": { $ref: "#/components/responses/Error" }
  /software/packages:
    get:
      tags: [Software]
      operationId: listSoftwarePackages
      responses:
        "200": { description: Governed package registry. }
    post:
      tags: [Software]
      operationId: createSoftwarePackage
      parameters:
        - $ref: "#/components/parameters/IdempotencyKey"
      requestBody:
        required: true
        content:
          application/json:
            schema: { $ref: "#/components/schemas/CreateSoftwarePackage" }
      responses:
        "201": { description: Draft package identity created. }
  /software/packages/{packageKey}/approvals:
    post:
      tags: [Software]
      operationId: attestPackageApproval
      parameters:
        - $ref: "#/components/parameters/PackageKey"
      requestBody:
        required: true
        content:
          application/json:
            schema: { $ref: "#/components/schemas/PackageApproval" }
      responses:
        "201": { description: Append-only legal or clinical-scope approval recorded. }
  /software/packages/{packageKey}/source-bundles:
    post:
      tags: [Software]
      operationId: initiateSoftwareSourceUpload
      parameters:
        - $ref: "#/components/parameters/PackageKey"
      requestBody:
        required: true
        content:
          application/json:
            schema: { $ref: "#/components/schemas/InitiateSoftwareBundle" }
      responses:
        "201": { description: Restricted source-bundle upload initiated. }
        "409": { $ref: "#/components/responses/Error" }
  /software/source-bundles/{bundleId}:
    get:
      tags: [Software]
      operationId: getSoftwareSourceBundle
      parameters:
        - $ref: "#/components/parameters/BundleId"
      responses:
        "200": { description: Custody and verification state for a source bundle. }
  /software/source-bundles/{bundleId}/parts:
    post:
      tags: [Software]
      operationId: presignSoftwareSourceParts
      parameters:
        - $ref: "#/components/parameters/BundleId"
      requestBody:
        required: true
        content:
          application/json:
            schema: { $ref: "#/components/schemas/PresignParts" }
      responses:
        "200": { description: Short-lived checksum-bound part URLs. }
  /software/source-bundles/{bundleId}/complete:
    post:
      tags: [Software]
      operationId: completeSoftwareSourceUpload
      parameters:
        - $ref: "#/components/parameters/BundleId"
      requestBody:
        required: true
        content:
          application/json:
            schema: { $ref: "#/components/schemas/CompleteUpload" }
      responses:
        "202": { description: Source bundle queued for independent full-object verification. }
  /software/build-requests:
    post:
      tags: [Software]
      operationId: requestIsolatedSoftwareBuild
      requestBody:
        required: true
        content:
          application/json:
            schema: { $ref: "#/components/schemas/SoftwareBuildRequest" }
      responses:
        "202": { description: Isolated GitLab build plane triggered. }
        "409": { $ref: "#/components/responses/Error" }
  /software/build-requests/{buildRequestId}/complete:
    post:
      tags: [Software]
      operationId: completeSoftwareBuildRequest
      parameters:
        - name: buildRequestId
          in: path
          required: true
          schema: { type: string }
      responses:
        "201": { description: Build registered in pending-validation state. }
  /software/builds:
    get:
      tags: [Software]
      operationId: listSoftwareBuilds
      responses:
        "200": { description: Immutable build registry. }
    post:
      tags: [Software]
      operationId: registerExternalSoftwareBuild
      responses:
        "201": { description: Build registered in pending-validation state. }
  /software/builds/{buildId}/gate-attestations:
    post:
      tags: [Software, Validation]
      operationId: attestSoftwareGate
      parameters:
        - name: buildId
          in: path
          required: true
          schema: { type: string, format: uuid }
      requestBody:
        required: true
        content:
          application/json:
            schema: { $ref: "#/components/schemas/GateAttestation" }
      responses:
        "201": { description: Append-only gate attestation recorded. }
  /validation/campaigns:
    post:
      tags: [Validation]
      operationId: createValidationCampaign
      responses:
        "201": { description: Validation campaign opened. }
  /validation/campaigns/{campaignId}/trials:
    post:
      tags: [Validation]
      operationId: recordValidationTrial
      parameters:
        - name: campaignId
          in: path
          required: true
          schema: { type: string, format: uuid }
      responses:
        "201": { description: Append-only weighted trial recorded. }
  /validation/campaigns/{campaignId}/decision:
    post:
      tags: [Validation]
      operationId: decideValidationCampaign
      parameters:
        - name: campaignId
          in: path
          required: true
          schema: { type: string, format: uuid }
      responses:
        "201": { description: Versioned Bayesian evidence decision recorded. }
  /pipelines:
    get:
      tags: [Pipelines]
      operationId: listPipelineDefinitions
      responses:
        "200": { description: Pipeline definition registry. }
    post:
      tags: [Pipelines]
      operationId: createPipelineDefinition
      responses:
        "201": { description: Inactive digest-pinned definition created. }
  /reference-stacks:
    get:
      tags: [Reference Stacks]
      operationId: listOmicsReferenceStacks
      description: >
        Returns governed analytical candidate stacks. These are not executable pipeline
        definitions and do not imply that any software, model, database, or assay is approved.
      parameters:
        - name: modality
          in: query
          schema: { type: string }
        - name: status
          in: query
          schema: { type: string }
      responses:
        "200":
          description: Governed reference-stack registry.
          content:
            application/json:
              schema: { $ref: "#/components/schemas/OmicsReferenceStackList" }
        "401": { $ref: "#/components/responses/Error" }
  /pipelines/{pipelineId}/approve:
    post:
      tags: [Pipelines]
      operationId: approvePipelineDefinition
      parameters:
        - name: pipelineId
          in: path
          required: true
          schema: { type: string, format: uuid }
      responses:
        "200": { description: Independently approved pipeline activated. }
  /drs/objects/{drsId}:
    get:
      tags: [DRS]
      operationId: getDrsObject
      parameters:
        - name: drsId
          in: path
          required: true
          schema: { type: string }
      responses:
        "200": { description: "GA4GH DRS-compatible verified-object metadata. An artifact of an Olink run that may not leave VERA (Olink Source Data, an Olink file not classified as final output, the plate layout) lists no access method." }
        "403": { description: "ROLE_REQUIRED: the record names the artifact's run, so it answers the run's readers and the artifact's downloaders only (src/lib/lab/run-roles.ts DRS_OBJECT_READERS)." }
  /drs/objects/{drsId}/access/authenticated-download:
    get:
      tags: [DRS]
      operationId: getDrsAccessUrl
      parameters:
        - name: drsId
          in: path
          required: true
          schema: { type: string }
      responses:
        "200": { description: Audited five-minute version-bound access URL. }
        "403": { description: "OLINK_SOURCE_DATA_NO_EGRESS, OLINK_EGRESS_COLUMNS_ONLY or OLINK_PLATE_LAYOUT_NO_EGRESS: the Olink Source Data quarantine (Olink GTC §5.4) keeps this artifact inside VERA. Audited with the code only." }
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: OIDC JWT verified by issuer, audience, signature, algorithm, expiry, and role claims.
  parameters:
    IdempotencyKey:
      name: Idempotency-Key
      in: header
      required: true
      schema: { type: string, minLength: 16, maxLength: 200 }
    RunId:
      name: runId
      in: path
      required: true
      schema: { type: string, pattern: "^RUN-" }
    ArtifactId:
      name: artifactId
      in: path
      required: true
      schema: { type: string, pattern: "^ART-" }
    PackageKey:
      name: packageKey
      in: path
      required: true
      schema: { type: string }
    BundleId:
      name: bundleId
      in: path
      required: true
      schema: { type: string, pattern: "^SRC-" }
  responses:
    Error:
      description: Fail-closed error.
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/Error"
  schemas:
    Error:
      type: object
      required: [error]
      properties:
        error:
          type: object
          required: [code, message, requestId]
          properties:
            code: { type: string }
            message: { type: string }
            requestId: { type: string }
            detail: {}
    PlatformHealth:
      type: object
      description: >-
        Every version up to 1.3.0 is additive; the changelog in src/lib/health-contract.ts says what each added. 1.1.0:
        build and the governed configuration check. 1.2.0: mode, models, checks.checkout and problems (later under
        1.2.0: the kept keys' sources and fingerprints, and the evidence retention). 1.3.0: validation,
        checks.certificates and the runtimeRole problem. 1.4.0: anonymous callers: validation without keysMissing,
        with keysMissingCount (R13). For any caller not signed in with a full-detail role, validation is
        PREPAIRE-VERA-PROCESS-FACTS-SUMMARY@1.0.0 (no keysMissing, configDigest or clinicalTablesDigest; with
        keysMissingCount) and checks.certificates is replaced by checks.certificateStates (a count per state, no
        setting names). A full-detail sign-in gets the 1.3.0 fields unchanged. 1.5.0: region, which region the copy
        was built for (additive, the same for every caller).
      required: [contract, service, status, build, region, mode, checks, validation, problems, timestamp]
      properties:
        contract: { const: PREPAIRE-PLATFORM-HEALTH@1.5.0 }
        service: { type: string }
        status: { enum: [configured, read_only] }
        build:
          description: The commit and numbered release (vera-YYYY.MM.DD-n) the node's build was made from; null when the build did not record them.
          type: object
          required: [commit, commitSource, tag, releaseCommit, builtAt, label]
          properties:
            commit: { type: [string, "null"], pattern: "^[0-9a-f]{40}$" }
            commitSource: { enum: [git, VERA_SOURCE_COMMIT, CI_COMMIT_SHA, null] }
            tag: { type: [string, "null"], pattern: "^vera-[0-9]{4}\\.[0-9]{2}\\.[0-9]{2}-[0-9]+$" }
            releaseCommit: { type: [string, "null"], pattern: "^[0-9a-f]{40}$" }
            builtAt: { type: [string, "null"], format: date-time }
            label: { type: string, description: "The version line the sidebar shows, e.g. VERA 2026.11.13-1 · 2bc27ac." }
        region:
          description: Which region the copy was built for (1.5.0), as its region record states it. A copy is one region from the day its image is built.
          type: object
          required: [regionKey, version, digest]
          properties:
            regionKey: { type: string, pattern: "^[a-z]{2}$", description: "The region's key, ISO 3166-1 alpha-2 in lower case: ae, us." }
            version: { type: string, pattern: "^[0-9]+\\.[0-9]+\\.[0-9]+$", description: The version of the region record. }
            digest: { type: string, pattern: "^[a-f0-9]{64}$", description: The SHA-256 of the region record's canonical JSON. }
        mode:
          description: What the copy is, whether VERA_MODE declared it, and whether its pages use a database (1.2.0).
          type: object
          required: [name, declared, databaseUsed]
          properties:
            name: { enum: [open_demonstration, operational, invalid] }
            declared: { type: boolean }
            databaseUsed: { type: boolean }
            problem: { type: string }
        models:
          description: The frontier models' readiness, present only when the vera-models gateway answers (1.2.0).
          type: object
        checks:
          type: object
          properties:
            governedConfig: { enum: [loaded, unreadable] }
            governedConfigUnreadable: { type: array, items: { type: string } }
            checkout: { enum: [current, stale, not_checked], description: The build against its checkout at start (1.2.0). }
            evidenceRetentionDays: { type: integer, description: The evidence bucket's lock in days (under 1.2.0). }
            certificates: { type: object, description: "How long each certificate VERA holds stays valid, by setting: state, days left, end date (1.3.0; from 1.4.0 for a full-detail sign-in only)." }
            certificateStates: { type: object, additionalProperties: { type: integer }, description: "How many certificates are in each state, no setting names (1.4.0, callers without a full-detail sign-in)." }
        validation:
          description: >-
            What the platform runs as, for the installation qualification: PREPAIRE-VERA-PROCESS-FACTS@1.0.0 for a
            full-detail sign-in (1.3.0), PREPAIRE-VERA-PROCESS-FACTS-SUMMARY@1.0.0 for anyone else (1.4.0). Names,
            digests and counts only.
          type: object
        problems:
          description: Why the copy is not healthy, in words; empty when healthy (1.2.0).
          type: array
          items: { type: string }
        timestamp: { type: string, format: date-time }
    InstrumentList:
      type: object
      required: [contract, registryContract, registrySourceSha256, count, items]
      properties:
        contract: { const: PREPAIRE-INSTRUMENT-LIST@3.0.0 }
        registryContract: { type: string }
        registrySourceSha256: { type: string, pattern: "^[a-f0-9]{64}$" }
        count: { type: integer }
        items: { type: array, items: { type: object } }
    OmicsReferenceStackList:
      type: object
      required: [contract, registryContract, generatedOn, equipmentBaseline, selectionPolicy, count, items]
      properties:
        contract: { const: PREPAIRE-OMICS-REFERENCE-STACK-LIST@1.0.0 }
        registryContract: { const: PREPAIRE-OMICS-REFERENCE-STACK-REGISTRY@1.0.0 }
        generatedOn: { type: string }
        equipmentBaseline:
          type: object
          description: Checksum-bound reconciliation of the AXIOM equipment workbook, analysis decision record, and owner-confirmed additions.
        selectionPolicy: { type: object }
        count: { type: integer, minimum: 0 }
        items: { type: array, items: { type: object } }
    InstrumentActivationAttestation:
      type: object
      additionalProperties: false
      required: [authority, state, assayProtocol, assayProtocolVersion, evidenceUri, evidenceSha256, rationale]
      properties:
        authority: { enum: [QUALITY, LAB_DIRECTOR] }
        state: { enum: [APPROVED, REVOKED] }
        assayProtocol: { type: string }
        assayProtocolVersion: { type: string }
        evidenceUri: { type: string, format: uri }
        evidenceSha256: { type: string, pattern: "^[a-fA-F0-9]{64}$" }
        rationale: { type: string, minLength: 20, maxLength: 4000 }
    RevokeRelease:
      type: object
      additionalProperties: false
      required: [reason, evidenceUri, evidenceSha256]
      properties:
        reason: { type: string, minLength: 20, maxLength: 4000 }
        evidenceUri: { type: string, format: uri }
        evidenceSha256: { type: string, pattern: "^[a-fA-F0-9]{64}$" }
    LimsEvent:
      type: object
      additionalProperties: false
      required:
        - contract
        - eventId
        - eventType
        - sourceSystem
        - correlationId
        - occurredAt
        - instrumentAssetId
        - sampleRef
        - assayProtocol
        - assayProtocolVersion
      properties:
        contract: { const: PREPAIRE-LIMS-EVENT@1.0.0 }
        eventId: { type: string, format: uuid }
        eventType: { enum: [RUN_READY, RUN_CANCELLED, SAMPLE_QUARANTINED] }
        sourceSystem: { type: string }
        correlationId: { type: string }
        occurredAt: { type: string, format: date-time }
        instrumentAssetId: { type: string }
        sampleRef: { type: string }
        accessionRef: { type: string }
        assayProtocol: { type: string }
        assayProtocolVersion: { type: string }
        metadata: { type: object }
    CreateRun:
      type: object
      required: [instrumentAssetId, sampleRef, assayProtocol, assayProtocolVersion]
      properties:
        instrumentAssetId: { type: string }
        sampleRef: { type: string }
        accessionRef: { type: string }
        assayProtocol: { type: string }
        assayProtocolVersion: { type: string }
        sourceStartedAt: { type: string, format: date-time }
        metadata: { type: object }
    InitiateArtifact:
      type: object
      required: [artifactClass, filename, mediaType, format, sizeBytes, sha256]
      properties:
        artifactClass:
          enum: [NATIVE_RAW, OPEN_DERIVATIVE, QC, NORMALIZED, DERIVED, REPORT, MANIFEST, AUDIT]
        filename: { type: string }
        mediaType: { type: string }
        format: { type: string }
        sizeBytes: { oneOf: [{ type: integer }, { type: string, pattern: "^[0-9]+$" }] }
        sha256: { type: string, pattern: "^[a-fA-F0-9]{64}$" }
        nativeSource: { type: boolean, default: false }
        sourceArtifactIds:
          type: array
          maxItems: 100
          items: { type: string }
    InitiateExecutionArtifact:
      type: object
      additionalProperties: false
      required: [outputKey, artifactClass, filename, mediaType, format, sizeBytes, sha256, sourceArtifactIds]
      properties:
        outputKey:
          type: string
          pattern: "^[a-zA-Z0-9][a-zA-Z0-9._-]{0,199}$"
          description: Stable producer-assigned key used to make output registration idempotent within one step.
        artifactClass:
          enum: [OPEN_DERIVATIVE, QC, NORMALIZED, DERIVED, REPORT]
        filename: { type: string }
        mediaType: { type: string }
        format: { type: string }
        sizeBytes: { oneOf: [{ type: integer }, { type: string, pattern: "^[0-9]+$" }] }
        sha256: { type: string, pattern: "^[a-fA-F0-9]{64}$" }
        sourceArtifactIds:
          type: array
          minItems: 1
          maxItems: 100
          uniqueItems: true
          items: { type: string, pattern: "^ART-" }
    UploadInitiation:
      type: object
      required: [contract, uploadId, partSizeBytes]
      properties:
        contract: { type: string }
        artifactId: { type: string }
        bundleId: { type: string }
        uploadId: { type: string }
        partSizeBytes: { type: integer }
        partsEndpoint: { type: string }
        completeEndpoint: { type: string }
    PresignParts:
      type: object
      required: [uploadId, parts]
      properties:
        uploadId: { type: string }
        parts:
          type: array
          minItems: 1
          maxItems: 100
          items:
            type: object
            required: [partNumber, checksumSha256Base64]
            properties:
              partNumber: { type: integer, minimum: 1, maximum: 10000 }
              checksumSha256Base64: { type: string }
    CompleteUpload:
      type: object
      required: [uploadId, parts]
      properties:
        uploadId: { type: string }
        parts:
          type: array
          minItems: 1
          maxItems: 10000
          items:
            type: object
            required: [partNumber, etag, checksumSha256Base64]
            properties:
              partNumber: { type: integer }
              etag: { type: string }
              checksumSha256Base64: { type: string }
    CreateSoftwarePackage:
      type: object
      required: [packageKey, name, vendor, mode, owner]
      properties:
        packageKey: { type: string }
        name: { type: string }
        vendor: { type: string }
        mode:
          enum: [OCI_NATIVE, BYOL_CONTAINER, EXTERNAL_VENDOR_RUNTIME, MANAGED_VENDOR_SERVICE, REPORT_ONLY_BLOCKED]
        owner: { type: string }
        licenseReference: { type: string }
        clinicalScope: { type: string }
        metadata: { type: object }
    PackageApproval:
      type: object
      required: [approvalType, passed, evidenceUri, evidenceSha256, scope]
      properties:
        approvalType: { enum: [LICENSE, CLINICAL_SCOPE] }
        passed: { type: boolean }
        evidenceUri: { type: string, format: uri }
        evidenceSha256: { type: string, pattern: "^[a-fA-F0-9]{64}$" }
        scope: { type: string }
    InitiateSoftwareBundle:
      type: object
      required: [filename, mediaType, sizeBytes, sha256]
      properties:
        filename: { type: string }
        mediaType: { enum: [application/zip, application/gzip, application/x-tar] }
        sizeBytes: { oneOf: [{ type: integer }, { type: string, pattern: "^[0-9]+$" }] }
        sha256: { type: string, pattern: "^[a-fA-F0-9]{64}$" }
    SoftwareBuildRequest:
      type: object
      required: [sourceBundleId, targetVersion, buildRecipeSha256, targetPlatforms]
      properties:
        sourceBundleId: { type: string }
        targetVersion: { type: string }
        buildRecipeSha256: { type: string, pattern: "^[a-fA-F0-9]{64}$" }
        targetPlatforms:
          type: array
          items: { enum: [linux/amd64, linux/arm64] }
    GateAttestation:
      type: object
      required: [gateName, passed, evidenceUri, evidenceSha256, method]
      properties:
        gateName: { type: string }
        passed: { type: boolean }
        evidenceUri: { type: string, format: uri }
        evidenceSha256: { type: string, pattern: "^[a-fA-F0-9]{64}$" }
        method: { type: string }
