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

# Update survey



## OpenAPI

````yaml /openapi/program.openapi.json patch /surveys/{surveyId}
openapi: 3.1.0
info:
  title: Questra Program API
  version: 0.0.1
  description: >-
    REST API for the Questra Program product. Browser users authenticate through
    Questra Auth SSO; automation uses workspace-scoped API keys (`Authorization:
    Bearer qpk_live_…`). API keys carry scopes enforced before handlers.
    Outbound webhooks follow Standard Webhooks (at-least-once delivery;
    consumers must be idempotent).
servers:
  - url: /v1
    description: Program API base path
security: []
paths:
  /surveys/{surveyId}:
    patch:
      tags:
        - Surveys
      summary: Update survey
      parameters:
        - schema:
            type: string
            format: uuid
          required: true
          name: surveyId
          in: path
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateSurveyRequest'
      responses:
        '200':
          description: Updated survey
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SurveyResponse'
        '400':
          description: Validation error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidationErrorBody'
        '404':
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorBody'
        '409':
          description: Duplicate slug
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorBody'
components:
  schemas:
    UpdateSurveyRequest:
      type: object
      properties:
        slug:
          type: string
          minLength: 1
          pattern: ^[a-z0-9]+(?:-[a-z0-9]+)*$
          example: customer-onboarding
        name:
          type: string
          minLength: 1
          example: Customer onboarding
        description:
          type: string
    SurveyResponse:
      type: object
      properties:
        data:
          $ref: '#/components/schemas/Survey'
      required:
        - data
    ValidationErrorBody:
      type: object
      properties:
        error:
          type: string
          enum:
            - validation_error
        message:
          type: string
        details: {}
      required:
        - error
    ErrorBody:
      type: object
      properties:
        error:
          type: string
        message:
          type: string
        resource:
          type: string
        slug:
          type: string
        file_id:
          type: string
        endpoint_id:
          type: string
        event_id:
          type: string
        delivery_id:
          type: string
        api_key_id:
          type: string
        integration_id:
          type: string
        audit_id:
          type: string
        status:
          type: string
        details: {}
        question_ids:
          type: array
          items:
            type: string
        survey_ids:
          type: array
          items:
            type: string
        revisions:
          type: array
          items:
            type: number
      required:
        - error
    Survey:
      type: object
      properties:
        id:
          type: string
          format: uuid
        slug:
          type: string
          minLength: 1
        name:
          type: string
          minLength: 1
        description:
          type: string
        status:
          $ref: '#/components/schemas/SurveyStatus'
        programming_target:
          $ref: '#/components/schemas/ProgrammingTarget'
        list_summary:
          $ref: '#/components/schemas/SurveyListSummary'
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
      required:
        - id
        - slug
        - name
        - status
        - programming_target
        - list_summary
        - created_at
        - updated_at
    SurveyStatus:
      type: string
      enum:
        - inspection
        - programming
        - reviewing
        - live
        - closed
    ProgrammingTarget:
      type:
        - object
        - 'null'
      properties:
        survey_id:
          type: string
          format: uuid
        platform:
          $ref: '#/components/schemas/ProgrammingPlatform'
        instructions:
          type:
            - string
            - 'null'
        fine_tuning_template_id:
          type:
            - string
            - 'null'
          format: uuid
          description: >-
            Fine-tuning template applied to this survey, or null when none is
            chosen.
        config:
          type: object
          additionalProperties: {}
        initial_push_succeeded:
          type: boolean
          description: >-
            Whether Program has landed its own survey configuration upstream at
            least once.
        updated_at:
          type: string
          format: date-time
      required:
        - survey_id
        - platform
        - instructions
        - fine_tuning_template_id
        - config
        - initial_push_succeeded
        - updated_at
    SurveyListSummary:
      type:
        - object
        - 'null'
      properties:
        kind:
          type: string
          enum:
            - waiting_questionnaire
            - programming
            - migrated
        programming:
          type: object
          properties:
            run_id:
              type: string
              minLength: 1
            status:
              $ref: '#/components/schemas/SurveyListProgrammingStatus'
            waiting_on_target_selection:
              type: boolean
              description: >-
                True while programming is blocked on user input (configure /
                platform / template).
            started_at:
              type:
                - string
                - 'null'
              format: date-time
            completed_at:
              type:
                - string
                - 'null'
              format: date-time
            target_wait_ms:
              type: integer
              minimum: 0
              description: Finalized user-input wait already accrued (ms).
            target_wait_started_at:
              type:
                - string
                - 'null'
              format: date-time
              description: Set only while actively blocked on user input after compose.
          required:
            - run_id
            - status
            - waiting_on_target_selection
            - started_at
            - completed_at
            - target_wait_ms
            - target_wait_started_at
        migrated_from:
          type: object
          properties:
            survey_id:
              type: string
              format: uuid
            slug:
              type: string
              minLength: 1
            name:
              type: string
              minLength: 1
          required:
            - survey_id
            - slug
            - name
      required:
        - kind
    ProgrammingPlatform:
      type: string
      enum:
        - questra
        - decipher
        - confirmit
        - qualtrics
        - alchemer
    SurveyListProgrammingStatus:
      type: string
      enum:
        - pending
        - running
        - completed
        - failed
        - cancelled

````