# Video Playlists

Operations dealing with playlists of videos. Playlists are bound to users and/or channels.

## List available playlist privacy policies

`GET /api/v1/video-playlists/privacies`

Authentication: no security requirement declared for this operation.

Responses:

- 200: successful operation

Content type: application/json

Type: Array<string>

Items:
  Type: string

## Examples

### cURL

```bash
curl -X GET 'https://peertube2.cpy.re/api/v1/video-playlists/privacies'
```

### JavaScript

```javascript
const response = await fetch('https://peertube2.cpy.re/api/v1/video-playlists/privacies', {
  method: 'GET',
});

const data = await response.text();
```

### Python

```python
import requests

response = requests.get('https://peertube2.cpy.re/api/v1/video-playlists/privacies')
print(response.text)
```


## List video playlists

`GET /api/v1/video-playlists`

Authentication: no security requirement declared for this operation.

Parameters:

- `start` (query, integer, optional) - Offset used to paginate results
  Type: integer
  
  minimum: 0

- `count` (query, integer, optional) - Number of items to return
  Type: integer
  
  default: 15
  
  minimum: 1
  
  maximum: 100

- `sort` (query, string, optional) - Sort column
  Type: string
  
  Example:
  
  ```json
  "-createdAt"
  ```

- `playlistType` (query, VideoPlaylistTypeSet, optional)
  Type: VideoPlaylistTypeSet
  
  The video playlist type (Regular = `1`, Watch Later = `2`)
  
  Schema: [VideoPlaylistTypeSet](https://docs.joinpeertube.org/api-rest-reference/api/models/videoplaylisttypeset.md)
  
  enum: [1,2]

Responses:

- 200: successful operation

Content type: application/json

Type: object

- `total` (optional)
  Type: integer
  
  Example:
  
  ```json
  1
  ```

- `data` (optional)
  Type: Array<VideoPlaylist>
  
  Items:
    Reference: [VideoPlaylist](https://docs.joinpeertube.org/api-rest-reference/api/models/videoplaylist.md); Type: VideoPlaylist

## Examples

### cURL

```bash
curl -X GET 'https://peertube2.cpy.re/api/v1/video-playlists?count=15'
```

### JavaScript

```javascript
const response = await fetch('https://peertube2.cpy.re/api/v1/video-playlists?count=15', {
  method: 'GET',
});

const data = await response.text();
```

### Python

```python
import requests

response = requests.get('https://peertube2.cpy.re/api/v1/video-playlists?count=15')
print(response.text)
```


## Create a video playlist

`POST /api/v1/video-playlists`

If the video playlist is set as public, `videoChannelId` is mandatory.

Authentication (security requirement alternatives):

```json
[
  {
    "OAuth2": []
  }
]
```

- OAuth2: oauth2. Authenticating via OAuth requires the following steps:
- Have an activated account
- [Generate] an access token for that account at `/api/v1/users/token`.
- Make requests with the *Authorization: Bearer <token\>* header
- Profit, depending on the role assigned to the account

Note that the __access token is valid for 1 day__ and is given
along with a __refresh token valid for 2 weeks__.

[Generate]: https://docs.joinpeertube.org/api/rest-getting-started


Request body: multipart/form-data

Type: object

- `displayName` (required)
  Type: string
  
  Video playlist display name
  
  minLength: 1
  
  maxLength: 120

- `thumbnailfile` (optional)
  Type: string, binary
  
  Video playlist thumbnail file

- `privacy` (optional)
  Reference: [VideoPlaylistPrivacySet](https://docs.joinpeertube.org/api-rest-reference/api/models/videoplaylistprivacyset.md); Type: VideoPlaylistPrivacySet
  
  Video playlist privacy policy (see [/video-playlists/privacies](https://docs.joinpeertube.org/api-rest-reference/api/operations/getplaylistprivacypolicies.html))
  
  enum: [1,2,3]

- `description` (optional)
  Type: string
  
  Video playlist description
  
  minLength: 3
  
  maxLength: 1000

- `videoChannelId` (optional)
  Type: id
  
  Video channel in which the playlist will be published
  
  allOf:
    Reference: [id](https://docs.joinpeertube.org/api-rest-reference/api/models/id.md); Type: id
    
    minimum: 1
    
    Example:
    
    ```json
    42
    ```

Responses:

- 200: successful operation

Content type: application/json

Type: object

- `videoPlaylist` (optional)
  Type: object
  
  - `id` (optional)
    Reference: [id](https://docs.joinpeertube.org/api-rest-reference/api/models/id.md); Type: id
    
    minimum: 1
    
    Example:
    
    ```json
    42
    ```
  
  - `uuid` (optional)
    Reference: [UUIDv4](https://docs.joinpeertube.org/api-rest-reference/api/models/uuidv4.md); Type: UUIDv4, uuid
    
    minLength: 36
    
    maxLength: 36
    
    pattern: "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
    
    Example:
    
    ```json
    "9c9de5e8-0a1e-484a-b099-e80766180a6d"
    ```
  
  - `shortUUID` (optional)
    Reference: [shortUUID](https://docs.joinpeertube.org/api-rest-reference/api/models/shortuuid.md); Type: shortUUID

## Examples

### cURL

```bash
curl -X POST 'https://peertube2.cpy.re/api/v1/video-playlists' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  --form-string 'displayName=string' \
  --form-string 'privacy=1' \
  --form-string 'description=string'
```

### JavaScript

```javascript
const form = new FormData();
form.append('displayName', 'string');
form.append('privacy', '1');
form.append('description', 'string');
const response = await fetch('https://peertube2.cpy.re/api/v1/video-playlists', {
  method: 'POST',
  headers: {"Authorization":"Bearer YOUR_TOKEN"},
  body: form,
});
console.log(await response.text());
```

### Python

```python
import requests
from contextlib import ExitStack

with ExitStack() as stack:
    files = [
        ('displayName', (None, 'string')),
        ('privacy', (None, '1')),
        ('description', (None, 'string')),
    ]
    response = requests.request('POST', 'https://peertube2.cpy.re/api/v1/video-playlists', headers={"Authorization":"Bearer YOUR_TOKEN"}, files=files)
    print(response.text)
```


## Get a video playlist

`GET /api/v1/video-playlists/{playlistId}`

Authentication: no security requirement declared for this operation.

Parameters:

- `playlistId` (path, id, required) - Playlist id
  Type: id
  
  Schema: [id](https://docs.joinpeertube.org/api-rest-reference/api/models/id.md)
  
  minimum: 1
  
  Example:
  
  ```json
  42
  ```

Responses:

- 200: successful operation

Content type: application/json

Type: VideoPlaylist

Schema: [VideoPlaylist](https://docs.joinpeertube.org/api-rest-reference/api/models/videoplaylist.md)

- `id` (optional)
  Reference: [id](https://docs.joinpeertube.org/api-rest-reference/api/models/id.md); Type: id
  
  minimum: 1
  
  Example:
  
  ```json
  42
  ```

- `uuid` (optional)
  Reference: [UUIDv4](https://docs.joinpeertube.org/api-rest-reference/api/models/uuidv4.md); Type: UUIDv4, uuid
  
  minLength: 36
  
  maxLength: 36
  
  pattern: "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
  
  Example:
  
  ```json
  "9c9de5e8-0a1e-484a-b099-e80766180a6d"
  ```

- `shortUUID` (optional)
  Reference: [shortUUID](https://docs.joinpeertube.org/api-rest-reference/api/models/shortuuid.md); Type: shortUUID

- `createdAt` (optional)
  Type: string, date-time

- `updatedAt` (optional)
  Type: string, date-time

- `description` (optional)
  Type: string
  
  minLength: 3
  
  maxLength: 1000

- `displayName` (optional)
  Type: string
  
  minLength: 1
  
  maxLength: 120

- `isLocal` (optional)
  Type: boolean

- `videoLength` (optional)
  Type: integer
  
  minimum: 0

- `thumbnailPath` (optional)
  Type: string; nullable
  
  Deprecated in PeerTube v8.1, use thumbnails instead. Null if the file is stored in object storage: use the non-deprecated field instead.
  
  deprecated: true

- `thumbnails` (optional)
  Type: Array<Thumbnail>
  
  **PeerTube >= 8.1** Array of thumbnails for the playlist
  
  Items:
    Reference: [Thumbnail](https://docs.joinpeertube.org/api-rest-reference/api/models/thumbnail.md); Type: Thumbnail

- `privacy` (optional)
  Reference: [VideoPlaylistPrivacyConstant](https://docs.joinpeertube.org/api-rest-reference/api/models/videoplaylistprivacyconstant.md); Type: VideoPlaylistPrivacyConstant

- `type` (optional)
  Reference: [VideoPlaylistTypeConstant](https://docs.joinpeertube.org/api-rest-reference/api/models/videoplaylisttypeconstant.md); Type: VideoPlaylistTypeConstant

- `ownerAccount` (optional)
  Reference: [AccountSummary](https://docs.joinpeertube.org/api-rest-reference/api/models/accountsummary.md); Type: AccountSummary

- `videoChannel` (optional)
  Reference: [VideoChannelSummary](https://docs.joinpeertube.org/api-rest-reference/api/models/videochannelsummary.md); Type: VideoChannelSummary

- `videoChannelPosition` (optional)
  Type: integer
  
  Position of the playlist in the channel
  
  minimum: 1

## Examples

### cURL

```bash
curl -X GET 'https://peertube2.cpy.re/api/v1/video-playlists/42'
```

### JavaScript

```javascript
const response = await fetch('https://peertube2.cpy.re/api/v1/video-playlists/42', {
  method: 'GET',
});

const data = await response.text();
```

### Python

```python
import requests

response = requests.get('https://peertube2.cpy.re/api/v1/video-playlists/42')
print(response.text)
```


## Update a video playlist

`PUT /api/v1/video-playlists/{playlistId}`

If the video playlist is set as public, the playlist must have a assigned channel.

Authentication (security requirement alternatives):

```json
[
  {
    "OAuth2": []
  }
]
```

- OAuth2: oauth2. Authenticating via OAuth requires the following steps:
- Have an activated account
- [Generate] an access token for that account at `/api/v1/users/token`.
- Make requests with the *Authorization: Bearer <token\>* header
- Profit, depending on the role assigned to the account

Note that the __access token is valid for 1 day__ and is given
along with a __refresh token valid for 2 weeks__.

[Generate]: https://docs.joinpeertube.org/api/rest-getting-started


Parameters:

- `playlistId` (path, id, required) - Playlist id
  Type: id
  
  Schema: [id](https://docs.joinpeertube.org/api-rest-reference/api/models/id.md)
  
  minimum: 1
  
  Example:
  
  ```json
  42
  ```

Request body: multipart/form-data

Type: object

- `displayName` (optional)
  Type: string
  
  Video playlist display name
  
  minLength: 1
  
  maxLength: 120

- `thumbnailfile` (optional)
  Type: string, binary
  
  Video playlist thumbnail file

- `privacy` (optional)
  Reference: [VideoPlaylistPrivacySet](https://docs.joinpeertube.org/api-rest-reference/api/models/videoplaylistprivacyset.md); Type: VideoPlaylistPrivacySet
  
  Video playlist privacy policy (see [/video-playlists/privacies](https://docs.joinpeertube.org/api-rest-reference/api/operations/getplaylistprivacypolicies.html))
  
  enum: [1,2,3]

- `description` (optional)
  Type: string
  
  Video playlist description

- `videoChannelId` (optional)
  Type: id
  
  Video channel in which the playlist will be published
  
  allOf:
    Reference: [id](https://docs.joinpeertube.org/api-rest-reference/api/models/id.md); Type: id
    
    minimum: 1
    
    Example:
    
    ```json
    42
    ```

Responses:

- 204: successful operation

## Examples

### cURL

```bash
curl -X PUT 'https://peertube2.cpy.re/api/v1/video-playlists/42' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  --form-string 'displayName=string' \
  --form-string 'privacy=1' \
  --form-string 'description=string'
```

### JavaScript

```javascript
const form = new FormData();
form.append('displayName', 'string');
form.append('privacy', '1');
form.append('description', 'string');
const response = await fetch('https://peertube2.cpy.re/api/v1/video-playlists/42', {
  method: 'PUT',
  headers: {"Authorization":"Bearer YOUR_TOKEN"},
  body: form,
});
console.log(await response.text());
```

### Python

```python
import requests
from contextlib import ExitStack

with ExitStack() as stack:
    files = [
        ('displayName', (None, 'string')),
        ('privacy', (None, '1')),
        ('description', (None, 'string')),
    ]
    response = requests.request('PUT', 'https://peertube2.cpy.re/api/v1/video-playlists/42', headers={"Authorization":"Bearer YOUR_TOKEN"}, files=files)
    print(response.text)
```


## Delete a video playlist

`DELETE /api/v1/video-playlists/{playlistId}`

Authentication (security requirement alternatives):

```json
[
  {
    "OAuth2": []
  }
]
```

- OAuth2: oauth2. Authenticating via OAuth requires the following steps:
- Have an activated account
- [Generate] an access token for that account at `/api/v1/users/token`.
- Make requests with the *Authorization: Bearer <token\>* header
- Profit, depending on the role assigned to the account

Note that the __access token is valid for 1 day__ and is given
along with a __refresh token valid for 2 weeks__.

[Generate]: https://docs.joinpeertube.org/api/rest-getting-started


Parameters:

- `playlistId` (path, id, required) - Playlist id
  Type: id
  
  Schema: [id](https://docs.joinpeertube.org/api-rest-reference/api/models/id.md)
  
  minimum: 1
  
  Example:
  
  ```json
  42
  ```

Responses:

- 204: successful operation

## Examples

### cURL

```bash
curl -X DELETE 'https://peertube2.cpy.re/api/v1/video-playlists/42' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('https://peertube2.cpy.re/api/v1/video-playlists/42', {
  method: 'DELETE',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

const data = await response.text();
```

### Python

```python
import requests

response = requests.delete(
    'https://peertube2.cpy.re/api/v1/video-playlists/42',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## List videos of a playlist

`GET /api/v1/video-playlists/{playlistId}/videos`

Authentication: no security requirement declared for this operation.

Parameters:

- `playlistId` (path, id, required) - Playlist id
  Type: id
  
  Schema: [id](https://docs.joinpeertube.org/api-rest-reference/api/models/id.md)
  
  minimum: 1
  
  Example:
  
  ```json
  42
  ```

- `start` (query, integer, optional) - Offset used to paginate results
  Type: integer
  
  minimum: 0

- `count` (query, integer, optional) - Number of items to return
  Type: integer
  
  default: 15
  
  minimum: 1
  
  maximum: 100

Responses:

- 200: successful operation

Content type: application/json

Type: any

- `total` (optional)
  Type: integer
  
  Example:
  
  ```json
  1
  ```

- `data` (optional)
  Type: Array<object>
  
  maxItems: 100
  
  Items:
    Type: object
    
    - `id` (optional)
      Type: id
      
      Playlist element id
      
      allOf:
        Reference: [id](https://docs.joinpeertube.org/api-rest-reference/api/models/id.md); Type: id
        
        minimum: 1
        
        Example:
        
        ```json
        42
        ```
    
    - `position` (optional)
      Type: integer
      
      Example:
      
      ```json
      2
      ```
    
    - `startTimestamp` (optional)
      Type: integer, seconds; nullable
      
      Example:
      
      ```json
      10
      ```
    
    - `stopTimestamp` (optional)
      Type: integer, seconds; nullable
      
      Example:
      
      ```json
      41
      ```
    
    - `video` (optional)
      Reference: [Video](https://docs.joinpeertube.org/api-rest-reference/api/models/video.md); Type: Video

## Examples

### cURL

```bash
curl -X GET 'https://peertube2.cpy.re/api/v1/video-playlists/42/videos?count=15'
```

### JavaScript

```javascript
const response = await fetch('https://peertube2.cpy.re/api/v1/video-playlists/42/videos?count=15', {
  method: 'GET',
});

const data = await response.text();
```

### Python

```python
import requests

response = requests.get('https://peertube2.cpy.re/api/v1/video-playlists/42/videos?count=15')
print(response.text)
```


## Add a video in a playlist

`POST /api/v1/video-playlists/{playlistId}/videos`

Authentication (security requirement alternatives):

```json
[
  {
    "OAuth2": []
  }
]
```

- OAuth2: oauth2. Authenticating via OAuth requires the following steps:
- Have an activated account
- [Generate] an access token for that account at `/api/v1/users/token`.
- Make requests with the *Authorization: Bearer <token\>* header
- Profit, depending on the role assigned to the account

Note that the __access token is valid for 1 day__ and is given
along with a __refresh token valid for 2 weeks__.

[Generate]: https://docs.joinpeertube.org/api/rest-getting-started


Parameters:

- `playlistId` (path, id, required) - Playlist id
  Type: id
  
  Schema: [id](https://docs.joinpeertube.org/api-rest-reference/api/models/id.md)
  
  minimum: 1
  
  Example:
  
  ```json
  42
  ```

Request body: application/json

Type: object

- `videoId` (required)
  Type: UUIDv4 | id
  
  Video to add in the playlist
  
  oneOf:
    Type: UUIDv4
    
    universal identifier for the video, that can be used across instances
    
    allOf:
      Reference: [UUIDv4](https://docs.joinpeertube.org/api-rest-reference/api/models/uuidv4.md); Type: UUIDv4, uuid
      
      minLength: 36
      
      maxLength: 36
      
      pattern: "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
      
      Example:
      
      ```json
      "9c9de5e8-0a1e-484a-b099-e80766180a6d"
      ```
  
    Reference: [id](https://docs.joinpeertube.org/api-rest-reference/api/models/id.md); Type: id
    
    object id for the video

- `startTimestamp` (optional)
  Type: integer, seconds
  
  Start the video at this specific timestamp

- `stopTimestamp` (optional)
  Type: integer, seconds
  
  Stop the video at this specific timestamp

Responses:

- 200: successful operation

Content type: application/json

Type: object

- `videoPlaylistElement` (optional)
  Type: object
  
  - `id` (optional)
    Type: integer
    
    Example:
    
    ```json
    2
    ```

## Examples

### cURL

```bash
curl -X POST 'https://peertube2.cpy.re/api/v1/video-playlists/42/videos' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "startTimestamp": 0,
  "stopTimestamp": 0
}'
```

### JavaScript

```javascript
const body = `{
  "startTimestamp": 0,
  "stopTimestamp": 0
}`;

const response = await fetch('https://peertube2.cpy.re/api/v1/video-playlists/42/videos', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
    'Content-Type': 'application/json',
  },
  body,
});

const data = await response.text();
```

### Python

```python
import requests

body = '''{
  "startTimestamp": 0,
  "stopTimestamp": 0
}'''

response = requests.post(
    'https://peertube2.cpy.re/api/v1/video-playlists/42/videos',
    data=body.encode('utf-8'),
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Reorder playlist elements

`POST /api/v1/video-playlists/{playlistId}/videos/reorder`

Authentication (security requirement alternatives):

```json
[
  {
    "OAuth2": []
  }
]
```

- OAuth2: oauth2. Authenticating via OAuth requires the following steps:
- Have an activated account
- [Generate] an access token for that account at `/api/v1/users/token`.
- Make requests with the *Authorization: Bearer <token\>* header
- Profit, depending on the role assigned to the account

Note that the __access token is valid for 1 day__ and is given
along with a __refresh token valid for 2 weeks__.

[Generate]: https://docs.joinpeertube.org/api/rest-getting-started


Parameters:

- `playlistId` (path, id, required) - Playlist id
  Type: id
  
  Schema: [id](https://docs.joinpeertube.org/api-rest-reference/api/models/id.md)
  
  minimum: 1
  
  Example:
  
  ```json
  42
  ```

Request body: application/json

Type: object

- `startPosition` (required)
  Type: integer
  
  Start position of the element to reorder
  
  minimum: 1

- `insertAfterPosition` (required)
  Type: integer
  
  New position for the block to reorder, to add the block before the first element
  
  minimum: 0

- `reorderLength` (optional)
  Type: integer
  
  How many element from `startPosition` to reorder
  
  minimum: 1

Responses:

- 204: successful operation

## Examples

### cURL

```bash
curl -X POST 'https://peertube2.cpy.re/api/v1/video-playlists/42/videos/reorder' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "startPosition": 1,
  "insertAfterPosition": 0,
  "reorderLength": 1
}'
```

### JavaScript

```javascript
const body = `{
  "startPosition": 1,
  "insertAfterPosition": 0,
  "reorderLength": 1
}`;

const response = await fetch('https://peertube2.cpy.re/api/v1/video-playlists/42/videos/reorder', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
    'Content-Type': 'application/json',
  },
  body,
});

const data = await response.text();
```

### Python

```python
import requests

body = '''{
  "startPosition": 1,
  "insertAfterPosition": 0,
  "reorderLength": 1
}'''

response = requests.post(
    'https://peertube2.cpy.re/api/v1/video-playlists/42/videos/reorder',
    data=body.encode('utf-8'),
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Update a playlist element

`PUT /api/v1/video-playlists/{playlistId}/videos/{playlistElementId}`

Authentication (security requirement alternatives):

```json
[
  {
    "OAuth2": []
  }
]
```

- OAuth2: oauth2. Authenticating via OAuth requires the following steps:
- Have an activated account
- [Generate] an access token for that account at `/api/v1/users/token`.
- Make requests with the *Authorization: Bearer <token\>* header
- Profit, depending on the role assigned to the account

Note that the __access token is valid for 1 day__ and is given
along with a __refresh token valid for 2 weeks__.

[Generate]: https://docs.joinpeertube.org/api/rest-getting-started


Parameters:

- `playlistId` (path, id, required) - Playlist id
  Type: id
  
  Schema: [id](https://docs.joinpeertube.org/api-rest-reference/api/models/id.md)
  
  minimum: 1
  
  Example:
  
  ```json
  42
  ```

- `playlistElementId` (path, id, required) - Playlist element id
  Type: id
  
  Schema: [id](https://docs.joinpeertube.org/api-rest-reference/api/models/id.md)
  
  minimum: 1
  
  Example:
  
  ```json
  42
  ```

Request body: application/json

Type: object

- `startTimestamp` (optional)
  Type: integer, seconds
  
  Start the video at this specific timestamp

- `stopTimestamp` (optional)
  Type: integer, seconds
  
  Stop the video at this specific timestamp

Responses:

- 204: successful operation

## Examples

### cURL

```bash
curl -X PUT 'https://peertube2.cpy.re/api/v1/video-playlists/42/videos/42' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "startTimestamp": 0,
  "stopTimestamp": 0
}'
```

### JavaScript

```javascript
const body = `{
  "startTimestamp": 0,
  "stopTimestamp": 0
}`;

const response = await fetch('https://peertube2.cpy.re/api/v1/video-playlists/42/videos/42', {
  method: 'PUT',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
    'Content-Type': 'application/json',
  },
  body,
});

const data = await response.text();
```

### Python

```python
import requests

body = '''{
  "startTimestamp": 0,
  "stopTimestamp": 0
}'''

response = requests.put(
    'https://peertube2.cpy.re/api/v1/video-playlists/42/videos/42',
    data=body.encode('utf-8'),
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Delete an element from a playlist

`DELETE /api/v1/video-playlists/{playlistId}/videos/{playlistElementId}`

Authentication (security requirement alternatives):

```json
[
  {
    "OAuth2": []
  }
]
```

- OAuth2: oauth2. Authenticating via OAuth requires the following steps:
- Have an activated account
- [Generate] an access token for that account at `/api/v1/users/token`.
- Make requests with the *Authorization: Bearer <token\>* header
- Profit, depending on the role assigned to the account

Note that the __access token is valid for 1 day__ and is given
along with a __refresh token valid for 2 weeks__.

[Generate]: https://docs.joinpeertube.org/api/rest-getting-started


Parameters:

- `playlistId` (path, id, required) - Playlist id
  Type: id
  
  Schema: [id](https://docs.joinpeertube.org/api-rest-reference/api/models/id.md)
  
  minimum: 1
  
  Example:
  
  ```json
  42
  ```

- `playlistElementId` (path, id, required) - Playlist element id
  Type: id
  
  Schema: [id](https://docs.joinpeertube.org/api-rest-reference/api/models/id.md)
  
  minimum: 1
  
  Example:
  
  ```json
  42
  ```

Responses:

- 204: successful operation

## Examples

### cURL

```bash
curl -X DELETE 'https://peertube2.cpy.re/api/v1/video-playlists/42/videos/42' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('https://peertube2.cpy.re/api/v1/video-playlists/42/videos/42', {
  method: 'DELETE',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

const data = await response.text();
```

### Python

```python
import requests

response = requests.delete(
    'https://peertube2.cpy.re/api/v1/video-playlists/42/videos/42',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Check video exists in my playlists

`GET /api/v1/users/me/video-playlists/videos-exist`

Authentication (security requirement alternatives):

```json
[
  {
    "OAuth2": []
  }
]
```

- OAuth2: oauth2. Authenticating via OAuth requires the following steps:
- Have an activated account
- [Generate] an access token for that account at `/api/v1/users/token`.
- Make requests with the *Authorization: Bearer <token\>* header
- Profit, depending on the role assigned to the account

Note that the __access token is valid for 1 day__ and is given
along with a __refresh token valid for 2 weeks__.

[Generate]: https://docs.joinpeertube.org/api/rest-getting-started


Parameters:

- `videoIds` (query, Array<id>, required) - The video ids to check
  Type: Array<id>
  
  Items:
    Reference: [id](https://docs.joinpeertube.org/api-rest-reference/api/models/id.md); Type: id
    
    object id for the video

Responses:

- 200: successful operation

Content type: application/json

Type: object

- `videoId` (optional)
  Type: Array<object>
  
  Items:
    Type: object
    
    - `playlistElementId` (optional)
      Type: integer
    
    - `playlistId` (optional)
      Type: integer
    
    - `startTimestamp` (optional)
      Type: integer, seconds; nullable
    
    - `stopTimestamp` (optional)
      Type: integer, seconds; nullable

## Examples

### cURL

```bash
curl -X GET 'https://peertube2.cpy.re/api/v1/users/me/video-playlists/videos-exist' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('https://peertube2.cpy.re/api/v1/users/me/video-playlists/videos-exist', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

const data = await response.text();
```

### Python

```python
import requests

response = requests.get(
    'https://peertube2.cpy.re/api/v1/users/me/video-playlists/videos-exist',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Search playlists

`GET /api/v1/search/video-playlists`

Authentication: no security requirement declared for this operation.

Parameters:

- `search` (query, string, required) - String to search. If the user can make a remote URI search, and the string is an URI then the PeerTube instance will fetch the remote object and add it to its database. Then, you can use the REST API to fetch the complete playlist information and interact with it.

  Type: string

- `start` (query, integer, optional) - Offset used to paginate results
  Type: integer
  
  minimum: 0

- `count` (query, integer, optional) - Number of items to return
  Type: integer
  
  default: 15
  
  minimum: 1
  
  maximum: 100

- `searchTarget` (query, string, optional) - If the administrator enabled search index support, you can override the default search target.

**Warning**: If you choose to make an index search, PeerTube will get results from a third party service. It means the instance may not yet know the objects you fetched. If you want to load video/channel information:
  * If the current user has the ability to make a remote URI search (this information is available in the config endpoint),
  then reuse the search API to make a search using the object URI so PeerTube instance fetches the remote object and fill its database.
  After that, you can use the classic REST API endpoints to fetch the complete object or interact with it
  * If the current user doesn't have the ability to make a remote URI search, then redirect the user on the origin instance or fetch
  the data from the origin instance API

  Type: string
  
  enum: ["local","search-index"]

- `sort` (query, string, optional) - Sort column
  Type: string
  
  Example:
  
  ```json
  "-createdAt"
  ```

- `host` (query, string, optional) - Find elements owned by this host
  Type: string

- `uuids` (query, any, optional) - Find elements with specific UUIDs
  Type: any
  
  Items:
    Type: string

Responses:

- 200: successful operation

Content type: application/json

Type: object

- `total` (optional)
  Type: integer
  
  Example:
  
  ```json
  1
  ```

- `data` (optional)
  Type: Array<VideoPlaylist>
  
  Items:
    Reference: [VideoPlaylist](https://docs.joinpeertube.org/api-rest-reference/api/models/videoplaylist.md); Type: VideoPlaylist

- 500: search index unavailable

## Examples

### cURL

```bash
curl -X GET 'https://peertube2.cpy.re/api/v1/search/video-playlists?search=string&count=15'
```

### JavaScript

```javascript
const response = await fetch('https://peertube2.cpy.re/api/v1/search/video-playlists?search=string&count=15', {
  method: 'GET',
});

const data = await response.text();
```

### Python

```python
import requests

response = requests.get('https://peertube2.cpy.re/api/v1/search/video-playlists?search=string&count=15')
print(response.text)
```
