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

# Migrate Legacy Question

> Stream structured questions generated from a legacy TEXT_AREA question.

This endpoint analyzes a legacy template question (created by the scribe_as_a_form migration)
and uses an LLM to suggest structured questions to replace it.

The endpoint streams SSE events:
- type: "question" - A generated question suggestion
- type: "done" - Generation complete
- type: "error" - An error occurred

This is a read-only operation. No data is modified. Users must explicitly
save the template to apply the suggested changes.



## OpenAPI

````yaml post /notes/templates/{template_id}/questions/{question_id}/migrate
openapi: 3.1.0
info:
  title: Decoda API
  description: External API documentation for the Decoda Health platform.
  version: '1.0'
servers: []
security: []
paths:
  /notes/templates/{template_id}/questions/{question_id}/migrate:
    post:
      tags:
        - provider
        - scribe
        - note
        - templates
      summary: Migrate Legacy Question
      description: >-
        Stream structured questions generated from a legacy TEXT_AREA question.


        This endpoint analyzes a legacy template question (created by the
        scribe_as_a_form migration)

        and uses an LLM to suggest structured questions to replace it.


        The endpoint streams SSE events:

        - type: "question" - A generated question suggestion

        - type: "done" - Generation complete

        - type: "error" - An error occurred


        This is a read-only operation. No data is modified. Users must
        explicitly

        save the template to apply the suggested changes.
      operationId: >-
        migrate_legacy_question_notes_templates__template_id__questions__question_id__migrate_post
      parameters:
        - name: TENANT
          in: header
          required: true
          schema:
            type: string
            title: Tenant
          description: The tenant you are making this request on behalf of
        - name: API-KEY
          in: header
          required: true
          schema:
            type: string
            title: Api-Key
          description: Your api key
        - name: template_id
          in: path
          required: true
          schema:
            type: string
            title: Template Id
        - name: question_id
          in: path
          required: true
          schema:
            type: string
            title: Question Id
      responses:
        '200':
          description: Successful Response
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError

````