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

> Use this API endpoint to fetch a list of video IDs from a YouTube playlist.

## Quick Start

### Request

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

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

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

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

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

  playlist_videos = supadata.youtube.playlist.videos(
      id="https://www.youtube.com/playlist?list=PLlaN88a7y2_plecYoJxvRFTLHVbIVAOoc",  # can be url or playlist id
      limit=50
  )
  print(f"Regular videos: {playlist_videos.video_ids}")
  print(f"Shorts: {playlist_videos.short_ids}")
  print(f"Live: {playlist_videos.live_ids}")
  ```

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

### Response

```json theme={null}
{
  "videoIds": ["dQw4w9WgXcQ", "xvFZjo5PgG0"],
  "shortIds": ["xvFZjo5PgG0", "dQw4w9WgXcQ"],
  "liveIds": ["dQw4w9WgXcQ", "xvFZjo5PgG0"]
}
```

## Specification

### Endpoint

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

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). |
| limit     | number | No       | Maximum number of video IDs to return. Default: 100. Max: 5000                                   |

### Response Format

```typescript theme={null}
{
  "videoIds": string[],  // List of vertical YouTube video IDs
  "shortIds": string[],  // List of Shorts IDs
  "liveIds": string[]   // List of live video IDs
}
```

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

## Working with Playlist Videos

After retrieving the list of video IDs, you can:

1. Get metadata for each video using the [Video Metadata](/youtube/video) endpoint
2. Get transcripts for each video using the [Transcript](/get-transcript) endpoint

<Info>
  For large playlists, consider using the `limit` parameter to control the
  number of results returned.
</Info>

## Pricing

* 1 playlist videos request = 1 credit
