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

> Use this API endpoint to fetch metadata from a YouTube playlist including title, description, video count, and more.

Fetching playlist details is part of the [free YouTube API](https://supadata.ai/youtube-api) from Supadata.

## Quick Start

### Request

<CodeGroup>
  ```js Node theme={null} theme={null} theme={null} theme={null} theme={null} theme={null} theme={null}
  import {
    Supadata,
    YoutubeChannel
  } from '@supadata/js';

  // Initialize the client
  const supadata = new Supadata({
    apiKey: 'YOUR_API_KEY',
  });

  const channel: YoutubeChannel = await supadata.youtube.channel({
    id: 'https://youtube.com/@RickAstleyVEVO', // can be url, channel id, handle
  });
  ```

  ```python Python theme={null} theme={null} theme={null} theme={null} theme={null} theme={null} theme={null}
  from supadata import Supadata, SupadataError

  # Initialize the client
  supadata = Supadata(api_key="YOUR_API_KEY")

  channel = supadata.youtube.channel(id="https://youtube.com/@RickAstleyVEVO") # can be url, channel id, handle
  print(f"Channel: {channel}")
  ```

  ```bash cURL theme={null} theme={null} theme={null} theme={null} theme={null} theme={null} theme={null}
  curl -X GET 'https://api.supadata.ai/v1/youtube/playlist?id=PLlaN88a7y2_plecYoJxvRFTLHVbIVAOoc' \
    -H 'x-api-key: YOUR_API_KEY'
  ```
</CodeGroup>

### Response

```json theme={null}
{
  "id": "PLlaN88a7y2_plecYoJxvRFTLHVbIVAOoc",
  "title": "My Favorite Videos",
  "description": "A collection of my favorite videos",
  "videoCount": 25,
  "viewCount": 1000000,
  "lastUpdated": "2023-01-01T00:00:00.000Z",
  "channel": {
    "id": "UCuAXFkgsw1L7xaCfnd5JJOw",
    "name": "Rick Astley"
  }
}
```

## Specification

### Endpoint

`GET https://api.supadata.ai/v1/youtube/playlist`

Each request requires an `x-api-key` header with your API key available after signing up. Get your API key [here](https://dash.supadata.ai/organizations/api-key).

### Query Parameters

| Parameter | Type   | Required | Description                                                                                      |
| --------- | ------ | -------- | ------------------------------------------------------------------------------------------------ |
| id        | string | Yes      | YouTube playlist URL or ID. See [Supported YouTube URL Formats](/youtube/supported-url-formats). |

## Playlist Videos

You can also retrieve a list of video IDs from a playlist using the [Playlist Videos](/youtube/playlist-videos) endpoint.

### Error Codes

The API returns HTTP status codes and error codes. See this [page](/errors) for more details.

### Supported YouTube Identifiers

The universal `id` parameter supports various YouTube URL and ID formats. See this [page](/youtube/supported-url-formats) for more details.

## Pricing

* 1 playlist metadata request = 1 credit
