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

# Get questionnaire

> Retrieve a questionnaire definition, including its full nested item tree — use this to render the form's questions to a patient.



## OpenAPI

````yaml /openapi.json get /questionnaires/{id}
openapi: 3.1.0
info:
  title: OpenLoop API
  version: 0.1.0
  description: >-
    Unified reference for the OpenLoop Patient (clinical) and Payments & Revenue
    APIs.
servers:
  - url: https://api.openloophealth.com/v0.1
    description: Production partner edge
  - url: https://api-staging.openloophealth.com/v0.1
    description: Staging partner edge (sandbox credentials)
security: []
paths:
  /questionnaires/{id}:
    get:
      tags:
        - Questionnaires
      summary: Get questionnaire
      description: >-
        Retrieve a questionnaire definition, including its full nested item tree
        — use this to render the form's questions to a patient.
      parameters:
        - schema:
            type: string
            minLength: 1
            maxLength: 64
          required: true
          name: id
          in: path
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/Questionnaire'
                  request_id:
                    type: string
                required:
                  - data
                  - request_id
        '400':
          description: Validation error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - serviceToken: []
        - userToken: []
components:
  schemas:
    Questionnaire:
      type: object
      properties:
        id:
          type: string
        url:
          type: string
        version:
          type: string
        name:
          type: string
        title:
          type: string
        status:
          type: string
          enum:
            - draft
            - active
            - retired
            - unknown
        experimental:
          type: boolean
        publisher:
          type: string
        description:
          type: string
        purpose:
          type: string
        date:
          type: string
          pattern: >-
            ^\d{4}(?:-\d{2}(?:-\d{2}(?:T\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:\d{2}))?)?)?$
        items:
          type: array
          items:
            $ref: '#/components/schemas/QuestionnaireItem'
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
        eligibility_rules: {}
        parent_questionnaire_id:
          type: string
          description: >-
            Id of the parent clinical questionnaire this one is derived from.
            Maintained in another organization and not resolvable through this
            API.
        program_code:
          type: string
          description: >-
            The program this questionnaire belongs to, such as `MWL`. With
            `encounter_type` and `model_version` it identifies an organization's
            questionnaire.
        encounter_type:
          type: string
          description: >-
            The encounter this questionnaire is for, read from `name`, which
            intakes are named `<program>-<encounter>`. One of `initial` or
            `followup`, with a name ending in `-refill` reading as `followup`,
            and absent when `name` does not follow that form.
        model_version:
          type: string
          description: >-
            The intake model version this questionnaire serves, as the intake
            sends it, such as `v1.0`. Unrelated to `version`, which is the
            questionnaire's own revision and uses a different scheme.
      required:
        - id
        - status
        - items
    ErrorResponse:
      type: object
      properties:
        error:
          type: object
          properties:
            message:
              type: string
            error_code:
              type: string
          required:
            - message
            - error_code
        request_id:
          type: string
      required:
        - error
        - request_id
    QuestionnaireItem:
      type: object
      required:
        - link_id
        - type
      properties:
        link_id:
          type: string
        text:
          type: string
        type:
          type: string
          enum:
            - group
            - display
            - boolean
            - decimal
            - integer
            - date
            - dateTime
            - time
            - string
            - text
            - url
            - choice
            - open-choice
            - attachment
            - reference
            - quantity
        required:
          type: boolean
        repeats:
          type: boolean
        read_only:
          type: boolean
        max_length:
          type: integer
          minimum: 1
        concept_id:
          type: integer
          minimum: 0
          maximum: 9007199254740991
        enable_when:
          type: array
          items:
            $ref: '#/components/schemas/QuestionnaireEnableWhen'
        enable_behavior:
          type: string
          enum:
            - all
            - any
        answer_options:
          type: array
          items:
            $ref: '#/components/schemas/QuestionnaireAnswerOption'
        items:
          type: array
          items:
            $ref: '#/components/schemas/QuestionnaireItem'
      not:
        properties:
          type:
            enum:
              - choice
              - open-choice
        required:
          - type
          - concept_id
    QuestionnaireEnableWhen:
      type: object
      properties:
        question:
          type: string
        operator:
          type: string
          enum:
            - exists
            - '='
            - '!='
            - '>'
            - <
            - '>='
            - <=
        value_boolean:
          type: boolean
        value_coding:
          type: object
          properties:
            code:
              type: string
            system:
              type: string
            display:
              type: string
          minProperties: 1
        value_string:
          type: string
        value_integer:
          type: integer
        value_decimal:
          type: number
        value_date:
          type: string
          pattern: ^\d{4}(-(0[1-9]|1[0-2])(-(0[1-9]|[12]\d|3[01]))?)?$
      required:
        - question
        - operator
      oneOf:
        - required:
            - value_boolean
        - required:
            - value_coding
        - required:
            - value_string
        - required:
            - value_integer
        - required:
            - value_decimal
        - required:
            - value_date
    QuestionnaireAnswerOption:
      type: object
      properties:
        value_string:
          type: string
        value_integer:
          type: integer
        value_date:
          type: string
          pattern: ^\d{4}(-(0[1-9]|1[0-2])(-(0[1-9]|[12]\d|3[01]))?)?$
        value_time:
          type: string
          pattern: ^([01]\d|2[0-3]):[0-5]\d:([0-5]\d|60)(\.\d{1,9})?$
        value_coding:
          type: object
          properties:
            code:
              type: string
            system:
              type: string
            display:
              type: string
          minProperties: 1
        value_reference:
          type: object
          properties:
            reference:
              type: string
            type:
              type: string
            display:
              type: string
            identifier:
              type: object
              properties:
                system:
                  type: string
                value:
                  type: string
          minProperties: 1
        concept_id:
          type: integer
          minimum: 0
          maximum: 9007199254740991
        initial_selected:
          type: boolean
      oneOf:
        - required:
            - value_string
        - required:
            - value_integer
        - required:
            - value_date
        - required:
            - value_time
        - required:
            - value_coding
        - required:
            - value_reference
  securitySchemes:
    serviceToken:
      type: oauth2
      description: >-
        Service (M2M) access token issued by POST /auth/token using the
        client_credentials grant. Required scopes, where known, are listed on
        each operation below.
      flows:
        clientCredentials:
          tokenUrl: https://api.openloophealth.com/v0.1/auth/token
          scopes: {}
    userToken:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        User access token issued by POST /auth/token via the verification-code
        grant (after Verify a one-time code) or the refresh_token grant.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.