---
openapi: 3.0.1
info:
  title: API V1
  version: v1
components:
  securitySchemes:
    Bearer:
      description: Create a token in settings
      type: apiKey
      name: Authorization
      in: header
  parameters:
    AccountId:
      name: x-account-id
      in: header
      required: true
      schema:
        type: string
  schemas:
    follicle_scan_input:
      type: object
      properties:
        follicle_scan:
          type: object
          properties:
            exam_date:
              type: string
              format: date
            source:
              type: string
              example: GE Voluson E10
            endometrial_measurements:
              type: array
              items:
                "$ref": "#/components/schemas/endometrial_measurements_input"
            follicle_measurements:
              type: array
              items:
                "$ref": "#/components/schemas/follicle_measurements_input"
    endometrial_measurements_input:
      type: object
      properties:
        id:
          type: number
          format: integer
          description: Required to update or destroy an existing value
        _destroy:
          type: boolean
          description: Mark for deletion, requires id to be set
        grade:
          type: string
          example: 'Smith: Grade A'
        thickness_m1_mm:
          type: number
          format: double
        thickness_m2_mm:
          type: number
          format: double
        thickness_m3_mm:
          type: number
          format: double
        thickness_m4_mm:
          type: number
          format: double
        thickness_m5_mm:
          type: number
          format: double
        thickness_m6_mm:
          type: number
          format: double
    follicle_measurements_input:
      type: object
      properties:
        id:
          type: number
          format: integer
          description: Required to update an existing value
        _destroy:
          type: boolean
          description: Mark for deletion
        side:
          type: string
          enum:
          - left
          - right
          example: left
        d1_mm:
          type: number
          format: double
        d2_mm:
          type: number
          format: double
        d3_mm:
          type: number
          format: double
        volume_cm3:
          type: number
          format: double
    patient_input:
      type: object
      properties:
        identity_management_id:
          type: string
          description: Unique identifier. Required to update an existing patient
        patient:
          type: object
          description: Create a new patient
          properties:
            identity_management_id:
              type: string
              description: Unique identifier
            first_name:
              type: string
            last_name:
              type: string
            preferred_name:
              type: string
            birthday:
              type: string
              format: date
              description: 'Date of birth. Format: YYYY-MM-DD'
            email:
              type: string
              format: email
            phone_number:
              type: string
            country_code:
              type: string
            sex:
              type: string
              description: male/female
            civil_status:
              type: string
              description: single / married / separated / divorced / widowed / never_married
                / in_civil_partnership / separated_still_married / separated_still_civil_partnership
                / dissolved_civil_partnership / surviving_partner
            has_partner:
              type: boolean
            pronouns:
              type: string
            preferred_language:
              type: string
              description: 'ISO 639-1 two-letter language code, lowercase (for example
                en, ro, ar). A full BCP 47 tag is narrowed to its language subtag,
                so en-GB records as en. Also accepted, for languages ISO 639-1 cannot
                express: yue, ckb, prs.'
            height:
              type: number
              description: Height in cm
            weight:
              type: number
              description: Weight in kg
            occupation:
              type: string
            ethnicity:
              type: string
            location_id:
              type: integer
              description: The id of the location
            patient_address_attributes:
              type: object
              properties:
                line1:
                  type: string
                line2:
                  type: string
                city:
                  type: string
                state:
                  type: string
                postal_code:
                  type: string
                country:
                  type: string
          required:
          - first_name
          - birthday
          - email
      required:
      - patient
    cryo_contract_input:
      type: object
      properties:
        reference_number:
          type: string
          description: Unique identifier. Required to update an existing contract
        cryo_contract:
          type: object
          description: Update an existing contract
          properties:
            start_date:
              type: string
              format: date
            expiry_years:
              type: integer
            invoicing_strategy_id:
              type: integer
            notes:
              type: string
            contract_samples_attributes:
              type: array
              items:
                type: object
                properties:
                  id:
                    type: number
                    format: integer
                    description: Required to update an existing value
                  cryo_sample_id:
                    type: number
                    format: integer
                  _destroy:
                    type: boolean
                    description: Mark for deletion
          required:
          - invoicing_strategy_id
      required:
      - cryo_contract
    cryo_thaw_input:
      type: object
      properties:
        cryo_devices:
          type: object
          properties:
            devices:
              type: array
              items:
                type: object
                properties:
                  id:
                    type: number
                    format: integer
                required:
                - id
            required:
            - devices
        cryo_thaw:
          type: object
          description: Create a new thaw
          properties:
            reason:
              type: string
            thawed_at:
              type: string
              format: date_time
            thawed_by_id:
              type: integer
            witnessed_by_id:
              type: integer
            notes:
              type: string
            cycle_id:
              type: integer
          required:
          - reason
          - thawed_at
          - thawed_by_id
          - witnessed_by_id
      required:
      - cryo_thaw
    cryo_sample_input:
      type: object
      properties:
        sample_id:
          type: string
          description: Unique identifier. Required to update an existing sample
        cryo_sample:
          type: object
          description: Update an existing sample
          properties:
            cryo_status:
              type: string
              description: cryopreserved / discarded / thawed / prep_for_thaw
            freeze_date:
              type: string
              format: date
            notes:
              type: string
            quarantined_until:
              type: string
              format: date
            sample_type:
              type: string
              description: eggs / sperm / embryos / tissue
            stored_at:
              type: string
            partner_id:
              type: integer
            devices_count:
              type: integer
            total_volume_frozen:
              type: number
            total_oocytes_frozen:
              type: integer
            expiry_date:
              type: string
              format: date
            sperm_provider_id:
              type: integer
            oocytes_provider_id:
              type: integer
            gametes_provider_id:
              type: integer
            devices_attributes:
              type: array
              items:
                type: object
                properties:
                  id:
                    type: integer
                  identification:
                    type: string
                  volume:
                    type: number
                  count:
                    type: integer
                  _destroy:
                    type: boolean
                    description: Mark for deletion
                  embryo_grading:
                    type: string
                  biopsy:
                    type: string
                  patient_reserved_for_id:
                    type: integer
          required:
          - devices_count
          - freeze_date
          - sample_type
          - cryo_status
      required:
      - cryo_sample
    invoice_input:
      type: object
      properties:
        invoice_number:
          type: string
          description: Unique identifier. Required to update an existing invoice
        invoice:
          type: object
          description: Update an existing invoice
          properties:
            currency:
              type: string
            due_date:
              type: string
              format: date
            issued_date:
              type: string
              format: date
            issued_to_id:
              type: integer
            issued_to_type:
              type: string
            payment_terms_id:
              type: integer
            reference_id:
              type: integer
            reference_type:
              type: string
            line_items:
              type: array
              items:
                type: object
                properties:
                  id:
                    type: integer
                  product_id:
                    type: integer
                    description: Product ID for the line item
                  quantity:
                    type: number
                    format: double
                    description: Quantity of the product
                  finance_tax_rate_id:
                    type: integer
                    description: Tax rate ID for the line item
                  unit_price:
                    type: number
                    format: double
                    description: Unit price of the product
                  _destroy:
                    type: boolean
                    description: Mark for deletion
          required:
          - currency
          - reference_type
          - reference_id
          - issued_to_id
    issue_invoice_input:
      type: object
      properties:
        invoice:
          type: object
          description: Issue an existing invoice
          properties:
            issued_date:
              type: string
              format: date
