> ## 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.

# Create a new content revision

> When the survey is linked to an upstream platform survey, pushes source there first; tip is written only after a successful push (or when there is no link). After a successful push, re-GETs upstream and persists that document (pull-after-push) so reformatting does not look like drift. Without `force`, returns 409 `save_blocked` listing every current warning (stale tip and/or live simulation crawl). `force: true` skips those guards. When `message` is omitted, the server drafts a revision note from the previous tip.



## OpenAPI

````yaml /openapi/program.openapi.json put /surveys/{surveyId}/content
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}/content:
    put:
      tags:
        - Survey content
      summary: Create a new content revision
      description: >-
        When the survey is linked to an upstream platform survey, pushes source
        there first; tip is written only after a successful push (or when there
        is no link). After a successful push, re-GETs upstream and persists that
        document (pull-after-push) so reformatting does not look like drift.
        Without `force`, returns 409 `save_blocked` listing every current
        warning (stale tip and/or live simulation crawl). `force: true` skips
        those guards. When `message` is omitted, the server drafts a revision
        note from the previous tip.
      parameters:
        - schema:
            type: string
            format: uuid
          required: true
          name: surveyId
          in: path
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PutContentRequest'
      responses:
        '201':
          description: Revision created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ContentRevisionResponse'
        '400':
          description: Validation or target required
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorBody'
        '404':
          description: Survey not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorBody'
        '409':
          description: >-
            Programming in progress, platform mismatch, or save blocked (stale
            tip and/or live simulation)
          content:
            application/json:
              schema:
                anyOf:
                  - $ref: '#/components/schemas/ErrorBody'
                  - $ref: '#/components/schemas/SaveBlockedErrorBody'
        '502':
          description: Upstream platform push or fetch failed (tip not written)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorBody'
components:
  schemas:
    PutContentRequest:
      type: object
      properties:
        source:
          type: string
          minLength: 1
        platform:
          $ref: '#/components/schemas/ProgrammingPlatform'
        message:
          type:
            - string
            - 'null'
          description: Optional reason or commit note. Stored as null when omitted.
        change_source:
          $ref: '#/components/schemas/ClientContentChangeSource'
        base_revision:
          type: integer
          exclusiveMinimum: 0
          description: >-
            Client pin of the tip revision this save is based on. When set and
            the tip has moved, PUT returns 409 save_blocked unless force is
            true.
        force:
          type: boolean
          description: >-
            When true, proceed despite a stale tip and/or a live simulation
            crawl. Set only after the user confirms Save anyway on a 409
            save_blocked dialog.
      required:
        - source
    ContentRevisionResponse:
      type: object
      properties:
        data:
          $ref: '#/components/schemas/ContentRevision'
      required:
        - data
    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
    SaveBlockedErrorBody:
      type: object
      properties:
        error:
          type: string
          enum:
            - save_blocked
        reasons:
          type: array
          items:
            $ref: '#/components/schemas/SaveBlockedReason'
          minItems: 1
        tip_revision:
          type: integer
          exclusiveMinimum: 0
        message:
          type: string
      required:
        - error
        - reasons
        - message
    ProgrammingPlatform:
      type: string
      enum:
        - questra
        - decipher
        - confirmit
        - qualtrics
        - alchemer
    ClientContentChangeSource:
      type: string
      enum:
        - manual
        - agent
      description: >-
        Client provenance for this write. Defaults to manual. Use agent when
        Review agent / content-edit saves.
    ContentRevision:
      type: object
      properties:
        survey_id:
          type: string
          minLength: 1
          description: >-
            Survey id. For Program-managed surveys this is a UUID; for
            integration surveys it is the provider opaque id.
        revision:
          type: integer
          exclusiveMinimum: 0
        platform:
          $ref: '#/components/schemas/ProgrammingPlatform'
        source:
          type: string
        user_id:
          type: string
          minLength: 1
          example: 60000000-0000-4000-8000-000000000001
          description: >-
            Actor id from the auth session or API key that created this revision
            (never client-supplied).
        message:
          type:
            - string
            - 'null'
          example: Reprogrammed after questionnaire clarifications
          description: Optional reason or commit note for this revision.
        change_source:
          $ref: '#/components/schemas/ContentChangeSource'
        created_at:
          type: string
          format: date-time
      required:
        - survey_id
        - revision
        - platform
        - source
        - user_id
        - message
        - change_source
        - created_at
    SaveBlockedReason:
      type: string
      enum:
        - stale_revision
        - simulation_live_apply_blocked
    ContentChangeSource:
      type: string
      enum:
        - manual
        - agent
        - programming
        - pull
      description: >-
        How this tip was written: manual Review Save, Review/content-edit agent,
        programming workflow, or upstream pull.

````