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

# Create full questionnaire (one shot)

> Creates protocol + form (v1) + questions (with options) + score ranges in one request. UI: single form, submit once.



## OpenAPI

````yaml /openapi.json post /protocols/questionnaires
openapi: 3.0.1
info:
  title: NextMed's Admin Service
  description: Documentation Admin Service v1.0.0
  contact:
    name: NextMed
    email: medchatbr@gmail.com
  version: 1.0.0
servers:
  - url: http://localhost:8081
    description: Admin Service (local)
  - url: http://localhost:8080/admin-service
    description: Local API (gateway)
security: []
tags:
  - name: User Controller
    description: Endpoints to handle users
  - name: Profile Controller
    description: Endpoints to handle user's profiles
  - name: Institution Controller
    description: Endpoints to handle institutions
  - name: Unity Controller
    description: Endpoints to handle institution's unities
  - name: Specialty Controller
    description: Endpoints to handle the available specialties
  - name: Protocol Controller
    description: >-
      Endpoints to manage clinical protocols (Admin): CRUD protocol, forms,
      questions, options, score ranges
paths:
  /protocols/questionnaires:
    post:
      tags:
        - Protocol Controller
      summary: Create full questionnaire (one shot)
      description: >-
        Creates protocol + form (v1) + questions (with options) + score ranges
        in one request. UI: single form, submit once.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateQuestionnaireRequest'
      responses:
        '201':
          description: Created protocol and form
          content:
            application/json:
              schema:
                type: object
                properties:
                  protocol:
                    $ref: '#/components/schemas/Protocol'
                  form:
                    $ref: '#/components/schemas/ProtocolForm'
        '400':
          description: Validation error
components:
  schemas:
    CreateQuestionnaireRequest:
      type: object
      required:
        - institutionId
        - name
        - questions
        - scoreRanges
      properties:
        institutionId:
          type: string
          format: uuid
        name:
          type: string
        prompt:
          type: string
          nullable: true
        questions:
          type: array
          items:
            type: object
            properties:
              questionText:
                type: string
              responseType:
                $ref: '#/components/schemas/ProtocolQuestionResponseType'
              metadata:
                type: object
              required:
                type: boolean
              weight:
                type: number
              position:
                type: integer
              options:
                type: array
                items:
                  type: object
                  properties:
                    optionText:
                      type: string
                    score:
                      type: number
                    position:
                      type: integer
        scoreRanges:
          type: array
          items:
            type: object
            required:
              - minScore
              - maxScore
              - classification
            properties:
              minScore:
                type: number
              maxScore:
                type: number
              classification:
                type: string
    Protocol:
      type: object
      properties:
        id:
          type: string
          format: uuid
        institutionId:
          type: string
          format: uuid
        name:
          type: string
        prompt:
          type: string
          nullable: true
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
    ProtocolForm:
      type: object
      properties:
        id:
          type: string
          format: uuid
        protocolId:
          type: string
          format: uuid
        version:
          type: integer
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
        questions:
          type: array
          items:
            $ref: '#/components/schemas/ProtocolQuestion'
    ProtocolQuestionResponseType:
      type: string
      enum:
        - TEXT
        - NUMBER
        - DATE
        - DATETIME
        - BOOLEAN
        - SELECT
        - MULTIPLE_SELECT
    ProtocolQuestion:
      type: object
      properties:
        id:
          type: string
          format: uuid
        protocolFormId:
          type: string
          format: uuid
        questionText:
          type: string
        responseType:
          $ref: '#/components/schemas/ProtocolQuestionResponseType'
        metadata:
          type: object
          description: Type-specific config (e.g. dateFormat, minValue/maxValue)
        required:
          type: boolean
        weight:
          type: number
        position:
          type: integer
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
        options:
          type: array
          items:
            $ref: '#/components/schemas/ProtocolQuestionOption'
    ProtocolQuestionOption:
      type: object
      properties:
        id:
          type: string
          format: uuid
        protocolQuestionId:
          type: string
          format: uuid
        optionText:
          type: string
        score:
          type: number
        position:
          type: integer
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time

````