Graph API Version

User Videos

Videos for a Facebook User.

You can't delete or update videos using this edge. However you can do this at the /{video-id} node. See Graph API Reference, Video.

Reading

Videos the person is tagged in or uploaded

By default reading the /{user-id}/videos edge returns a list of videos that the person is tagged in. You can get the list of videos uploaded by this person by adding a type=uploaded parameter to the query or using the /{user-id}/videos/uploaded path, which implictly adds the type parameter.

Although it is the default behavior, you can also make explicit calls to get the videos a person is tagged in with the /{user-id}/videos/tagged endpoint or by adding a type=tagged parameter.

Graph API Explorer
GET /v2.9/{user-id}/videos HTTP/1.1
Host: graph.facebook.com
/* PHP SDK v5.0.0 */
/* make the API call */
$request = new FacebookRequest(
  $session,
  'GET',
  '/{user-id}/videos'
);
$response = $request->execute();
$graphObject = $response->getGraphObject();
/* handle the result */
/* make the API call */
FB.api(
    "/{user-id}/videos",
    function (response) {
      if (response && !response.error) {
        /* handle the result */
      }
    }
);
/* make the API call */
new GraphRequest(
    AccessToken.getCurrentAccessToken(),
    "/{user-id}/videos",
    null,
    HttpMethod.GET,
    new GraphRequest.Callback() {
        public void onCompleted(GraphResponse response) {
            /* handle the result */
        }
    }
).executeAsync();
// For more complex open graph stories, use `FBSDKShareAPI`
// with `FBSDKShareOpenGraphContent`
/* make the API call */
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
                               initWithGraphPath:@"/{user-id}/videos"
                                      parameters:params
                                      HTTPMethod:@"GET"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection,
                                      id result,
                                      NSError *error) {
    // Handle the result
}];

Permissions

Developers usually request these permissions for this endpoint:

Marketing Apps
No data
Page management Apps
No data
Other Apps
  • user_photos
  • user_videos
  • user_posts

Parameters

NameDescription
type
enum{tagged, uploaded}
Default value: tagged

Allows you to query which type of videos to return

Fields

Reading from this edge will return a JSON formatted result:

{ "data": [], "paging": {} }

data

A list of Video nodes.

paging

For more details about pagination, see the Graph API guide.

Validation Rules

ErrorDescription
100Invalid parameter
200Permissions error

Creating

Resumable Upload

In Graph API 2.3+ you can perform resumable upload of video chunks at the (user-id||event-id||page-id)/videos/ edges.

For information, see the tutorial at Video Upload with Graph API.

Supported Formats

Videos must be encoded as multipart/form-data and published to graph-video.facebook.com instead of the regular Graph API URL.

POST /v2.9/{page-id}/videos HTTP/1.1
Host: graph-video.facebook.com

source=vid.mov
/* PHP SDK v5.0.0 */
/* make the API call */
$request = new FacebookRequest(
  $session,
  'POST',
  '/{page-id}/videos',
  array (
    'source' => 'vid.mov',
  )
);
$response = $request->execute();
$graphObject = $response->getGraphObject();
/* handle the result */
/* make the API call */
FB.api(
    "/{page-id}/videos",
    "POST",
    {
        "source": "vid.mov"
    },
    function (response) {
      if (response && !response.error) {
        /* handle the result */
      }
    }
);
Bundle params = new Bundle();
params.putString("source", "vid.mov");
/* make the API call */
new GraphRequest(
    AccessToken.getCurrentAccessToken(),
    "/{page-id}/videos",
    params,
    HttpMethod.POST,
    new GraphRequest.Callback() {
        public void onCompleted(GraphResponse response) {
            /* handle the result */
        }
    }
).executeAsync();
FBSDKShareVideoContent *content = [[FBSDKShareVideoContent alloc] init];
// assetURL should refer to the video in the Asset Library.
// If you have raw video data, construct a FBSDKGraphRequest manually.
content.video = [FBSDKShareVideo videoWithVideoURL:assetURL];
[FBSDKShareAPI shareWithContent:content delegate:self];

We support the following formats for uploaded videos:

3g2, 3gp, 3gpp, asf, avi, dat, divx, dv, f4v, flv, m2ts, m4v, mkv, mod, mov, mp4, mpe, mpeg, mpeg4, mpg, mts, nsv, ogm, ogv, qt, tod, ts, vob, wmv.

