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

# Preview YouTube URL

> Preview a YouTube URL before importing. Fetches metadata + an exact
cost estimate (in cents) for the video or full playlist/channel.
For large playlists this can take a few seconds — the client is
expected to show a spinner.



## OpenAPI

````yaml https://api.gleap.io/api-docs.json post /youtube-source/preview
openapi: 3.0.0
info:
  title: gleap-server
  version: 14.0.0
  contact: {}
servers:
  - url: https://api.gleap.io/v3
security: []
paths:
  /youtube-source/preview:
    post:
      tags:
        - AI content
      summary: Preview YouTube URL
      description: |-
        Preview a YouTube URL before importing. Fetches metadata + an exact
        cost estimate (in cents) for the video or full playlist/channel.
        For large playlists this can take a few seconds — the client is
        expected to show a spinner.
      operationId: Preview
      parameters:
        - in: header
          name: project
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PreviewYouTubeDto'
      responses:
        '200':
          description: Ok
          content:
            application/json:
              schema:
                anyOf:
                  - properties:
                      estimatedCostCents:
                        type: number
                        format: double
                      video:
                        allOf:
                          - $ref: '#/components/schemas/VideoMetadata'
                          - properties:
                              alreadyImported:
                                type: boolean
                            required:
                              - alreadyImported
                            type: object
                      type:
                        type: string
                        enum:
                          - video
                        nullable: false
                    required:
                      - estimatedCostCents
                      - video
                      - type
                    type: object
                  - properties:
                      estimatedCostCents:
                        type: number
                        format: double
                      videos:
                        items:
                          allOf:
                            - $ref: '#/components/schemas/VideoMetadata'
                            - properties:
                                alreadyImported:
                                  type: boolean
                              required:
                                - alreadyImported
                              type: object
                        type: array
                      alreadyImportedCount:
                        type: number
                        format: double
                      billableDurationSeconds:
                        type: number
                        format: double
                      totalDurationSeconds:
                        type: number
                        format: double
                      videoCount:
                        type: number
                        format: double
                      thumbnailUrl:
                        type: string
                      channelName:
                        type: string
                      title:
                        type: string
                      type:
                        type: string
                        enum:
                          - channel
                          - playlist
                    required:
                      - estimatedCostCents
                      - videos
                      - alreadyImportedCount
                      - billableDurationSeconds
                      - totalDurationSeconds
                      - videoCount
                      - thumbnailUrl
                      - channelName
                      - title
                      - type
                    type: object
      security:
        - jwt: []
components:
  schemas:
    PreviewYouTubeDto:
      properties:
        url:
          type: string
      required:
        - url
      type: object
      additionalProperties: false
    VideoMetadata:
      properties:
        videoId:
          type: string
        title:
          type: string
        durationSeconds:
          type: number
          format: double
        thumbnailUrl:
          type: string
        channelName:
          type: string
        privacyStatus:
          anyOf:
            - type: string
            - type: string
              enum:
                - public
                - unlisted
                - private
      required:
        - videoId
        - title
        - durationSeconds
        - thumbnailUrl
        - channelName
        - privacyStatus
      type: object
      additionalProperties: false
  securitySchemes:
    jwt:
      type: http
      scheme: bearer
      bearerFormat: JWT

````