Skip to main content
POST
/
monetization
/
ads
/
v1
/
video_ads
cURL
curl --request POST \
  --url https://api.mottostreaming.com/monetization/ads/v1/video_ads \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "project_id": "<string>",
  "name": "<string>",
  "ad_manifest": {
    "title": "<string>",
    "video_files": [
      {
        "config": {
          "asset_id": "<string>"
        }
      }
    ],
    "aspect_ratio": "<string>",
    "duration_seconds": 123,
    "allow_skip_after_seconds": 123,
    "clickthrough_url": "<string>",
    "impression_tracking_url": "<string>",
    "error_tracking_url": "<string>"
  },
  "ad_tag_url": "<string>",
  "geo_applicability_exempt": {
    "country_codes": [
      "<string>"
    ]
  },
  "geo_applicability_apply": {
    "country_codes": [
      "<string>"
    ]
  },
  "applies_to_all": true,
  "target": {
    "entity_ids": [
      "<string>"
    ],
    "event_ids": [
      "<string>"
    ],
    "creative_work_ids": [
      "<string>"
    ],
    "content_start_time": "2023-11-07T05:31:56Z",
    "content_end_time": "2023-11-07T05:31:56Z",
    "video_ids": [
      "<string>"
    ]
  },
  "filter": {
    "filter_events": "<string>",
    "filter_creative_works": "<string>"
  },
  "priority": "<string>"
}
'
import requests

url = "https://api.mottostreaming.com/monetization/ads/v1/video_ads"

payload = {
"project_id": "<string>",
"name": "<string>",
"ad_manifest": {
"title": "<string>",
"video_files": [{ "config": { "asset_id": "<string>" } }],
"aspect_ratio": "<string>",
"duration_seconds": 123,
"allow_skip_after_seconds": 123,
"clickthrough_url": "<string>",
"impression_tracking_url": "<string>",
"error_tracking_url": "<string>"
},
"ad_tag_url": "<string>",
"geo_applicability_exempt": { "country_codes": ["<string>"] },
"geo_applicability_apply": { "country_codes": ["<string>"] },
"applies_to_all": True,
"target": {
"entity_ids": ["<string>"],
"event_ids": ["<string>"],
"creative_work_ids": ["<string>"],
"content_start_time": "2023-11-07T05:31:56Z",
"content_end_time": "2023-11-07T05:31:56Z",
"video_ids": ["<string>"]
},
"filter": {
"filter_events": "<string>",
"filter_creative_works": "<string>"
},
"priority": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
project_id: '<string>',
name: '<string>',
ad_manifest: {
title: '<string>',
video_files: [{config: {asset_id: '<string>'}}],
aspect_ratio: '<string>',
duration_seconds: 123,
allow_skip_after_seconds: 123,
clickthrough_url: '<string>',
impression_tracking_url: '<string>',
error_tracking_url: '<string>'
},
ad_tag_url: '<string>',
geo_applicability_exempt: {country_codes: ['<string>']},
geo_applicability_apply: {country_codes: ['<string>']},
applies_to_all: true,
target: {
entity_ids: ['<string>'],
event_ids: ['<string>'],
creative_work_ids: ['<string>'],
content_start_time: '2023-11-07T05:31:56Z',
content_end_time: '2023-11-07T05:31:56Z',
video_ids: ['<string>']
},
filter: {filter_events: '<string>', filter_creative_works: '<string>'},
priority: '<string>'
})
};

fetch('https://api.mottostreaming.com/monetization/ads/v1/video_ads', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://api.mottostreaming.com/monetization/ads/v1/video_ads",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'project_id' => '<string>',
'name' => '<string>',
'ad_manifest' => [
'title' => '<string>',
'video_files' => [
[
'config' => [
'asset_id' => '<string>'
]
]
],
'aspect_ratio' => '<string>',
'duration_seconds' => 123,
'allow_skip_after_seconds' => 123,
'clickthrough_url' => '<string>',
'impression_tracking_url' => '<string>',
'error_tracking_url' => '<string>'
],
'ad_tag_url' => '<string>',
'geo_applicability_exempt' => [
'country_codes' => [
'<string>'
]
],
'geo_applicability_apply' => [
'country_codes' => [
'<string>'
]
],
'applies_to_all' => true,
'target' => [
'entity_ids' => [
'<string>'
],
'event_ids' => [
'<string>'
],
'creative_work_ids' => [
'<string>'
],
'content_start_time' => '2023-11-07T05:31:56Z',
'content_end_time' => '2023-11-07T05:31:56Z',
'video_ids' => [
'<string>'
]
],
'filter' => [
'filter_events' => '<string>',
'filter_creative_works' => '<string>'
],
'priority' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"strings"
"net/http"
"io"
)

