> ## Documentation Index
> Fetch the complete documentation index at: https://synapse-docs.apart.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Continuous Due Questions



## OpenAPI

````yaml /openapi.json post /v1/organizations/{organization_id}/apps/{app_id}/environments/{environment_id}/continuous-evaluation/due-questions
openapi: 3.1.0
info:
  description: Are we on the same page?
  title: Synapse
  version: 0.1.0
servers: []
security: []
paths:
  /v1/organizations/{organization_id}/apps/{app_id}/environments/{environment_id}/continuous-evaluation/due-questions:
    post:
      tags:
        - v1-platform
      summary: Continuous Due Questions
      operationId: >-
        continuous_due_questions_v1_organizations__organization_id__apps__app_id__environments__environment_id__continuous_evaluation_due_questions_post
      parameters:
        - in: path
          name: organization_id
          required: true
          schema:
            format: uuid
            title: Organization Id
            type: string
        - in: path
          name: app_id
          required: true
          schema:
            format: uuid
            title: App Id
            type: string
        - in: path
          name: environment_id
          required: true
          schema:
            format: uuid
            title: Environment Id
            type: string
        - in: header
          name: Idempotency-Key
          required: true
          schema:
            maxLength: 255
            minLength: 1
            title: Idempotency-Key
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ContinuousDueQuestionsRequest'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ContinuousDueQuestionsResponse'
          description: Successful Response
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorResponse'
          description: Authentication required
        '403':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorResponse'
          description: Insufficient scope
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorResponse'
          description: Resource not found
        '409':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorResponse'
          description: State or idempotency conflict
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorResponse'
          description: Request validation failed
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorResponse'
          description: Internal server error
      security:
        - BearerAuth: []
        - ApiKeyAuth: []
        - SessionCookie: []
