# Create or Update

put ` https://app.mk.io/api/v1/projects/:project_name/media/streamingPolicies/:policy_name`

Create or update a Streaming Policy. Updating an existing policy may not be available on all accounts.

RBAC Capability Required: `ams.streamingpolicy.create` or `ams.streamingpolicy.update`

## Authentication

Authorization Bearer

Bearer authentication of the form `Bearer <token>`, where token is your auth token.

## Path parameters

project_name  string  Required  
policy_name  string  Required

## Request

This endpoint expects an object.

### properties  object [StreamingPolicyProperties](https://docs.mediakind.com/api-reference/media-api/schemas/streamingpolicyproperties)  Required

The properties of the streaming policy.

#### Show 6 properties

- catalog  map from strings to any  Optional  
  The custom catalog configuration.

- commonEncryptionCbcs  object [CommonEncryptionCbcs](https://docs.mediakind.com/api-reference/media-api/schemas/commonencryptioncbcs)  Optional  
  CommonEncryptionCbcs

- clearKeyEncryptionConfiguration  object [ClearKeyEncryptionConfiguration](https://docs.mediakind.com/api-reference/media-api/schemas/clearkeyencryptionconfiguration)  Optional  
  Clear key configuration

- customKeysAcquisitionUrlTemplate  string  Optional  
  The custom license acquisition URL template for a Clear Key license delivery service.

- clearTracks  list of objects [StreamingPolicyTrackSelection](https://docs.mediakind.com/api-reference/media-api/schemas/streamingpolicytrackselection)  Optional  
  This represents which tracks should _not_ be encrypted.

- trackSelections  list of objects [StreamingPolicyTrackPropertyCondition](https://docs.mediakind.com/api-reference/media-api/schemas/streamingpolicytrackpropertycondition)  Optional  
  track selections is used to specify a set or a subset of track for selection by the streaming policy.

### operation  enum  Required  
Track property operation. Only equality is supported.
Allowed values: Unknown, Equal

### property  enum  Required  
Track property type
Allowed values: Unknown, FourCC

### value  string  Optional  
Track property value

### contentKeys  object [StreamingPolicyContentKeys](https://docs.mediakind.com/api-reference/media-api/schemas/streamingpolicycontentkeys)  Optional  
Content keys used by the streaming policy.

- defaultKey  object [DefaultKey](https://docs.mediakind.com/api-reference/media-api/schemas/defaultkey)  Optional  
Default content key used by the encryption.

- label  string  Optional  
Labels are a potential matching field for selecting a content key via a streaming locator.

- policyName  string  Optional  
Policy used by the key.

- keyToTrackMappings  list of objects [StreamingPolicyContentKey](https://docs.mediakind.com/api-reference/media-api/schemas/streamingpolicycontentkey)  Optional  
List of content keys used by the key. Used to assign different keys to different tracks. For instance, using widevine L3 for SD and L1 for HD.

- tracks  list of objects [StreamingPolicyTrackSelection](https://docs.mediakind.com/api-reference/media-api/schemas/streamingpolicytrackselection)  Optional  
This represents which tracks should be encrypted.

### trackSelections  list of objects [StreamingPolicyTrackPropertyCondition](https://docs.mediakind.com/api-reference/media-api/schemas/streamingpolicytrackpropertycondition)  Optional  
track selections is used to specify a set or a subset of track for selection by the streaming policy.

### operation  enum  Required  
Track property operation. Only equality is supported.
Allowed values: Unknown, Equal

### property  enum  Required  
Track property type
Allowed values: Unknown, FourCC

### value  string  Optional  
Track property value

### drm  object [CbcsDrmConfiguration](https://docs.mediakind.com/api-reference/media-api/schemas/cbcsdrmconfiguration)  Optional  
DRM configuration

- fairPlay  object [StreamingPolicyFairPlayConfiguration](https://docs.mediakind.com/api-reference/media-api/schemas/streamingpolicyfairplayconfiguration)  Optional  
FairPlay configuration

- allowPersistentLicense  boolean  Required  
Allow persistent license

- customLicenseAcquisitionUrlTemplate  string  Optional

- playReady  object [StreamingPolicyPlayReadyConfiguration](https://docs.mediakind.com/api-reference/media-api/schemas/streamingpolicyplayreadyconfiguration)  Optional  
PlayReady configuration

- customLicenseAcquisitionUrlTemplate  string  Optional

- playReadyCustomAttributes  string  Optional

- widevine  object [StreamingPolicyWidevineConfiguration](https://docs.mediakind.com/api-reference/media-api/schemas/streamingpolicywidevineconfiguration)  Optional  
Widevine configuration

- customLicenseAcquisitionUrlTemplate  string  Optional

- enabledProtocols  object [EnabledProtocols](https://docs.mediakind.com/api-reference/media-api/schemas/enabledprotocols)  Optional  
Enabled protocols. This is the set of protocols (dash, download, and hls) that will be delivered with common encryption.

### dash  boolean  Required  
Enable Dash protocol

### download  boolean  Required  
Enable download protocol

### hls  boolean  Required  
Enable HLS protocol

### smoothStreaming  boolean  Required  
Smooth streaming is not supported and the value of this field is ignored.

### commonEncryptionCenc  object [CommonEncryptionCenc](https://docs.mediakind.com/api-reference/media-api/schemas/commonencryptioncenc)  Optional  
CommonEncryptionCenc

### clearKeyEncryptionConfiguration  object [ClearKeyEncryptionConfiguration](https://docs.mediakind.com/api-reference/media-api/schemas/clearkeyencryptionconfiguration)  Optional  
Clear key configuration

### customKeysAcquisitionUrlTemplate  string  Optional

### clearTracks  list of objects [StreamingPolicyTrackSelection](https://docs.mediakind.com/api-reference/media-api/schemas/streamingpolicytrackselection)  Optional  
This represents which tracks should _not_ be encrypted.

### operation  enum  Required  
Track property operation. Only equality is supported.
Allowed values: Unknown, Equal

### property  enum  Required  
Track property type
Allowed values: Unknown, FourCC

### value  string  Optional  
Track property value

- contentKeys  object [StreamingPolicyContentKeys](https://docs.mediakind.com/api-reference/media-api/schemas/streamingpolicycontentkeys)  Optional  
Content keys used by the streaming policy.

- defaultKey  object [DefaultKey](https://docs.mediakind.com/api-reference/media-api/schemas/defaultkey)  Optional  
Default content key used by the encryption.

- label  string  Optional  
Labels are a potential matching field for selecting a content key via a streaming locator.

- policyName  string  Optional  
Policy used by the key.

### operation  enum  Required  
Track property operation. Only equality is supported.
Allowed values: Unknown, Equal

### property  enum  Required  
Track property type
Allowed values: Unknown, FourCC

### value  string  Optional  
Track property value

- drm  object [CencDrmConfiguration](https://docs.mediakind.com/api-reference/media-api/schemas/cencdrmconfiguration)  Optional  
DRM configuration

- customLicenseAcquisitionUrlTemplate  string  Optional

- playReadyCustomAttributes  string  Optional

- customLicenseAcquisitionUrlTemplate  string  Optional

- enabledProtocols  object [EnabledProtocols](https://docs.mediakind.com/api-reference/media-api/schemas/enabledprotocols)  Optional  
Enabled protocols. This is the set of protocols (dash, download, and hls) that will be delivered with envelope encryption.

### dash  boolean  Required  
Enable Dash protocol

### download  boolean  Required  
Enable download protocol

### hls  boolean  Required  
Enable HLS protocol

### smoothStreaming  boolean  Required  
Smooth streaming is not supported and the value of this field is ignored.

- defaultContentKeyPolicyName  string  Optional  <=260 characters
The default content key policy name used by current streaming policy.

### envelopeEncryption  object [EnvelopeEncryption](https://docs.mediakind.com/api-reference/media-api/schemas/envelopeencryption)  Optional  
EnvelopeEncryption

- clearTracks  list of objects [StreamingPolicyTrackSelection](https://docs.mediakind.com/api-reference/media-api/schemas/streamingpolicytrackselection)  Optional  
Clear tracks. This is the set of tracks that will be delivered without envelope encryption.

### operation  enum  Required  
Track property operation. Only equality is supported.
Allowed values: Unknown, Equal

### property  enum  Required  
Track property type
Allowed values: Unknown, FourCC

### value  string  Optional  
Track property value

- defaultKey  object [DefaultKey](https://docs.mediakind.com/api-reference/media-api/schemas/defaultkey)  Optional  
Default content key used by the encryption.

- label  string  Optional  
Labels are a potential matching field for selecting a content key via a streaming locator.

- policyName  string  Optional  
Policy used by the key.

### operation  enum  Required  
Track property operation. Only equality is supported.
Allowed values: Unknown, Equal

### property  enum  Required  
Track property type
Allowed values: Unknown, FourCC

### value  string  Optional  
Track property value

- customKeyAcquisitionUrlTemplate  string  Optional 1-1024 characters
Optional template for the customer service to use for key acquisition. Not needed if using the built-in key delivery service.

### dash  boolean  Required  
Enable Dash protocol

### download  boolean  Required  
Enable download protocol

### hls  boolean  Required  
Enable HLS protocol

### smoothStreaming  boolean  Required  
Smooth streaming is not supported and the value of this field is ignored.

- noEncryption  object [NoEncryption](https://docs.mediakind.com/api-reference/media-api/schemas/noencryption)  Optional  
NoEncryption

### enabledProtocols  object [EnabledProtocols](https://docs.mediakind.com/api-reference/media-api/schemas/enabledprotocols)  Optional  
Enabled protocols. This is the set of protocols (dash, download, and hls) that will be delivered without encryption.

### dash  boolean  Required  
Enable Dash protocol

### download  boolean  Required  
Enable download protocol

### hls  boolean  Required  
Enable HLS protocol

### smoothStreaming  boolean  Required  
Smooth streaming is not supported and the value of this field is ignored.

## Response

200 Streaming Policy updated

- id  string  Optional  
Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}

- name  string  Optional  1-260 characters  pattern: ^[^\\'<>%&:\?/*+]+$

The name of the resource

- properties  object [StreamingPolicyProperties](https://docs.mediakind.com/api-reference/media-api/schemas/streamingpolicyproperties)  Required  
The properties of the streaming policy.

- catalog  map from strings to any  Optional  
  The custom catalog configuration.

- customKeysAcquisitionUrlTemplate  string  Optional  
  The custom license acquisition URL template for a Clear Key license delivery service.

### operation  enum  Required  
Track property operation. Only equality is supported.
Allowed values: Unknown, Equal

### property  enum  Required  
Track property type
Allowed values: Unknown, FourCC

### value  string  Optional  
Track property value

- defaultKey  object [DefaultKey](https://docs.mediakind.com/api-reference/media-api/schemas/defaultkey)  Optional  
Default content key used by the encryption.

- label  string  Optional  
Labels are a potential matching field for selecting a content key via a streaming locator.

- policyName  string  Optional  
Policy used by the key.

### operation  enum  Required  
Track property operation. Only equality is supported.
Allowed values: Unknown, Equal

### property  enum  Required  
Track property type
Allowed values: Unknown, FourCC

### value  string  Optional  
Track property value

- drm  object [CbcsDrmConfiguration](https://docs.mediakind.com/api-reference/media-api/schemas/cbcsdrmconfiguration)  Optional  
DRM configuration

- allowPersistentLicense  boolean  Required  
Allow persistent license

- customLicenseAcquisitionUrlTemplate  string  Optional

- customLicenseAcquisitionUrlTemplate  string  Optional

- playReadyCustomAttributes  string  Optional

- customLicenseAcquisitionUrlTemplate  string  Optional

### dash  boolean  Required  
Enable Dash protocol

### download  boolean  Required  
Enable download protocol

### hls  boolean  Required  
Enable HLS protocol

### smoothStreaming  boolean  Required  
Smooth streaming is not supported and the value of this field is ignored.

### customKeysAcquisitionUrlTemplate  string  Optional

### operation  enum  Required  
Track property operation. Only equality is supported.
Allowed values: Unknown, Equal

### property  enum  Required  
Track property type
Allowed values: Unknown, FourCC

### value  string  Optional  
Track property value

- defaultKey  object [DefaultKey](https://docs.mediakind.com/api-reference/media-api/schemas/defaultkey)  Optional  
Default content key used by the encryption.

- label  string  Optional  
Labels are a potential matching field for selecting a content key via a streaming locator.

- policyName  string  Optional  
Policy used by the key.

### operation  enum  Required  
Track property operation. Only equality is supported.
Allowed values: Unknown, Equal

### property  enum  Required  
Track property type
Allowed values: Unknown, FourCC

### value  string  Optional  
Track property value

### dash  boolean  Required  
Enable Dash protocol

### download  boolean  Required  
Enable download protocol

### hls  boolean  Required  
Enable HLS protocol

### smoothStreaming  boolean  Required  
Smooth streaming is not supported and the value of this field is ignored.

- noEncryption  object [NoEncryption](https://docs.mediakind.com/api-reference/media-api/schemas/noencryption)  Optional  
NoEncryption

### dash  boolean  Required  
Enable Dash protocol

### download  boolean  Required  
Enable download protocol

### hls  boolean  Required  
Enable HLS protocol

### smoothStreaming  boolean  Required  
Smooth streaming is not supported and the value of this field is ignored.

## Errors

### 400 Bad Request

- error  object [ErrorDetail](https://docs.mediakind.com/api-reference/media-api/schemas/errordetail)  Required  
Pertinent information about the error

- code  string  Required  
The error code.

- detail  string  Required  
The error message.

- extraDetail  map from strings to any  Optional  
Extra information regarding this error.

- ref  string  Required  
A reference to the request that caused the error.

- status  integer  Required  
The HTTP status code

### 401 Unauthorized

- error  object [ErrorDetail](https://docs.mediakind.com/api-reference/media-api/schemas/errordetail)  Required  
Pertinent information about the error

- code  string  Required  
The error code.

- detail  string  Required  
The error message.

- extraDetail  map from strings to any  Optional  
Extra information regarding this error.

- ref  string  Required  
A reference to the request that caused the error.

- status  integer  Required  
The HTTP status code

### 403 Forbidden

- error  object [ErrorDetail](https://docs.mediakind.com/api-reference/media-api/schemas/errordetail)  Required  
Pertinent information about the error

- code  string  Required  
The error code.

- detail  string  Required  
The error message.

- extraDetail  map from strings to any  Optional  
Extra information regarding this error.

- ref  string  Required  
A reference to the request that caused the error.

- status  integer  Required  
The HTTP status code

### 404 Not Found

- error  object [ErrorDetail](https://docs.mediakind.com/api-reference/media-api/schemas/errordetail)  Required  
Pertinent information about the error

- code  string  Required  
The error code.

- detail  string  Required  
The error message.

- extraDetail  map from strings to any  Optional  
Extra information regarding this error.

- ref  string  Required  
A reference to the request that caused the error.

- status  integer  Required  
The HTTP status code

### 429 Too Many Requests

- error  object [ErrorDetail](https://docs.mediakind.com/api-reference/media-api/schemas/errordetail)  Required  
Pertinent information about the error

- code  string  Required  
The error code.

- detail  string  Required  
The error message.

- extraDetail  map from strings to any  Optional  
Extra information regarding this error.

- ref  string  Required  
A reference to the request that caused the error.

- status  integer  Required  
The HTTP status code

### 500 Internal Server Error

- error  object [ErrorDetail](https://docs.mediakind.com/api-reference/media-api/schemas/errordetail)  Required  
Pertinent information about the error

- code  string  Required  
The error code.

- detail  string  Required  
The error message.

- extraDetail  map from strings to any  Optional  
Extra information regarding this error.

- ref  string  Required  
A reference to the request that caused the error.

- status  integer  Required  
The HTTP status code