paths:
  "/api/v1/appointments":
    get:
      summary: list appointments
      tags:
      - Appointments
      description: Retrieve a list of appointments with optional date filtering
      parameters:
      - name: start_date
        in: query
        format: date
        required: false
        description: Filter appointments starting from this date (YYYY-MM-DD format)
        schema:
          type: string
      - name: end_date
        in: query
        format: date
        required: false
        description: Filter appointments ending on this date (YYYY-MM-DD format)
        schema:
          type: string
      - name: page
        in: query
        required: false
        description: Page number for pagination
        schema:
          type: integer
      - name: items
        in: query
        required: false
        description: Number of items per page
        schema:
          type: integer
      - name: page
        in: query
        required: false
        description: Page number
        schema:
          type: integer
      - name: x-account-id
        in: header
        schema:
          type: string
      security:
      - Bearer: []
      responses:
        '200':
          description: successful
          headers:
            total-count:
              description: Total item count
              schema:
                type: integer
            total-pages:
              description: Total page count
              schema:
                type: integer
            page-items:
              description: Items per page
              schema:
                type: integer
            current-page:
              description: Current page
              schema:
                type: integer
          content:
            application/json:
              example:
                appointments: []
              schema:
                type: object
                properties:
                  appointments:
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: integer
                        title:
                          type: string
                        start_at:
                          type: string
                          format: datetime
                        end_at:
                          type: string
                          format: datetime
                        created_at:
                          type: string
                          format: datetime
                        updated_at:
                          type: string
                          format: datetime
                        notes:
                          type: string
                          nullable: true
                        is_physical:
                          type: boolean
                        patient:
                          type: object
                          properties:
                            id:
                              type: integer
                            first_name:
                              type: string
                            last_name:
                              type: string
                        user_ids:
                          type: array
                          items:
                            type: integer
                        team_ids:
                          type: array
                          items:
                            type: integer
                        room_ids:
                          type: array
                          items:
                            type: integer
  "/api/v1/cryo/tanks/{tank_id}/canisters":
    get:
      summary: list
      parameters:
      - name: tank_id
        in: path
        required: true
        schema:
          type: string
      - name: page
        in: query
        required: false
        description: Page number
        schema:
          type: integer
      - name: x-account-id
        in: header
        schema:
          type: string
      security:
      - Bearer: []
      responses:
        '200':
          description: successful
          headers:
            total-count:
              description: Total item count
              schema:
                type: integer
            total-pages:
              description: Total page count
              schema:
                type: integer
            page-items:
              description: Items per page
              schema:
                type: integer
            current-page:
              description: Current page
              schema:
                type: integer
          content:
            application/json:
              example:
                cryo_canisters:
                - cryo_canister:
                    id: 7
                    name: Canister 7
                    cane_capacity: 5
                    color: "#fff0"
                    created_at: '2026-07-16T08:55:05.486+01:00'
                    updated_at: '2026-07-16T08:55:05.486+01:00'
                    tank_id: 7
  "/api/v1/cryo/cryohexagon/activities":
    get:
      summary: list activities
      parameters:
      - name: x-account-id
        in: header
        schema:
          type: string
      - name: date
        in: query
        required: false
        description: Filter activities by specific date
        schema:
          type: string
      - name: since
        in: query
        required: false
        description: Filter activities created after this datetime
        schema:
          type: string
      - name: page
        in: query
        required: false
        description: Page number
        schema:
          type: integer
      security:
      - Bearer: []
      tags:
      - Cryohexagon
      description: |
        **Authorization requirements:**
        - Cryohexagon system account only

        **Data Scoping:**
        - Returns activities for samples in tanks with active `Integration::Cryohexagon`
        - Only shows activities for samples that are stored in cryohexagon-integrated tanks
        - Activities track changes made in Wawa
        - Includes tracked changes for each activity (e.g., PGT result updates)

        **Query Parameters:**
        - `date` (optional): ISO8601 date to filter activities for a specific day
        - `since` (optional): ISO8601 datetime to filter activities created after this time
      responses:
        '200':
          description: successful with since filter
          headers:
            total-count:
              description: Total item count
              schema:
                type: integer
            total-pages:
              description: Total page count
              schema:
                type: integer
            page-items:
              description: Items per page
              schema:
                type: integer
            current-page:
              description: Current page
              schema:
                type: integer
          content:
            application/json:
              example:
                activities:
                - id: 21
                  title: Cryo Device created
                  description: Cryo Device was created by Dr. Smith
                  action: created
                  created_at: '2026-07-16T08:55:05.817+01:00'
                  created_by_id: 49
                  record:
                    type: Cryo::Device
                    id: '1'
                  tracked_changes: []
        '403':
          description: forbidden - no cryohexagon access
          content:
            application/json:
              example:
                error: Access to Cryohexagon endpoints is not authorized for this
                  account
  "/api/v1/cryo/cryohexagon/tanks/{tank_id}/canisters":
    get:
      summary: list
      parameters:
      - name: x-account-id
        in: header
        schema:
          type: string
      - name: tank_id
        in: path
        description: Tank ID
        required: true
        schema:
          type: string
      - name: page
        in: query
        required: false
        description: Page number
        schema:
          type: integer
      security:
      - Bearer: []
      tags:
      - Cryohexagon
      description: |
        **Authorization requirements:**
        - Cryohexagon system account only

        **Data Scoping:**
        - Returns canisters for tanks from accounts with active `Integration::Cryohexagon`
        - Only returns canisters for Cryohexagon-type tanks
        - Tank must exist and be accessible through the Cryohexagon integration

        **Use Cases:**
        - Validate that a provided Wawa canister ID corresponds to a valid, integrated tank
        - Support bulk_update workflow for canister operations
        - Address canister-duplication scenarios
      responses:
        '200':
          description: successful
          headers:
            total-count:
              description: Total item count
              schema:
                type: integer
            total-pages:
              description: Total page count
              schema:
                type: integer
            page-items:
              description: Items per page
              schema:
                type: integer
            current-page:
              description: Current page
              schema:
                type: integer
          content:
            application/json:
              example:
                data:
                - id: 11
                  name: Canister A
                  cane_capacity: 10
                  color: "#fff0"
                  created_at: '2026-07-16T08:55:06.095+01:00'
                  updated_at: '2026-07-16T08:55:06.095+01:00'
                  tank_id: 11
                - id: 12
                  name: Canister B
                  cane_capacity: 15
                  color: "#fff0"
                  created_at: '2026-07-16T08:55:06.099+01:00'
                  updated_at: '2026-07-16T08:55:06.099+01:00'
                  tank_id: 11
        '404':
          description: nonexistent tank ID
          content:
            application/json:
              example:
                error: Not found
        '403':
          description: forbidden
          content:
            application/json:
              example:
                error: Access to Cryohexagon endpoints is not authorized for this
                  account
  "/api/v1/cryo/cryohexagon/devices/bulk_update":
    put:
      summary: bulk update devices
      parameters:
      - name: x-account-id
        in: header
        schema:
          type: string
      security:
      - Bearer: []
      tags:
      - Cryohexagon
      description: |
        **Authorization requirements:**
        - Cryohexagon system account only

        **Data Scoping:**
        - Only updates devices in samples that are in tanks with active `Integration::Cryohexagon`

        **Request Body:**
        - `devices`: Array of device updates, each containing:
          - `id`: Device ID to update
          - `location_attributes`: Location attributes (optional, uses nested attributes)
            - `cane`: Cane identifier
            - `cane_position`: Position on cane
            - `cane_position_color_1`: First color marker
            - `cane_position_color_2`: Second color marker
            - `canister_id`: Existing canister ID (to associate with existing canister)
            - `canister_attributes`: Canister attributes (to create new canister)
              - `name`: Canister name (required when creating)
              - `tank_id`: Tank ID (required when creating)
              - `color`: Canister color
              - `cane_capacity`: Cane capacity (optional, defaults to 10)

        **Response:**
        - Returns success status, count of updated devices, and any errors
        - Supports partial success: some devices can fail while others succeed
      responses:
        '200':
          description: successful - creating canister in different tank
          content:
            application/json:
              example:
                success: true
                updated: 1
                devices:
                - id: 4
                  success: true
        '422':
          description: unprocessable entity - device not in cryohexagon tank
          content:
            application/json:
              example:
                success: false
                updated: 0
                devices: []
                errors:
                - id: 7
                  error: Device not found
        '403':
          description: forbidden - no cryohexagon access
          content:
            application/json:
              example:
                error: Access to Cryohexagon endpoints is not authorized for this
                  account
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                devices:
                  type: array
                  items:
                    type: object
                    properties:
                      id:
                        type: integer
                      location_attributes:
                        type: object
                        properties:
                          cane:
                            type: string
                          cane_position:
                            type: string
                          cane_position_color_1:
                            type: string
                          cane_position_color_2:
                            type: string
                          canister_id:
                            type: integer
                          canister_attributes:
                            type: object
                            properties:
                              name:
                                type: string
                              tank_id:
                                type: integer
                              cane_capacity:
                                type: integer
                              color:
                                type: string
                    required:
                    - id
              required:
              - devices
  "/api/v1/cryo/cryohexagon/exports":
    get:
      summary: list
      parameters:
      - name: x-account-id
        in: header
        schema:
          type: string
      - name: page
        in: query
        required: false
        description: Page number
        schema:
          type: integer
      security:
      - Bearer: []
      tags:
      - Cryohexagon
      description: |
        **Authorization requirements:**
        - Cryohexagon system account only

        **Data Scoping:**
        - Returns exports from accounts with active `Integration::Cryohexagon`
        - Only returns draft exports
      responses:
        '200':
          description: successful
          headers:
            total-count:
              description: Total item count
              schema:
                type: integer
            total-pages:
              description: Total page count
              schema:
                type: integer
            page-items:
              description: Items per page
              schema:
                type: integer
            current-page:
              description: Current page
              schema:
                type: integer
          content:
            application/json:
              example:
                data:
                - id: 1
                  account_id: 56
                  initiated_at: '2026-07-16T08:55:07.727+01:00'
                  receiving_clinic: Wawa Clinic
                  receiving_clinic_name:
                  receiving_country: DK
                  international_transfer: false
                  courier_information: DHL
                  initiated_by_id: 65
                  draft_at: '2026-07-16T08:55:07.727+01:00'
                  accepted_at:
                  devices:
                  - id: 8
                    identification: Device 8
                    sample_id: 11
                    device_type:
                    fate:
                    availability: no_restrictions
                    use_status:
                    freeze_date:
                    freeze_purpose:
                    freezing_media:
                    volume: 0.0
                    count: 1
                    location:
                      id: 5
                      cane: A1
                      cane_position: top
                      cane_position_color_1: red
                      cane_position_color_2: blue
                      canister:
                        id: 19
                        name: Canister 16
                        color: "#fff0"
                      tank:
                        id: 17
                        name: Tank 16
                        color: "#0f2a9a"
                        account_id: 56
                    patient_reserved_for:
                    embryo_devices:
                    - id: 1
                      cycle_id: 1
                      thaw_id: 1
                      device_id: 8
                      embryo_id: 1
                      embryo_identifier: 1-0001
                      oocyte_maturity: Not defined
                      fate: default
                      post_thaw: not_defined
                      current_grading_value: 4AA
                      share_with_patient:
                      shared_with_patient_at:
                      discarded_at:
                      discarded_by_id:
                      account_id: 56
                      patient_id: 19
                      location_id:
                      embryology_aspiration_id:
                      embryology_transfer_report_id:
                      cryo_thaw_id:
                      donation_id:
                      gradings:
                      - id: 1
                        grading: 4AA
                        graded_at: '2026-07-13T08:55:07.287+01:00'
                      cycle:
                        id: 1
                        cd1_date:
                        lmp_date:
                        start_date: '2026-07-14'
                        end_date:
                        type: Treatment Type 1
                        protocol: Treatment Protocol 1
                      fertilization:
                        id: 1
                        performed_at: '2026-07-11T08:55:07.099+01:00'
                        fertilization_type: ivf
                      biopsies:
                      - id: 2
                        chromosomal_status: euploid
                        carrier_status:
                        development_stage: blastocyst
                        suitable_for_transfer: true
                        biopsy:
                          id: 1
                          requested_at: '2026-07-14T08:55:07.299+01:00'
                          destination_lab: Some Lab
                          test_types:
                          - pgt_a
                          requested_by_id: 61
                          embryologist_id:
                  samples:
                  - id: 11
                    sample_id: SAMPLE-11
                    account_id: 56
                    sample_type: embryos
                    draft_at:
                    accepted_at:
                    virology_statuses: []
                    oocyte_provider_virology_statuses:
                    - 'Screened: Negative'
                    sperm_provider_virology_statuses:
                    - 'Screened: Negative'
                    gametes_provider:
                      id:
                      identity_management_id:
                      first_name:
                      last_name:
                    oocytes_provider:
                      id:
                      identity_management_id:
                      first_name:
                      last_name:
                    sperm_provider:
                      id:
                      identity_management_id:
                      first_name:
                      last_name:
                    patient:
                      id: 20
                      identity_management_id: 258a51bd-277e-4eae-9acb-a1205719daca
                      first_name: PatientName20
                      last_name: PatientLastName
                      sex: sex_not_specified
                      birthday: '1996-07-16'
                      picture: https://i.pravatar.cc/150?u=20
                      donor_status:
                      partner_identity_management_id:
                      partner_first_name:
                      partner_last_name:
                    devices: []
                    import:
                      courier_information:
                      international_transfer:
                      received_at:
                      shipping_clinic:
                      shipping_clinic_name:
                      shipping_country:
        '403':
          description: forbidden
          content:
            application/json:
              example:
                error: Access to Cryohexagon endpoints is not authorized for this
                  account
  "/api/v1/cryo/cryohexagon/exports/{id}":
    patch:
      summary: update
      parameters:
      - name: x-account-id
        in: header
        schema:
          type: string
      - name: id
        in: path
        description: Export ID
        required: true
        schema:
          type: string
      security:
      - Bearer: []
      tags:
      - Cryohexagon
      description: |
        **Authorization requirements:**
        - Cryohexagon system account only

        **Data Scoping:**
        - Updates exports from accounts with active `Integration::Cryohexagon`
      responses:
        '200':
          description: successful
          content:
            application/json:
              example:
                id: 1
                account_id: 56
                initiated_at: '2026-07-16T08:55:07.727+01:00'
                receiving_clinic: Wawa Clinic
                receiving_clinic_name:
                receiving_country: DK
                international_transfer: false
                courier_information: DHL
                initiated_by_id: 65
                draft_at: '2026-07-16T08:55:07.727+01:00'
                accepted_at: '2026-07-16T08:55:07.886+01:00'
                devices:
                - id: 8
                  identification: Device 8
                  sample_id: 11
                  device_type:
                  fate:
                  availability: no_restrictions
                  use_status:
                  freeze_date:
                  freeze_purpose:
                  freezing_media:
                  volume: 0.0
                  count: 1
                  location:
                    id: 5
                    cane: A1
                    cane_position: top
                    cane_position_color_1: red
                    cane_position_color_2: blue
                    canister:
                      id: 19
                      name: Canister 16
                      color: "#fff0"
                    tank:
                      id: 17
                      name: Tank 16
                      color: "#0f2a9a"
                      account_id: 56
                  patient_reserved_for:
                  embryo_devices:
                  - id: 1
                    cycle_id: 1
                    thaw_id: 1
                    device_id: 8
                    embryo_id: 1
                    embryo_identifier: 1-0001
                    oocyte_maturity: Not defined
                    fate: default
                    post_thaw: not_defined
                    current_grading_value: 4AA
                    share_with_patient:
                    shared_with_patient_at:
                    discarded_at:
                    discarded_by_id:
                    account_id: 56
                    patient_id: 19
                    location_id:
                    embryology_aspiration_id:
                    embryology_transfer_report_id:
                    cryo_thaw_id:
                    donation_id:
                    gradings:
                    - id: 1
                      grading: 4AA
                      graded_at: '2026-07-13T08:55:07.287+01:00'
                    cycle:
                      id: 1
                      cd1_date:
                      lmp_date:
                      start_date: '2026-07-14'
                      end_date:
                      type: Treatment Type 1
                      protocol: Treatment Protocol 1
                    fertilization:
                      id: 1
                      performed_at: '2026-07-11T08:55:07.099+01:00'
                      fertilization_type: ivf
                    biopsies:
                    - id: 2
                      chromosomal_status: euploid
                      carrier_status:
                      development_stage: blastocyst
                      suitable_for_transfer: true
                      biopsy:
                        id: 1
                        requested_at: '2026-07-14T08:55:07.299+01:00'
                        destination_lab: Some Lab
                        test_types:
                        - pgt_a
                        requested_by_id: 61
                        embryologist_id:
                samples:
                - id: 11
                  sample_id: SAMPLE-11
                  account_id: 56
                  sample_type: embryos
                  draft_at:
                  accepted_at:
                  virology_statuses: []
                  oocyte_provider_virology_statuses:
                  - 'Screened: Negative'
                  sperm_provider_virology_statuses:
                  - 'Screened: Negative'
                  gametes_provider:
                    id:
                    identity_management_id:
                    first_name:
                    last_name:
                  oocytes_provider:
                    id:
                    identity_management_id:
                    first_name:
                    last_name:
                  sperm_provider:
                    id:
                    identity_management_id:
                    first_name:
                    last_name:
                  patient:
                    id: 20
                    identity_management_id: 258a51bd-277e-4eae-9acb-a1205719daca
                    first_name: PatientName20
                    last_name: PatientLastName
                    sex: sex_not_specified
                    birthday: '1996-07-16'
                    picture: https://i.pravatar.cc/150?u=20
                    donor_status:
                    partner_identity_management_id:
                    partner_first_name:
                    partner_last_name:
                  devices: []
                  import:
                    courier_information:
                    international_transfer:
                    received_at:
                    shipping_clinic:
                    shipping_clinic_name:
                    shipping_country:
        '404':
          description: not found
          content:
            application/json:
              example:
                message: Export not found
        '403':
          description: forbidden
          content:
            application/json:
              example:
                error: Access to Cryohexagon endpoints is not authorized for this
                  account
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                export:
                  type: object
                  properties:
                    notes:
                      type: string
                    accepted_at:
                      type: string
                      format: date-time
  "/api/v1/cryo/cryohexagon/extractions":
    post:
      summary: create device extractions
      parameters:
      - name: x-account-id
        in: header
        schema:
          type: string
      security:
      - Bearer: []
      tags:
      - Cryohexagon
      description: |
        **Authorization requirements:**

        **Request Body:**
        - `extractions`: Array of extraction records, each containing:
          - `device_id`: ID of the device being extracted (required)
          - `extraction_type`: Type of extraction - "thaw", "export", or "move" (required)
          - `thaw_attributes`: Attributes for thaw extraction (required if extraction_type is "thaw"):
            - `thawed_at`: ISO8601 datetime when thaw occurred
            - `reason`: Reason for thaw - "treatment", "biopsy_and_refreeze", "destruction", "research", "other"
            - `cycle_id`: Associated cycle ID (required only for treatment & biopsy_and_refreeze thaws)
            - `destruction_reason`: Reason for destruction (optional, required for destruction thaws)
          - `export_attributes`: Attributes for export extraction (required if extraction_type is "export"):
            - `initiated_at`: ISO8601 datetime when export was initiated
            - `receiving_clinic_name`: Receiving clinic name (optional)
            - `receiving_country`: Receiving country code (optional)
            - `international_transfer`: Whether this is an international transfer (optional)
            - `courier_information`: Courier details (optional)
          - `move_attributes`: Attributes for move extraction (required if extraction_type is "move"):
            - `to_canister_id`: Destination canister ID (required)
            - `to_cane`: Destination cane (required)
            - `to_position`: Destination cane position (optional)
            - `to_color`: Destination position colour (optional)
            - `to_second_color`: Destination position second colour (optional)

        **Behavior:**
        - Each extraction creates a new Cryo::Thaw, Cryo::Export, or Cryo::Move record
        - For thaws: Creates a Cryo::Thaw record and associates the device with it
        - For exports: Creates a Cryo::Export record and associates the device with it via ExportedDevice
        - For moves: Relocates the device to the destination canister via a Cryo::Move (in-clinic relocation; the device stays frozen and is not exported)
        - Each extraction is independent - multiple extractions create multiple records
        - Returns success status, count of processed extractions, and any errors
        - Supports partial success: some devices can fail while others succeed
      responses:
        '201':
          description: successful
          content:
            application/json:
              example:
                success: true
                processed: 2
                extractions:
                - success: true
                  device_id: 12
                  record_id: 2
                  record_type: Cryo::Thaw
                - success: true
                  device_id: 13
                  record_id: 2
                  record_type: Cryo::Export
        '422':
          description: partial success
          content:
            application/json:
              example:
                success: false
                processed: 1
                extractions:
                - success: true
                  device_id: 12
                  record_id: 3
                  record_type: Cryo::Thaw
                errors:
                - device_id: 999999
                  errors:
                  - Device not found
        '403':
          description: forbidden
          content:
            application/json:
              example:
                error: Access to Cryohexagon endpoints is not authorized for this
                  account
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                extractions:
                  type: array
                  items:
                    type: object
                    properties:
                      device_id:
                        type: integer
                      extraction_type:
                        type: string
                        enum:
                        - thaw
                        - export
                        - move
                      thaw_attributes:
                        type: object
                        properties:
                          reason:
                            type: string
                            enum:
                            - treatment
                            - biopsy_and_refreeze
                            - destruction
                            - research
                            - other
                            description: |-
                              Reason for thaw:
                               * `treatment` - Thawed for treatment purposes
                               * `biopsy_and_refreeze` - Thawed for biopsy and will be refrozen
                               * `destruction` - Thawed for destruction
                               * `research` - Thawed for research purposes
                               * `other` - Other reason
                          thawed_at:
                            type: string
                            format: date-time
                          cycle_id:
                            type: integer
                          destruction_reason:
                            type: string
                            enum:
                            - none
                            - expired
                            - financial_burden
                            - proactive
                            - other
                            description: |-
                              Reason for destruction (when reason is 'destruction'):
                               * `none` - No specific reason
                               * `expired` - Sample expired
                               * `financial_burden` - Financial burden
                               * `proactive` - Proactive destruction
                               * `other` - Other reason
                      export_attributes:
                        type: object
                        properties:
                          courier_information:
                            type: string
                          initiated_at:
                            type: string
                            format: date-time
                          international_transfer:
                            type: boolean
                          receiving_clinic_name:
                            type: string
                          receiving_country:
                            type: string
                      move_attributes:
                        type: object
                        properties:
                          to_canister_id:
                            type: integer
                          to_cane:
                            type: string
                          to_position:
                            type: string
                          to_color:
                            type: string
                          to_second_color:
                            type: string
                    required:
                    - device_id
                    - extraction_type
              required:
              - extractions
  "/api/v1/cryo/cryohexagon/moves":
    get:
      summary: list
      parameters:
      - name: x-account-id
        in: header
        schema:
          type: string
      - name: page
        in: query
        required: false
        description: Page number
        schema:
          type: integer
      security:
      - Bearer: []
      tags:
      - Cryohexagon
      description: |
        **Authorization requirements:**
        - Cryohexagon system account only

        **Data Scoping:**
        - Returns pending moves out of a Cryohexagon tank (source tank is Cryohexagon,
          destination is not) for accounts with active `Integration::Cryohexagon`
      responses:
        '200':
          description: successful
          headers:
            total-count:
              description: Total item count
              schema:
                type: integer
            total-pages:
              description: Total page count
              schema:
                type: integer
            page-items:
              description: Items per page
              schema:
                type: integer
            current-page:
              description: Current page
              schema:
                type: integer
          content:
            application/json:
              example:
                data:
                - id: 1
                  account_id: 69
                  status: pending
                  external_status:
                  movable_type: Cryo::Sample
                  movable_id: 16
                  from_cane: A1
                  to_cane: B2
                  created_at: '2026-07-16T08:55:09.251+01:00'
                  updated_at: '2026-07-16T08:55:09.251+01:00'
                  from_tank:
                    id: 24
                    name: Tank 23
                  to_tank:
                    id: 25
                    name: Tank 24
                  patient:
                    id: 30
                    identity_management_id: d79b4d9d-ec84-466a-8692-484a9e02df80
                    first_name: PatientName30
                    last_name: PatientLastName
                  devices:
                  - id: 16
                    identification: Device 16
                    sample_id: 16
                    device_type:
                    fate:
                    availability: no_restrictions
                    use_status:
                    freeze_date:
                    freeze_purpose:
                    freezing_media:
                    volume: 0.0
                    count: 1
                    location:
                      id: 9
                      cane: A1
                      cane_position: top
                      cane_position_color_1: red
                      cane_position_color_2: blue
                      canister:
                        id: 24
                        name: Canister 21
                        color: "#fff0"
                      tank:
                        id: 24
                        name: Tank 23
                        color: "#0f2a9a"
                        account_id: 69
                    patient_reserved_for:
                    embryo_devices: []
                  sample:
                    id: 16
                    sample_id: SAMPLE-16
                    account_id: 69
                    sample_type: embryos
                    draft_at:
                    accepted_at:
                    virology_statuses: []
                    oocyte_provider_virology_statuses:
                    - 'Screened: Negative'
                    sperm_provider_virology_statuses:
                    - 'Screened: Negative'
                    gametes_provider:
                      id:
                      identity_management_id:
                      first_name:
                      last_name:
                    oocytes_provider:
                      id: 31
                      identity_management_id: 58d92d36-6f34-4736-8ac4-742b70a718f9
                      first_name: PatientName31
                      last_name: PatientLastName
                    sperm_provider:
                      id: 32
                      identity_management_id: d2d31eb1-fb02-45ec-b789-038efe91068d
                      first_name: PatientName32
                      last_name: PatientLastName
                    patient:
                      id: 30
                      identity_management_id: d79b4d9d-ec84-466a-8692-484a9e02df80
                      first_name: PatientName30
                      last_name: PatientLastName
                      sex: sex_not_specified
                      birthday: '1996-07-16'
                      picture: https://i.pravatar.cc/150?u=30
                      donor_status:
                      partner_identity_management_id:
                      partner_first_name:
                      partner_last_name:
                    devices:
                    - id: 16
                      identification: Device 16
                      sample_id: 16
                      device_type:
                      fate:
                      availability: no_restrictions
                      use_status:
                      freeze_date:
                      freeze_purpose:
                      freezing_media:
                      volume: 0.0
                      count: 1
                      location:
                        id: 9
                        cane: A1
                        cane_position: top
                        cane_position_color_1: red
                        cane_position_color_2: blue
                        canister:
                          id: 24
                          name: Canister 21
                          color: "#fff0"
                        tank:
                          id: 24
                          name: Tank 23
                          color: "#0f2a9a"
                          account_id: 69
                      patient_reserved_for:
                      embryo_devices: []
                    import:
                      courier_information:
                      international_transfer:
                      received_at:
                      shipping_clinic:
                      shipping_clinic_name:
                      shipping_country:
        '403':
          description: forbidden
          content:
            application/json:
              example:
                error: Access to Cryohexagon endpoints is not authorized for this
                  account
  "/api/v1/cryo/cryohexagon/moves/{id}":
    patch:
      summary: confirm
      parameters:
      - name: x-account-id
        in: header
        schema:
          type: string
      - name: id
        in: path
        description: Move ID
        required: true
        schema:
          type: string
      security:
      - Bearer: []
      tags:
      - Cryohexagon
      description: |
        **Authorization requirements:**
        - Cryohexagon system account only

        Reports Cryohexagon's status for a held move. The `external_status` is stored verbatim
        and drives the move's internal lifecycle (mirroring how the TMRW integration maps an
        external status onto `pending`/`completed`/`cancelled`):

        - `Extracted` — applies the held relocation (devices move to the destination tank) and
          transitions the move to `completed`
        - `Cancelled` — reverses the move (devices stay in the Cryohexagon tank) and cancels it
        - any other value — leaves the move `pending`, recording the reported status
      responses:
        '200':
          description: cancelled when Cryohexagon reports Cancelled
          content:
            application/json:
              example:
                id: 1
                account_id: 69
                status: cancelled
                external_status: Cancelled
                movable_type: Cryo::Sample
                movable_id: 16
                from_cane: A1
                to_cane: B2
                created_at: '2026-07-16T08:55:09.251+01:00'
                updated_at: '2026-07-16T08:55:09.621+01:00'
                from_tank:
                  id: 24
                  name: Tank 23
                to_tank:
                  id: 25
                  name: Tank 24
                patient:
                  id: 30
                  identity_management_id: d79b4d9d-ec84-466a-8692-484a9e02df80
                  first_name: PatientName30
                  last_name: PatientLastName
                devices:
                - id: 16
                  identification: Device 16
                  sample_id: 16
                  device_type:
                  fate:
                  availability: no_restrictions
                  use_status:
                  freeze_date:
                  freeze_purpose:
                  freezing_media:
                  volume: 0.0
                  count: 1
                  location:
                    id: 9
                    cane: A1
                    cane_position:
                    cane_position_color_1:
                    cane_position_color_2:
                    canister:
                      id: 24
                      name: Canister 21
                      color: "#fff0"
                    tank:
                      id: 24
                      name: Tank 23
                      color: "#0f2a9a"
                      account_id: 69
                  patient_reserved_for:
                  embryo_devices: []
                sample:
                  id: 16
                  sample_id: SAMPLE-16
                  account_id: 69
                  sample_type: embryos
                  draft_at:
                  accepted_at:
                  virology_statuses: []
                  oocyte_provider_virology_statuses:
                  - 'Screened: Negative'
                  sperm_provider_virology_statuses:
                  - 'Screened: Negative'
                  gametes_provider:
                    id:
                    identity_management_id:
                    first_name:
                    last_name:
                  oocytes_provider:
                    id: 31
                    identity_management_id: 58d92d36-6f34-4736-8ac4-742b70a718f9
                    first_name: PatientName31
                    last_name: PatientLastName
                  sperm_provider:
                    id: 32
                    identity_management_id: d2d31eb1-fb02-45ec-b789-038efe91068d
                    first_name: PatientName32
                    last_name: PatientLastName
                  patient:
                    id: 30
                    identity_management_id: d79b4d9d-ec84-466a-8692-484a9e02df80
                    first_name: PatientName30
                    last_name: PatientLastName
                    sex: sex_not_specified
                    birthday: '1996-07-16'
                    picture: https://i.pravatar.cc/150?u=30
                    donor_status:
                    partner_identity_management_id:
                    partner_first_name:
                    partner_last_name:
                  devices:
                  - id: 16
                    identification: Device 16
                    sample_id: 16
                    device_type:
                    fate:
                    availability: no_restrictions
                    use_status:
                    freeze_date:
                    freeze_purpose:
                    freezing_media:
                    volume: 0.0
                    count: 1
                    location:
                      id: 9
                      cane: A1
                      cane_position:
                      cane_position_color_1:
                      cane_position_color_2:
                      canister:
                        id: 24
                        name: Canister 21
                        color: "#fff0"
                      tank:
                        id: 24
                        name: Tank 23
                        color: "#0f2a9a"
                        account_id: 69
                    patient_reserved_for:
                    embryo_devices: []
                  import:
                    courier_information:
                    international_transfer:
                    received_at:
                    shipping_clinic:
                    shipping_clinic_name:
                    shipping_country:
        '404':
          description: not found
          content:
            application/json:
              example:
                message: Move not found
        '403':
          description: forbidden
          content:
            application/json:
              example:
                error: Access to Cryohexagon endpoints is not authorized for this
                  account
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                move:
                  type: object
                  properties:
                    external_status:
                      type: string
                      description: 'Cryohexagon''s reported status, stored verbatim
                        and mapped to Wawa''s internal move lifecycle (same pattern
                        as the TMRW integration): `Extracted` → completed, `Cancelled`
                        → cancelled, any other value → pending.'
  "/api/v1/cryo/cryohexagon/patients":
    get:
      summary: list patients
      parameters:
      - name: x-account-id
        in: header
        schema:
          type: string
      - name: page
        in: query
        required: false
        description: Page number
        schema:
          type: integer
      security:
      - Bearer: []
      tags:
      - Cryohexagon
      description: |
        **Authorization requirements:**
        - Cryohexagon system account only

        **Data Scoping:**
        - Returns patients with devices stored in, or reserved for them in, Cryohexagon tanks
          across accounts with active `Integration::Cryohexagon`, regardless of the calling account
      responses:
        '200':
          description: successful
          headers:
            total-count:
              description: Total item count
              schema:
                type: integer
            total-pages:
              description: Total page count
              schema:
                type: integer
            page-items:
              description: Items per page
              schema:
                type: integer
            current-page:
              description: Current page
              schema:
                type: integer
          content:
            application/json:
              example:
                data:
                - created_at: '2026-07-16T08:55:09.880+01:00'
                  id: 34
                  email: mail33@email.com
                  first_name: PatientName34
                  last_name: PatientLastName
                  preferred_name:
                  identity_management_id: 2b681612-c56e-442d-aac1-694155121dac
                  sex: sex_not_specified
                  ethnicity:
                  pronouns:
                  account_id: 71
                  date_of_birth: '1996-07-16'
                  phone_number:
                    country_code: '45'
                    phone_number: '80808080'
                  address:
                  location_id:
                  has_wawa_app: false
                  partner_id:
        '403':
          description: forbidden
          content:
            application/json:
              example:
                error: Access to Cryohexagon endpoints is not authorized for this
                  account
  "/api/v1/cryo/cryohexagon/patients/{id}":
    get:
      summary: show
      parameters:
      - name: x-account-id
        in: header
        schema:
          type: string
      - name: id
        in: path
        description: Patient ID
        required: true
        schema:
          type: string
      security:
      - Bearer: []
      tags:
      - Cryohexagon
      description: |
        **Authorization requirements:**
        - Cryohexagon system account only

        **Data Scoping:**
        - Returns patients with devices stored in, or reserved for them in, Cryohexagon tanks
          across accounts with active `Integration::Cryohexagon`, regardless of the calling account
      responses:
        '200':
          description: successful
          content:
            application/json:
              example:
                created_at: '2026-07-16T08:55:09.880+01:00'
                id: 34
                email: mail33@email.com
                first_name: PatientName34
                last_name: PatientLastName
                preferred_name:
                identity_management_id: 2b681612-c56e-442d-aac1-694155121dac
                sex: sex_not_specified
                ethnicity:
                pronouns:
                account_id: 71
                date_of_birth: '1996-07-16'
                phone_number:
                  country_code: '45'
                  phone_number: '80808080'
                address:
                location_id:
                has_wawa_app: false
                partner_id:
        '404':
          description: not found
          content:
            application/json:
              example:
                message: Patient not found
        '403':
          description: forbidden
          content:
            application/json:
              example:
                error: Access to Cryohexagon endpoints is not authorized for this
                  account
  "/api/v1/cryo/cryohexagon/samples":
    get:
      summary: list
      parameters:
      - name: x-account-id
        in: header
        schema:
          type: string
      - name: page
        in: query
        required: false
        description: Page number
        schema:
          type: integer
      security:
      - Bearer: []
      tags:
      - Cryohexagon
      description: |
        **Authorization requirements:**
        - Cryohexagon system account only

        **Data Scoping:**
        - Returns samples from accounts with active `Integration::Cryohexagon`
      responses:
        '200':
          description: successful
          headers:
            total-count:
              description: Total item count
              schema:
                type: integer
            total-pages:
              description: Total page count
              schema:
                type: integer
            page-items:
              description: Items per page
              schema:
                type: integer
            current-page:
              description: Current page
              schema:
                type: integer
          content:
            application/json:
              example:
                data:
                - id: 20
                  sample_id: SAMPLE-20
                  account_id: 73
                  sample_type: embryos
                  draft_at: '2026-07-16T08:55:10.427+01:00'
                  accepted_at:
                  virology_statuses:
                  - 'Screened: Positive'
                  - HepB+
                  oocyte_provider_virology_statuses:
                  - HepB+
                  sperm_provider_virology_statuses:
                  - 'Screened: Negative'
                  gametes_provider:
                    id:
                    identity_management_id:
                    first_name:
                    last_name:
                  oocytes_provider:
                    id: 38
                    identity_management_id: 1292fe3e-160c-4132-8bc8-98fe0c8d3c8c
                    first_name: PatientName38
                    last_name: PatientLastName
                  sperm_provider:
                    id: 39
                    identity_management_id: '02181e9a-f501-46af-a1a5-757ea9390a14'
                    first_name: PatientName39
                    last_name: PatientLastName
                  patient:
                    id: 40
                    identity_management_id: 8001cd5b-02d8-4df2-a5a1-dcf4aad467a0
                    first_name: PatientName40
                    last_name: PatientLastName
                    sex: sex_not_specified
                    birthday: '1996-07-16'
                    picture: https://i.pravatar.cc/150?u=40
                    donor_status:
                    partner_identity_management_id:
                    partner_first_name:
                    partner_last_name:
                  devices:
                  - id: 20
                    identification: Device 20
                    sample_id: 20
                    device_type:
                    fate:
                    availability: no_restrictions
                    use_status:
                    freeze_date:
                    freeze_purpose:
                    freezing_media:
                    volume: 0.0
                    count: 1
                    location:
                      id: 13
                      cane: A1
                      cane_position: top
                      cane_position_color_1: red
                      cane_position_color_2: blue
                      canister:
                        id: 29
                        name: Canister 26
                        color: "#fff0"
                      tank:
                        id: 28
                        name: Tank 27
                        color: "#0f2a9a"
                        account_id: 73
                    patient_reserved_for:
                      id: 41
                      identity_management_id: e26cb1d2-93fe-4553-ba10-fede65464bf5
                      first_name: PatientName41
                      last_name: PatientLastName
                    embryo_devices:
                    - id: 4
                      cycle_id: 5
                      thaw_id: 5
                      device_id: 20
                      embryo_id: 4
                      embryo_identifier: 1-0003
                      oocyte_maturity: Not defined
                      fate: default
                      post_thaw: not_defined
                      current_grading_value: 4AA
                      share_with_patient:
                      shared_with_patient_at:
                      discarded_at:
                      discarded_by_id:
                      account_id: 73
                      patient_id: 37
                      location_id:
                      embryology_aspiration_id:
                      embryology_transfer_report_id:
                      cryo_thaw_id:
                      donation_id:
                      gradings:
                      - id: 2
                        grading: 4AA
                        graded_at: '2026-07-13T08:55:10.970+01:00'
                      cycle:
                        id: 5
                        cd1_date:
                        lmp_date:
                        start_date: '2026-07-14'
                        end_date:
                        type: Treatment Type 5
                        protocol: Treatment Protocol 5
                      fertilization:
                        id: 2
                        performed_at: '2026-07-11T08:55:10.810+01:00'
                        fertilization_type: ivf
                      biopsies:
                      - id: 4
                        chromosomal_status: euploid
                        carrier_status:
                        development_stage: blastocyst
                        suitable_for_transfer: true
                        biopsy:
                          id: 2
                          requested_at: '2026-07-14T08:55:10.976+01:00'
                          destination_lab: Some Lab
                          test_types:
                          - pgt_a
                          requested_by_id: 84
                          embryologist_id:
                  import:
                    courier_information:
                    international_transfer:
                    received_at:
                    shipping_clinic:
                    shipping_clinic_name:
                    shipping_country:
        '403':
          description: forbidden
          content:
            application/json:
              example:
                error: Access to Cryohexagon endpoints is not authorized for this
                  account
  "/api/v1/cryo/cryohexagon/samples/{id}":
    patch:
      summary: update
      parameters:
      - name: x-account-id
        in: header
        schema:
          type: string
      - name: id
        in: path
        description: Sample ID
        required: true
        schema:
          type: string
      security:
      - Bearer: []
      tags:
      - Cryohexagon
      description: |
        **Authorization requirements:**
        - Cryohexagon system account only

        **Data Scoping:**
        - Updates samples from accounts with active `Integration::Cryohexagon`

        **Updateable Fields:**
        - `notes`: Sample notes
        - `accepted_at`: Timestamp when sample was accepted (transitions from draft to accepted)
        - `devices_attributes[].location_attributes.cane_position_color_1`: Device location color 1
        - `devices_attributes[].location_attributes.cane_position_color_2`: Device location color 2
      responses:
        '200':
          description: successful
          content:
            application/json:
              example:
                id: 20
                sample_id: SAMPLE-20
                account_id: 73
                sample_type: embryos
                draft_at: '2026-07-16T08:55:10.427+01:00'
                accepted_at: '2024-01-15T10:30:00.000+00:00'
                virology_statuses:
                - 'Screened: Positive'
                - HepB+
                oocyte_provider_virology_statuses:
                - HepB+
                sperm_provider_virology_statuses:
                - 'Screened: Negative'
                gametes_provider:
                  id:
                  identity_management_id:
                  first_name:
                  last_name:
                oocytes_provider:
                  id: 38
                  identity_management_id: 1292fe3e-160c-4132-8bc8-98fe0c8d3c8c
                  first_name: PatientName38
                  last_name: PatientLastName
                sperm_provider:
                  id: 39
                  identity_management_id: '02181e9a-f501-46af-a1a5-757ea9390a14'
                  first_name: PatientName39
                  last_name: PatientLastName
                patient:
                  id: 40
                  identity_management_id: 8001cd5b-02d8-4df2-a5a1-dcf4aad467a0
                  first_name: PatientName40
                  last_name: PatientLastName
                  sex: sex_not_specified
                  birthday: '1996-07-16'
                  picture: https://i.pravatar.cc/150?u=40
                  donor_status:
                  partner_identity_management_id:
                  partner_first_name:
                  partner_last_name:
                devices:
                - id: 20
                  identification: Device 20
                  sample_id: 20
                  device_type:
                  fate:
                  availability: no_restrictions
                  use_status:
                  freeze_date:
                  freeze_purpose:
                  freezing_media:
                  volume: 0.0
                  count: 1
                  location:
                    id: 13
                    cane: A1
                    cane_position: top
                    cane_position_color_1: red
                    cane_position_color_2: blue
                    canister:
                      id: 29
                      name: Canister 26
                      color: "#fff0"
                    tank:
                      id: 28
                      name: Tank 27
                      color: "#0f2a9a"
                      account_id: 73
                  patient_reserved_for:
                    id: 41
                    identity_management_id: e26cb1d2-93fe-4553-ba10-fede65464bf5
                    first_name: PatientName41
                    last_name: PatientLastName
                  embryo_devices:
                  - id: 4
                    cycle_id: 5
                    thaw_id: 5
                    device_id: 20
                    embryo_id: 4
                    embryo_identifier: 1-0003
                    oocyte_maturity: Not defined
                    fate: default
                    post_thaw: not_defined
                    current_grading_value: 4AA
                    share_with_patient:
                    shared_with_patient_at:
                    discarded_at:
                    discarded_by_id:
                    account_id: 73
                    patient_id: 37
                    location_id:
                    embryology_aspiration_id:
                    embryology_transfer_report_id:
                    cryo_thaw_id:
                    donation_id:
                    gradings:
                    - id: 2
                      grading: 4AA
                      graded_at: '2026-07-13T08:55:10.970+01:00'
                    cycle:
                      id: 5
                      cd1_date:
                      lmp_date:
                      start_date: '2026-07-14'
                      end_date:
                      type: Treatment Type 5
                      protocol: Treatment Protocol 5
                    fertilization:
                      id: 2
                      performed_at: '2026-07-11T08:55:10.810+01:00'
                      fertilization_type: ivf
                    biopsies:
                    - id: 4
                      chromosomal_status: euploid
                      carrier_status:
                      development_stage: blastocyst
                      suitable_for_transfer: true
                      biopsy:
                        id: 2
                        requested_at: '2026-07-14T08:55:10.976+01:00'
                        destination_lab: Some Lab
                        test_types:
                        - pgt_a
                        requested_by_id: 84
                        embryologist_id:
                import:
                  courier_information:
                  international_transfer:
                  received_at:
                  shipping_clinic:
                  shipping_clinic_name:
                  shipping_country:
        '422':
          description: unprocessable content
          content:
            application/json:
              example:
                message: Devices count must be equal to the number of devices, Total
                  material frozen must be equal to the sum of devices count, and Freeze
                  date must be less than 2026-07-16 08:55:11 +0100
        '403':
          description: forbidden
          content:
            application/json:
              example:
                error: Access to Cryohexagon endpoints is not authorized for this
                  account
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                sample:
                  type: object
                  properties:
                    notes:
                      type: string
                    accepted_at:
                      type: string
                      format: date-time
                    devices_attributes:
                      type: array
                      items:
                        type: object
                        properties:
                          id:
                            type: integer
                          location_attributes:
                            type: object
                            properties:
                              cane_position_color_1:
                                type: string
                              cane_position_color_2:
                                type: string
  "/api/v1/cryo/cryohexagon/tanks":
    get:
      summary: list
      parameters:
      - name: x-account-id
        in: header
        schema:
          type: string
      - name: page
        in: query
        required: false
        description: Page number
        schema:
          type: integer
      security:
      - Bearer: []
      tags:
      - Cryohexagon
      description: |
        **Authorization requirements:**
        - Cryohexagon system account only

        **Data Scoping:**
        - Returns tanks from accounts with active `Integration::Cryohexagon`
        - Only returns Cryohexagon-type tanks (integration_type: "Integration::Cryohexagon")
      responses:
        '200':
          description: successful
          headers:
            total-count:
              description: Total item count
              schema:
                type: integer
            total-pages:
              description: Total page count
              schema:
                type: integer
            page-items:
              description: Items per page
              schema:
                type: integer
            current-page:
              description: Current page
              schema:
                type: integer
          content:
            application/json:
              example:
                data:
                - id: 31
                  name: Tank 30
                  location: Wawa Office
                  status: active
                  tank_type: Standard
                  color: "#0f2a9a"
                  canister_capacity: 10
                  service_start_date: '2026-07-16'
                  sperm: true
                  eggs: true
                  embryos: true
                  donor_sperm: true
                  donor_eggs: true
                  donor_embryos: true
                  account_id: 89
        '403':
          description: forbidden
          content:
            application/json:
              example:
                error: Access to Cryohexagon endpoints is not authorized for this
                  account
  "/api/v1/cryo/cryohexagon/thaws":
    get:
      summary: list
      parameters:
      - name: x-account-id
        in: header
        schema:
          type: string
      - name: page
        in: query
        required: false
        description: Page number
        schema:
          type: integer
      security:
      - Bearer: []
      tags:
      - Cryohexagon
      description: |
        **Authorization requirements:**
        - Cryohexagon system account only

        **Data Scoping:**
        - Returns thaws from accounts with active `Integration::Cryohexagon`
        - Only returns draft thaws
      responses:
        '200':
          description: successful
          headers:
            total-count:
              description: Total item count
              schema:
                type: integer
            total-pages:
              description: Total page count
              schema:
                type: integer
            page-items:
              description: Items per page
              schema:
                type: integer
            current-page:
              description: Current page
              schema:
                type: integer
          content:
            application/json:
              example:
                data:
                - id: 7
                  identification: 123-0005
                  reason: other
                  thawed_at: '2026-07-16T08:55:12.667+01:00'
                  notes:
                  cycle_id: 9
                  patient_id: 51
                  destruction_reason: none
                  draft_at: '2026-07-16T08:55:12.667+01:00'
                  accepted_at:
                  account_id: 92
                  cycle:
                    id: 9
                    cd1_date:
                    lmp_date:
                    start_date: '2026-07-14'
                    end_date:
                    type: Treatment Type 9
                    protocol: Treatment Protocol 9
                  sample:
                    id: 22
                    sample_id: SAMPLE-22
                    account_id: 92
                    sample_type: embryos
                    draft_at:
                    accepted_at: '2026-07-16T08:55:12.052+01:00'
                    virology_statuses: []
                    oocyte_provider_virology_statuses:
                    - 'Screened: Negative'
                    sperm_provider_virology_statuses:
                    - 'Screened: Negative'
                    gametes_provider:
                      id:
                      identity_management_id:
                      first_name:
                      last_name:
                    oocytes_provider:
                      id:
                      identity_management_id:
                      first_name:
                      last_name:
                    sperm_provider:
                      id:
                      identity_management_id:
                      first_name:
                      last_name:
                    patient:
                      id: 51
                      identity_management_id: 3c375fe9-6cb0-4b63-a3e3-9e6d7482fdf0
                      first_name: PatientName51
                      last_name: PatientLastName
                      sex: sex_not_specified
                      birthday: '1996-07-16'
                      picture: https://i.pravatar.cc/150?u=51
                      donor_status:
                      partner_identity_management_id:
                      partner_first_name:
                      partner_last_name:
                    devices: []
                    import:
                      courier_information:
                      international_transfer:
                      received_at:
                      shipping_clinic:
                      shipping_clinic_name:
                      shipping_country:
                  devices:
                  - id: 25
                    identification: Device 25
                    sample_id: 22
                    device_type:
                    fate:
                    availability: no_restrictions
                    use_status:
                    freeze_date:
                    freeze_purpose:
                    freezing_media:
                    volume: 0.0
                    count: 1
                    location:
                      id: 16
                      cane: A1
                      cane_position: top
                      cane_position_color_1: red
                      cane_position_color_2: blue
                      canister:
                        id: 32
                        name: Canister 29
                        color: "#fff0"
                      tank:
                        id: 33
                        name: Tank 32
                        color: "#0f2a9a"
                        account_id: 92
                    patient_reserved_for:
                    embryo_devices:
                    - id: 6
                      cycle_id: 9
                      thaw_id: 6
                      device_id: 25
                      embryo_id: 6
                      embryo_identifier: 1-0005
                      oocyte_maturity: Not defined
                      fate: default
                      post_thaw: not_defined
                      current_grading_value: 4AA
                      share_with_patient:
                      shared_with_patient_at:
                      discarded_at:
                      discarded_by_id:
                      account_id: 92
                      patient_id: 51
                      location_id:
                      embryology_aspiration_id:
                      embryology_transfer_report_id:
                      cryo_thaw_id:
                      donation_id:
                      gradings:
                      - id: 3
                        grading: 4AA
                        graded_at: '2026-07-13T08:55:12.366+01:00'
                      cycle:
                        id: 9
                        cd1_date:
                        lmp_date:
                        start_date: '2026-07-14'
                        end_date:
                        type: Treatment Type 9
                        protocol: Treatment Protocol 9
                      fertilization:
                        id: 3
                        performed_at: '2026-07-11T08:55:12.162+01:00'
                        fertilization_type: ivf
                      biopsies:
                      - id: 6
                        chromosomal_status: euploid
                        carrier_status:
                        development_stage: blastocyst
                        suitable_for_transfer: true
                        biopsy:
                          id: 3
                          requested_at: '2026-07-14T08:55:12.373+01:00'
                          destination_lab: Some Lab
                          test_types:
                          - pgt_a
                          requested_by_id: 97
                          embryologist_id:
        '403':
          description: forbidden
          content:
            application/json:
              example:
                error: Access to Cryohexagon endpoints is not authorized for this
                  account
  "/api/v1/cryo/cryohexagon/thaws/{id}":
    patch:
      summary: update
      parameters:
      - name: x-account-id
        in: header
        schema:
          type: string
      - name: id
        in: path
        description: Thaw ID
        required: true
        schema:
          type: string
      security:
      - Bearer: []
      tags:
      - Cryohexagon
      description: |
        **Authorization requirements:**
        - Cryohexagon system account only

        **Data Scoping:**
        - Updates thaws from accounts with active `Integration::Cryohexagon`
      responses:
        '200':
          description: successful
          content:
            application/json:
              example:
                id: 7
                identification: 123-0005
                reason: other
                thawed_at: '2026-07-16T08:55:12.667+01:00'
                notes: Updated notes from Cryohexagon
                cycle_id: 9
                patient_id: 51
                destruction_reason: none
                draft_at: '2026-07-16T08:55:12.667+01:00'
                accepted_at: '2026-07-16T08:55:12.857+01:00'
                account_id: 92
                cycle:
                  id: 9
                  cd1_date:
                  lmp_date:
                  start_date: '2026-07-14'
                  end_date:
                  type: Treatment Type 9
                  protocol: Treatment Protocol 9
                sample:
                  id: 22
                  sample_id: SAMPLE-22
                  account_id: 92
                  sample_type: embryos
                  draft_at:
                  accepted_at: '2026-07-16T08:55:12.052+01:00'
                  virology_statuses: []
                  oocyte_provider_virology_statuses:
                  - 'Screened: Negative'
                  sperm_provider_virology_statuses:
                  - 'Screened: Negative'
                  gametes_provider:
                    id:
                    identity_management_id:
                    first_name:
                    last_name:
                  oocytes_provider:
                    id:
                    identity_management_id:
                    first_name:
                    last_name:
                  sperm_provider:
                    id:
                    identity_management_id:
                    first_name:
                    last_name:
                  patient:
                    id: 51
                    identity_management_id: 3c375fe9-6cb0-4b63-a3e3-9e6d7482fdf0
                    first_name: PatientName51
                    last_name: PatientLastName
                    sex: sex_not_specified
                    birthday: '1996-07-16'
                    picture: https://i.pravatar.cc/150?u=51
                    donor_status:
                    partner_identity_management_id:
                    partner_first_name:
                    partner_last_name:
                  devices: []
                  import:
                    courier_information:
                    international_transfer:
                    received_at:
                    shipping_clinic:
                    shipping_clinic_name:
                    shipping_country:
                devices:
                - id: 25
                  identification: Device 25
                  sample_id: 22
                  device_type:
                  fate:
                  availability: no_restrictions
                  use_status:
                  freeze_date:
                  freeze_purpose:
                  freezing_media:
                  volume: 0.0
                  count: 1
                  location:
                    id: 16
                    cane: A1
                    cane_position: top
                    cane_position_color_1: red
                    cane_position_color_2: blue
                    canister:
                      id: 32
                      name: Canister 29
                      color: "#fff0"
                    tank:
                      id: 33
                      name: Tank 32
                      color: "#0f2a9a"
                      account_id: 92
                  patient_reserved_for:
                  embryo_devices:
                  - id: 6
                    cycle_id: 9
                    thaw_id: 6
                    device_id: 25
                    embryo_id: 6
                    embryo_identifier: 1-0005
                    oocyte_maturity: Not defined
                    fate: default
                    post_thaw: not_defined
                    current_grading_value: 4AA
                    share_with_patient:
                    shared_with_patient_at:
                    discarded_at:
                    discarded_by_id:
                    account_id: 92
                    patient_id: 51
                    location_id:
                    embryology_aspiration_id:
                    embryology_transfer_report_id:
                    cryo_thaw_id:
                    donation_id:
                    gradings:
                    - id: 3
                      grading: 4AA
                      graded_at: '2026-07-13T08:55:12.366+01:00'
                    cycle:
                      id: 9
                      cd1_date:
                      lmp_date:
                      start_date: '2026-07-14'
                      end_date:
                      type: Treatment Type 9
                      protocol: Treatment Protocol 9
                    fertilization:
                      id: 3
                      performed_at: '2026-07-11T08:55:12.162+01:00'
                      fertilization_type: ivf
                    biopsies:
                    - id: 6
                      chromosomal_status: euploid
                      carrier_status:
                      development_stage: blastocyst
                      suitable_for_transfer: true
                      biopsy:
                        id: 3
                        requested_at: '2026-07-14T08:55:12.373+01:00'
                        destination_lab: Some Lab
                        test_types:
                        - pgt_a
                        requested_by_id: 97
                        embryologist_id:
        '404':
          description: not found
          content:
            application/json:
              example:
                message: Thaw not found
        '403':
          description: forbidden
          content:
            application/json:
              example:
                error: Access to Cryohexagon endpoints is not authorized for this
                  account
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                thaw:
                  type: object
                  properties:
                    notes:
                      type: string
                    accepted_at:
                      type: string
                      format: date-time
  "/api/v1/cryo/invoicing_strategies":
    get:
      summary: list
      parameters:
      - name: page
        in: query
        required: false
        description: Page number
        schema:
          type: integer
      - name: x-account-id
        in: header
        schema:
          type: string
      security:
      - Bearer: []
      responses:
        '200':
          description: successful
          headers:
            total-count:
              description: Total item count
              schema:
                type: integer
            total-pages:
              description: Total page count
              schema:
                type: integer
            page-items:
              description: Items per page
              schema:
                type: integer
            current-page:
              description: Current page
              schema:
                type: integer
          content:
            application/json:
              example:
                invoicing_strategies:
                - id: 6
                  name: omnis
                  type: Cryo::InvoicingStrategyPerPatient
                  created_at: '2026-07-16T08:55:13.065+01:00'
                  updated_at: '2026-07-16T08:55:13.065+01:00'
                  expiry_years: 10
                  invoice_recurrence_period: 12
                  per_patient_fee_cents: 50000
                  per_patient_fee_currency: EUR
                  per_sample_fee_cents: 0
                  per_sample_fee_currency:
                  default_at:
                  discarded_at:
                - id: 7
                  name: ut
                  type: Cryo::InvoicingStrategyPerSample
                  created_at: '2026-07-16T08:55:13.070+01:00'
                  updated_at: '2026-07-16T08:55:13.070+01:00'
                  expiry_years: 10
                  invoice_recurrence_period: 12
                  per_patient_fee_cents: 0
                  per_patient_fee_currency:
                  per_sample_fee_cents: 30000
                  per_sample_fee_currency: EUR
                  default_at:
                  discarded_at:
  "/api/v1/cryo/samples/{id}":
    parameters:
    - name: id
      in: path
      description: Sample ID
      required: true
      schema:
        type: integer
    get:
      summary: show sample
      parameters:
      - name: x-account-id
        in: header
        schema:
          type: string
      - name: x-account-id
        in: header
        schema:
          type: string
      - name: x-account-id
        in: header
        schema:
          type: string
      security:
      - Bearer: []
      responses:
        '200':
          description: includes sperm provider data
          content:
            application/json:
              example:
                sample:
                  id: 26
                  partner_id:
                  patient_id: 60
                  sample_id: SAMPLE-26
                  sample_type: embryos
                  cryo_status: cryopreserved
                  source:
                  hfea_gamete_source: donor_eggs
                  notes:
                  thaw_reason:
                  freeze_date: '2026-07-15T08:55:13.396+01:00'
                  stored_at: '2026-07-15T08:55:13.396+01:00'
                  expiry_date:
                  quarantined_until:
                  deceased_consent_expiry:
                  created_at: '2026-07-16T08:55:13.404+01:00'
                  updated_at: '2026-07-16T08:55:13.404+01:00'
                  devices_count: 0
                  total_oocytes_frozen: 1
                  total_volume_frozen: 0.0
                  virology_statuses: []
                  sperm_provider_virology_statuses:
                  - 'Screened: Negative'
                  oocyte_provider_virology_statuses:
                  - 'Screened: Negative'
                  imported_from:
                  exported_to:
                  external_id:
                  account_id: 102
                  user_id: 102
                  witnessed_by_id:
                  computed_status: empty
                patient:
                  id: 60
                  identity_management_id: 2f56d842-b221-4d32-bc53-4305f88fbafa
                  first_name: PatientName60
                  last_name: PatientLastName
                  full_name: PatientName60 PatientLastName
                  donor_id:
                  donor_status:
                  sex: sex_not_specified
                  birthday: '1996-07-16'
                  email: mail59@email.com
                  phone_number: '80808080'
                  created_at: '2026-07-16T08:55:13.180+01:00'
                partner:
                sperm_provider:
                  id: 61
                  identity_management_id: ee8f0c38-6959-46fb-9d3a-0529410fc461
                  first_name: PatientName61
                  last_name: PatientLastName
                  full_name: PatientName61 PatientLastName
                  donor_id:
                  donor_status: sperm_donor
                  sex: sex_not_specified
                  created_at: '2026-07-16T08:55:13.386+01:00'
                oocytes_provider:
                gametes_provider:
                user:
                  id: 102
                  name: FirstName 97 LastName 100
                  email: email97@mail.com
                  created_at: '2026-07-16T08:55:13.105+01:00'
                witnessed_by:
                location:
                  canister:
                    id: 35
                    name: Canister 32
                    tank_id: 36
                    created_at: '2026-07-16T08:55:13.192+01:00'
                  tank:
                    id: 36
                    name: Tank 35
                    clinic_id:
                    created_at: '2026-07-16T08:55:13.189+01:00'
                devices: []
                contract:
                integration_source:
                metadata:
                  fetched_at: '2026-07-16T08:55:13+01:00'
                  api_version: v1
                  endpoint_type: public
  "/api/v1/cryo/tanks":
    get:
      summary: list
      parameters:
      - name: page
        in: query
        required: false
        description: Page number
        schema:
          type: integer
      - name: x-account-id
        in: header
        schema:
          type: string
      security:
      - Bearer: []
      responses:
        '200':
          description: successful
          headers:
            total-count:
              description: Total item count
              schema:
                type: integer
            total-pages:
              description: Total page count
              schema:
                type: integer
            page-items:
              description: Items per page
              schema:
                type: integer
            current-page:
              description: Current page
              schema:
                type: integer
          content:
            application/json:
              example:
                cryo_tanks:
                - cryo_tank:
                    id: 40
                    name: Tank 39
                    color: "#0f2a9a"
                    location: Wawa Office
                    status: active
                    tank_type: Standard
                    canister_capacity: 10
                    donor_eggs: true
                    donor_embryos: true
                    donor_sperm: true
                    eggs: true
                    embryos: true
                    sperm: true
                    created_at: '2026-07-16T08:55:13.554+01:00'
                    updated_at: '2026-07-16T08:55:13.554+01:00'
                    service_start_date: '2026-07-16'
  "/api/v1/locations":
    get:
      summary: list
      parameters:
      - name: x-account-id
        in: header
        schema:
          type: string
      security:
      - Bearer: []
      responses:
        '200':
          description: successful
          content:
            application/json:
              example:
                locations: []
  "/api/v1/me":
    get:
      summary: show me
      parameters:
      - name: x-account-id
        in: header
        schema:
          type: string
      security:
      - Bearer: []
      responses:
        '200':
          description: successful
          content:
            application/json:
              example:
                id: 105
                name: FirstName 100 LastName 103
                avatar_url: https://i.pravatar.cc/150?u=105
  "/api/v1/patient_conversations/{id}/messages":
    get:
      summary: list messages for a conversation
      tags:
      - Patient Conversations
      parameters:
      - name: id
        in: path
        description: Patient conversation ID
        required: true
        schema:
          type: string
      - name: x-account-id
        in: header
        schema:
          type: string
      security:
      - Bearer: []
      responses:
        '200':
          description: successful
          content:
            application/json:
              example:
                messages:
                - id: cc019dd9-277a-4caa-9d55-6b63c40afaab
                  message: Message 1
                  internal: false
                  read_at:
                  created_at: '2026-07-16T08:55:14.197+01:00'
                  updated_at: '2026-07-16T08:55:14.197+01:00'
                  user_id:
                  patient_id: 67
                  sender_type: patient
                  reply_to_id:
                  message_attachment_id:
                  deleted: false
                  deleted_at:
                conversation:
                  id: 4de81138-3ba6-42b3-ad74-c27860b48825
                  subject: Subject 2
                  state: open
              schema:
                type: object
                properties:
                  messages:
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: string
                        message:
                          type: string
                          nullable: true
                        internal:
                          type: boolean
                        read_at:
                          type: string
                          format: date-time
                          nullable: true
                        created_at:
                          type: string
                          format: date-time
                        updated_at:
                          type: string
                          format: date-time
                        user_id:
                          type: integer
                          nullable: true
                        patient_id:
                          type: integer
                          nullable: true
                        sender_type:
                          type: string
                          enum:
                          - user
                          - patient
                          - system
                        reply_to_id:
                          type: string
                          nullable: true
                        message_attachment_id:
                          type: integer
                          nullable: true
                        video_call:
                          type: object
                          nullable: true
                          properties:
                            room_name:
                              type: string
                            expired:
                              type: boolean
                            expiry_at:
                              type: string
                              format: date-time
                              nullable: true
                        deleted:
                          type: boolean
                        deleted_at:
                          type: string
                          format: date-time
                          nullable: true
                      required:
                      - id
                      - internal
                      - created_at
                      - updated_at
                      - sender_type
                      - deleted
                  conversation:
                    type: object
                    properties:
                      id:
                        type: string
                      subject:
                        type: string
                        nullable: true
                      state:
                        type: string
                        enum:
                        - open
                        - closed
                    required:
                    - id
                    - state
                required:
                - messages
                - conversation
        '404':
          description: conversation not found
          content:
            application/json:
              example:
                error: Not found
  "/api/v1/patient_conversations":
    get:
      summary: list patient conversations
      tags:
      - Patient Conversations
      parameters:
      - name: x-account-id
        in: header
        schema:
          type: string
      security:
      - Bearer: []
      responses:
        '200':
          description: successful
          content:
            application/json:
              example:
                patient_conversations: []
              schema:
                type: object
                properties:
                  patient_conversations:
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: string
                        subject:
                          type: string
                          nullable: true
                        state:
                          type: string
                          enum:
                          - open
                          - closed
                        resolved:
                          type: boolean
                        resolved_at:
                          type: string
                          format: date-time
                          nullable: true
                        created_at:
                          type: string
                          format: date-time
                        updated_at:
                          type: string
                          format: date-time
                        label:
                          type: string
                          nullable: true
                        patient_id:
                          type: integer
                          nullable: true
                        secondary_patient_id:
                          type: integer
                          nullable: true
                        assignee_id:
                          type: integer
                          nullable: true
                        user_assignee_ids:
                          type: array
                          items:
                            type: integer
                        team_assignee_ids:
                          type: array
                          items:
                            type: integer
                      required:
                      - id
                      - state
                      - resolved
                      - created_at
                      - updated_at
                required:
                - patient_conversations
  "/api/v1/patients/{id}/appointments":
    get:
      summary: list
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: string
      - name: page
        in: query
        required: false
        description: Page number
        schema:
          type: integer
      - name: x-account-id
        in: header
        schema:
          type: string
      security:
      - Bearer: []
      responses:
        '200':
          description: successful
          headers:
            total-count:
              description: Total item count
              schema:
                type: integer
            total-pages:
              description: Total page count
              schema:
                type: integer
            page-items:
              description: Items per page
              schema:
                type: integer
            current-page:
              description: Current page
              schema:
                type: integer
          content:
            application/json:
              example:
                appointments: []
  "/api/v1/patients/{id}/consents":
    get:
      summary: list
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: string
      - name: page
        in: query
        required: false
        description: Page number
        schema:
          type: integer
      - name: x-account-id
        in: header
        schema:
          type: string
      security:
      - Bearer: []
      responses:
        '200':
          description: successful
          headers:
            total-count:
              description: Total item count
              schema:
                type: integer
            total-pages:
              description: Total page count
              schema:
                type: integer
            page-items:
              description: Items per page
              schema:
                type: integer
            current-page:
              description: Current page
              schema:
                type: integer
          content:
            application/json:
              example:
                consents: []
  "/api/v1/patients/{id}/cryo/contracts/{contract_id}":
    get:
      summary: show
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: string
      - name: contract_id
        in: path
        required: true
        schema:
          type: string
      - name: x-account-id
        in: header
        schema:
          type: string
      security:
      - Bearer: []
      responses:
        '200':
          description: successful
          content:
            application/json:
              example:
                cryo_contract:
                  id: 9
                  reference_number: 17dbf576-e402-45b8-a9da-cc41115683b2-1784188517
                  issued_to_id: 73
                  invoicing_strategy_id: 12
                  start_date: '2026-07-16'
                  expiry_date: '2036-07-16'
                  status: active
                  created_at: '2026-07-16T08:55:17.002+01:00'
                  updated_at: '2026-07-16T08:55:17.002+01:00'
                  notes: ''
                  contract_samples:
                  - id: 31
  "/api/v1/patients/{id}/cryo/contracts":
    get:
      summary: list
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: string
      - name: page
        in: query
        required: false
        description: Page number
        schema:
          type: integer
      - name: x-account-id
        in: header
        schema:
          type: string
      security:
      - Bearer: []
      responses:
        '200':
          description: successful
          headers:
            total-count:
              description: Total item count
              schema:
                type: integer
            total-pages:
              description: Total page count
              schema:
                type: integer
            page-items:
              description: Items per page
              schema:
                type: integer
            current-page:
              description: Current page
              schema:
                type: integer
          content:
            application/json:
              example:
                contracts:
                - cryo_contract:
                    id: 6
                    reference_number: 17dbf576-e402-45b8-a9da-cc41115683b2-1784188514
                    issued_to_id: 73
                    invoicing_strategy_id: 9
                    start_date: '2026-07-16'
                    expiry_date: '2036-07-16'
                    status: active
                    created_at: '2026-07-16T08:55:14.724+01:00'
                    updated_at: '2026-07-16T08:55:14.724+01:00'
                    notes: ''
                    contract_samples:
                    - id: 28
                - cryo_contract:
                    id: 7
                    reference_number: 17dbf576-e402-45b8-a9da-cc41115683b2-1784188515
                    issued_to_id: 73
                    invoicing_strategy_id: 10
                    start_date: '2026-07-16'
                    expiry_date: '2036-07-16'
                    status: active
                    created_at: '2026-07-16T08:55:15.008+01:00'
                    updated_at: '2026-07-16T08:55:15.008+01:00'
                    notes: ''
                    contract_samples:
                    - id: 29
                - cryo_contract:
                    id: 8
                    reference_number: 17dbf576-e402-45b8-a9da-cc41115683b2-1784188516
                    issued_to_id: 73
                    invoicing_strategy_id: 11
                    start_date: '2026-07-16'
                    expiry_date: '2036-07-16'
                    status: active
                    created_at: '2026-07-16T08:55:16.003+01:00'
                    updated_at: '2026-07-16T08:55:16.003+01:00'
                    notes: ''
                    contract_samples:
                    - id: 30
  "/api/v1/patients/{id}/cryo/contracts/upsert":
    post:
      summary: upsert
      parameters:
      - name: x-account-id
        in: header
        schema:
          type: string
      - name: id
        in: path
        required: true
        schema:
          type: string
      security:
      - Bearer: []
      responses:
        '200':
          description: ok
          content:
            application/json:
              example:
                cryo_contract:
                  id: 12
                  reference_number: 17dbf576-e402-45b8-a9da-cc41115683b2-1784188518
                  issued_to_id: 73
                  invoicing_strategy_id: 13
                  start_date: '2026-07-16'
                  expiry_date: '2036-07-16'
                  status: active
                  created_at: '2026-07-16T08:55:18.003+01:00'
                  updated_at: '2026-07-16T08:55:18.003+01:00'
                  notes: ''
                  contract_samples:
                  - id: 32
        '422':
          description: unprocessable entity
          content:
            application/json:
              example:
                message: Invoicing strategy must exist
      requestBody:
        content:
          application/json:
            schema:
              "$ref": "#/components/schemas/cryo_contract_input"
  "/api/v1/patients/{id}/cryo/contracts/{contract_id}/start":
    put:
      summary: start
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: string
      - name: contract_id
        in: path
        required: true
        schema:
          type: string
      - name: x-account-id
        in: header
        schema:
          type: string
      security:
      - Bearer: []
      responses:
        '200':
          description: successful
          content:
            application/json:
              example:
                cryo_contract:
                  id: 14
                  reference_number: 17dbf576-e402-45b8-a9da-cc41115683b2-1784188518
                  issued_to_id: 73
                  invoicing_strategy_id: 15
                  start_date: '2026-07-16'
                  expiry_date: '2036-07-16'
                  status: active
                  created_at: '2026-07-16T08:55:18.195+01:00'
                  updated_at: '2026-07-16T08:55:18.286+01:00'
                  notes: ''
                  contract_samples:
                  - id: 34
  "/api/v1/patients/{id}/cryo/contracts/{contract_id}/terminate":
    put:
      summary: terminate
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: string
      - name: contract_id
        in: path
        required: true
        schema:
          type: string
      - name: x-account-id
        in: header
        schema:
          type: string
      security:
      - Bearer: []
      responses:
        '200':
          description: successful
          content:
            application/json:
              example:
                cryo_contract:
                  id: 16
                  reference_number: 17dbf576-e402-45b8-a9da-cc41115683b2-1784188518
                  issued_to_id: 73
                  invoicing_strategy_id: 17
                  start_date: '2026-07-16'
                  expiry_date: '2036-07-16'
                  status: terminated
                  created_at: '2026-07-16T08:55:18.430+01:00'
                  updated_at: '2026-07-16T08:55:18.493+01:00'
                  notes: ''
                  contract_samples:
                  - id: 36
  "/api/v1/patients/{id}/cryo/samples/{sample_id}/devices":
    get:
      summary: list
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: string
      - name: sample_id
        in: path
        required: true
        schema:
          type: string
      - name: page
        in: query
        required: false
        description: Page number
        schema:
          type: integer
      - name: x-account-id
        in: header
        schema:
          type: string
      security:
      - Bearer: []
      responses:
        '200':
          description: successful
          headers:
            total-count:
              description: Total item count
              schema:
                type: integer
            total-pages:
              description: Total page count
              schema:
                type: integer
            page-items:
              description: Items per page
              schema:
                type: integer
            current-page:
              description: Current page
              schema:
                type: integer
          content:
            application/json:
              example:
                cryo_devices:
                - cryo_device:
                    id: 48
                    identification: Device 48
                    sample_id: 37
                    volume: 0.0
                    count: 1
                    embryo_grading:
                    fate:
                    biopsy:
                    patient_reserved_for_id:
                    created_at: '2026-07-16T08:55:18.589+01:00'
                    updated_at: '2026-07-16T08:55:18.589+01:00'
                - cryo_device:
                    id: 49
                    identification: Device 49
                    sample_id: 37
                    volume: 0.0
                    count: 1
                    embryo_grading:
                    fate:
                    biopsy:
                    patient_reserved_for_id:
                    created_at: '2026-07-16T08:55:18.593+01:00'
                    updated_at: '2026-07-16T08:55:18.593+01:00'
  "/api/v1/patients/{id}/cryo/samples":
    get:
      summary: list
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: string
      - name: page
        in: query
        required: false
        description: Page number
        schema:
          type: integer
      - name: x-account-id
        in: header
        schema:
          type: string
      security:
      - Bearer: []
      responses:
        '200':
          description: successful
          headers:
            total-count:
              description: Total item count
              schema:
                type: integer
            total-pages:
              description: Total page count
              schema:
                type: integer
            page-items:
              description: Items per page
              schema:
                type: integer
            current-page:
              description: Current page
              schema:
                type: integer
          content:
            application/json:
              example:
                cryo_samples: []
  "/api/v1/patients/{id}/cryo/samples?sample_id={sample_id}":
    get:
      summary: list
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: string
      - name: sample_id
        in: query
        schema:
          type: string
      - name: page
        in: query
        required: false
        description: Page number
        schema:
          type: integer
      - name: x-account-id
        in: header
        schema:
          type: string
      security:
      - Bearer: []
      responses:
        '200':
          description: successful
          headers:
            total-count:
              description: Total item count
              schema:
                type: integer
            total-pages:
              description: Total page count
              schema:
                type: integer
            page-items:
              description: Items per page
              schema:
                type: integer
            current-page:
              description: Current page
              schema:
                type: integer
          content:
            application/json:
              example:
                cryo_samples: []
  "/api/v1/patients/{id}/cryo/samples/{sample_id}":
    get:
      summary: show
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: string
      - name: sample_id
        in: path
        required: true
        schema:
          type: string
      - name: x-account-id
        in: header
        schema:
          type: string
      security:
      - Bearer: []
      responses:
        '200':
          description: successful
          content:
            application/json:
              example:
                cryo_sample:
                  id: 39
                  sample_id: SAMPLE-39
                  created_at: '2026-07-16T08:55:18.863+01:00'
                  updated_at: '2026-07-16T08:55:18.863+01:00'
                  cane: PAT-39
                  color:
                  cryo_status: cryopreserved
                  freeze_date: '2026-07-15T08:55:18.835+01:00'
                  notes:
                  position: first
                  quarantined_until:
                  sample_type: embryos
                  source:
                  stored_at: '2026-07-15T08:55:18.835+01:00'
                  thaw_reason:
                  canister_id: 48
                  partner_id:
                  patient_id: 78
                  user_id:
                  devices_count: 0
                  imported_from:
                  exported_to:
                  second_color:
                  total_volume_frozen: 0.0
                  total_oocytes_frozen: 1
                  expiry_date:
                  witnessed_by_id:
                  sperm_provider_id:
                  oocytes_provider_id:
                  gametes_provider_id:
                  cryo_devices: []
  "/api/v1/patients/{id}/cryo/samples/upsert":
    post:
      summary: upsert
      parameters:
      - name: x-account-id
        in: header
        schema:
          type: string
      - name: id
        in: path
        required: true
        schema:
          type: string
      security:
      - Bearer: []
      responses:
        '200':
          description: ok
          content:
            application/json:
              example:
                cryo_sample:
                  id: 42
                  sample_id: 07ad1e13-32bb-467e-ac85-ac316f14c840-0001
                  created_at: '2026-07-16T08:55:19.076+01:00'
                  updated_at: '2026-07-16T08:55:19.076+01:00'
                  cane: CANE
                  color:
                  cryo_status: cryopreserved
                  freeze_date: '2026-07-16T00:00:00.000+01:00'
                  notes:
                  position:
                  quarantined_until:
                  sample_type: sperm
                  source:
                  stored_at:
                  thaw_reason:
                  canister_id: 50
                  partner_id:
                  patient_id: 80
                  user_id:
                  devices_count: 1
                  imported_from:
                  exported_to:
                  second_color:
                  total_volume_frozen: 1.0
                  total_oocytes_frozen: 0
                  expiry_date:
                  witnessed_by_id:
                  sperm_provider_id:
                  oocytes_provider_id:
                  gametes_provider_id:
                  cryo_devices:
                  - cryo_device:
                      id: 51
                      identification: '1'
                      sample_id: 42
                      volume: 1.0
                      count: 0
                      embryo_grading:
                      fate:
                      biopsy:
                      patient_reserved_for_id:
                      created_at: '2026-07-16T08:55:19.078+01:00'
                      updated_at: '2026-07-16T08:55:19.078+01:00'
        '422':
          description: unprocessable entity
          content:
            application/json:
              example:
                message: Cryo status is missing value, Freeze date is missing value,
                  Type is missing value, Virology Statuses is missing value, and Freeze
                  date is missing value
      requestBody:
        content:
          application/json:
            schema:
              "$ref": "#/components/schemas/cryo_sample_input"
  "/api/v1/patients/{id}/cryo/samples/{sample_id}/thaws":
    get:
      summary: list
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: string
      - name: sample_id
        in: path
        required: true
        schema:
          type: string
      - name: page
        in: query
        required: false
        description: Page number
        schema:
          type: integer
      - name: x-account-id
        in: header
        schema:
          type: string
      security:
      - Bearer: []
      responses:
        '200':
          description: successful
          headers:
            total-count:
              description: Total item count
              schema:
                type: integer
            total-pages:
              description: Total page count
              schema:
                type: integer
            page-items:
              description: Items per page
              schema:
                type: integer
            current-page:
              description: Current page
              schema:
                type: integer
          content:
            application/json:
              example:
                cryo_thaws:
                - cryo_thaw:
                    id: 8
                    identification: 123-0006
                    reason: destruction
                    thawed_at: '2026-07-16T08:55:19.287+01:00'
                    created_at: '2026-07-16T08:55:19.290+01:00'
                    updated_at: '2026-07-16T08:55:19.290+01:00'
                    external_status:
                    notes:
                    thawed_by_id:
                    witnessed_by_id:
                    cycle_id:
                    patient_id: 83
                    cryo_devices:
                    - cryo_device:
                        id: 52
                        identification: Device 50
                        sample_id: 44
                        volume: 0.0
                        count: 1
                        embryo_grading:
                        fate:
                        biopsy:
                        patient_reserved_for_id:
                        created_at: '2026-07-16T08:55:19.243+01:00'
                        updated_at: '2026-07-16T08:55:19.292+01:00'
                    - cryo_device:
                        id: 53
                        identification: Device 51
                        sample_id: 44
                        volume: 0.0
                        count: 1
                        embryo_grading:
                        fate:
                        biopsy:
                        patient_reserved_for_id:
                        created_at: '2026-07-16T08:55:19.246+01:00'
                        updated_at: '2026-07-16T08:55:19.294+01:00'
    post:
      summary: create
      parameters:
      - name: x-account-id
        in: header
        schema:
          type: string
      - name: id
        in: path
        required: true
        schema:
          type: string
      - name: sample_id
        in: path
        required: true
        schema:
          type: string
      security:
      - Bearer: []
      responses:
        '200':
          description: ok
          content:
            application/json:
              example:
                cryo_thaw:
                  id: 11
                  identification: CT-67500857-40af-4ca4-839e-42897b48be49-0001
                  reason: destruction
                  thawed_at: '2026-07-16T08:55:19.510+01:00'
                  created_at: '2026-07-16T08:55:19.589+01:00'
                  updated_at: '2026-07-16T08:55:19.589+01:00'
                  external_status:
                  notes: Some notes
                  thawed_by_id: 116
                  witnessed_by_id: 116
                  cycle_id:
                  patient_id: 82
                  cryo_devices:
                  - cryo_device:
                      id: 56
                      identification: Device 54
                      sample_id: 46
                      volume: 0.0
                      count: 1
                      embryo_grading:
                      fate: thawed
                      biopsy:
                      patient_reserved_for_id:
                      created_at: '2026-07-16T08:55:19.451+01:00'
                      updated_at: '2026-07-16T08:55:19.592+01:00'
                  - cryo_device:
                      id: 57
                      identification: Device 55
                      sample_id: 46
                      volume: 0.0
                      count: 1
                      embryo_grading:
                      fate: thawed
                      biopsy:
                      patient_reserved_for_id:
                      created_at: '2026-07-16T08:55:19.454+01:00'
                      updated_at: '2026-07-16T08:55:19.594+01:00'
        '422':
          description: unprocessable entity
          content:
            application/json:
              example:
                message: Reason is missing value, Thawed at is missing value, and
                  Cryo devices is missing value
      requestBody:
        content:
          application/json:
            schema:
              "$ref": "#/components/schemas/cryo_thaw_input"
  "/api/v1/patients/{id}/cryo/samples/{sample_id}/thaws/{thaw_id}":
    get:
      summary: show
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: string
      - name: sample_id
        in: path
        required: true
        schema:
          type: string
      - name: thaw_id
        in: path
        required: true
        schema:
          type: string
      - name: x-account-id
        in: header
        schema:
          type: string
      security:
      - Bearer: []
      responses:
        '200':
          description: successful
          content:
            application/json:
              example:
                cryo_thaw:
                  id: 9
                  identification: 123-0007
                  reason: destruction
                  thawed_at: '2026-07-16T08:55:19.390+01:00'
                  created_at: '2026-07-16T08:55:19.393+01:00'
                  updated_at: '2026-07-16T08:55:19.393+01:00'
                  external_status:
                  notes:
                  thawed_by_id:
                  witnessed_by_id:
                  cycle_id:
                  patient_id: 84
                  cryo_devices:
                  - cryo_device:
                      id: 54
                      identification: Device 52
                      sample_id: 45
                      volume: 0.0
                      count: 1
                      embryo_grading:
                      fate:
                      biopsy:
                      patient_reserved_for_id:
                      created_at: '2026-07-16T08:55:19.348+01:00'
                      updated_at: '2026-07-16T08:55:19.395+01:00'
                  - cryo_device:
                      id: 55
                      identification: Device 53
                      sample_id: 45
                      volume: 0.0
                      count: 1
                      embryo_grading:
                      fate:
                      biopsy:
                      patient_reserved_for_id:
                      created_at: '2026-07-16T08:55:19.351+01:00'
                      updated_at: '2026-07-16T08:55:19.397+01:00'
  "/api/v1/patients/{id}/cycles":
    get:
      summary: list
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: string
      - name: page
        in: query
        required: false
        description: Page number
        schema:
          type: integer
      - name: x-account-id
        in: header
        schema:
          type: string
      security:
      - Bearer: []
      responses:
        '200':
          description: successful
          headers:
            total-count:
              description: Total item count
              schema:
                type: integer
            total-pages:
              description: Total page count
              schema:
                type: integer
            page-items:
              description: Items per page
              schema:
                type: integer
            current-page:
              description: Current page
              schema:
                type: integer
          content:
            application/json:
              example:
                cycles:
                - id: 12
                  cd1_date:
                  lmp_date:
                  start_date: '2026-07-14'
                  end_date:
                  created_at: '2026-07-16T08:55:19.817+01:00'
                  updated_at: '2026-07-16T08:55:19.817+01:00'
                  type: Treatment Type 12
                  protocol: Treatment Protocol 12
                - id: 13
                  cd1_date:
                  lmp_date:
                  start_date: '2026-07-14'
                  end_date:
                  created_at: '2026-07-16T08:55:19.835+01:00'
                  updated_at: '2026-07-16T08:55:19.835+01:00'
                  type: Treatment Type 13
                  protocol: Treatment Protocol 13
                - id: 14
                  cd1_date:
                  lmp_date:
                  start_date: '2026-07-14'
                  end_date:
                  created_at: '2026-07-16T08:55:19.853+01:00'
                  updated_at: '2026-07-16T08:55:19.853+01:00'
                  type: Treatment Type 14
                  protocol: Treatment Protocol 14
  "/api/v1/patients/{id}/egg_collections":
    get:
      summary: list
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: string
      - name: page
        in: query
        required: false
        description: Page number
        schema:
          type: integer
      - name: x-account-id
        in: header
        schema:
          type: string
      security:
      - Bearer: []
      responses:
        '200':
          description: successful
          headers:
            total-count:
              description: Total item count
              schema:
                type: integer
            total-pages:
              description: Total page count
              schema:
                type: integer
            page-items:
              description: Items per page
              schema:
                type: integer
            current-page:
              description: Current page
              schema:
                type: integer
          content:
            application/json:
              example:
                egg_collections: []
  "/api/v1/patients/{id}/embryo_transfers":
    get:
      summary: list
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: string
      - name: page
        in: query
        required: false
        description: Page number
        schema:
          type: integer
      - name: x-account-id
        in: header
        schema:
          type: string
      security:
      - Bearer: []
      responses:
        '200':
          description: successful
          headers:
            total-count:
              description: Total item count
              schema:
                type: integer
            total-pages:
              description: Total page count
              schema:
                type: integer
            page-items:
              description: Items per page
              schema:
                type: integer
            current-page:
              description: Current page
              schema:
                type: integer
          content:
            application/json:
              example:
                embryo_transfers: []
  "/api/v1/patients/{id}/embryos":
    get:
      summary: list
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: string
      - name: page
        in: query
        required: false
        description: Page number
        schema:
          type: integer
      - name: x-account-id
        in: header
        schema:
          type: string
      security:
      - Bearer: []
      responses:
        '200':
          description: successful
          headers:
            total-count:
              description: Total item count
              schema:
                type: integer
            total-pages:
              description: Total page count
              schema:
                type: integer
            page-items:
              description: Items per page
              schema:
                type: integer
            current-page:
              description: Current page
              schema:
                type: integer
          content:
            application/json:
              example:
                embryos: []
  "/api/v1/patients/{id}/files":
    get:
      summary: list
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: string
      - name: page
        in: query
        required: false
        description: Page number
        schema:
          type: integer
      - name: x-account-id
        in: header
        schema:
          type: string
      security:
      - Bearer: []
      responses:
        '200':
          description: successful
          headers:
            total-count:
              description: Total item count
              schema:
                type: integer
            total-pages:
              description: Total page count
              schema:
                type: integer
            page-items:
              description: Items per page
              schema:
                type: integer
            current-page:
              description: Current page
              schema:
                type: integer
          content:
            application/json:
              example:
                files: []
  "/api/v1/patients/{id}/finance/invoices":
    get:
      summary: list
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: string
      - name: page
        in: query
        required: false
        description: Page number
        schema:
          type: integer
      - name: x-account-id
        in: header
        schema:
          type: string
      security:
      - Bearer: []
      responses:
        '200':
          description: successful
          headers:
            total-count:
              description: Total item count
              schema:
                type: integer
            total-pages:
              description: Total page count
              schema:
                type: integer
            page-items:
              description: Items per page
              schema:
                type: integer
            current-page:
              description: Current page
              schema:
                type: integer
          content:
            application/json:
              example:
                invoices:
                - invoice:
                    id: 27
                    invoice_number: 2025-18
                    currency: EUR
                    due_date: '2026-07-23'
                    issued_date: '2026-07-16'
                    issued_to_id: 101
                    issued_to_type: Patient
                    status: draft
                    created_at: '2026-07-16T08:55:21.516+01:00'
                    updated_at: '2026-07-16T08:55:21.516+01:00'
                    total_amount_cents: 10000
                    total_amount_currency: EUR
                    outstanding_amount_cents: 10000
                    outstanding_amount_currency: EUR
                    discount_amount:
                      cents: 0
                      currency_iso: EUR
                    discount_percentage:
                    public_note:
                    internal_note:
                    price_list_id:
                    payment_terms_id:
                    reference_id: 101
                    reference_type: Patient
                    line_items:
                    - line_item:
                        id: 44
                        product_id:
                        quantity: 1
                        finance_tax_rate_id:
                        unit_price:
                          cents: 10000
                          currency_iso: EUR
                        discount_amount:
                          cents: 0
                          currency_iso: EUR
                        discount_percentage:
                    - line_item:
                        id: 45
                        product_id:
                        quantity: 1
                        finance_tax_rate_id:
                        unit_price:
                          cents: 10000
                          currency_iso: EUR
                        discount_amount:
                          cents: 0
                          currency_iso: EUR
                        discount_percentage:
  "/api/v1/patients/{id}/finance/invoices/{invoice_id}":
    get:
      summary: show
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: string
      - name: invoice_id
        in: path
        required: true
        schema:
          type: string
      - name: x-account-id
        in: header
        schema:
          type: string
      security:
      - Bearer: []
      responses:
        '200':
          description: successful
          content:
            application/json:
              example:
                invoice:
                  id: 28
                  invoice_number: 2025-19
                  currency: EUR
                  due_date: '2026-07-23'
                  issued_date: '2026-07-16'
                  issued_to_id: 101
                  issued_to_type: Patient
                  status: draft
                  created_at: '2026-07-16T08:55:21.611+01:00'
                  updated_at: '2026-07-16T08:55:21.611+01:00'
                  total_amount_cents: 10000
                  total_amount_currency: EUR
                  outstanding_amount_cents: 10000
                  outstanding_amount_currency: EUR
                  discount_amount:
                    cents: 0
                    currency_iso: EUR
                  discount_percentage:
                  public_note:
                  internal_note:
                  price_list_id:
                  payment_terms_id:
                  reference_id: 101
                  reference_type: Patient
                  line_items:
                  - line_item:
                      id: 46
                      product_id:
                      quantity: 1
                      finance_tax_rate_id:
                      unit_price:
                        cents: 10000
                        currency_iso: EUR
                      discount_amount:
                        cents: 0
                        currency_iso: EUR
                      discount_percentage:
                  - line_item:
                      id: 47
                      product_id:
                      quantity: 1
                      finance_tax_rate_id:
                      unit_price:
                        cents: 10000
                        currency_iso: EUR
                      discount_amount:
                        cents: 0
                        currency_iso: EUR
                      discount_percentage:
  "/api/v1/patients/{id}/finance/invoices/upsert":
    post:
      summary: upsert
      parameters:
      - name: x-account-id
        in: header
        schema:
          type: string
      - name: id
        in: path
        required: true
        schema:
          type: string
      security:
      - Bearer: []
      responses:
        '200':
          description: ok
          content:
            application/json:
              example:
                invoice:
                  id: 32
                  invoice_number: 20260716-5078fe6d-0769-4b7b-b25c-b80cd41b26c3-0002
                  currency: EUR
                  due_date: '2026-08-15'
                  issued_date: '2026-07-16'
                  issued_to_id: 101
                  issued_to_type: Patient
                  status: issued
                  created_at: '2026-07-16T08:55:22.032+01:00'
                  updated_at: '2026-07-16T08:55:22.032+01:00'
                  total_amount_cents: 50000
                  total_amount_currency: EUR
                  outstanding_amount_cents: 50000
                  outstanding_amount_currency: EUR
                  discount_amount:
                    cents: 0
                    currency_iso: EUR
                  discount_percentage:
                  public_note:
                  internal_note:
                  price_list_id:
                  payment_terms_id: 2
                  reference_id: 101
                  reference_type: Patient
                  line_items:
                  - line_item:
                      id: 53
                      product_id: 13
                      quantity: 5
                      finance_tax_rate_id:
                      unit_price:
                        cents: 10000
                        currency_iso: EUR
                      discount_amount:
                        cents: 0
                        currency_iso: EUR
                      discount_percentage: '0.0'
      requestBody:
        content:
          application/json:
            schema:
              "$ref": "#/components/schemas/invoice_input"
  "/api/v1/patients/{id}/finance/invoices/{invoice_id}/issue":
    put:
      summary: issue
      parameters:
      - name: x-account-id
        in: header
        schema:
          type: string
      - name: id
        in: path
        required: true
        schema:
          type: string
      - name: invoice_id
        in: path
        required: true
        schema:
          type: string
      security:
      - Bearer: []
      responses:
        '200':
          description: ok
          content:
            application/json:
              example:
                invoice:
                  id: 34
                  invoice_number: 2025-23
                  currency: EUR
                  due_date: '2026-07-23'
                  issued_date: '2026-07-16'
                  issued_to_id: 101
                  issued_to_type: Patient
                  status: issued
                  created_at: '2026-07-16T08:55:22.260+01:00'
                  updated_at: '2026-07-16T08:55:22.402+01:00'
                  total_amount_cents: 22000
                  total_amount_currency: EUR
                  outstanding_amount_cents: 22000
                  outstanding_amount_currency: EUR
                  discount_amount:
                    cents: 0
                    currency_iso: EUR
                  discount_percentage:
                  public_note:
                  internal_note:
                  price_list_id:
                  payment_terms_id:
                  reference_id: 101
                  reference_type: Patient
                  line_items:
                  - line_item:
                      id: 56
                      product_id:
                      quantity: 1
                      finance_tax_rate_id:
                      unit_price:
                        cents: 10000
                        currency_iso: EUR
                      discount_amount:
                        cents: 0
                        currency_iso: EUR
                      discount_percentage:
                  - line_item:
                      id: 57
                      product_id:
                      quantity: 1
                      finance_tax_rate_id:
                      unit_price:
                        cents: 10000
                        currency_iso: EUR
                      discount_amount:
                        cents: 0
                        currency_iso: EUR
                      discount_percentage:
      requestBody:
        content:
          application/json:
            schema:
              "$ref": "#/components/schemas/issue_invoice_input"
  "/api/v1/patients/{id}/finance/invoices/{invoice_id}/cancel":
    put:
      summary: cancel
      parameters:
      - name: x-account-id
        in: header
        schema:
          type: string
      - name: id
        in: path
        required: true
        schema:
          type: string
      - name: invoice_id
        in: path
        required: true
        schema:
          type: string
      security:
      - Bearer: []
      responses:
        '200':
          description: ok
          content:
            application/json:
              example:
                invoice:
                  id: 36
                  invoice_number: 2025-25
                  currency: EUR
                  due_date: '2026-07-23'
                  issued_date: '2026-07-16'
                  issued_to_id: 101
                  issued_to_type: Patient
                  status: cancelled
                  created_at: '2026-07-16T08:55:22.569+01:00'
                  updated_at: '2026-07-16T08:55:22.642+01:00'
                  total_amount_cents: 10000
                  total_amount_currency: EUR
                  outstanding_amount_cents: 0
                  outstanding_amount_currency: EUR
                  discount_amount:
                    cents: 0
                    currency_iso: EUR
                  discount_percentage:
                  public_note:
                  internal_note:
                  price_list_id:
                  payment_terms_id:
                  reference_id: 101
                  reference_type: Patient
                  line_items:
                  - line_item:
                      id: 60
                      product_id:
                      quantity: 1
                      finance_tax_rate_id:
                      unit_price:
                        cents: 10000
                        currency_iso: EUR
                      discount_amount:
                        cents: 0
                        currency_iso: EUR
                      discount_percentage:
                  - line_item:
                      id: 61
                      product_id:
                      quantity: 1
                      finance_tax_rate_id:
                      unit_price:
                        cents: 10000
                        currency_iso: EUR
                      discount_amount:
                        cents: 0
                        currency_iso: EUR
                      discount_percentage:
  "/api/v1/patients/{id}/follicle_scans":
    get:
      summary: list
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: string
      - name: page
        in: query
        required: false
        description: Page number
        schema:
          type: integer
      - name: x-account-id
        in: header
        schema:
          type: string
      security:
      - Bearer: []
      responses:
        '200':
          description: successful
          headers:
            total-count:
              description: Total item count
              schema:
                type: integer
            total-pages:
              description: Total page count
              schema:
                type: integer
            page-items:
              description: Items per page
              schema:
                type: integer
            current-page:
              description: Current page
              schema:
                type: integer
          content:
            application/json:
              example:
                follicle_scans: []
    post:
      summary: create
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: string
      - name: x-account-id
        in: header
        schema:
          type: string
      security:
      - Bearer: []
      responses:
        '201':
          description: successful
          content:
            application/json:
              example:
                id: 1
                chaperone:
                consent_given:
                exam_date: '2024-07-01'
                scan_received_at:
                source: GE Voluson E10
                created_at: '2026-07-16T08:55:22.940+01:00'
                updated_at: '2026-07-16T08:55:22.940+01:00'
                follicle_measurements:
                - id: 1
                  side: right
                  d1_mm: '1.1'
                  d2_mm: '1.2'
                  d3_mm: '1.3'
                  volume_cm3: '3.4'
                - id: 2
                  side: left
                  d1_mm: '2.1'
                  d2_mm: '2.2'
                  d3_mm: '2.3'
                  volume_cm3: '3.4'
                endometrial_measurements:
                - id: 1
                  grade: 'Smith: Grade A'
                  thickness_m1_mm: '1.1'
                  thickness_m2_mm: '1.2'
                  thickness_m3_mm: '1.3'
                  thickness_m4_mm: '1.4'
                  thickness_m5_mm: '1.5'
                  thickness_m6_mm: '1.6'
      requestBody:
        content:
          application/json:
            schema:
              "$ref": "#/components/schemas/follicle_scan_input"
  "/api/v1/patients/{id}/follicle_scans/{follicle_scan_id}":
    put:
      summary: update
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: string
      - name: follicle_scan_id
        in: path
        required: true
        schema:
          type: string
      - name: x-account-id
        in: header
        schema:
          type: string
      security:
      - Bearer: []
      responses:
        '200':
          description: successful
          content:
            application/json:
              example:
                id: 2
                chaperone:
                consent_given:
                exam_date: '2024-07-01'
                scan_received_at:
                source: GE Voluson E10
                created_at: '2026-07-16T08:55:22.980+01:00'
                updated_at: '2026-07-16T08:55:23.071+01:00'
                follicle_measurements:
                - id: 3
                  side: left
                  d1_mm: '1.1'
                  d2_mm: '1.2'
                  d3_mm: '1.3'
                  volume_cm3: '3.4'
                - id: 4
                  side: right
                  d1_mm: '2.1'
                  d2_mm: '3.2'
                  d3_mm: '4.3'
                  volume_cm3: '3.4'
                endometrial_measurements: []
      requestBody:
        content:
          application/json:
            schema:
              "$ref": "#/components/schemas/follicle_scan_input"
    delete:
      summary: destroy
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: string
      - name: follicle_scan_id
        in: path
        required: true
        schema:
          type: string
      - name: x-account-id
        in: header
        schema:
          type: string
      security:
      - Bearer: []
      responses:
        '200':
          description: successful
          content:
            application/json:
              example:
                message: deleted
    get:
      summary: show
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: string
      - name: follicle_scan_id
        in: path
        required: true
        schema:
          type: string
      - name: x-account-id
        in: header
        schema:
          type: string
      security:
      - Bearer: []
      responses:
        '200':
          description: successful
          content:
            application/json:
              example:
                id: 4
                chaperone:
                consent_given:
                exam_date: '2026-07-16'
                scan_received_at:
                source: DICOM
                created_at: '2026-07-16T08:55:23.253+01:00'
                updated_at: '2026-07-16T08:55:23.291+01:00'
                follicle_measurements:
                - id: 6
                  side: left
                  d1_mm: '1.5'
                  d2_mm: '2.5'
                  d3_mm: '3.5'
                  volume_cm3: '4.5'
                endometrial_measurements: []
  "/api/v1/patients/{id}/follicle_scans/{follicle_scan_id}/imaging":
    get:
      summary: index
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: string
      - name: follicle_scan_id
        in: path
        required: true
        schema:
          type: string
      - name: x-account-id
        in: header
        schema:
          type: string
      security:
      - Bearer: []
      responses:
        '200':
          description: successful
          content:
            application/json:
              example:
                imaging:
                - image:
                    id: 9
                    filename: test.jpg
                    content_type: image/jpeg
                    byte_size: 10
                    created_at: '2026-07-16T08:55:23.412+01:00'
                    url: "/rails/active_storage/blobs/redirect/eyJfcmFpbHMiOnsiZGF0YSI6OSwicHVyIjoiYmxvYl9pZCJ9fQ==--9446a7ccaa619709992c1034e204b3600b6ad991/test.jpg"
    post:
      summary: create
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: string
      - name: follicle_scan_id
        in: path
        required: true
        schema:
          type: string
      - name: x-account-id
        in: header
        schema:
          type: string
      security:
      - Bearer: []
      responses:
        '201':
          description: successful
          content:
            application/json:
              example:
                image:
                  id: 11
                  filename: avatar.jpg
                  content_type: image/jpeg
                  byte_size: 4197
                  created_at: '2026-07-16T08:55:23.564+01:00'
                  url: "/rails/active_storage/blobs/redirect/eyJfcmFpbHMiOnsiZGF0YSI6MTEsInB1ciI6ImJsb2JfaWQifX0=--45f2ed7afae2af7350018e598da940d7a603b1a0/avatar.jpg"
      requestBody:
        content:
          multipart/form-data:
            schema:
              type: file
        required: true
        description: Image file
  "/api/v1/patients/{id}/follicle_scans/{follicle_scan_id}/imaging/{image_id}":
    delete:
      summary: destroy
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: string
      - name: follicle_scan_id
        in: path
        required: true
        schema:
          type: string
      - name: image_id
        in: path
        required: true
        schema:
          type: string
      - name: x-account-id
        in: header
        schema:
          type: string
      security:
      - Bearer: []
      responses:
        '200':
          description: successful
          content:
            application/json:
              example:
                message: deleted
  "/api/v1/patients/{id}/invoices":
    get:
      summary: list
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: string
      - name: page
        in: query
        required: false
        description: Page number
        schema:
          type: integer
      - name: x-account-id
        in: header
        schema:
          type: string
      security:
      - Bearer: []
      responses:
        '200':
          description: successful
          headers:
            total-count:
              description: Total item count
              schema:
                type: integer
            total-pages:
              description: Total page count
              schema:
                type: integer
            page-items:
              description: Items per page
              schema:
                type: integer
            current-page:
              description: Current page
              schema:
                type: integer
          content:
            application/json:
              example:
                invoices: []
  "/api/v1/patients/{id}/lab_reports":
    get:
      summary: list
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: string
      - name: page
        in: query
        required: false
        description: Page number
        schema:
          type: integer
      - name: x-account-id
        in: header
        schema:
          type: string
      security:
      - Bearer: []
      responses:
        '200':
          description: successful
          headers:
            total-count:
              description: Total item count
              schema:
                type: integer
            total-pages:
              description: Total page count
              schema:
                type: integer
            page-items:
              description: Items per page
              schema:
                type: integer
            current-page:
              description: Current page
              schema:
                type: integer
          content:
            application/json:
              example:
                lab_reports: []
  "/api/v1/patients/{id}/letters":
    get:
      summary: list
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: string
      - name: page
        in: query
        required: false
        description: Page number
        schema:
          type: integer
      - name: x-account-id
        in: header
        schema:
          type: string
      security:
      - Bearer: []
      responses:
        '200':
          description: successful
          headers:
            total-count:
              description: Total item count
              schema:
                type: integer
            total-pages:
              description: Total page count
              schema:
                type: integer
            page-items:
              description: Items per page
              schema:
                type: integer
            current-page:
              description: Current page
              schema:
                type: integer
          content:
            application/json:
              example:
                letters: []
  "/api/v1/patients/{id}/medications":
    get:
      summary: list
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: string
      - name: page
        in: query
        required: false
        description: Page number
        schema:
          type: integer
      - name: x-account-id
        in: header
        schema:
          type: string
      security:
      - Bearer: []
      responses:
        '200':
          description: successful
          headers:
            total-count:
              description: Total item count
              schema:
                type: integer
            total-pages:
              description: Total page count
              schema:
                type: integer
            page-items:
              description: Items per page
              schema:
                type: integer
            current-page:
              description: Current page
              schema:
                type: integer
          content:
            application/json:
              example:
                medications: []
  "/api/v1/patients/{id}/notes":
    get:
      summary: list
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: string
      - name: page
        in: query
        required: false
        description: Page number
        schema:
          type: integer
      - name: x-account-id
        in: header
        schema:
          type: string
      security:
      - Bearer: []
      responses:
        '200':
          description: successful
          headers:
            total-count:
              description: Total item count
              schema:
                type: integer
            total-pages:
              description: Total page count
              schema:
                type: integer
            page-items:
              description: Items per page
              schema:
                type: integer
            current-page:
              description: Current page
              schema:
                type: integer
          content:
            application/json:
              example:
                notes: []
  "/api/v1/patients/{id}/quotes":
    get:
      summary: list
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: string
      - name: page
        in: query
        required: false
        description: Page number
        schema:
          type: integer
      - name: x-account-id
        in: header
        schema:
          type: string
      security:
      - Bearer: []
      responses:
        '200':
          description: successful
          headers:
            total-count:
              description: Total item count
              schema:
                type: integer
            total-pages:
              description: Total page count
              schema:
                type: integer
            page-items:
              description: Items per page
              schema:
                type: integer
            current-page:
              description: Current page
              schema:
                type: integer
          content:
            application/json:
              example:
                quotes: []
  "/api/v1/patients/{id}/surveys":
    get:
      summary: list
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: string
      - name: page
        in: query
        required: false
        description: Page number
        schema:
          type: integer
      - name: x-account-id
        in: header
        schema:
          type: string
      security:
      - Bearer: []
      responses:
        '200':
          description: successful
          headers:
            total-count:
              description: Total item count
              schema:
                type: integer
            total-pages:
              description: Total page count
              schema:
                type: integer
            page-items:
              description: Items per page
              schema:
                type: integer
            current-page:
              description: Current page
              schema:
                type: integer
          content:
            application/json:
              example:
                surveys: []
  "/api/v1/patients":
    get:
      summary: list
      parameters:
      - name: page
        in: query
        required: false
        description: Page number
        schema:
          type: integer
      - name: x-account-id
        in: header
        schema:
          type: string
      security:
      - Bearer: []
      responses:
        '200':
          description: successful
          headers:
            total-count:
              description: Total item count
              schema:
                type: integer
            total-pages:
              description: Total page count
              schema:
                type: integer
            page-items:
              description: Items per page
              schema:
                type: integer
            current-page:
              description: Current page
              schema:
                type: integer
          content:
            application/json:
              example:
                data:
                - created_at: '2026-07-16T08:55:24.342+01:00'
                  id: 110
                  email: mail109@email.com
                  first_name: PatientName110
                  last_name: PatientLastName
                  preferred_name:
                  identity_management_id: 27133568-e28f-466a-8ef6-a95b4993b0d4
                  sex: sex_not_specified
                  ethnicity:
                  pronouns:
                  account_id: 135
                  date_of_birth: '1996-07-16'
                  phone_number:
                    country_code: '45'
                    phone_number: '80808080'
                  address:
                  location_id:
                  has_wawa_app: false
                  partner_id:
  "/api/v1/patients/upsert":
    post:
      summary: upsert
      parameters:
      - name: x-account-id
        in: header
        schema:
          type: string
      security:
      - Bearer: []
      responses:
        '200':
          description: ok
          content:
            application/json:
              example:
                created_at: '2026-07-16T08:55:24.461+01:00'
                id: 112
                email: random@test.com
                first_name: UpdatedName
                last_name: PatientLastName
                preferred_name:
                identity_management_id: '123456'
                sex: sex_not_specified
                ethnicity:
                pronouns:
                account_id: 135
                date_of_birth: '1996-07-16'
                phone_number:
                  country_code: '45'
                  phone_number: '80808080'
                address:
                location_id:
                has_wawa_app: false
                partner_id:
        '422':
          description: unprocessable entity
          content:
            application/json:
              example:
                message: First name is missing value and Email is missing value
      requestBody:
        content:
          application/json:
            schema:
              "$ref": "#/components/schemas/patient_input"
  "/api/v1/patients/{id}":
    get:
      summary: show
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: string
      - name: x-account-id
        in: header
        schema:
          type: string
      security:
      - Bearer: []
      responses:
        '200':
          description: successful
          content:
            application/json:
              example:
                created_at: '2026-07-16T08:55:24.342+01:00'
                id: 110
                email: mail109@email.com
                first_name: PatientName110
                last_name: PatientLastName
                preferred_name:
                identity_management_id: 27133568-e28f-466a-8ef6-a95b4993b0d4
                sex: sex_not_specified
                ethnicity:
                pronouns:
                account_id: 135
                date_of_birth: '1996-07-16'
                phone_number:
                  country_code: '45'
                  phone_number: '80808080'
                address:
                location_id:
                has_wawa_app: false
                partner_id:
  "/api/v1/rooms":
    get:
      summary: list
      parameters:
      - name: x-account-id
        in: header
        schema:
          type: string
      security:
      - Bearer: []
      responses:
        '200':
          description: successful
          content:
            application/json:
              example:
                rooms: []
  "/api/v1/teams":
    get:
      summary: list
      parameters:
      - name: x-account-id
        in: header
        schema:
          type: string
      - name: x-account-id
        in: header
        schema:
          type: string
      security:
      - Bearer: []
      responses:
        '200':
          description: excludes discarded teams
          content:
            application/json:
              example:
                teams:
                - id: 1
                  name: Kept Team
                  created_at: '2026-07-16T08:55:24.822+01:00'
                  updated_at: '2026-07-16T08:55:24.822+01:00'
                  member_user_ids: []
  "/api/v1/users":
    get:
      summary: list
      parameters:
      - name: x-account-id
        in: header
        schema:
          type: string
      security:
      - Bearer: []
      responses:
        '200':
          description: successful
          content:
            application/json:
              example:
                users:
                - id: 139
                  name: FirstName 134 LastName 137
                  email: email134@mail.com
                  created_at: '2026-07-16T08:55:24.877+01:00'
                  updated_at: '2026-07-16T08:55:24.877+01:00'
servers:
- url: "{defaultHost}"
  variables:
    defaultHost:
      default: https://clinic.wawafertility.com
