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

# Search Video

> Search video content by spoken words or visual scenes

Search for specific content within a video using semantic search on transcripts or visual indexes.

> [!NOTE]
>
> This is a supported legacy `POST /video/{video_id}/search/` endpoint. For current retrieval, use [Search V2 direct methods](https://docs.videodb.io/pages/understand/search-and-retrieval/natural-language-query.md): `semantic_search()`, `query()`, or `aggregate()`.

```python Python theme={null}
import videodb

conn = videodb.connect(api_key="your_api_key")
coll = conn.get_collection()
video = coll.get_videos()[0]

# Search a legacy index
results = video.legacy_search("customer reviews discussion")
shots = results.get_shots()

print(f"Found {len(shots)} matches")
for shot in shots:
    print(f"Time: {shot.start:.2f}s - {shot.end:.2f}s")
    print(f"Text: {shot.text}")
```

```javascript Node.js theme={null}
import { connect } from 'videodb';

const conn = connect({ apiKey: 'your_api_key' });
const coll = await conn.getCollection();
const videos = await coll.getVideos();
const video = videos[0];

// Search a legacy index
const results = await video.legacySearch('customer reviews discussion');
const shots = results.getShots();

console.log(`Found ${shots.length} matches`);
for (const shot of shots) {
  console.log(`Time: ${shot.start.toFixed(2)}s - ${shot.end.toFixed(2)}s`);
  console.log(`Text: ${shot.text}`);
}
```

> [!NOTE]
>
> * Requires index to be created first (create-index endpoint)
> * Returns matched segments with timestamps and relevance scores
> * Supports semantic search on transcribed text
> * Can filter results by score threshold and result count
> * Search results include exact timestamp ranges for video navigation


## OpenAPI

````yaml POST /video/{video_id}/search/
openapi: 3.0.3
info:
  title: VideoDB Server API
  description: >
    VideoDB Server API for video, audio, and image processing with AI
    capabilities.

    This API provides comprehensive video management, search, indexing, and
    AI-powered features.
  version: 1.0.0
  contact:
    name: VideoDB Support
    url: https://videodb.io
  license:
    name: MIT
    url: https://opensource.org/licenses/MIT
servers:
  - url: https://api.videodb.io
    description: Production server
  - url: https://staging-api.videodb.io
    description: Staging server
security:
  - ApiKeyAuth: []
tags:
  - name: Authentication
    description: User authentication and API key management
  - name: Collections
    description: Collection management operations
  - name: Videos
    description: Video upload, processing, and management
  - name: Audio
    description: Audio management operations
  - name: Images
    description: Image management operations
  - name: Search
    description: Content search and indexing
  - name: AI Generation
    description: AI-powered content generation
  - name: Billing
    description: Billing and usage management
  - name: RTStream
    description: Real-time streaming operations
  - name: Utilities
    description: Utility endpoints
  - name: Meeting
    description: Meeting recording and management
  - name: Capture
    description: Capture session management for recording streams
  - name: Editor
    description: Timeline editor operations
  - name: Transcode
    description: Media transcoding operations
  - name: Assets
    description: Cross-collection asset listing
paths:
  /video/{video_id}/search/:
    post:
      summary: Search within video
      parameters:
        - name: video_id
          in: path
          required: true
          schema:
            type: string
            pattern: ^m-
            example: m-12345
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - query
              properties:
                query:
                  type: string
                  example: search query
                index_type:
                  type: string
                  enum:
                    - spoken_word
                    - scene
                  example: spoken_word
                search_type:
                  type: string
                  enum:
                    - semantic
                    - keyword
                  example: semantic
                score_threshold:
                  type: number
                  example: 0.2
                result_threshold:
                  type: integer
                  example: 10
                stitch:
                  type: boolean
                  example: true
                scene_index_id:
                  type: string
                  example: idx-12345
                filter:
                  type: array
                  items:
                    type: object
      responses:
        '200':
          description: Search results
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SearchResult'
      security:
        - ApiKeyAuth: []
components:
  schemas:
    SearchResult:
      type: object
      properties:
        success:
          type: boolean
          example: true
        data:
          type: object
          properties:
            query:
              type: string
              example: search query
            results:
              type: array
              items:
                type: object
                properties:
                  video_id:
                    type: string
                    example: m-12345
                  start:
                    type: number
                    example: 10.5
                  end:
                    type: number
                    example: 20.3
                  text:
                    type: string
                    example: matched content
                  score:
                    type: number
                    example: 0.95
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-access-token
      description: API key for authentication (sk-xxx format)

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.