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

# Playlist

> Get metadata for a YouTube playlist.



## OpenAPI

````yaml v1-openapi GET /youtube/playlist
openapi: 3.1.0
info:
  title: Supadata
  description: Web & Social Media Content API for Developers
  version: 1.3.0
servers:
  - url: https://api.supadata.ai/v1
security:
  - apiKeyAuth: []
paths:
  /youtube/playlist:
    get:
      description: Get metadata for a YouTube playlist.
      operationId: getYoutubePlaylist
      parameters:
        - in: query
          name: id
          schema:
            type: string
            description: >-
              YouTube playlist URL or ID. See [supported URL
              formats](https://supadata.ai/documentation/youtube/supported-url-formats).
            examples:
              - >-
                https://www.youtube.com/playlist?list=PLlaN88a7y2_plecYoJxvRFTLHVbIVAOoc
              - PLlaN88a7y2_plecYoJxvRFTLHVbIVAOoc
          required: true
      responses:
        '200':
          description: Successfully fetched playlist metadata
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/YoutubePlaylist'
        '400':
          description: Invalid Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: Internal Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      x-codeSamples:
        - lang: TypeScript
          label: Node.js
          source: >-
            import { Supadata } from '@supadata/js';


            const supadata = new Supadata({
              apiKey: 'YOUR_API_KEY',
            });

            const playlist = await supadata.youtube.playlist({
              id: 'https://www.youtube.com/playlist?list=PLlaN88a7y2_plecYoJxvRFTLHVbIVAOoc', // can be id or url
            });

            console.log(`Playlist ${playlist.title} contains
            ${playlist.videoCount} videos`);
        - lang: Python
          label: Python
          source: >-
            from supadata import Supadata


            supadata = Supadata(api_key="YOUR_API_KEY")

            playlist = supadata.youtube.playlist(
                id="https://www.youtube.com/playlist?list=PLlaN88a7y2_plecYoJxvRFTLHVbIVAOoc" # can be id or url
            )

            print(f"Playlist title: {playlist.title} contains
            {playlist.video_count} videos")
        - lang: Shell
          label: cURL
          source: >-
            curl -X GET
            "https://api.supadata.ai/v1/youtube/playlist?id=https://www.youtube.com/playlist?list=PLlaN88a7y2_plecYoJxvRFTLHVbIVAOoc"
            \
              -H "x-api-key: YOUR_API_KEY" \
              -H "Content-Type: application/json"
components:
  schemas:
    YoutubePlaylist:
      type: object
      properties:
        id:
          type: string
          description: YouTube playlist ID
          example: PLlaN88a7y2_plecYoJxvRFTLHVbIVAOoc
        title:
          type: string
          description: Playlist title
          example: My Favorite Videos
        description:
          type: string
          description: Playlist description
          example: A collection of my favorite videos
        videoCount:
          type: number
          description: Number of videos in the playlist
          example: 25
        viewCount:
          type: number
          description: Number of views for the playlist
          example: 1000000
        lastUpdated:
          type: string
          description: When the playlist was last updated
          example: '2023-01-01T00:00:00.000Z'
          format: date-time
        channel:
          type: object
          properties:
            id:
              type: string
              description: Channel ID
              example: UCuAXFkgsw1L7xaCfnd5JJOw
            name:
              type: string
              description: Channel name
              example: Rick Astley
          required:
            - id
            - name
          description: Channel information
      required:
        - id
        - title
        - videoCount
        - channel
    Error:
      type: object
      properties:
        error:
          type: string
          enum:
            - invalid-request
            - internal-error
            - forbidden
            - unauthorized
            - upgrade-required
            - transcript-unavailable
            - not-found
            - limit-exceeded
          description: Error code identifying the type of error
          example: invalid-request
        message:
          type: string
          description: Human readable error message
          example: Invalid Request
        details:
          type: string
          description: Detailed error description
          example: The request is invalid or malformed
        documentationUrl:
          type: string
          description: URL to error documentation
          example: https://supadata.ai/documentation/errors#invalid-request
      required:
        - error
        - message
        - details
      description: Standard error response format
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key

````