Graph API Version

Ad Videos

Reading

You can't perform this operation on this endpoint.

Creating

You can make a POST request to advideos edge from the following paths:
When posting to this edge, a Video will be created.

Example

curl -X POST \ -F 'source="@<VIDEO_PATH>"' \ -F 'access_token=<ACCESS_TOKEN>' \ https://graph.facebook.com/v20.0/act_<AD_ACCOUNT_ID>/advideos
'use strict'; const bizSdk = require('facebook-nodejs-business-sdk'); const AdAccount = bizSdk.AdAccount; const AdVideo = bizSdk.AdVideo; const access_token = '<ACCESS_TOKEN>'; const app_secret = '<APP_SECRET>'; const app_id = '<APP_ID>'; const id = '<AD_ACCOUNT_ID>'; const api = bizSdk.FacebookAdsApi.init(access_token); const showDebugingInfo = true; // Setting this to true shows more debugging info. if (showDebugingInfo) { api.setDebug(true); } const logApiCallResult = (apiCallName, data) => { console.log(apiCallName); if (showDebugingInfo) { console.log('Data:' + JSON.stringify(data)); } }; let fields, params; fields = [ ]; params = { 'source' : '<videoPath>', }; const advideos = (new AdAccount(id)).createAdVideo( fields, params ); logApiCallResult('advideos api call complete.', advideos);
require __DIR__ . '/vendor/autoload.php'; use FacebookAds\Object\AdAccount; use FacebookAds\Object\AdVideo; use FacebookAds\Api; use FacebookAds\Logger\CurlLogger; $access_token = '<ACCESS_TOKEN>'; $app_secret = '<APP_SECRET>'; $app_id = '<APP_ID>'; $id = '<AD_ACCOUNT_ID>'; $api = Api::init($app_id, $app_secret, $access_token); $api->setLogger(new CurlLogger()); $fields = array( ); $params = array( 'source' => '<videoPath>', ); echo json_encode((new AdAccount($id))->createAdVideo( $fields, $params )->exportAllData(), JSON_PRETTY_PRINT);
from facebook_business.adobjects.adaccount import AdAccount from facebook_business.adobjects.advideo import AdVideo from facebook_business.api import FacebookAdsApi access_token = '<ACCESS_TOKEN>' app_secret = '<APP_SECRET>' app_id = '<APP_ID>' id = '<AD_ACCOUNT_ID>' FacebookAdsApi.init(access_token=access_token) fields = [ ] params = { 'source': '<videoPath>', } print AdAccount(id).create_ad_video( fields=fields, params=params, )
import com.facebook.ads.sdk.*; import java.io.File; import java.util.Arrays; public class SAMPLE_CODE_EXAMPLE { public static void main (String args[]) throws APIException { String access_token = \"<ACCESS_TOKEN>\"; String app_secret = \"<APP_SECRET>\"; String app_id = \"<APP_ID>\"; String id = \"<AD_ACCOUNT_ID>\"; APIContext context = new APIContext(access_token).enableDebug(true); new AdAccount(id, context).createAdVideo() .setSource(\"<videoPath>\") .execute(); } }
require 'facebook_ads' access_token = '<ACCESS_TOKEN>' app_secret = '<APP_SECRET>' app_id = '<APP_ID>' id = '<AD_ACCOUNT_ID>' FacebookAds.configure do |config| config.access_token = access_token config.app_secret = app_secret end ad_account = FacebookAds::AdAccount.get(id) advideos = ad_account.advideos.create({ source: '<videoPath>', })

Parameters

ParameterDescription
audio_story_wave_animation_handle
string

Everstore handle of wave animation used to burn audio story video

composer_session_id
string

SELF_EXPLANATORY

description
UTF-8 string

SELF_EXPLANATORY

Supports Emoji
end_offset
int64

end_offset

file_size
int64

The size of the video file in bytes. Using during chunked upload.

file_url
string

SELF_EXPLANATORY

fisheye_video_cropped
boolean

Whether the single fisheye video is cropped or not

front_z_rotation
float

The front z rotation in degrees on the single fisheye video

name
string

The name of the video in the library.

og_action_type_id
numeric string or integer

SELF_EXPLANATORY

og_icon_id
numeric string or integer

SELF_EXPLANATORY

og_object_id
OG object ID or URL string

SELF_EXPLANATORY

og_phrase
string

SELF_EXPLANATORY

og_suggestion_mechanism
string

SELF_EXPLANATORY

original_fov
int64

Original field of view of the source camera

original_projection_type
enum {equirectangular, cubemap, half_equirectangular}

Original Projection type of the video being uploaded

prompt_id
string

SELF_EXPLANATORY

prompt_tracking_string
string

SELF_EXPLANATORY

referenced_sticker_id
numeric string or integer

SELF_EXPLANATORY

slideshow_spec
JSON object

An object required for slideshow video.

images_urls
list<URL>

A 3-7 element array of the URLs of the images. Required.

Required
duration_ms
integer

The duration in milliseconds of each image. Default value is 1000.

transition_ms
integer

The duration in milliseconds of the crossfade transition between images. Default value is 1000.

reordering_opt_in
boolean
Default value: false

music_variations_opt_in
boolean
Default value: false

source
string

The video, encoded as form data. See the Video Format doc for more details on video formats.

start_offset
int64

The start position in byte of the chunk that is being sent, inclusive. Used during chunked upload.

time_since_original_post
int64

SELF_EXPLANATORY

title
UTF-8 string

The name of the video being uploaded. Must be less than 255 characters. Special characters may count as more than 1 character.

Supports Emoji
transcode_setting_properties
string

Properties used in computing transcode settings for the video

unpublished_content_type
enum {SCHEDULED, SCHEDULED_RECURRING, DRAFT, ADS_POST, INLINE_CREATED, PUBLISHED, REVIEWABLE_BRANDED_CONTENT}

SELF_EXPLANATORY

upload_phase
enum {start, transfer, finish, cancel}

The phase during chunked upload. Using during chunked upload.

upload_session_id
numeric string or integer

The session ID of this chunked upload. Using during chunked upload.

video_file_chunk
string

The chunk of the video, between start_offset and end_offset. Using during chunked upload.

Return Type

Struct {
id: numeric string,
upload_session_id: numeric string,
video_id: numeric string,
start_offset: numeric string,
end_offset: numeric string,
success: bool,
skip_upload: bool,
upload_domain: string,
region_hint: string,
xpv_asset_id: numeric string,
is_xpv_single_prod: bool,
transcode_bit_rate_bps: numeric string,
transcode_dimension: numeric string,
should_expand_to_transcode_dimension: bool,
action_id: string,
gop_size_seconds: numeric string,
target_video_codec: string,
target_hdr: string,
maximum_frame_rate: numeric string,
}

Error Codes

ErrorDescription
100Invalid parameter
389Unable to fetch video file from URL.
368The action attempted has been deemed abusive or is otherwise disallowed
200Permissions error
222Video not visible
382The video file you tried to upload is too small. Please try again with a larger file.
351There was a problem with your video file. Please try again with another file,
190Invalid OAuth 2.0 Access Token
390There was a problem uploading your video file. Please try again.
6001There was a problem uploading your video. Please try again.

Updating

You can't perform this operation on this endpoint.

Deleting

You can dissociate a Video from an AdAccount by making a DELETE request to /act_{ad_account_id}/advideos.

Parameters

ParameterDescription
video_id
video ID

Ad account library video ID

Required

Return Type

Struct {
success: bool,
}

Error Codes

ErrorDescription
613Calls to this api have exceeded the rate limit.
100Invalid parameter