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

# Create Timeline (v1)

> Create a video composition using the legacy Timeline v1 API

Create a video timeline by adding video clips inline and overlaying audio, images, or text assets on top.

<CodeGroup>
  ```python Python theme={null}
  import videodb
  from videodb.editor import Timeline, VideoAsset, AudioAsset

  conn = videodb.connect(api_key="your_api_key")

  # Create a timeline
  timeline = Timeline(conn)

  # Add videos inline (sequentially)
  video_asset = VideoAsset(asset_id="m-abc123def")
  timeline.add_inline(video_asset)

  # Add audio overlay (starts at 5 seconds)
  audio_asset = AudioAsset(asset_id="a-xyz789")
  timeline.add_overlay(start=5, asset=audio_asset)

  # Generate stream
  stream_url = timeline.generate_stream()
  print(f"Stream: {stream_url}")
  ```

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

  const conn = await connect({ apiKey: 'your_api_key' });

  // Create a timeline
  const timeline = new Timeline(conn);

  // Add videos inline (sequentially)
  const videoAsset = new VideoAsset('m-abc123def');
  timeline.addInline(videoAsset);

  // Add audio overlay (starts at 5 seconds)
  const audioAsset = new AudioAsset('a-xyz789');
  timeline.addOverlay(5, audioAsset);

  // Generate stream
  const streamUrl = await timeline.generateStream();
  console.log(`Stream: ${streamUrl}`);
  ```
</CodeGroup>

<Note>
  * Timeline v1 uses simple inline and overlay operations
  * Video IDs start with `m-`, audio with `a-`, images with `img-`
  * For advanced editing with tracks and effects, use Timeline v2
  * `generate_stream()` returns a playable stream URL
</Note>

<CardGroup cols={2}>
  <Card title="Create Timeline v2" icon="plus" href="/api-reference/timeline/create_timeline_v2">
    Advanced timeline with tracks and effects
  </Card>

  <Card title="Timeline Guides" icon="book" href="/examples-and-tutorials/programmatic-editing/intro-outro">
    Learn timeline composition
  </Card>
</CardGroup>


## OpenAPI

````yaml POST /timeline
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:
  /timeline:
    post:
      summary: Compile timeline
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - request_type
                - timeline
              properties:
                request_type:
                  type: string
                  enum:
                    - compile
                  example: compile
                timeline:
                  type: array
                  items:
                    $ref: '#/components/schemas/Timeline'
      responses:
        '200':
          description: Timeline compilation result
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    type: object
                    properties:
                      stream_url:
                        type: string
                        example: https://stream.videodb.io/compiled/12345
      security:
        - ApiKeyAuth: []
components:
  schemas:
    Timeline:
      type: object
      properties:
        video_id:
          type: string
          example: m-12345
        clips:
          type: array
          items:
            type: object
            properties:
              start:
                type: number
                example: 0
              end:
                type: number
                example: 30
              volume:
                type: number
                example: 1
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-access-token
      description: API key for authentication (sk-xxx format)

````