---
updatedAt: 2025-10-09T17:37:25.000Z
agentTools:
  projectIndex: https://docs.uplynk.com/llms.txt
---

# Create / Update Studio DRM Policy Configuration

This endpoint allows the following actions:

* Create a Studio DRM policy configuration.
* Update an existing Studio DRM policy configuration.

An existing Studio DRM policy configuration will be updated when either of the following conditions are true:

* The `_id` parameter is set to the system-defined ID of an existing Studio DRM policy configuration.
* The value assigned to the `policy_name` parameter matches the name assigned to an existing Studio DRM policy configuration.

### Request

#### Request Syntax

```
POST /drm/policies/create-or-update
```

#### Request Body Parameters

Pass the following request body parameters:

| Name                     | Data Type  | Description                                                                                                                                                                                 |
| ------------------------ | ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `policy_name` (Required) | String     | Assigns a name to the Studio DRM policy configuration. If the specified value matches an existing configuration, it will be updated.                                                        |
| `_id`                    | String     | **Update Policy Only** Identify the Studio DRM policy configuration to be updated by its system-defined ID. This parameter should only be included when updating an existing configuration. |
| `fairplay`               | Dictionary | Contains Studio DRM policy settings for Apple FairPlay Streaming.                                                                                                                           |
| `widevine`               | Dictionary | Contains Studio DRM policy settings for Google Widevine DRM.                                                                                                                                |
| `playready`              | Dictionary | Contains Studio DRM policy settings for Microsoft PlayReady.                                                                                                                                |

Policy settings that are not explicitly set are defined by the [default Studio DRM policy](#DefaultPolicy). If you are updating an existing Studio DRM policy configuration, then [those settings will be overwritten](#UpdatePolicySS) by the default Studio DRM policy.

### Response

The response for a successful request contains the following parameters:

| Name      | Data Type            | Description                                                                            |
| --------- | -------------------- | -------------------------------------------------------------------------------------- |
| `configs` | List of dictionaries | Contains all of the Studio DRM policy configurations associated with the current user. |
| `error`   | Integer              | Indicates whether an error occurred.                                                   |

### Sample Request/Response

The code below (Python 3) shows how to create a Studio DRM policy configuration.

This code imports names from the `api_auth` module for V4 APIs (see below).

<TutorialTile
  backgroundColor="#018FF4"
  emoji="🦉"
  id="682d18228dd6230012097fad"
  link="https://docs.uplynk.com/v2.0/recipes/api-auth-for-classic-authentication-v4-apis"
  slug="api-auth-for-classic-authentication-v4-apis"
  title="API Auth for Classic Authentication (V4 APIs)"
/>  

#### Sample Request (Python 3)

```python
import requests
from api_auth import APICredentials, APIParams

class DRMPolicies:
    def __init__(self):
        self.host = "https://services.uplynk.com"

    def run(self):
        """
        Create a DRM policy.
        """
        self._create_or_update_drm_policy()

    def _create_or_update_drm_policy(self):
        policy_data = dict()
        url = "{}{}".format(self.host, "/api/v3/drm/policies/create-or-update")

        new_policy_data = {
            'policy_name': 'My First Policy',
            'widevine': {
                'content_key_specs': [
                    {
                        'track_type': 'ALL',
                        'security_level': 1,
                        'required_output_protection': {
                            'hdcp': 'HDCP_NONE'
                        }
                    }
                ],
                'policy_overrides': {
                    'can_persist': True,
                    'can_play': True,
                    'can_renew': True
                }
            },
            'fairplay': {
                "hd": {
                    'allow_airplay': False,
                    'allow_av_adapter': False
                }
            },
            'playready': {
                "hd": {
                    'require_hdcp_type_1': True,
                    'digital_video_protection_level': 250
                },
                "uhd1": {
                    'require_hdcp_type_1': True,
                    'digital_video_protection_level': 250
                },
                "uhd2": {
                    'require_hdcp_type_1': True,
                    'digital_video_protection_level': 250
                }
            }
        }

        policy_data['item'] = new_policy_data

        response = requests.post(
            url, data=APIParams(APICredentials()).get_params(policy_data)
        )

        print(response.json())

DRMPolicies().run()
```

#### Sample Response

```json
{
    "configs": [
        {
            "_id": "abcdef123456ghijkl7890123mno789",
            "created": 1558566151978,
            "policy_name": "My First Policy",
            "fairplay": {
                "key_duration_seconds": 0,
                "hd": {
                    "hdcp_enforcement": -1,
                    "allow_airplay": False,
                    "allow_av_adapter": False
                },
                "persistence_duration_seconds": 0,
                "rental_duration_seconds": 0,
                "lease_duration_seconds": 0,
                "uhd2": {
                    "hdcp_enforcement": -1,
                    "allow_airplay": True,
                    "allow_av_adapter": True
                },
                "uhd1": {
                    "hdcp_enforcement": -1,
                    "allow_airplay": True,
                    "allow_av_adapter": True
                },
                "playback_duration_seconds": 0,
                "sd": {
                    "hdcp_enforcement": -1,
                    "allow_airplay": True,
                    "allow_av_adapter": True
                },
                "rental": False,
                "persistence": False,
                "lease": False
            },
            "lmsig": "1538693547862491_10735_4271",
            "widevine": {
                "content_key_specs": [
                    {
                        "track_type": "ALL",
                        "security_level": 1,
                        "required_output_protection": {
                            "hdcp_srm_rule": "HDCP_SRM_RULE_NONE",
                            "hdcp": "HDCP_NONE",
                            "cgms_flags": "CGMS_NONE",
                            "disable_analog_output": False
                        }
                    }
                ],
                "policy_overrides": {
                    "renewal_retry_interval_seconds": 0,
                    "can_renew": True,
                    "can_persist": True,
                    "license_duration_seconds": 86400,
                    "always_include_client_id": False,
                    "can_play": True,
                    "rental_duration_seconds": 0,
                    "renewal_delay_seconds": 0,
                    "renewal_recovery_duration_seconds": 0,
                    "playback_duration_seconds": 0,
                    "renew_with_usage": False
                }
            },
            "owner": "abc33864a92c46a1a286cdd49b0a9123",
            "playready": {
                "license_duration_seconds": 86400,
                "can_persist": False,
                "can_play": True,
                "uhd2": {
                    "digital_video_protection_level": 250,
                    "security_level": 2000,
                    "play_enabler": False,
                    "require_hdcp_type_1": True
                },
                "uhd1": {
                    "digital_video_protection_level": 250,
                    "security_level": 2000,
                    "play_enabler": False,
                    "require_hdcp_type_1": True
                }
            },
            "lastmod": 1558566152020
        }
    ],
    "error": 0
}
```