func main() {

url := "https://api.mottostreaming.com/monetization/ads/v1/video_ads"

payload := strings.NewReader("{\n \"project_id\": \"<string>\",\n \"name\": \"<string>\",\n \"ad_manifest\": {\n \"title\": \"<string>\",\n \"video_files\": [\n {\n \"config\": {\n \"asset_id\": \"<string>\"\n }\n }\n ],\n \"aspect_ratio\": \"<string>\",\n \"duration_seconds\": 123,\n \"allow_skip_after_seconds\": 123,\n \"clickthrough_url\": \"<string>\",\n \"impression_tracking_url\": \"<string>\",\n \"error_tracking_url\": \"<string>\"\n },\n \"ad_tag_url\": \"<string>\",\n \"geo_applicability_exempt\": {\n \"country_codes\": [\n \"<string>\"\n ]\n },\n \"geo_applicability_apply\": {\n \"country_codes\": [\n \"<string>\"\n ]\n },\n \"applies_to_all\": true,\n \"target\": {\n \"entity_ids\": [\n \"<string>\"\n ],\n \"event_ids\": [\n \"<string>\"\n ],\n \"creative_work_ids\": [\n \"<string>\"\n ],\n \"content_start_time\": \"2023-11-07T05:31:56Z\",\n \"content_end_time\": \"2023-11-07T05:31:56Z\",\n \"video_ids\": [\n \"<string>\"\n ]\n },\n \"filter\": {\n \"filter_events\": \"<string>\",\n \"filter_creative_works\": \"<string>\"\n },\n \"priority\": \"<string>\"\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://api.mottostreaming.com/monetization/ads/v1/video_ads")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"project_id\": \"<string>\",\n \"name\": \"<string>\",\n \"ad_manifest\": {\n \"title\": \"<string>\",\n \"video_files\": [\n {\n \"config\": {\n \"asset_id\": \"<string>\"\n }\n }\n ],\n \"aspect_ratio\": \"<string>\",\n \"duration_seconds\": 123,\n \"allow_skip_after_seconds\": 123,\n \"clickthrough_url\": \"<string>\",\n \"impression_tracking_url\": \"<string>\",\n \"error_tracking_url\": \"<string>\"\n },\n \"ad_tag_url\": \"<string>\",\n \"geo_applicability_exempt\": {\n \"country_codes\": [\n \"<string>\"\n ]\n },\n \"geo_applicability_apply\": {\n \"country_codes\": [\n \"<string>\"\n ]\n },\n \"applies_to_all\": true,\n \"target\": {\n \"entity_ids\": [\n \"<string>\"\n ],\n \"event_ids\": [\n \"<string>\"\n ],\n \"creative_work_ids\": [\n \"<string>\"\n ],\n \"content_start_time\": \"2023-11-07T05:31:56Z\",\n \"content_end_time\": \"2023-11-07T05:31:56Z\",\n \"video_ids\": [\n \"<string>\"\n ]\n },\n \"filter\": {\n \"filter_events\": \"<string>\",\n \"filter_creative_works\": \"<string>\"\n },\n \"priority\": \"<string>\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.mottostreaming.com/monetization/ads/v1/video_ads")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"project_id\": \"<string>\",\n \"name\": \"<string>\",\n \"ad_manifest\": {\n \"title\": \"<string>\",\n \"video_files\": [\n {\n \"config\": {\n \"asset_id\": \"<string>\"\n }\n }\n ],\n \"aspect_ratio\": \"<string>\",\n \"duration_seconds\": 123,\n \"allow_skip_after_seconds\": 123,\n \"clickthrough_url\": \"<string>\",\n \"impression_tracking_url\": \"<string>\",\n \"error_tracking_url\": \"<string>\"\n },\n \"ad_tag_url\": \"<string>\",\n \"geo_applicability_exempt\": {\n \"country_codes\": [\n \"<string>\"\n ]\n },\n \"geo_applicability_apply\": {\n \"country_codes\": [\n \"<string>\"\n ]\n },\n \"applies_to_all\": true,\n \"target\": {\n \"entity_ids\": [\n \"<string>\"\n ],\n \"event_ids\": [\n \"<string>\"\n ],\n \"creative_work_ids\": [\n \"<string>\"\n ],\n \"content_start_time\": \"2023-11-07T05:31:56Z\",\n \"content_end_time\": \"2023-11-07T05:31:56Z\",\n \"video_ids\": [\n \"<string>\"\n ]\n },\n \"filter\": {\n \"filter_events\": \"<string>\",\n \"filter_creative_works\": \"<string>\"\n },\n \"priority\": \"<string>\"\n}"

