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

# Start a clarifications probe on the tip questionnaire

> Starts a `survey.questionnaire_clarifications` workflow on the tip questionnaire and returns **202** with `workflow_id`, initial `session`, and `stream_url`.

**Subscribe to identified clarifications (first-party / live UI):** open an NDJSON GET to `stream_url` (`GET /v1/workflows/{workflowId}/stream`). The stream uses the greenfield anatomy protocol:
- `workflow.anatomy` — probe + await-responses steps
- `step.started` / nested `clarification.item` chunks as discrepancies parse / `step.ended`
- Authors answer or skip each item with tip `PATCH` (`{ kind: "answer", text? | option_id? }` or `{ kind: "skip" }`)
Omit `startIndex` (or pass `0`) to subscribe from the start. Reconnect with a positive or negative `startIndex` while the World retains the run. A newer POST (newest-wins) returns a new `workflow_id` — switch streams.

**Reconcile tip state:** side-effect-free `GET .../clarifications`, plus account webhook `questionnaire.clarifications.updated` (full session). Use these after the stream ends, on reconnect gaps, or for non-browser consumers. Thin `GET .../runs/{runId}` returns run status/error when the stream ends early. Tip `PATCH` remains for answering when no live webhook gate is open (e.g. after skip-all).

Skip all: start programming (cancels the in-flight clarifications run). After answers settle (`status: complete`), POST again for follow-up probes. Historical revisions are read-only.

See Workflows → Live updates in the Program docs for the full per-kind subscribe catalog.



## OpenAPI

