PolicyRule
Stay organized with collections
Save and categorize content based on your preferences.
This object represents a policy rule, which specifies a set of conditions that must be met and the action that YouTube should take when those conditions are met. For a rule to be valid, all of the rule's conditions must be satisfied.
Conditions
Represents conditions for a policy rule. YouTube enforces a rights policy if any of the rules specified for the policy are valid. For a rule to be valid, all of the rule's conditions must be satisfied, and a condition is true when all set parts are satisfied. Unset conditions are disregarded (or always satisfied) for a rule. For example, if a rule does not specify a
MatchDuration
, then the length of the actual match duration could not cause the rule to not be satisfied. If no conditions are set, the condition as a whole is always true.
TerritoryCondition
Territory condition used by policy rule's conditions.
IntervalCondition
Identifies the minimum and maximum values associated with a match condition. If a potential match falls within the specified range, then the condition is satisfied.
All rights reserved. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-08-20 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-20 UTC."],[[["\u003cp\u003eThis content outlines the structure and components of a policy rule, which dictates actions YouTube takes when specific conditions are met regarding content.\u003c/p\u003e\n"],["\u003cp\u003eA policy rule includes an \u003ccode\u003eaction\u003c/code\u003e, a set of \u003ccode\u003econditions\u003c/code\u003e, and optional \u003ccode\u003esubactions\u003c/code\u003e, where all conditions must be satisfied for the rule to be valid.\u003c/p\u003e\n"],["\u003cp\u003eConditions can involve territory (\u003ccode\u003eTerritoryCondition\u003c/code\u003e), match duration or percentage (\u003ccode\u003eIntervalCondition\u003c/code\u003e), reference duration or percentage (\u003ccode\u003eIntervalCondition\u003c/code\u003e), and content match type.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eTerritoryCondition\u003c/code\u003e specifies whether a policy rule applies within certain geographic regions, while \u003ccode\u003eIntervalCondition\u003c/code\u003e defines acceptable ranges for match duration or percentages.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eConditions\u003c/code\u003e object describes the criteria that determines if the action specified by the rule is applied.\u003c/p\u003e\n"]]],["A policy rule dictates YouTube's actions based on specific conditions. These rules specify an `action` and optional `subactions` to be enforced if all `conditions` are met. Conditions include `requiredTerritories` which define allowed user locations, and match criteria like `matchDuration`, `matchPercent`, `referenceDuration`, `referencePercent` and `contentMatchType`. `TerritoryCondition` defines if the rule is valid in certain territories. `IntervalCondition` sets ranges (min and max) for match criteria values to be considered as satisfied.\n"],null,["# PolicyRule\n\n- [JSON representation](#SCHEMA_REPRESENTATION)\n- [Conditions](#Conditions)\n - [JSON representation](#Conditions.SCHEMA_REPRESENTATION)\n- [TerritoryCondition](#TerritoryCondition)\n - [JSON representation](#TerritoryCondition.SCHEMA_REPRESENTATION)\n- [IntervalCondition](#IntervalCondition)\n - [JSON representation](#IntervalCondition.SCHEMA_REPRESENTATION)\n\nThis object represents a policy rule, which specifies a set of conditions that must be met and the action that YouTube should take when those conditions are met. For a rule to be valid, all of the rule's conditions must be satisfied.\n\n| JSON representation |\n|--------------------------------------------------------------------------------------------------------------------------------------------|\n| ``` { \"action\": string, \"conditions\": { object (/youtube/partner/reference/rest/v1/PolicyRule#Conditions) }, \"subaction\": [ string ] } ``` |\n\n| Fields ||\n|---------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `action` | `string` The policy that YouTube should enforce if the rule's conditions are all valid for an asset or for an attempt to view that asset on YouTube. |\n| `conditions` | `object (`[Conditions](/youtube/partner/reference/rest/v1/PolicyRule#Conditions)`)` A set of conditions that must be met for the rule's action (and subactions) to be enforced. For a rule to be valid, all of its conditions must be met. |\n| `subaction[]` | `string` A list of additional actions that YouTube should take if the conditions in the rule are met. |\n\nConditions\n----------\n\nRepresents conditions for a policy rule. YouTube enforces a rights policy if any of the rules specified for the policy are valid. For a rule to be valid, all of the rule's conditions must be satisfied, and a condition is true when all set parts are satisfied. Unset conditions are disregarded (or always satisfied) for a rule. For example, if a rule does not specify a\n\n`MatchDuration`\n\n, then the length of the actual match duration could not cause the rule to not be satisfied. If no conditions are set, the condition as a whole is always true.\n\n| JSON representation |\n|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ``` { \"requiredTerritories\": { object (/youtube/partner/reference/rest/v1/PolicyRule#TerritoryCondition) }, \"matchDuration\": [ { object (/youtube/partner/reference/rest/v1/PolicyRule#IntervalCondition) } ], \"matchPercent\": [ { object (/youtube/partner/reference/rest/v1/PolicyRule#IntervalCondition) } ], \"referenceDuration\": [ { object (/youtube/partner/reference/rest/v1/PolicyRule#IntervalCondition) } ], \"referencePercent\": [ { object (/youtube/partner/reference/rest/v1/PolicyRule#IntervalCondition) } ], \"contentMatchType\": [ string ] } ``` |\n\n| Fields ||\n|-----------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `requiredTerritories` | `object (`[TerritoryCondition](/youtube/partner/reference/rest/v1/PolicyRule#TerritoryCondition)`)` This watch condition specifies where users are (or or not) allowed to watch (or listen to) an asset. YouTube determines whether the condition is satisfied based on the user's location. |\n| `matchDuration[]` | `object (`[IntervalCondition](/youtube/partner/reference/rest/v1/PolicyRule#IntervalCondition)`)` This match condition specifies an amount of time that the user- or partner- uploaded content needs to match a reference file for the rule to apply. |\n| `matchPercent[]` | `object (`[IntervalCondition](/youtube/partner/reference/rest/v1/PolicyRule#IntervalCondition)`)` This match condition specifies a percentage of the user- or partner-uploaded content that needs to match a reference file for the rule to apply. |\n| `referenceDuration[]` | `object (`[IntervalCondition](/youtube/partner/reference/rest/v1/PolicyRule#IntervalCondition)`)` This match condition indicates that the reference must be a certain duration for the rule to apply. |\n| `referencePercent[]` | `object (`[IntervalCondition](/youtube/partner/reference/rest/v1/PolicyRule#IntervalCondition)`)` This match condition indicates that the specified percentage of a reference file must match the user- or partner-uploaded content for the rule to apply. |\n| `contentMatchType[]` | `string` This match condition specifies whether the user- or partner-uploaded content needs to match the audio, video or audiovisual content of a reference file for the rule to apply. |\n\nTerritoryCondition\n------------------\n\nTerritory condition used by policy rule's conditions.\n\n| JSON representation |\n|-------------------------------------------------------|\n| ``` { \"type\": string, \"territories\": [ string ] } ``` |\n\n| Fields ||\n|-----------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `type` | `string` This field indicates whether the associated policy rule is or is not valid in the specified territories. |\n| `territories[]` | `string` A list of territories. Each territory is an [ISO 3166 two-letter country code.](http://www.iso.org/iso/country_codes/iso_3166_code_lists/country_names_and_code_elements.htm). |\n\nIntervalCondition\n-----------------\n\nIdentifies the minimum and maximum values associated with a match condition. If a potential match falls within the specified range, then the condition is satisfied.\n\n| JSON representation |\n|-------------------------------------------|\n| ``` { \"low\": number, \"high\": number } ``` |\n\n| Fields ||\n|--------|--------------------------------------------------------------------------------------------------------------------|\n| `low` | `number` The minimum (inclusive) allowed value for the condition to be satisfied. The default value is `-∞`. |\n| `high` | `number` The maximum (inclusive) allowed value for the condition to be satisfied. The default value is `∞`. |"]]