Method: videoAdvertisingOptions.getEnabledAds

Retrieves details about the types of allowed ads for a specified partner- or user-uploaded video.

HTTP request

GET https://youtubepartner.googleapis.com/youtube/partner/v1/videoAdvertisingOptions/{videoId}/getEnabledAds

The URL uses gRPC Transcoding syntax.

Path parameters

Parameters
videoId

string

The videoId parameter specifies the YouTube video ID of the video for which you are retrieving advertising options.

Query parameters

Parameters
onBehalfOfContentOwner

string

The onBehalfOfContentOwner parameter identifies the content owner that the user is acting on behalf of. This parameter supports users whose accounts are associated with multiple content owners.

Request body

The request body must be empty.

Response body

This resource identifies the ad settings for a claimed YouTube video. It identifies the video, the times when ads can run during the video, the countries where ads can run, and the types of ads allowed in those countries. It also indicates whether ads can run if the video plays in an embedded player.

If successful, the response body contains data with the following structure:

JSON representation
{
  "kind": string,
  "countriesRestriction": [
    {
      object (CountriesRestriction)
    }
  ],
  "adBreaks": [
    {
      object (AdBreak)
    }
  ],
  "adsOnEmbeds": boolean,
  "id": string
}
Fields
kind

string

The type of the API resource. For this resource, the value is youtubePartner#videoAdvertisingOptionGetEnabledAds.

countriesRestriction[]

object (CountriesRestriction)

A list that identifies the countries where ads can run and the types of ads allowed in those countries.

adBreaks[]

object (AdBreak)

A list of ad breaks that occur in a claimed YouTube video.

adsOnEmbeds

boolean

This field indicates whether YouTube can show ads when the video is played in an embedded player.

id

string

The ID that YouTube uses to uniquely identify the claimed video.

Authorization scopes

Requires the following OAuth scope:

  • https://www.googleapis.com/auth/youtubepartner

For more information, see the OAuth 2.0 Overview.

CountriesRestriction

Formats enabled in given countries, based on applied policy.

JSON representation
{
  "adFormats": [
    string
  ],
  "territories": [
    string
  ]
}
Fields
adFormats[]

string

A list of ad formats that can be used in the specified countries.

territories[]

string

A list of ISO 3166-1 alpha-2 country codes that identify the countries where ads are enabled.