````yaml /openapi/program.openapi.json post /surveys/{surveyId}/questionnaire/clarifications
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}/questionnaire/clarifications:
    post:
      tags:
        - Survey questionnaire clarifications
      summary: Start a clarifications probe on the tip questionnaire
      description: >-
        Starts a `survey.questionnaire_clarifications` workflow on the tip
        questionnaire and returns **202** with `workflow_id`, initial `session`,
        and `stream_url`.


        **Subscribe to identified clarifications (first-party / live UI):** open
        an NDJSON GET to `stream_url` (`GET /v1/workflows/{workflowId}/stream`).
        The stream uses the greenfield anatomy protocol:

        - `workflow.anatomy` — probe + await-responses steps

        - `step.started` / nested `clarification.item` chunks as discrepancies
        parse / `step.ended`

        - Authors answer or skip each item with tip `PATCH` (`{ kind: "answer",
        text? | option_id? }` or `{ kind: "skip" }`)

        Omit `startIndex` (or pass `0`) to subscribe from the start. Reconnect
        with a positive or negative `startIndex` while the World retains the
        run. A newer POST (newest-wins) returns a new `workflow_id` — switch
        streams.


        **Reconcile tip state:** side-effect-free `GET .../clarifications`, plus
        account webhook `questionnaire.clarifications.updated` (full session).
        Use these after the stream ends, on reconnect gaps, or for non-browser
        consumers. Thin `GET .../runs/{runId}` returns run status/error when the
        stream ends early. Tip `PATCH` remains for answering when no live
        webhook gate is open (e.g. after skip-all).


        Skip all: start programming (cancels the in-flight clarifications run).
        After answers settle (`status: complete`), POST again for follow-up
        probes. Historical revisions are read-only.


        See Workflows → Live updates in the Program docs for the full per-kind
        subscribe catalog.
      parameters:
        - schema:
            type: string
            format: uuid
          required: true
          name: surveyId
          in: path
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ProbeQuestionnaireClarificationsRequest'
      responses:
        '202':
          description: Probe pass accepted
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProbeQuestionnaireClarificationsResponse'
        '400':
          description: >-
            Validation error, missing questionnaire tip, or workflow create
            failed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorBody'
        '404':
          description: Survey, questionnaire, or file not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorBody'
        '409':
          description: Questionnaire file not ready, or a probe pass is already in progress
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorBody'
components:
  schemas:
    ProbeQuestionnaireClarificationsRequest:
      type: object
      properties: {}
    ProbeQuestionnaireClarificationsResponse:
      type: object
      properties:
        data:
          $ref: '#/components/schemas/ProbeQuestionnaireClarificationsResponseData'
      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
    ProbeQuestionnaireClarificationsResponseData:
      type: object
      properties:
        workflow_id:
          type: string
          minLength: 1
        workflow:
          $ref: '#/components/schemas/Workflow'
        session:
          $ref: '#/components/schemas/QuestionnaireClarifications'
        stream_url:
          type: string
          description: >-
            Generic World NDJSON stream (`GET
            /v1/workflows/{workflow_id}/stream`). Anatomy + progressive
            `clarification.item` chunks; answer via tip `PATCH`.
      required:
        - workflow_id
        - workflow
        - session
        - stream_url
    Workflow:
      type: object
      properties:
        id:
          type: string
          minLength: 1
          description: >-
            Workflow SDK run id (`wrun_...`). Also used as the public workflow
            id.
        kind:
          $ref: '#/components/schemas/WorkflowKind'
        subject:
          $ref: '#/components/schemas/WorkflowSubject'
        status:
          $ref: '#/components/schemas/WorkflowRunStatus'
        user_id:
          type: string
          minLength: 1
          description: >-
            Auth user id of the requester who started this workflow. Propagated
            to content revisions produced by the workflow.
        input:
          type: object
          additionalProperties: {}
        output:
          type:
            - object
            - 'null'
          additionalProperties: {}
        error:
          $ref: '#/components/schemas/WorkflowError'
        created_at:
          type: string
          format: date-time
        started_at:
          type:
            - string
            - 'null'
          format: date-time
        updated_at:
          type: string
          format: date-time
        completed_at:
          type:
            - string
            - 'null'
          format: date-time
      required:
        - id
        - kind
        - subject
        - status
        - user_id
        - input
        - output
        - error
        - created_at
        - started_at
        - updated_at
        - completed_at
    QuestionnaireClarifications:
      type: object
      properties:
        survey_id:
          type: string
          format: uuid
        questionnaire_revision:
          type: integer
          exclusiveMinimum: 0
        status:
          $ref: '#/components/schemas/QuestionnaireClarificationsStatus'
        probe_exhausted:
          type: boolean
        active_workflow_id:
          type:
            - string
            - 'null'
          minLength: 1
          description: >-
            In-flight survey.questionnaire_clarifications workflow id
            (`wrun_...`) while probing; null otherwise.
        clarifications:
          type: array
          items:
            $ref: '#/components/schemas/QuestionnaireClarification'
        summary:
          type:
            - string
            - 'null'
        error:
          $ref: '#/components/schemas/QuestionnaireClarificationsError'
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
        completed_at:
          type:
            - string
            - 'null'
          format: date-time
      required:
        - survey_id
        - questionnaire_revision
        - status
        - probe_exhausted
        - active_workflow_id
        - clarifications
        - summary
        - error
        - created_at
        - updated_at
        - completed_at
    WorkflowKind:
      type: string
      enum:
        - survey.programming
        - survey.programming.fan_out
        - survey.questionnaire_clarifications
        - survey.audit
        - survey.audit.remediate
        - survey.migration
        - survey.simulation
        - survey.path_walk
        - survey.behavior_review.regression
        - survey.behavior_review.replay
        - fine_tuning_template.populate
        - workspace.upstream_status_sync
        - workspace.onboarding_drip
        - survey.export_live_pulse
    WorkflowSubject:
      type: object
      properties:
        type:
          type: string
          enum:
            - survey
            - fine_tuning_template
            - workspace
        id:
          type: string
          minLength: 1
      required:
        - type
        - id
    WorkflowRunStatus:
      type: string
      enum:
        - pending
        - running
        - completed
        - failed
        - cancelled
    WorkflowError:
      type:
        - object
        - 'null'
      properties:
        code:
          type: string
        message:
          type: string
      required:
        - code
        - message
    QuestionnaireClarificationsStatus:
      type: string
      enum:
        - probing
        - active
        - complete
        - failed
    QuestionnaireClarification:
      type: object
      properties:
        id:
          type: string
          format: uuid
        category:
          $ref: '#/components/schemas/QuestionnaireClarificationCategory'
        prompt:
          type: string
        context:
          type:
            - string
            - 'null'
        options:
          type: array
          items:
            $ref: '#/components/schemas/QuestionnaireClarificationOption'
        response:
          $ref: '#/components/schemas/QuestionnaireClarificationResponse'
        responded_at:
          type:
            - string
            - 'null'
          format: date-time
        created_at:
          type: string
          format: date-time
        resume_path:
          type:
            - string
            - 'null'
          minLength: 1
          description: >-
            Greenfield hook resume path for this clarification while the probe
            awaits a response.
      required:
        - id
        - category
        - prompt
        - context
        - options
        - response
        - responded_at
        - created_at
    QuestionnaireClarificationsError:
      type:
        - object
        - 'null'
      properties:
        code:
          type: string
        message:
          type: string
      required:
        - code
        - message
    QuestionnaireClarificationCategory:
      type: string
      enum:
        - ambiguity
        - instruction_collision
        - missing_reference
        - inconsistency
        - other
    QuestionnaireClarificationOption:
      type: object
      properties:
        id:
          type: string
          minLength: 1
        label:
          type: string
          minLength: 1
      required:
        - id
        - label
    QuestionnaireClarificationResponse:
      oneOf:
        - type: object
          properties:
            kind:
              type: string
              enum:
                - answer
            text:
              type: string
              minLength: 1
            option_id:
              type:
                - string
                - 'null'
              minLength: 1
          required:
            - kind
            - text
            - option_id
        - type: object
          properties:
            kind:
              type: string
              enum:
                - skip
          required:
            - kind
        - type: 'null'

````