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

# Get Segments

> Retrieve the current state of a segmentation job



## OpenAPI

````yaml GET /segments/{job_id}
openapi: 3.0.0
info:
  title: Cloudglue API
  description: API for Cloudglue
  license:
    name: Apache License 2.0
    url: https://www.apache.org/licenses/LICENSE-2.0
  version: 0.7.13
servers:
  - url: https://api.cloudglue.dev/v1
security:
  - bearerAuth: []
paths:
  /segments/{job_id}:
    get:
      tags:
        - Segments
      summary: Retrieve the current state of a segmentation job
      description: Retrieve the current state of a segmentation job
      operationId: getSegments
      parameters:
        - name: job_id
          in: path
          required: true
          description: The unique identifier of the segmentation job
          schema:
            type: string
            format: uuid
      responses:
        '200':
          description: Successful response with job details
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Segments'
        '404':
          description: Job not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: An unexpected error occurred on the server
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    Segments:
      type: object
      required:
        - file_id
        - job_id
        - object
        - status
        - criteria
        - created_at
      properties:
        job_id:
          type: string
          format: uuid
          description: Unique identifier for the segment job
        file_id:
          type: string
          format: uuid
          description: ID of the file this segment belongs to
        object:
          type: string
          enum:
            - segments
          description: Object type, always 'segments'
        status:
          type: string
          enum:
            - pending
            - processing
            - completed
            - failed
          description: Current status of the segment job
        criteria:
          type: string
          enum:
            - shot
            - narrative
          description: Segment criteria used for this job
        created_at:
          type: integer
          description: Unix timestamp in milliseconds when the job was created
        shot_config:
          $ref: '#/components/schemas/ShotConfig'
          description: >-
            Configuration used for shot-based segmentation (only present when
            criteria is 'shot')
        narrative_config:
          $ref: '#/components/schemas/NarrativeConfig'
          description: >-
            Configuration used for narrative-based segmentation (only present
            when criteria is 'narrative')
        total_segments:
          type: integer
          minimum: 0
          description: >-
            Total number of segments generated (only present when status is
            'completed')
        total_shots:
          type: integer
          minimum: 0
          description: >-
            Total number of shots in the original video (only present when
            criteria is 'shot')
        total_chapters:
          type: integer
          minimum: 0
          description: >-
            Total number of chapters in the video (only present when criteria is
            'narrative')
        segments:
          type: array
          description: >-
            Array of generated segments (only present when status is
            'completed')
          items:
            $ref: '#/components/schemas/Segment'
        shots:
          type: array
          description: >-
            Array of shots in the original video (only present when criteria is
            'shot')
          items:
            $ref: '#/components/schemas/Shot'
        chapters:
          type: array
          description: >-
            Array of narrative chapters in the video (only present when criteria
            is 'narrative')
          items:
            $ref: '#/components/schemas/Chapter'
    Error:
      required:
        - error
      type: object
      properties:
        error:
          type: string
    ShotConfig:
      type: object
      properties:
        detector:
          type: string
          enum:
            - content
            - adaptive
          description: >-
            Detection algorithm:

            • **adaptive**: Designed for dynamic footage with camera movement
            and action (default)

            • **content**: Optimized for controlled footage with clear visual
            transitions
        max_duration_seconds:
          type: number
          minimum: 1
          maximum: 600
          description: >-
            Maximum duration for each segment in seconds (1 second to 10
            minutes, default: 5 minutes)
        min_duration_seconds:
          type: number
          minimum: 0.6
          maximum: 600
          description: >-
            Minimum duration for each segment in seconds (0.6 seconds to 10
            minutes, default: 0.6 seconds)
        fill_gaps:
          type: boolean
          description: >-
            When true, gaps between detected shots are filled: gaps greater than
            or equal to min_duration_seconds become their own segments (split by
            max_duration_seconds if needed), and shorter gaps are merged into
            the nearest adjacent segment. Defaults to true.
    NarrativeConfig:
      type: object
      properties:
        prompt:
          type: string
          description: >-
            Optional custom prompt to guide the narrative segmentation analysis.
            This will be incorporated into the main segmentation prompt as
            additional guidance.
        strategy:
          type: string
          enum:
            - comprehensive
            - balanced
            - transcript
          description: >-
            Narrative segmentation strategy:


            • **comprehensive**: Uses a VLM to deeply analyze logical segments
            of video. Only available for video files (not YouTube or audio).


            • **balanced** (default): Balanced analysis approach using multiple
            modalities. Supports YouTube URLs and audio files.


            • **transcript**: Cheap and fast speech-transcript-based
            segmentation. Requires a transcript; returns an error for silent or
            visual-only content (use `balanced` instead, or `comprehensive` for
            non-YouTube/non-audio video files).


            **Note**: YouTube URLs and audio files only support the **balanced**
            and **transcript** strategies; **comprehensive** will be rejected
            with an error.
        number_of_chapters:
          type: integer
          minimum: 1
          description: >-
            Optional target number of chapters to generate. If provided,
            min_chapters and max_chapters will be calculated automatically if
            not specified. If only target is provided, the AI will attempt to
            generate exactly this number of chapters.
        min_chapters:
          type: integer
          minimum: 1
          description: >-
            Optional minimum number of chapters to generate. If provided along
            with number_of_chapters and max_chapters, validates that min <=
            number_of_chapters <= max. If only number_of_chapters is provided,
            min and max are calculated automatically.
        max_chapters:
          type: integer
          minimum: 1
          description: >-
            Optional maximum number of chapters to generate. If provided along
            with number_of_chapters and min_chapters, validates that min <=
            number_of_chapters <= max. If only number_of_chapters is provided,
            min and max are calculated automatically.
    Segment:
      type: object
      required:
        - start_time
        - end_time
      properties:
        start_time:
          type: number
          minimum: 0
          description: Start time of the segment in seconds
        end_time:
          type: number
          minimum: 0
          description: End time of the segment in seconds
        description:
          type: string
          description: >-
            Optional description of the segment content (available for narrative
            segmentation)
        thumbnail_url:
          type: string
          format: uri
          description: Optional URL of the thumbnail for this segment
        shot_index:
          type: integer
          description: >-
            Index of the shot in the original video segmentation. Only present
            when criteria is set to 'shot'
    Shot:
      type: object
      required:
        - index
        - start_time
        - end_time
      properties:
        index:
          type: integer
          description: Index of the shot in the original video
        start_time:
          type: number
          minimum: 0
          description: Start time of the shot in seconds
        end_time:
          type: number
          minimum: 0
          description: End time of the shot in seconds
    Chapter:
      type: object
      required:
        - index
        - start_time
        - end_time
        - description
      properties:
        index:
          type: integer
          description: Index of the chapter in the video
        start_time:
          type: number
          minimum: 0
          description: Start time of the chapter in seconds
        end_time:
          type: number
          minimum: 0
          description: End time of the chapter in seconds
        description:
          type: string
          description: AI-generated description of the chapter content
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````