> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://fastpix.com/docs/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://fastpix.com/docs/_mcp/server.

# Delete media in a playlist by ID

DELETE https://api.fastpix.com/v1/on-demand/playlists/{playlistId}/media
Content-Type: application/json

This endpoint allows you to delete one or more media items from an existing playlist. By passing the media ID(s) in the request, the specified media items are removed from the playlist.
#### How it works

 - When a user sends a DELETE request to this endpoint with the playlist ID as the path parameter and the media ID(s) to be removed in the request body, FastPix deletes the specified media items from the playlist and returns the updated playlist details.

#### Example
An e-learning platform removes outdated video tutorials from the "Beginner Python Series" playlist by specifying their media IDs in the request. The playlist is updated to exclude these items, ensuring learners only access relevant content.

Reference: https://fastpix.com/docs/video-on-demand-api/playlist/delete-media-from-playlist

## Authentication

- `Authorization` header (basic auth, required) — FastPix APIs are secured with Basic Authentication. Use your Access Token ID as the username and Secret Key as the password in the Authorization header of each API request. * Username: Access Token ID * Password: Secret Key Activate your FastPix account to generate your API credentials. See the guide here

## Request

### Path parameters

- `playlistId` (string, required) — The unique id of the playlist you want to perform the operation on.

### Body (application/json)

This endpoint expects a MediaIdsRequest.

- `mediaIds` (list of string, required)

## Response

### 200

Deleted media from playlist successfully

- `success` (boolean, required) — Shows the request status. Returns true for success and false for failure.
- `data` (PlaylistByIdResponseData, required)

## Types

### PlaylistByIdResponseData

- `type`: `manual` (manual)
  - `createdAt` (datetime, optional) — Timestamp of playlist creation.
  - `description` (string, optional) — Description of the playlist set by the user.
  - `id` (string, optional) — The unique id of the playlist
  - `mediaCount` (integer, optional) — No. of media present in the playlist
  - `mediaList` (list of PlaylistByIdResponseMediaListItem, optional)
  - `name` (string, optional) — The name of the playlist set by the user
  - `referenceId` (string, optional) — Unique string value assigned by user to the playlist.
  - `updatedAt` (datetime, optional) — Playlist's most recent update timestamp.
  - `workspaceId` (string, optional) — The unique id of the workspace in which the playlist is present.
- `type`: `smart` (smart)
  - `metadata` (PlaylistByIdResponseMetadata, required) — Required when the playlist type is `smart`. Media created between `startDate` and `endDate` of `createdDate` is added. Optionally, you can include media based on `updatedDate`.
  - `playOrder` (enum, required) — Determines the insertion order of media into playlist.
    - Allowed values: `createdDate ASC`, `createdDate DESC`
  - `createdAt` (datetime, optional) — Timestamp of playlist creation.
  - `description` (string, optional) — Description of the playlist set by the user.
  - `id` (string, optional) — The unique id of the playlist
  - `mediaCount` (integer, optional) — No. of media present in the playlist
  - `mediaList` (list of PlaylistByIdResponseMediaListItem, optional)
  - `name` (string, optional) — The name of the playlist set by the user
  - `referenceId` (string, optional) — Unique string value assigned by user to the playlist.
  - `updatedAt` (datetime, optional) — Playlist's most recent update timestamp.
  - `workspaceId` (string, optional) — The unique id of the workspace in which the playlist is present.

### PlaylistByIdResponseMediaListItem

- `createdAt` (datetime, optional) — Timestamp of media creation in the workspace.
- `creatorId` (string, optional, nullable) — Creator ID of the media.
- `duration` (double, optional) — Duration of the media in seconds.
- `id` (string, optional) — unique id of the particular media.
- `sourceResolution` (string, optional) — source resolution of the media.
- `status` (string, optional) — status of the media, only media with ready status is added to playlist.
- `thumbnail` (string, optional) — thumbnail for the particular media.
- `title` (string, optional, nullable) — Title of the media.

### PlaylistByIdResponseMetadata

Required when the playlist type is `smart`. Media created between `startDate` and `endDate` of `createdDate` is added. Optionally, you can include media based on `updatedDate`.

- `createdDate` (DateRange, optional) — Date range with start and end dates.
- `updatedDate` (DateRange, optional) — Date range with start and end dates.

### DateRange

Date range with start and end dates.

- `startDate` (string, optional)
- `endDate` (string, optional)

## Examples

**Request**

```json
{
  "mediaIds": [
    "a1cd180e-f9b5-4e99-9d44-b9c9baabad89",
    "245800c3-7b73-47d9-a201-e961260dcb30",
    "41316aac-5396-4278-8f44-08d5f2495b12"
  ]
}
```

**Response**