response = http.request(request)
puts response.read_body
{
  "video_ad": {
    "project_id": "<string>",
    "name": "<string>",
    "id": "<string>",
    "ad_manifest": {
      "title": "<string>",
      "video_files": [
        {
          "config": {
            "asset_id": "<string>"
          }
        }
      ],
      "aspect_ratio": "<string>",
      "duration_seconds": 123,
      "allow_skip_after_seconds": 123,
      "clickthrough_url": "<string>",
      "impression_tracking_url": "<string>",
      "error_tracking_url": "<string>"
    },
    "ad_tag_url": "<string>",
    "geo_applicability_exempt": {
      "country_codes": [
        "<string>"
      ]
    },
    "geo_applicability_apply": {
      "country_codes": [
        "<string>"
      ]
    },
    "applies_to_all": true,
    "target": {
      "entity_ids": [
        "<string>"
      ],
      "event_ids": [
        "<string>"
      ],
      "creative_work_ids": [
        "<string>"
      ],
      "content_start_time": "2023-11-07T05:31:56Z",
      "content_end_time": "2023-11-07T05:31:56Z",
      "video_ids": [
        "<string>"
      ]
    },
    "filter": {
      "filter_events": "<string>",
      "filter_creative_works": "<string>"
    },
    "priority": "<string>"
  }
}
{
"code": 123,
"message": "<string>",
"details": [
{
"@type": "<string>"
}
]
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json
project_id
string
required

The ID of the project that the ad belongs to.

name
string
required

Name of the video ad

ad_manifest
object

The necessary parameters to generate a manifest (for a VAST or VMAP) to be used for this video ad.

Important: at most one of ad_manifest, ad_tag_url may be set per request.

ad_tag_url
string

A third-party hosted ad tag URL to be used for this video ad. This is typically a VAST or VMAP tag in Google Ad Manager or similar.

Important: at most one of ad_manifest, ad_tag_url may be set per request.

visibility
enum<string>

Visibility settings for the video ad. When not set to published, the ad will not be shown to end users.

Available options:
VISIBILITY_UNSPECIFIED,
VISIBILITY_PUBLISHED,
VISIBILITY_UNLISTED,
VISIBILITY_HIDDEN
geo_applicability_exempt
object

Viewers from these countries will not have this video ad shown.

Important: at most one of geo_applicability_exempt, geo_applicability_apply may be set per request.

geo_applicability_apply
object

Viewers from these countries will have this video ad shown.

Important: at most one of geo_applicability_exempt, geo_applicability_apply may be set per request.

applies_to_all
boolean

This video ad applies to all videos in the project.

Important: at most one of applies_to_all, target, filter may be set per request.

target
object

This video ad applies to a specific set of videos, as defined by the target.

Important: at most one of applies_to_all, target, filter may be set per request.

filter
object

This video ad applies to a complex set of events and creative works, as defined by the filter target.

Important: at most one of applies_to_all, target, filter may be set per request.

priority
string

The priority of the ad. If multiple ads apply to a video, the ad with the highest priority will be used.

Response

OK

video_ad
object