Skip to Content
Create a Playback Restriction
post

Create a new Playback Restriction.

curl 'https://api.mux.com/video/v1/playback-restrictions' \
  -X POST \
  -d '{ "referrer": { "allowed_domains": ["*.example.com"], "allow_no_referrer": true } }' \
  -H "Content-Type: application/json" \
  -u ${MUX_TOKEN_ID}:${MUX_TOKEN_SECRET}
Request body params

A list of domains allowed to play your videos.

referrer.allowed_domains
array

List of domains allowed to play videos. Possible values are

  • [] Empty Array indicates deny video playback requests for all domains
  • ["*"] A Single Wildcard * entry means allow video playback requests from any domain
  • ["*.example.com", "foo.com"] A list of up to 10 domains or valid dns-style wildcards
referrer.allow_no_referrer
boolean
(default: false)

A boolean to determine whether to allow or deny HTTP requests without Referer HTTP request header. Playback requests coming from non-web/native applications like iOS, Android or smart TVs will not have a Referer HTTP header. Set this value to true to allow these playback requests.

Rules that control what user agents are allowed to play your videos. Please see Using User-Agent HTTP header for validation for more details on this feature.

user_agent.allow_no_user_agent
boolean
(default: true)

Whether or not to allow views without a User-Agent HTTP request header.

user_agent.allow_high_risk_user_agent
boolean
(default: true)

Whether or not to allow high risk user agents. The high risk user agents are defined by Mux.

post
201
/video/v1/playback-restrictions
Request
(application/json)
{
  "referrer": {
    "allowed_domains": [
      "*.example.com"
    ],
    "allow_no_referrer": true
  },
  "user_agent": {
    "allow_no_user_agent": false,
    "allow_high_risk_user_agent": false
  }
}
Response
(application/json)
{
  "data": {
    "id": "9dbEg8o00uqQzZbzJT6NXdqNA00SdnSo8O",
    "updated_at": "1607945257",
    "created_at": "1607945257",
    "referrer": {
      "allowed_domains": [
        "*.example.com"
      ],
      "allow_no_referrer": true
    },
    "user_agent": {
      "allow_no_user_agent": false,
      "allow_high_risk_user_agent": false
    }
  }
}