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

# Create a qualification library question

> Creates a reusable screening question for your brand. The question must bind a fact from the authoring catalog; a request that names no such fact, or a fact that asks for medical information, is rejected with a plain-language message. Binding a shared fact is what lets a patient answer the same question only once across screening and the medical intake.



## OpenAPI

````yaml /openapi/public-openapi.json post /v1/account/question-library/questions
openapi: 3.1.0
info:
  title: Purple API
  version: 0.0.0
servers:
  - url: https://api.dev.purplelabelmd.com
security: []
tags:
  - description: Sign a patient in and out and manage the browser session.
    name: Sessions & authentication
  - description: Run the server-driven intake questionnaire question by question.
    name: Intake
  - description: Address autocomplete for the intake flow.
    name: Addresses
  - description: Read the public status of a patient's enrollment.
    name: Enrollment
  - description: Track a client's onboarding progress.
    name: Onboarding
  - description: Read back the platform configuration stored for your brand.
    name: Brand configuration
  - description: Enable offerings for your brand and set their display copy.
    name: Offering configuration
  - description: Start and track payments for an order.
    name: Payments
  - description: Subscribe to platform events and manage delivery endpoints.
    name: Webhooks
paths:
  /v1/account/question-library/questions:
    post:
      tags:
        - Offering configuration
      summary: Create a qualification library question
      description: >-
        Creates a reusable screening question for your brand. The question must
        bind a fact from the authoring catalog; a request that names no such
        fact, or a fact that asks for medical information, is rejected with a
        plain-language message. Binding a shared fact is what lets a patient
        answer the same question only once across screening and the medical
        intake.
      operationId: createQualificationLibraryQuestion
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/QualificationQuestionWrite'
        required: true
      responses:
        '201':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/QualificationQuestionResult'
          description: the created library question
        '400':
          $ref: '#/components/responses/OverlayBadRequest'
        '404':
          $ref: '#/components/responses/OverlayNotFound'
        '422':
          $ref: '#/components/responses/OverlayUnprocessable'
        '503':
          $ref: '#/components/responses/OverlayStoreUnavailable'
      security:
        - apiKey: []
components:
  schemas:
    QualificationQuestionWrite:
      description: >-
        create body for a qualification question — the question fields, FLAT (no
        wrapper object). Your brand comes from your API key, and the platform
        derives the therapy context from the offering itself, so the body
        carries neither. The question id is server-minted; a client-sent id is
        ignored.
      properties:
        control:
          enum:
            - single_select_cards
            - multi_select_cards
            - scale
            - number
            - number_pair
            - date
            - text
            - long_text
            - file_capture
            - address
            - phone
            - email
            - search_select
          type: string
        copy:
          additionalProperties:
            type: string
          description: >-
            your display copy — the question wording rides the `prompt` slot
            (required)
          type: object
        fact:
          description: >-
            the stable code of the catalog fact this question collects (must
            resolve)
          type: string
        option_labels:
          additionalProperties:
            type: string
          description: >-
            your per-option labels, keyed by stable option code (labels never
            bind logic)
          type: object
        options:
          description: >-
            stable option codes offered as answers — a subset of the bound
            fact's own codes
          items:
            type: string
          type: array
        required:
          type: boolean
        when:
          allOf:
            - $ref: '#/components/schemas/QualificationCondition'
          description: >-
            an optional condition — show this question only when an earlier
            screening answer calls for it. See the same field on the question
            shape for the full rules.
      required:
        - fact
        - control
        - copy
      type: object
    QualificationQuestionResult:
      description: >-
        the saved question under `data`, plus non-blocking duplicate notices
        when another question already collects the same fact (the write still
        succeeds — warnings never block)
      properties:
        data:
          $ref: '#/components/schemas/QualificationOverlayQuestion'
        warnings:
          items:
            properties:
              code:
                enum:
                  - DUPLICATE_FACT
                type: string
              fact:
                type: string
              message:
                type: string
            required:
              - code
              - fact
              - message
            type: object
          type: array
      required:
        - data
      type: object
    QualificationCondition:
      additionalProperties: true
      description: >-
        A condition on a screening question, built from your own earlier
        screening answers. It compares an earlier answer to a value, or combines
        such comparisons, in the same rule language the platform uses to serve
        questions. The question is shown only when the condition holds.
      properties:
        kind:
          description: >-
            the kind of condition node (comparison, presence check, boolean
            combination, or if/else)
          enum:
            - compare
            - 'null'
            - bool
            - cond
          type: string
      required:
        - kind
      type: object
    QualificationOverlayQuestion:
      description: >-
        A client-authored screening question — a library definition or an
        offering-local copy. It binds a fact by its stable code (the code must
        resolve in your authoring fact catalog) and a display control, and
        carries your own wording. Copy and option labels are yours to author.
      properties:
        control:
          enum:
            - single_select_cards
            - multi_select_cards
            - scale
            - number
            - number_pair
            - date
            - text
            - long_text
            - file_capture
            - address
            - phone
            - email
            - search_select
          type: string
        copy:
          additionalProperties:
            type: string
          description: your display copy (the question prompt rides the `prompt` slot)
          type: object
        fact:
          description: >-
            the stable code of the catalog fact this question collects (must
            resolve)
          type: string
        id:
          type: string
        option_labels:
          additionalProperties:
            type: string
          description: >-
            your per-option labels, keyed by option code (labels never bind
            logic)
          type: object
        options:
          description: >-
            stable option codes offered as answers — a subset of the bound
            fact's own codes
          items:
            type: string
          type: array
        required:
          type: boolean
        when:
          allOf:
            - $ref: '#/components/schemas/QualificationCondition'
          description: >-
            an optional condition — show this question only when an earlier
            screening answer calls for it (for example, ask "how long have you
            used one?" only after "have you used one?" is yes). A condition may
            use only facts collected by questions shown EARLIER in this
            offering; never a medical-intake answer or another brand's fact.
            When the condition is not met the question is skipped; with no
            condition the question is always shown. Accepted and validated at
            authoring now; conditional serving activates in a coming release
            (see the changelog).
      required:
        - id
        - fact
        - control
      type: object
    CompileProblem:
      description: RFC 7807 problem, extended with the structured compile issue list
      properties:
        issues:
          items:
            properties:
              code:
                type: string
              message:
                type: string
              where:
                type: string
            required:
              - code
              - where
              - message
            type: object
          type: array
        status:
          type: integer
        title:
          type: string
      required:
        - title
        - status
      type: object
  responses:
    OverlayBadRequest:
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/CompileProblem'
      description: missing or invalid parameters
    OverlayNotFound:
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/CompileProblem'
      description: >-
        no shared clinical bundle for that (therapy|offering, mode), or no such
        resource
    OverlayUnprocessable:
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/CompileProblem'
      description: validation failed — the declare-a-fact wall or the compile bar (422)
    OverlayStoreUnavailable:
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/CompileProblem'
      description: >-
        the durable question store did not answer — nothing was written or
        changed; safe to retry once the store recovers
  securitySchemes:
    apiKey:
      description: 'Per-client API key (M2M). Presented as `Authorization: Bearer <key>`.'
      scheme: bearer
      type: http

````