Introduction
The CMS API has a feature to delete the digital master (source file for a video) in the Video Cloud catalog. This will permit you to perform one-time cleanup tasks to decrease the size of your managed content.
To understand how masters are archived, and how you can prevent them from being archived at all - if that is what you want to do - see Archiving Masters.
Requirements
- Deletion of digital masters can be performed using the CMS API only - this option will not be available in Studio.
Implications of deleting masters
Before you proceed, be sure you understand the following implications of deleting digital masters:
- You will no longer be able to re-transcode a video after its master is deleted. If you need new renditions, you will have to replace the video through Studio or the Dynamic Ingest API.
- Managing videos via Batch Provisioning (deprecated) will no longer work. Use the CMS and Dynamic Ingest APIs instead.
- Deleting a digital master is a permanent operation. We cannot restore deleted digital masters.
Steps: deleting a digital master
Follow the following steps to delete a digital master.
- Be sure you have your own copy of the master in case you ever need it.
- If you need to retranscode any videos, do so before deleting the master. After the master is deleted you will no longer be able to retranscode the video.
- Obtain the necessary client credentials for the operation. The client credentials must include permissions for the following operations:
[ "video-cloud/asset/delete", "video-cloud/video/read" ]
These permissions are not available in the Studio UI, so you will need to use the OAuth API to obtain them. Below is a cURL command that will do the job if you replace the highlighted items with your own information:
curl --request POST \ --url https://oauth.brightcove.com/v4/client_credentials \ --header 'authorization: BC_TOKEN YOUR_BC_TOKEN' \ --header 'content-type: application/json' \ --data '{ "type": "credential", "maximum_scope": [ { "identity": { "type": "video-cloud-account", "account-id": YOUR_ACCOUNT_ID }, "operations": [ "video-cloud/asset/delete", "video-cloud/video/read" ] } ], "name": "Delete-Masters" }'
To obtain your BC_TOKEN, open any Studio page (you need to be an administrator on the account), open the JavaScript console in your browser, paste in the Javascript code below and press return (enter):
var cookiesArray = document.cookie.split(";"), cookiesObj = {}, i, tmpArray = []; for (i = 0; i < cookiesArray.length; i++) { tmpArray = cookiesArray[i].split("="); if (tmpArray[0].indexOf('BC_TOKEN') > -1) { cookiesObj.BC_TOKEN = tmpArray[1]; } } window.prompt("BC_TOKEN:", cookiesObj.BC_TOKEN);
- Use the client credentials to generate an access token
- Delete digital masters using these endpoints.
Delete Master Base URL https://cms.api.brightcove.com/v1
Method DELETE
Endpoint /accounts/accountID/videos/videoID/digital_master
Header Authorization: Bearer Authorization: Bearer {access_token}
Response 204 NO_CONTENT (204 is a standard response for delete operations, indicating that the operation was successful, or that the asset had already been deleted.)