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

# Analyze media file

> Upload a full recording and receive the complete JSON payload once processing completes. This is the canonical "batch" API.



## OpenAPI

````yaml api-reference/openapi.json post /analyze
openapi: 3.1.0
info:
  title: Illocution Insights API
  description: >-
    Developer-facing guide for the conversation-intelligence platform that
    powers docs.illocution.ai. The FastAPI service (version 0.3.0) exposes REST
    and Server‑Sent Events (SSE) endpoints for uploading media, driving live
    sessions, and retrieving higher-level insights.
  version: 0.3.0
servers:
  - url: https://api.illocution.ai
    description: Production API server
security:
  - apiKeyAuth: []
paths:
  /analyze:
    post:
      tags:
        - Analysis
      summary: Analyze media file
      description: >-
        Upload a full recording and receive the complete JSON payload once
        processing completes. This is the canonical "batch" API.
      operationId: analyzeMedia
      parameters:
        - name: stream
          in: query
          description: >-
            When true, behave like /analyze/stream and emit SSE instead of a
            JSON body
          required: false
          schema:
            type: boolean
            default: false
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              required:
                - file
              properties:
                file:
                  type: string
                  format: binary
                  description: >-
                    Audio/video media file (.mp4, .mov, .webm, .mp3, .wav, .m4a,
                    .aac)
                goal:
                  type: string
                  description: >-
                    Optional analysis focus (e.g., "Highlight objections about
                    pricing")
      responses:
        '200':
          description: Analysis complete
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AnalysisResponse'
            text/event-stream:
              schema:
                type: string
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Invalid or missing API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: Analysis failed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    AnalysisResponse:
      type: object
      properties:
        conversation_id:
          type: string
          description: Unique identifier for the analysis
          example: analysis_f38de2c0c1
        utterances:
          type: integer
          description: Count of diarized utterances
        timeline:
          type: array
          items:
            $ref: '#/components/schemas/TimelineEntry'
          description: Array of enriched utterances
        summary:
          $ref: '#/components/schemas/ConversationSummary'
        insights:
          $ref: '#/components/schemas/Insights'
        transitions:
          type: array
          items:
            $ref: '#/components/schemas/TransitionEvent'
          description: Affective state transitions
        moments:
          type: array
          items:
            $ref: '#/components/schemas/MomentEvent'
          description: Key moment detections
        segmentation:
          $ref: '#/components/schemas/ConversationSegmentation'
        agent_results:
          type: array
          description: Per-utterance raw agent payloads (emotion, sentiment, cognitive)
        artifact_dir:
          type: string
          description: Server-side path for debugging
        upload_path:
          type: string
          description: Server-side path for debugging
        agent_outputs_path:
          type: string
          description: Server-side path for debugging
        goal:
          type: string
          description: Echo of the provided context string
    Error:
      type: object
      required:
        - detail
      properties:
        detail:
          type: string
          description: Error message
          example: Invalid or missing API key
    TimelineEntry:
      type: object
      properties:
        utterance_id:
          type: string
        speaker:
          type: string
        t_start:
          type: number
          format: float
          description: Start time in seconds
        t_end:
          type: number
          format: float
          description: End time in seconds
        text:
          type: string
          description: Transcribed text
        asr_confidence:
          type: number
          format: float
        prosody:
          type: object
          description: Acoustic metrics (pitch/energy stats, pauses, spectral features)
        prosody_desc:
          type: string
          description: >-
            Natural-language descriptor (e.g., "COMMITTED, PASSIONATE,
            emphatic")
        emotion:
          type: object
          description: Full emotion analysis with PAD scores
        sentiment:
          type: object
        polarity:
          type: number
          format: float
        subjectivity:
          type: number
          format: float
        cognitive:
          type: object
          description: Cognitive analysis including engagement and load level
        commitment_score:
          type: number
          format: float
        commitment_level:
          type: string
        passion_score:
          type: number
          format: float
        passion_level:
          type: string
        conviction_score:
          type: number
          format: float
        lexical_markers:
          type: object
          description: Hedges, fillers, questions, disfluency rate, self-repair flags
        acoustic_reasoning:
          type: string
          description: Narrative explaining how acoustic cues map to cognition/emotion
        confidence:
          type: number
          format: float
          description: Average confidence across agents
    ConversationSummary:
      type: object
      properties:
        overview:
          type: string
        key_insights:
          type: array
          items:
            type: string
        notable_patterns:
          type: array
          items:
            type: string
        recommendations:
          type: array
          items:
            type: string
        what_went_well:
          type: array
          items:
            type: string
        what_went_wrong:
          type: array
          items:
            type: string
        speaker_dynamics:
          type: object
        conversation_quality:
          type: string
    Insights:
      type: object
      properties:
        overall_sentiment:
          type: object
          properties:
            mean:
              type: number
              format: float
            std:
              type: number
              format: float
            trend:
              type: string
        dominant_emotions:
          type: array
          items:
            type: string
          description: Top three emotions
        engagement_pattern:
          type: string
          enum:
            - increasing
            - decreasing
            - stable
        key_moments:
          type: array
          items:
            $ref: '#/components/schemas/MomentEvent'
        speaker_profiles:
          type: object
        conversation_dynamics:
          type: object
        cognitive_profile:
          type: object
    TransitionEvent:
      type: object
      properties:
        transition_id:
          type: string
        at_ms:
          type: integer
          description: Timestamp in milliseconds
        from_state:
          type: object
        to_state:
          type: object
        evidence_utterance_ids:
          type: array
          items:
            type: string
        drivers:
          type: object
          description: Valence/arousal/engagement deltas
        confidence:
          type: number
          format: float
        stability:
          type: string
    MomentEvent:
      type: object
      properties:
        moment_id:
          type: string
        category:
          type: string
          enum:
            - objection
            - cta_offered
            - cta_accepted
            - cta_rejected
            - topic_shift
        speaker_id:
          type: string
        start_ms:
          type: integer
        end_ms:
          type: integer
        utterance_ids:
          type: array
          items:
            type: string
        summary:
          type: string
        labels:
          type: array
          items:
            type: string
        confidence:
          type: number
          format: float
    ConversationSegmentation:
      type: object
      properties:
        phases:
          type: array
          items:
            $ref: '#/components/schemas/ConversationPhase'
        total_phases:
          type: integer
        segmentation_rationale:
          type: string
        narrative_arc:
          type: string
        key_transitions:
          type: array
          items:
            $ref: '#/components/schemas/TransitionEvent'
    ConversationPhase:
      type: object
      properties:
        phase_id:
          type: string
        phase_name:
          type: string
        start_timestamp:
          type: number
          format: float
        end_timestamp:
          type: number
          format: float
        start_utterance_id:
          type: string
        end_utterance_id:
          type: string
        utterance_count:
          type: integer
        theme:
          type: string
        summary:
          type: string
        emotional_tone:
          type: string
        key_moments:
          type: array
          items:
            $ref: '#/components/schemas/MomentEvent'
        transition_signal:
          $ref: '#/components/schemas/TransitionEvent'
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key
      description: >-
        API key for authentication. Can also be passed as query parameter:
        api_key=<client key>

````