The aspect ratio of the video must be between 9x16 and 16x9.

Permissions

To publish a video to a user profile, you need publish_actions permission. You can get this from Graph API Explorer.

Limitations

If you upload a video with a multi-part HTTP request or by providing a URL to a video, the video cannot exceed 1GB in size and 20 minutes in duration.

Resumable video upload supports uploading videos that are up to 1.75GB and 45 minutes long.

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

Parameters

NameDescription
content_category
enum {BEAUTY_FASHION, BUSINESS, CARS_TRUCKS, COMEDY, CUTE_ANIMALS, ENTERTAINMENT, FAMILY, FOOD_HEALTH, HOME, LIFESTYLE, MUSIC, NEWS, POLITICS, SCIENCE, SPORTS, TECHNOLOGY, VIDEO_GAMING, OTHER}

Content category of this video.

description
UTF-8 string

The description of the video, used as the accompanying status message in any feed story. This parameter can contain mentions of other Facebook Pages using the following syntax:

@[page-id]

For example the following description would mention the Facebook Developers page inline:

Test message @[19292868552] tag

Usage of this feature is subject to review but by using Pages you are an admin of (both to make the API call, and to be used in a mention), and an app you are a developer of, you can test it for yourself before review.

Supports Emoji
direct_share_status
int64

The status to allow sponsor directly boost the post.

embeddable
boolean

Whether the video is embeddable.

file_size
int64

The size of the entire video file in bytes.

file_url
string

Accessible URL of a video file. Cannot be used with upload_phase.

fov
int64

360 video only: Vertical field of view

guide
list<list<int64>>

360 video only: Guide keyframes data. An array of keyframes, each of which is an array of 3 or 4 elements in the following order: [video timestamp (seconds), pitch (degrees, -90 ~ 90), yaw (degrees, -180 ~ 180), field of view (degrees, 40 ~ 90, optional)], ordered by video timestamp in strictly ascending order.

guide_enabled
boolean

360 video only: Whether Guide is active.

initial_heading
int64

360 video only: Horizontal camera perspective to display when the video begins.

initial_pitch
int64

360 video only: Vertical camera perspective to display when the video begins.

no_story
boolean
Default value: false

If set to true, this will suppress feed and timeline story.

original_fov
int64

Original field of view of the source camera

original_projection_type
enum {equirectangular, cubemap}

360 video only: The original projection type of the 360 video being uploaded.

privacy
Privacy Parameter

Determines the privacy settings of the video. If not supplied, this defaults to the privacy level granted to the app in the Login Dialog. This field cannot be used to set a more open privacy setting than the one granted.

referenced_sticker_id
numeric string or integer

Sticker id of the sticker in the post

replace_video_id
numeric string or integer

The video id your uploaded video about to replace

slideshow_spec
JSON object

Specification of a list of images that are used to generate 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.

source
string

The video, encoded as form data. This field is required.

spherical
boolean
Default value: false

Set if the video was recorded in 360 format.

sponsor_id
numeric string or integer

Facebook Page id that is tagged as sponsor in the video post

start_offset
int64

Start byte position of the file chunk.

swap_mode
enum {replace}

Type of replacing video request

thumb
image

The video thumbnail raw data to be uploaded and associated with a video.

title
UTF-8 string

The title of the video.

Supports Emoji
unpublished_content_type
enum {SCHEDULED, DRAFT, ADS_POST}

Type of unpublished content, such as scheduled, draft or ads_post.

upload_phase
enum {start, transfer, finish, cancel}

Type of chunked upload request.

upload_session_id
numeric string or integer

ID of the chunked upload session.

video_file_chunk
string

The video file chunk, encoded as form data. This field is required during transfer upload phase.

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,
transcode_bit_rate_bps: numeric string,
transcode_dimension: numeric string,
}

Validation Rules

ErrorDescription
6001There was a problem uploading your video. Please try again.
100Invalid parameter
356There was a problem uploading your video file. Please try again.
6000There was a problem uploading your video file. Please try again with another file.
200Permissions error
352Sorry, the video file you selected is in a format that we don't support.
390There was a problem uploading your video file. Please try again.
389Unable to fetch video file from URL.
368The action attempted has been deemed abusive or is otherwise disallowed

Updating

You can't perform this operation on this endpoint.

Deleting

You can't perform this operation on this endpoint.