components:
  schemas:
    ContinuousDueQuestionsRequest:
      additionalProperties: false
      properties:
        now:
          anyOf:
            - format: date-time
              type: string
            - type: 'null'
          title: Now
        program_id:
          format: uuid
          title: Program Id
          type: string
        subject_id:
          format: uuid
          title: Subject Id
          type: string
        trigger:
          $ref: '#/components/schemas/ContinuousTrigger'
      required:
        - subject_id
        - program_id
        - trigger
      title: ContinuousDueQuestionsRequest
      type: object
    ContinuousDueQuestionsResponse:
      properties:
        delivered_at:
          format: date-time
          title: Delivered At
          type: string
        items:
          items:
            $ref: '#/components/schemas/ContinuousDueQuestion'
          title: Items
          type: array
      required:
        - items
        - delivered_at
      title: ContinuousDueQuestionsResponse
      type: object
    ApiErrorResponse:
      additionalProperties: false
      properties:
        detail:
          anyOf:
            - $ref: '#/components/schemas/ErrorDetail'
            - type: string
            - items: {}
              type: array
            - additionalProperties: true
              type: object
          title: Detail
      required:
        - detail
      title: ApiErrorResponse
      type: object
    ContinuousTrigger:
      additionalProperties: false
      properties:
        event:
          anyOf:
            - maxLength: 255
              minLength: 1
              type: string
            - type: 'null'
          title: Event
        login_session_id:
          anyOf:
            - maxLength: 255
              minLength: 1
              type: string
            - type: 'null'
          title: Login Session Id
        page:
          anyOf:
            - maxLength: 1024
              minLength: 1
              type: string
            - type: 'null'
          title: Page
        type:
          enum:
            - after_login
            - page_visit
            - event
          title: Type
          type: string
      required:
        - type
      title: ContinuousTrigger
      type: object
    ContinuousDueQuestion:
      properties:
        delivery_id:
          format: uuid
          title: Delivery Id
          type: string
        due_reason:
          enum:
            - first_delivery
            - unanswered_retry
            - per_login_window
            - frequency_window_elapsed
          title: Due Reason
          type: string
        question:
          discriminator:
            mapping:
              date:
                $ref: '#/components/schemas/DateQuestion'
              multi_select:
                $ref: '#/components/schemas/MultiSelectQuestion'
              number:
                $ref: '#/components/schemas/NumberQuestion'
              number_group:
                $ref: '#/components/schemas/NumberGroupQuestion'
              short_text:
                $ref: '#/components/schemas/ShortTextQuestion'
              single_select:
                $ref: '#/components/schemas/SingleSelectQuestion'
            propertyName: input
          oneOf:
            - $ref: '#/components/schemas/SingleSelectQuestion'
            - $ref: '#/components/schemas/MultiSelectQuestion'
            - $ref: '#/components/schemas/ShortTextQuestion'
            - $ref: '#/components/schemas/NumberQuestion'
            - $ref: '#/components/schemas/DateQuestion'
            - $ref: '#/components/schemas/NumberGroupQuestion'
          title: Question
      required:
        - delivery_id
        - question
        - due_reason
      title: ContinuousDueQuestion
      type: object
    ErrorDetail:
      additionalProperties: false
      description: Stable structured detail returned by versioned API errors.
      properties:
        code:
          title: Code
          type: string
        context:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Context
        message:
          title: Message
          type: string
        request_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Request Id
      required:
        - code
        - message
      title: ErrorDetail
      type: object
    DateQuestion:
      additionalProperties: false
      properties:
        id:
          title: Id
          type: string
        input:
          const: date
          title: Input
          type: string
        prompt:
          title: Prompt
          type: string
        purpose:
          items:
            type: string
          title: Purpose
          type: array
        remarks:
          anyOf:
            - type: string
            - type: 'null'
          title: Remarks
        required:
          default: false
          title: Required
          type: boolean
        schedule:
          anyOf:
            - $ref: '#/components/schemas/Schedule'
            - type: 'null'
        section_id:
          title: Section Id
          type: string
        visible_if:
          anyOf:
            - discriminator:
                mapping:
                  agg:
                    $ref: '#/components/schemas/Agg'
                  bool:
                    $ref: '#/components/schemas/BoolOp'
                  calc:
                    $ref: '#/components/schemas/Calc'
                  cmp:
                    $ref: '#/components/schemas/Cmp'
                  if:
                    $ref: '#/components/schemas/IfExpr'
                  in:
                    $ref: '#/components/schemas/InExpr'
                  lit:
                    $ref: '#/components/schemas/Lit'
                  var:
                    $ref: '#/components/schemas/Var'
                  years_since:
                    $ref: '#/components/schemas/YearsSince'
                propertyName: op
              oneOf:
                - $ref: '#/components/schemas/Lit'
                - $ref: '#/components/schemas/Var'
                - $ref: '#/components/schemas/Calc'
                - $ref: '#/components/schemas/Cmp'
                - $ref: '#/components/schemas/BoolOp'
                - $ref: '#/components/schemas/IfExpr'
                - $ref: '#/components/schemas/Agg'
                - $ref: '#/components/schemas/InExpr'
                - $ref: '#/components/schemas/YearsSince'
            - type: 'null'
          title: Visible If
      required:
        - id
        - section_id
        - prompt
        - input
      title: DateQuestion
      type: object
    MultiSelectQuestion:
      additionalProperties: false
      properties:
        aggregation:
          default: sum
          enum:
            - sum
            - max
            - mean
          title: Aggregation
          type: string
        id:
          title: Id
          type: string
        input:
          const: multi_select
          title: Input
          type: string
        options:
          items:
            $ref: '#/components/schemas/Option'
          title: Options
          type: array
        prompt:
          title: Prompt
          type: string
        purpose:
          items:
            type: string
          title: Purpose
          type: array
        remarks:
          anyOf:
            - type: string
            - type: 'null'
          title: Remarks
        required:
          default: false
          title: Required
          type: boolean
        schedule:
          anyOf:
            - $ref: '#/components/schemas/Schedule'
            - type: 'null'
        section_id:
          title: Section Id
          type: string
        visible_if:
          anyOf:
            - discriminator:
                mapping:
                  agg:
                    $ref: '#/components/schemas/Agg'
                  bool:
                    $ref: '#/components/schemas/BoolOp'
                  calc:
                    $ref: '#/components/schemas/Calc'
                  cmp:
                    $ref: '#/components/schemas/Cmp'
                  if:
                    $ref: '#/components/schemas/IfExpr'
                  in:
                    $ref: '#/components/schemas/InExpr'
                  lit:
                    $ref: '#/components/schemas/Lit'
                  var:
                    $ref: '#/components/schemas/Var'
                  years_since:
                    $ref: '#/components/schemas/YearsSince'
                propertyName: op
              oneOf:
                - $ref: '#/components/schemas/Lit'
                - $ref: '#/components/schemas/Var'
                - $ref: '#/components/schemas/Calc'
                - $ref: '#/components/schemas/Cmp'
                - $ref: '#/components/schemas/BoolOp'
                - $ref: '#/components/schemas/IfExpr'
                - $ref: '#/components/schemas/Agg'
                - $ref: '#/components/schemas/InExpr'
                - $ref: '#/components/schemas/YearsSince'
            - type: 'null'
          title: Visible If
      required:
        - id
        - section_id
        - prompt
        - input
        - options
      title: MultiSelectQuestion
      type: object
    NumberQuestion:
      additionalProperties: false
      properties:
        id:
          title: Id
          type: string
        input:
          const: number
          title: Input
          type: string
        prompt:
          title: Prompt
          type: string
        purpose:
          items:
            type: string
          title: Purpose
          type: array
        remarks:
          anyOf:
            - type: string
            - type: 'null'
          title: Remarks
        required:
          default: false
          title: Required
          type: boolean
        schedule:
          anyOf:
            - $ref: '#/components/schemas/Schedule'
            - type: 'null'
        section_id:
          title: Section Id
          type: string
        unit:
          anyOf:
            - type: string
            - type: 'null'
          title: Unit
        visible_if:
          anyOf:
            - discriminator:
                mapping:
                  agg:
                    $ref: '#/components/schemas/Agg'
                  bool:
                    $ref: '#/components/schemas/BoolOp'
                  calc:
                    $ref: '#/components/schemas/Calc'
                  cmp:
                    $ref: '#/components/schemas/Cmp'
                  if:
                    $ref: '#/components/schemas/IfExpr'
                  in:
                    $ref: '#/components/schemas/InExpr'
                  lit:
                    $ref: '#/components/schemas/Lit'
                  var:
                    $ref: '#/components/schemas/Var'
                  years_since:
                    $ref: '#/components/schemas/YearsSince'
                propertyName: op
              oneOf:
                - $ref: '#/components/schemas/Lit'
                - $ref: '#/components/schemas/Var'
                - $ref: '#/components/schemas/Calc'
                - $ref: '#/components/schemas/Cmp'
                - $ref: '#/components/schemas/BoolOp'
                - $ref: '#/components/schemas/IfExpr'
                - $ref: '#/components/schemas/Agg'
                - $ref: '#/components/schemas/InExpr'
                - $ref: '#/components/schemas/YearsSince'
            - type: 'null'
          title: Visible If
      required:
        - id
        - section_id
        - prompt
        - input
      title: NumberQuestion
      type: object
    NumberGroupQuestion:
      additionalProperties: false
      description: >-
        Multi-field numeric group (e.g. per-asset-class current values).


        Field values are addressable in expressions as
        ``answers.<qid>.<fieldId>``.
      properties:
        fields:
          items:
            $ref: '#/components/schemas/GroupField'
          title: Fields
          type: array
        id:
          title: Id
          type: string
        input:
          const: number_group
          title: Input
          type: string
        prompt:
          title: Prompt
          type: string
        purpose:
          items:
            type: string
          title: Purpose
          type: array
        remarks:
          anyOf:
            - type: string
            - type: 'null'
          title: Remarks
        required:
          default: false
          title: Required
          type: boolean
        schedule:
          anyOf:
            - $ref: '#/components/schemas/Schedule'
            - type: 'null'
        section_id:
          title: Section Id
          type: string
        visible_if:
          anyOf:
            - discriminator:
                mapping:
                  agg:
                    $ref: '#/components/schemas/Agg'
                  bool:
                    $ref: '#/components/schemas/BoolOp'
                  calc:
                    $ref: '#/components/schemas/Calc'
                  cmp:
                    $ref: '#/components/schemas/Cmp'
                  if:
                    $ref: '#/components/schemas/IfExpr'
                  in:
                    $ref: '#/components/schemas/InExpr'
                  lit:
                    $ref: '#/components/schemas/Lit'
                  var:
                    $ref: '#/components/schemas/Var'
                  years_since:
                    $ref: '#/components/schemas/YearsSince'
                propertyName: op
              oneOf:
                - $ref: '#/components/schemas/Lit'
                - $ref: '#/components/schemas/Var'
                - $ref: '#/components/schemas/Calc'
                - $ref: '#/components/schemas/Cmp'
                - $ref: '#/components/schemas/BoolOp'
                - $ref: '#/components/schemas/IfExpr'
                - $ref: '#/components/schemas/Agg'
                - $ref: '#/components/schemas/InExpr'
                - $ref: '#/components/schemas/YearsSince'
            - type: 'null'
          title: Visible If
      required:
        - id
        - section_id
        - prompt
        - input
        - fields
      title: NumberGroupQuestion
      type: object
    ShortTextQuestion:
      additionalProperties: false
      properties:
        id:
          title: Id
          type: string
        input:
          const: short_text
          title: Input
          type: string
        prompt:
          title: Prompt
          type: string
        purpose:
          items:
            type: string
          title: Purpose
          type: array
        remarks:
          anyOf:
            - type: string
            - type: 'null'
          title: Remarks
        required:
          default: false
          title: Required
          type: boolean
        rubric:
          anyOf:
            - $ref: '#/components/schemas/Rubric'
            - type: 'null'
        schedule:
          anyOf:
            - $ref: '#/components/schemas/Schedule'
            - type: 'null'
        section_id:
          title: Section Id
          type: string
        visible_if:
          anyOf:
            - discriminator:
                mapping:
                  agg:
                    $ref: '#/components/schemas/Agg'
                  bool:
                    $ref: '#/components/schemas/BoolOp'
                  calc:
                    $ref: '#/components/schemas/Calc'
                  cmp:
                    $ref: '#/components/schemas/Cmp'
                  if:
                    $ref: '#/components/schemas/IfExpr'
                  in:
                    $ref: '#/components/schemas/InExpr'
                  lit:
                    $ref: '#/components/schemas/Lit'
                  var:
                    $ref: '#/components/schemas/Var'
                  years_since:
                    $ref: '#/components/schemas/YearsSince'
                propertyName: op
              oneOf:
                - $ref: '#/components/schemas/Lit'
                - $ref: '#/components/schemas/Var'
                - $ref: '#/components/schemas/Calc'
                - $ref: '#/components/schemas/Cmp'
                - $ref: '#/components/schemas/BoolOp'
                - $ref: '#/components/schemas/IfExpr'
                - $ref: '#/components/schemas/Agg'
                - $ref: '#/components/schemas/InExpr'
                - $ref: '#/components/schemas/YearsSince'
            - type: 'null'
          title: Visible If
      required:
        - id
        - section_id
        - prompt
        - input
      title: ShortTextQuestion
      type: object
    SingleSelectQuestion:
      additionalProperties: false
      properties:
        id:
          title: Id
          type: string
        input:
          const: single_select
          title: Input
          type: string
        options:
          items:
            $ref: '#/components/schemas/Option'
          title: Options
          type: array
        prompt:
          title: Prompt
          type: string
        purpose:
          items:
            type: string
          title: Purpose
          type: array
        remarks:
          anyOf:
            - type: string
            - type: 'null'
          title: Remarks
        required:
          default: false
          title: Required
          type: boolean
        schedule:
          anyOf:
            - $ref: '#/components/schemas/Schedule'
            - type: 'null'
        section_id:
          title: Section Id
          type: string
        visible_if:
          anyOf:
            - discriminator:
                mapping:
                  agg:
                    $ref: '#/components/schemas/Agg'
                  bool:
                    $ref: '#/components/schemas/BoolOp'
                  calc:
                    $ref: '#/components/schemas/Calc'
                  cmp:
                    $ref: '#/components/schemas/Cmp'
                  if:
                    $ref: '#/components/schemas/IfExpr'
                  in:
                    $ref: '#/components/schemas/InExpr'
                  lit:
                    $ref: '#/components/schemas/Lit'
                  var:
                    $ref: '#/components/schemas/Var'
                  years_since:
                    $ref: '#/components/schemas/YearsSince'
                propertyName: op
              oneOf:
                - $ref: '#/components/schemas/Lit'
                - $ref: '#/components/schemas/Var'
                - $ref: '#/components/schemas/Calc'
                - $ref: '#/components/schemas/Cmp'
                - $ref: '#/components/schemas/BoolOp'
                - $ref: '#/components/schemas/IfExpr'
                - $ref: '#/components/schemas/Agg'
                - $ref: '#/components/schemas/InExpr'
                - $ref: '#/components/schemas/YearsSince'
            - type: 'null'
          title: Visible If
      required:
        - id
        - section_id
        - prompt
        - input
        - options
      title: SingleSelectQuestion
      type: object
    Schedule:
      additionalProperties: false
      description: Continuous Evaluation metadata (from the Excel's CE Question builder).
      properties:
        frequency:
          enum:
            - one_time
            - per_login
            - fortnightly
            - monthly
            - quarterly
            - semiannually
            - annually
          title: Frequency
          type: string
        max_per_login:
          anyOf:
            - type: integer
            - type: 'null'
          title: Max Per Login
        repeat_until_answered:
          default: false
          title: Repeat Until Answered
          type: boolean
        trigger:
          $ref: '#/components/schemas/Trigger'
      required:
        - frequency
        - trigger
      title: Schedule
      type: object
    Agg:
      additionalProperties: false
      description: |-
        Aggregate over the evaluated args; nulls are dropped first.

        Empty (after dropping nulls) → null, except ``count`` → 0.
      properties:
        args:
          items:
            discriminator:
              mapping:
                agg:
                  $ref: '#/components/schemas/Agg'
                bool:
                  $ref: '#/components/schemas/BoolOp'
                calc:
                  $ref: '#/components/schemas/Calc'
                cmp:
                  $ref: '#/components/schemas/Cmp'
                if:
                  $ref: '#/components/schemas/IfExpr'
                in:
                  $ref: '#/components/schemas/InExpr'
                lit:
                  $ref: '#/components/schemas/Lit'
                var:
                  $ref: '#/components/schemas/Var'
                years_since:
                  $ref: '#/components/schemas/YearsSince'
              propertyName: op
            oneOf:
              - $ref: '#/components/schemas/Lit'
              - $ref: '#/components/schemas/Var'
              - $ref: '#/components/schemas/Calc'
              - $ref: '#/components/schemas/Cmp'
              - $ref: '#/components/schemas/BoolOp'
              - $ref: '#/components/schemas/IfExpr'
              - $ref: '#/components/schemas/Agg'
              - $ref: '#/components/schemas/InExpr'
              - $ref: '#/components/schemas/YearsSince'
          title: Args
          type: array
        fn:
          enum:
            - sum
            - min
            - max
            - median
            - count
          title: Fn
          type: string
        op:
          const: agg
          title: Op
          type: string
      required:
        - op
        - fn
        - args
      title: Agg
      type: object
    BoolOp:
      additionalProperties: false
      description: >-
        Boolean logic with three-valued (null-aware) semantics. ``not`` takes
        one arg.
      properties:
        args:
          items:
            discriminator:
              mapping:
                agg:
                  $ref: '#/components/schemas/Agg'
                bool:
                  $ref: '#/components/schemas/BoolOp'
                calc:
                  $ref: '#/components/schemas/Calc'
                cmp:
                  $ref: '#/components/schemas/Cmp'
                if:
                  $ref: '#/components/schemas/IfExpr'
                in:
                  $ref: '#/components/schemas/InExpr'
                lit:
                  $ref: '#/components/schemas/Lit'
                var:
                  $ref: '#/components/schemas/Var'
                years_since:
                  $ref: '#/components/schemas/YearsSince'
              propertyName: op
            oneOf:
              - $ref: '#/components/schemas/Lit'
              - $ref: '#/components/schemas/Var'
              - $ref: '#/components/schemas/Calc'
              - $ref: '#/components/schemas/Cmp'
              - $ref: '#/components/schemas/BoolOp'
              - $ref: '#/components/schemas/IfExpr'
              - $ref: '#/components/schemas/Agg'
              - $ref: '#/components/schemas/InExpr'
              - $ref: '#/components/schemas/YearsSince'
          title: Args
          type: array
        fn:
          enum:
            - and
            - or
            - not
          title: Fn
          type: string
        op:
          const: bool
          title: Op
          type: string
      required:
        - op
        - fn
        - args
      title: BoolOp
      type: object
    Calc:
      additionalProperties: false
      description: >-
        Arithmetic. ``sub``/``div`` use exactly two args; ``add``/``mul`` any
        number.
      properties:
        args:
          items:
            discriminator:
              mapping:
                agg:
                  $ref: '#/components/schemas/Agg'
                bool:
                  $ref: '#/components/schemas/BoolOp'
                calc:
                  $ref: '#/components/schemas/Calc'
                cmp:
                  $ref: '#/components/schemas/Cmp'
                if:
                  $ref: '#/components/schemas/IfExpr'
                in:
                  $ref: '#/components/schemas/InExpr'
                lit:
                  $ref: '#/components/schemas/Lit'
                var:
                  $ref: '#/components/schemas/Var'
                years_since:
                  $ref: '#/components/schemas/YearsSince'
              propertyName: op
            oneOf:
              - $ref: '#/components/schemas/Lit'
              - $ref: '#/components/schemas/Var'
              - $ref: '#/components/schemas/Calc'
              - $ref: '#/components/schemas/Cmp'
              - $ref: '#/components/schemas/BoolOp'
              - $ref: '#/components/schemas/IfExpr'
              - $ref: '#/components/schemas/Agg'
              - $ref: '#/components/schemas/InExpr'
              - $ref: '#/components/schemas/YearsSince'
          title: Args
          type: array
        fn:
          enum:
            - add
            - sub
            - mul
            - div
          title: Fn
          type: string
        op:
          const: calc
          title: Op
          type: string
      required:
        - op
        - fn
        - args
      title: Calc
      type: object
    Cmp:
      additionalProperties: false
      description: >-
        Comparison. ``eq``/``neq`` compare same-typed scalars; the rest numbers
        only.
      properties:
        a:
          discriminator:
            mapping:
              agg:
                $ref: '#/components/schemas/Agg'
              bool:
                $ref: '#/components/schemas/BoolOp'
              calc:
                $ref: '#/components/schemas/Calc'
              cmp:
                $ref: '#/components/schemas/Cmp'
              if:
                $ref: '#/components/schemas/IfExpr'
              in:
                $ref: '#/components/schemas/InExpr'
              lit:
                $ref: '#/components/schemas/Lit'
              var:
                $ref: '#/components/schemas/Var'
              years_since:
                $ref: '#/components/schemas/YearsSince'
            propertyName: op
          oneOf:
            - $ref: '#/components/schemas/Lit'
            - $ref: '#/components/schemas/Var'
            - $ref: '#/components/schemas/Calc'
            - $ref: '#/components/schemas/Cmp'
            - $ref: '#/components/schemas/BoolOp'
            - $ref: '#/components/schemas/IfExpr'
            - $ref: '#/components/schemas/Agg'
            - $ref: '#/components/schemas/InExpr'
            - $ref: '#/components/schemas/YearsSince'
          title: A
        b:
          discriminator:
            mapping:
              agg:
                $ref: '#/components/schemas/Agg'
              bool:
                $ref: '#/components/schemas/BoolOp'
              calc:
                $ref: '#/components/schemas/Calc'
              cmp:
                $ref: '#/components/schemas/Cmp'
              if:
                $ref: '#/components/schemas/IfExpr'
              in:
                $ref: '#/components/schemas/InExpr'
              lit:
                $ref: '#/components/schemas/Lit'
              var:
                $ref: '#/components/schemas/Var'
              years_since:
                $ref: '#/components/schemas/YearsSince'
            propertyName: op
          oneOf:
            - $ref: '#/components/schemas/Lit'
            - $ref: '#/components/schemas/Var'
            - $ref: '#/components/schemas/Calc'
            - $ref: '#/components/schemas/Cmp'
            - $ref: '#/components/schemas/BoolOp'
            - $ref: '#/components/schemas/IfExpr'
            - $ref: '#/components/schemas/Agg'
            - $ref: '#/components/schemas/InExpr'
            - $ref: '#/components/schemas/YearsSince'
          title: B
        fn:
          enum:
            - gt
            - gte
            - lt
            - lte
            - eq
            - neq
          title: Fn
          type: string
        op:
          const: cmp
          title: Op
          type: string
      required:
        - op
        - fn
        - a
        - b
      title: Cmp
      type: object
    IfExpr:
      additionalProperties: false
      description: First case whose ``when`` is true wins; null conditions are skipped.
      properties:
        cases:
          items:
            $ref: '#/components/schemas/IfCase'
          title: Cases
          type: array
        else:
          discriminator:
            mapping:
              agg:
                $ref: '#/components/schemas/Agg'
              bool:
                $ref: '#/components/schemas/BoolOp'
              calc:
                $ref: '#/components/schemas/Calc'
              cmp:
                $ref: '#/components/schemas/Cmp'
              if:
                $ref: '#/components/schemas/IfExpr'
              in:
                $ref: '#/components/schemas/InExpr'
              lit:
                $ref: '#/components/schemas/Lit'
              var:
                $ref: '#/components/schemas/Var'
              years_since:
                $ref: '#/components/schemas/YearsSince'
            propertyName: op
          oneOf:
            - $ref: '#/components/schemas/Lit'
            - $ref: '#/components/schemas/Var'
            - $ref: '#/components/schemas/Calc'
            - $ref: '#/components/schemas/Cmp'
            - $ref: '#/components/schemas/BoolOp'
            - $ref: '#/components/schemas/IfExpr'
            - $ref: '#/components/schemas/Agg'
            - $ref: '#/components/schemas/InExpr'
            - $ref: '#/components/schemas/YearsSince'
          title: Else
        op:
          const: if
          title: Op
          type: string
      required:
        - op
        - cases
        - else
      title: IfExpr
      type: object
    InExpr:
      additionalProperties: false
      description: Membership test of a scalar against a list of literal scalars.
      properties:
        op:
          const: in
          title: Op
          type: string
        options:
          items:
            anyOf:
              - type: number
              - type: integer
              - type: string
              - type: boolean
              - type: 'null'
          title: Options
          type: array
        value:
          discriminator:
            mapping:
              agg:
                $ref: '#/components/schemas/Agg'
              bool:
                $ref: '#/components/schemas/BoolOp'
              calc:
                $ref: '#/components/schemas/Calc'
              cmp:
                $ref: '#/components/schemas/Cmp'
              if:
                $ref: '#/components/schemas/IfExpr'
              in:
                $ref: '#/components/schemas/InExpr'
              lit:
                $ref: '#/components/schemas/Lit'
              var:
                $ref: '#/components/schemas/Var'
              years_since:
                $ref: '#/components/schemas/YearsSince'
            propertyName: op
          oneOf:
            - $ref: '#/components/schemas/Lit'
            - $ref: '#/components/schemas/Var'
            - $ref: '#/components/schemas/Calc'
            - $ref: '#/components/schemas/Cmp'
            - $ref: '#/components/schemas/BoolOp'
            - $ref: '#/components/schemas/IfExpr'
            - $ref: '#/components/schemas/Agg'
            - $ref: '#/components/schemas/InExpr'
            - $ref: '#/components/schemas/YearsSince'
          title: Value
      required:
        - op
        - value
        - options
      title: InExpr
      type: object
    Lit:
      additionalProperties: false
      description: A literal scalar value.
      properties:
        op:
          const: lit
          title: Op
          type: string
        value:
          anyOf:
            - type: number
            - type: integer
            - type: string
            - type: boolean
            - type: 'null'
          title: Value
      required:
        - op
        - value
      title: Lit
      type: object
    Var:
      additionalProperties: false
      description: |-
        A dotted path into the evaluation context.

        Allowed roots: ``answers.<questionId>[.<fieldId>]``, ``computed.<id>``,
        ``signals.<id>``. A missing path evaluates to null.
      properties:
        op:
          const: var
          title: Op
          type: string
        path:
          title: Path
          type: string
      required:
        - op
        - path
      title: Var
      type: object
    YearsSince:
      additionalProperties: false
      description: Whole years elapsed between an ISO date (``YYYY-MM-DD``) and ctx.now.
      properties:
        date:
          discriminator:
            mapping:
              agg:
                $ref: '#/components/schemas/Agg'
              bool:
                $ref: '#/components/schemas/BoolOp'
              calc:
                $ref: '#/components/schemas/Calc'
              cmp:
                $ref: '#/components/schemas/Cmp'
              if:
                $ref: '#/components/schemas/IfExpr'
              in:
                $ref: '#/components/schemas/InExpr'
              lit:
                $ref: '#/components/schemas/Lit'
              var:
                $ref: '#/components/schemas/Var'
              years_since:
                $ref: '#/components/schemas/YearsSince'
            propertyName: op
          oneOf:
            - $ref: '#/components/schemas/Lit'
            - $ref: '#/components/schemas/Var'
            - $ref: '#/components/schemas/Calc'
            - $ref: '#/components/schemas/Cmp'
            - $ref: '#/components/schemas/BoolOp'
            - $ref: '#/components/schemas/IfExpr'
            - $ref: '#/components/schemas/Agg'
            - $ref: '#/components/schemas/InExpr'
            - $ref: '#/components/schemas/YearsSince'
          title: Date
        op:
          const: years_since
          title: Op
          type: string
      required:
        - op
        - date
      title: YearsSince
      type: object
    Option:
      additionalProperties: false
      properties:
        id:
          title: Id
          type: string
        label:
          title: Label
          type: string
        scores:
          additionalProperties:
            type: number
          title: Scores
          type: object
      required:
        - id
        - label
      title: Option
      type: object
    GroupField:
      additionalProperties: false
      properties:
        id:
          title: Id
          type: string
        label:
          title: Label
          type: string
      required:
        - id
        - label
      title: GroupField
      type: object
    Rubric:
      additionalProperties: false
      description: |-
        LLM rubric scoring for a free-text answer (Approach 2, "Spec Foundry").

        Scored beside the deterministic path: temperature-0 LLM call returning
        score + rationale + quoted evidence, fully logged, human-overridable.
        Score range is [0, max_score].
      properties:
        axis:
          title: Axis
          type: string
        criteria:
          title: Criteria
          type: string
        max_score:
          title: Max Score
          type: number
      required:
        - axis
        - max_score
        - criteria
      title: Rubric
      type: object
    Trigger:
      additionalProperties: false
      properties:
        event:
          anyOf:
            - type: string
            - type: 'null'
          title: Event
        page:
          anyOf:
            - type: string
            - type: 'null'
          title: Page
        type:
          enum:
            - after_login
            - page_visit
            - event
          title: Type
          type: string
      required:
        - type
      title: Trigger
      type: object
    IfCase:
      additionalProperties: false
      properties:
        then:
          discriminator:
            mapping:
              agg:
                $ref: '#/components/schemas/Agg'
              bool:
                $ref: '#/components/schemas/BoolOp'
              calc:
                $ref: '#/components/schemas/Calc'
              cmp:
                $ref: '#/components/schemas/Cmp'
              if:
                $ref: '#/components/schemas/IfExpr'
              in:
                $ref: '#/components/schemas/InExpr'
              lit:
                $ref: '#/components/schemas/Lit'
              var:
                $ref: '#/components/schemas/Var'
              years_since:
                $ref: '#/components/schemas/YearsSince'
            propertyName: op
          oneOf:
            - $ref: '#/components/schemas/Lit'
            - $ref: '#/components/schemas/Var'
            - $ref: '#/components/schemas/Calc'
            - $ref: '#/components/schemas/Cmp'
            - $ref: '#/components/schemas/BoolOp'
            - $ref: '#/components/schemas/IfExpr'
            - $ref: '#/components/schemas/Agg'
            - $ref: '#/components/schemas/InExpr'
            - $ref: '#/components/schemas/YearsSince'
          title: Then
        when:
          discriminator:
            mapping:
              agg:
                $ref: '#/components/schemas/Agg'
              bool:
                $ref: '#/components/schemas/BoolOp'
              calc:
                $ref: '#/components/schemas/Calc'
              cmp:
                $ref: '#/components/schemas/Cmp'
              if:
                $ref: '#/components/schemas/IfExpr'
              in:
                $ref: '#/components/schemas/InExpr'
              lit:
                $ref: '#/components/schemas/Lit'
              var:
                $ref: '#/components/schemas/Var'
              years_since:
                $ref: '#/components/schemas/YearsSince'
            propertyName: op
          oneOf:
            - $ref: '#/components/schemas/Lit'
            - $ref: '#/components/schemas/Var'
            - $ref: '#/components/schemas/Calc'
            - $ref: '#/components/schemas/Cmp'
            - $ref: '#/components/schemas/BoolOp'
            - $ref: '#/components/schemas/IfExpr'
            - $ref: '#/components/schemas/Agg'
            - $ref: '#/components/schemas/InExpr'
            - $ref: '#/components/schemas/YearsSince'
          title: When
      required:
        - when
        - then
      title: IfCase
      type: object
  securitySchemes:
    BearerAuth:
      description: Named syn_ API key or migration-only legacy key.
      scheme: bearer
      type: http
    ApiKeyAuth:
      description: Header alias for a named or legacy API key.
      in: header
      name: X-API-Key
      type: apiKey
    SessionCookie:
      description: Opaque administrator browser session.
      in: cookie
      name: synapse_session
      type: apiKey

````