# 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://sourcey-peertube.pages.dev/api-rest-reference/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://sourcey-peertube.pages.dev/api-rest-reference/models/videoplaylistprivacyset.md); Type: VideoPlaylistPrivacySet
  
  Video playlist privacy policy (see [/video-playlists/privacies](#operation/getPlaylistPrivacyPolicies))
  
  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://sourcey-peertube.pages.dev/api-rest-reference/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)
```