```json
{
  "success": true,
  "data": {
    "type": "smart",
    "metadata": {
      "createdDate": {
        "startDate": "2024-12-11",
        "endDate": "2024-12-12"
      },
      "updatedDate": {
        "startDate": "2024-12-11",
        "endDate": "2024-12-12"
      }
    },
    "playOrder": "createdDate ASC",
    "createdAt": "2025-06-05T09:10:30.655275Z",
    "description": "This Playlist contains videos from December 2024.",
    "id": "46d5fce1-683a-457f-86d7-c048bb429505",
    "mediaCount": 3,
    "mediaList": [
      {
        "createdAt": "2025-05-27T09:37:52.445936Z",
        "creatorId": "FastPix@14612",
        "duration": 10.5,
        "id": "a1cd180e-f9b5-4e99-9d44-b9c9baabad89",
        "sourceResolution": "1080p",
        "status": "Ready",
        "thumbnail": "https://venus-images.fastpix.dev/bed25609-1887-4c49-91a5-5c6b1edeb1a2/thumbnail.png",
        "title": "Media 1"
      },
      {
        "createdAt": "2025-04-04T13:26:23.507284Z",
        "creatorId": "FastPix@14612",
        "duration": 10.5,
        "id": "245800c3-7b73-47d9-a201-e961260dcb30",
        "sourceResolution": "1080p",
        "status": "Ready",
        "thumbnail": "https://mercury-images.fastpix.dev/3c6ceeea-d24b-487f-9dd0-5a16148b5d46/thumbnail.png",
        "title": "Media 2"
      },
      {
        "createdAt": "2025-04-04T13:26:12.552840Z",
        "creatorId": "FastPix@14612",
        "duration": 10.5,
        "id": "41316aac-5396-4278-8f44-08d5f2495b12",
        "sourceResolution": "1080p",
        "status": "Ready",
        "thumbnail": "https://mercury-images.fastpix.dev/8989d0d3-5c5b-41b2-89d5-df6094e6093f/thumbnail.png",
        "title": "Media 3"
      }
    ],
    "name": "My Playlist",
    "referenceId": "122q",
    "updatedAt": "2025-06-05T12:23:47.096690Z",
    "workspaceId": "d760b903-86ef-44d6-9b73-334130e0cf2d"
  }
}
```

**SDK Code**

```python
import requests

url = "https://api.fastpix.com/v1/on-demand/playlists/playlistId/media"

payload = { "mediaIds": ["a1cd180e-f9b5-4e99-9d44-b9c9baabad89", "245800c3-7b73-47d9-a201-e961260dcb30", "41316aac-5396-4278-8f44-08d5f2495b12"] }
headers = {
    "Content-Type": "application/json"
}

response = requests.delete(url, json=payload, headers=headers, auth=("<username>", "<password>"))

print(response.json())
```

```javascript
const url = 'https://api.fastpix.com/v1/on-demand/playlists/playlistId/media';
const credentials = btoa("<username>:<password>");

const options = {
  method: 'DELETE',
  headers: {
    Authorization: `Basic ${credentials}`,
    'Content-Type': 'application/json'
  },
  body: '{"mediaIds":["a1cd180e-f9b5-4e99-9d44-b9c9baabad89","245800c3-7b73-47d9-a201-e961260dcb30","41316aac-5396-4278-8f44-08d5f2495b12"]}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.fastpix.com/v1/on-demand/playlists/playlistId/media"

	payload := strings.NewReader("{\n  \"mediaIds\": [\n    \"a1cd180e-f9b5-4e99-9d44-b9c9baabad89\",\n    \"245800c3-7b73-47d9-a201-e961260dcb30\",\n    \"41316aac-5396-4278-8f44-08d5f2495b12\"\n  ]\n}")

	req, _ := http.NewRequest("DELETE", url, payload)

	req.SetBasicAuth("<username>", "<password>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.fastpix.com/v1/on-demand/playlists/playlistId/media")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Delete.new(url)
request.basic_auth("<username>", "<password>")
request["Content-Type"] = 'application/json'
request.body = "{\n  \"mediaIds\": [\n    \"a1cd180e-f9b5-4e99-9d44-b9c9baabad89\",\n    \"245800c3-7b73-47d9-a201-e961260dcb30\",\n    \"41316aac-5396-4278-8f44-08d5f2495b12\"\n  ]\n}"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.delete("https://api.fastpix.com/v1/on-demand/playlists/playlistId/media")
  .basicAuth("<username>", "<password>")
  .header("Content-Type", "application/json")
  .body("{\n  \"mediaIds\": [\n    \"a1cd180e-f9b5-4e99-9d44-b9c9baabad89\",\n    \"245800c3-7b73-47d9-a201-e961260dcb30\",\n    \"41316aac-5396-4278-8f44-08d5f2495b12\"\n  ]\n}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('DELETE', 'https://api.fastpix.com/v1/on-demand/playlists/playlistId/media', [
  'body' => '{
  "mediaIds": [
    "a1cd180e-f9b5-4e99-9d44-b9c9baabad89",
    "245800c3-7b73-47d9-a201-e961260dcb30",
    "41316aac-5396-4278-8f44-08d5f2495b12"
  ]
}',
  'headers' => [
    'Content-Type' => 'application/json',
  ],
    'auth' => ['<username>', '<password>'],
]);

echo $response->getBody();
```

```csharp
using RestSharp;
using RestSharp.Authenticators;

var client = new RestClient("https://api.fastpix.com/v1/on-demand/playlists/playlistId/media");
client.Authenticator = new HttpBasicAuthenticator("<username>", "<password>");
var request = new RestRequest(Method.DELETE);

request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"mediaIds\": [\n    \"a1cd180e-f9b5-4e99-9d44-b9c9baabad89\",\n    \"245800c3-7b73-47d9-a201-e961260dcb30\",\n    \"41316aac-5396-4278-8f44-08d5f2495b12\"\n  ]\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let credentials = Data("<username>:<password>".utf8).base64EncodedString()

let headers = [
  "Authorization": "Basic \(credentials)",
  "Content-Type": "application/json"
]
let parameters = ["mediaIds": ["a1cd180e-f9b5-4e99-9d44-b9c9baabad89", "245800c3-7b73-47d9-a201-e961260dcb30", "41316aac-5396-4278-8f44-08d5f2495b12"]] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.fastpix.com/v1/on-demand/playlists/playlistId/media")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "DELETE"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```