Page Summary
-
The
VideoAdvertisingOptionresource defines the types and timing of ads that can appear during a video, including third-party ads. -
The available ad formats for videos are limited to
thirdPartyand previous ad format controls likeinstream_standard,display,preroll, andpostrollshould not be included in API requests. -
An
AdBreakspecifies a moment during video playback when an in-stream advertisement can be shown, marked by thepositionandmidrollSeconds. -
Several methods are provided to manage video advertising settings, including retrieving, updating, patching, and getting details about the allowed ads for a video.
-
Automatic generation of midroll breaks can be enabled on a video by setting the field
autoGeneratedBreaksto true.
Resource: VideoAdvertisingOption
The advertising settings for a video. The settings identify the types of ads that can run during the video as well as the times when ads are allowed to run during the video.
| JSON representation |
|---|
{
"kind"
:
string
,
"adFormats"
:
[
string
]
,
"breakPosition"
:
[
string
]
,
"adBreaks"
:
[
{
object (
|
| Fields | |
|---|---|
kind
|
The type of the API resource. For this resource, the value is |
adFormats[]
|
A list of ad formats that the video is allowed to show. Note: as of November 2023, only |
breakPosition[]
|
The point at which the break occurs during the video playback. |
adBreaks[]
|
A list of times when YouTube can show an in-stream advertisement during playback of the video. |
autoGeneratedBreaks
|
Enables this video for automatically generated midroll breaks. If autoGeneratedBreaks is set to true on a video with adBreaks defined, our systems will identify places to show ads in addition to your manually placed ad slots. |
id
|
The ID that YouTube uses to uniquely identify the video associated with the advertising settings. |
tpAdServerVideoId
|
A value that uniquely identifies the video to the third-party ad server. |
tpTargetingUrl
|
The base URL for a third-party ad server from which YouTube can retrieve in-stream ads for the video. |
tpUrlParameters
|
A parameter string to append to the end of the request to the third-party ad server. |
AdBreak
An adBreak
resource contains information about a time when YouTube can show an in-stream advertisement during video playback.
| JSON representation |
|---|
{ "position" : string , "midrollSeconds" : integer } |
| Fields | |
|---|---|
position
|
The point at which the break occurs during the video playback. |
midrollSeconds
|
The time of the ad break specified as the number of seconds after the start of the video when the break occurs. |
Methods |
|
|---|---|
|
Retrieves advertising settings for the specified video. |
|
Retrieves details about the types of allowed ads for a specified partner- or user-uploaded video. |
|
Patches the advertising settings for the specified video. |
|
Updates the advertising settings for the specified video. |

