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

# Record a presentations onboarding completion or dismissal

> Records that the current user completed or dismissed the presentations onboarding modal (ENG-641; versioned in ENG-636). The server records the acknowledged content version (`CURRENT_ONBOARDING_VERSION`, currently `2`) on the user's row and returns the full updated `TourState` so callers can write it straight into the shared `/api/auth/me` cache. Idempotent per `(organization, user, version)`: the underlying upsert only fires when the stored `tourVersion` is behind the incoming version, so a repeat call at the same version is a no-op and never overwrites `tourCompletedAt` or `tourDismissedAt`. A PostHog `onboarding_milestone` event (`tour_completed` or `tour_dismissed`, keyed on organization ID, carrying a `tour_version` property) is captured only on the first transition to a new version; subsequent calls emit no analytics. Pass `legacy: true` (only valid with `action: "dismissed"`) to silently backfill users carrying the old per-browser `templates_onboarding_seen_v1` localStorage flag: the row is written at `LEGACY_TOUR_VERSION` (`1`) so the user stays eligible for newer content, and no event fires.



## OpenAPI

````yaml /openapi.json post /api/onboarding/tour
openapi: 3.0.0
info:
  title: AI Presentations API
  version: 1.0.0
  description: >-
    REST API for AI Presentations — an AI-powered presentation platform with
    narrated slides, live Q&A, and deck management.


    **Authentication**: Most endpoints require a session cookie obtained from
    `POST /api/auth/login`. Presentation playback endpoints (`/api/qa`,
    `/api/narration/*`) also accept a `presentationId` for unauthenticated
    viewer access.
  contact:
    name: Demand IQ
    url: https://demand-iq.com
servers:
  - url: https://app.demand-iq.com
    description: Production
  - url: http://localhost:3000
    description: Local development
security: []
tags:
  - name: Decks
    description: Manage presentation decks
  - name: Slides
    description: Manage slides within a deck
  - name: FAQs
    description: Manage pre-built Q&A pairs
  - name: Branding
    description: Colors, logo, and call-to-action configuration
  - name: Q&A
    description: Live question answering and Q&A settings
  - name: Narration
    description: Text-to-speech synthesis
  - name: Presentations
    description: Create and manage personalized presentation instances
  - name: Generation
    description: AI-powered content generation from slide images
  - name: Images
    description: Image upload and management
  - name: Voices
    description: Available TTS voices
  - name: Utility
    description: Health check and diagnostics
  - name: Authentication
    description: Session-based login, logout, and identity
  - name: Company
    description: Organization contact info and knowledge base
  - name: Notifications
    description: Event subscriptions and delivery log
  - name: Contracts
    description: Contract template import and e-signature
  - name: Fonts
    description: Available Google Fonts for branding
  - name: Roof Measurements
    description: Request and track automated roof measurements
  - name: Actions
    description: Voice/text command detection for presentation control
  - name: Appointments
    description: Appointment scheduling for presentation viewers
  - name: Activity
    description: Recent presentation activity feed
  - name: Onboarding
    description: >-
      Per-user product onboarding milestones (ENG-641). Milestone endpoints are
      idempotent and are called by the app UI — they should not be treated as
      tenant-integration surface.
paths:
  /api/onboarding/tour:
    post:
      tags:
        - Onboarding
      summary: Record a presentations onboarding completion or dismissal
      description: >-
        Records that the current user completed or dismissed the presentations
        onboarding modal (ENG-641; versioned in ENG-636). The server records the
        acknowledged content version (`CURRENT_ONBOARDING_VERSION`, currently
        `2`) on the user's row and returns the full updated `TourState` so
        callers can write it straight into the shared `/api/auth/me` cache.
        Idempotent per `(organization, user, version)`: the underlying upsert
        only fires when the stored `tourVersion` is behind the incoming version,
        so a repeat call at the same version is a no-op and never overwrites
        `tourCompletedAt` or `tourDismissedAt`. A PostHog `onboarding_milestone`
        event (`tour_completed` or `tour_dismissed`, keyed on organization ID,
        carrying a `tour_version` property) is captured only on the first
        transition to a new version; subsequent calls emit no analytics. Pass
        `legacy: true` (only valid with `action: "dismissed"`) to silently
        backfill users carrying the old per-browser
        `templates_onboarding_seen_v1` localStorage flag: the row is written at
        `LEGACY_TOUR_VERSION` (`1`) so the user stays eligible for newer
        content, and no event fires.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                action:
                  type: string
                  enum:
                    - completed
                    - dismissed
                  description: >-
                    `completed` — user clicked the "Get Started" button on the
                    onboarding modal. `dismissed` — any other close (X, Esc, or
                    navigation). Overlay clicks do not dismiss the modal.
                source:
                  type: string
                  enum:
                    - templates
                    - my_presentations
                  description: >-
                    Which page the tour was shown on. Used for analytics
                    attribution only; it does not affect persistence.
                legacy:
                  type: boolean
                  description: >-
                    Set to `true` to backfill a user with the deprecated
                    per-browser localStorage flag. Silent — no PostHog event is
                    emitted. Only valid when `action` is `dismissed`.
              required:
                - action
                - source
      responses:
        '200':
          description: Updated tour state for the current user
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TourState'
        '400':
          description: >-
            Invalid JSON body, unknown `action`/`source`, or `legacy: true`
            combined with `action: "completed"`
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
        - sessionCookie: []
components:
  schemas:
    TourState:
      type: object
      description: >-
        Per-user state for the presentations onboarding modal (ENG-641;
        versioned in ENG-636). The modal shows at most once per user across
        devices per content version. The show/hide decision keys on
        `tourVersion`: whenever it is less than the current content version, the
        modal is shown. `tourCompletedAt` means the user clicked the "Get
        Started" button on the single-screen video modal; `tourDismissedAt`
        covers every other close (X, Esc, navigation, or a silent legacy
        backfill from the old per-browser `localStorage` flag). Both timestamps
        are written once and never cleared, so they preserve the first-ever
        moment even after later content versions are acknowledged.
      properties:
        tourCompletedAt:
          type: string
          format: date-time
          nullable: true
          description: >-
            Timestamp of the first-ever completion. `null` until the user clicks
            "Get Started" for the first time. Never overwritten by a later
            version acknowledgement.
        tourDismissedAt:
          type: string
          format: date-time
          nullable: true
          description: >-
            Timestamp of the first-ever dismissal. `null` until dismissed. Never
            overwritten by a later version acknowledgement.
        tourVersion:
          type: integer
          description: >-
            Highest onboarding content version the user has acknowledged. `0` =
            never onboarded, `1` = illustrated multi-step tour (ENG-641), `2` =
            Wistia explainer video (ENG-636). The modal shows whenever this is
            below the current content version. Bumping the current version
            re-shows the modal to every user exactly once.
      required:
        - tourCompletedAt
        - tourDismissedAt
        - tourVersion
    Error:
      type: object
      properties:
        error:
          type: string
      required:
        - error
  securitySchemes:
    sessionCookie:
      type: apiKey
      in: cookie
      name: session
      description: Session cookie obtained from `POST /api/auth/login`.

````