This document shows you how to integrate sharing into your iOS app so that users can share video content to Reels on Instagram.
The Reels composer has a background video layer and an optional sticker layer.
You will need:
By accessing and using this functionality, you acknowledge and agree to be bound by the Meta Platform Terms and Developer Policies . You also represent and warrant that any content made available through your application or website, or shared to Instagram Reels from your application or website, does not infringe upon the intellectual property rights of any third party and that you own, control or have otherwise secured all rights necessary to distribute, copy, publicly perform and display, or otherwise use the content via this functionality, including as uploaded and shared on Instagram Reels. You further represent and warrant that you have the authority to make the foregoing representations on behalf of your organization. If you do not have such authority or are otherwise unable to make the foregoing representations, you are not authorized to continue and should not do so.
Before you can implement sharing in your app, add your app ID and register Instagram's custom URL scheme in the Info.plist
file for your app. Add instagram-reels
to the LSApplicationQueriesSchemes
key.
You use a custom URL scheme to launch the Instagram app and send it content for Reels. The Instagram app receives the content, loads it in the Reels composer, and the user can edit and publish the content to their Instagram Reels.
In general, your sharing flow does the following:
Remove any temporary files that you create on the user's device.
You send the following data when you share to Reels.
Data | Type | Description | Required |
---|---|---|---|
Meta App ID |
NSString * |
Your Meta App ID |
Yes |
Background Video |
NSURL * |
The URL for a video. Videos can be 1080p and should be between 3 and 60 seconds in duration. Acceptable video formats are H.264, H.265, and WebM. Under 50 MB is recommended. |
Yes |
Sticker Asset |
NSURL * |
The URL for an image that is a local file on the user's device. Acceptable image formats are JPG and PNG, and the recommended dimensions are 640 x 480. The image appears over the video. |
No |
The following code example sends a video to Instagram so the user can edit and publish it to their Instagram Reels.
func shareBackgroundVideo() {
// Identify your App ID
let appIDString = "1234567890"
// Identify your video content
guard let backgroundVideoURL = URL(string: "your-video-url-goes-here") else { return }
guard let backgroundVideoData = try? Data.init(contentsOf: backgroundVideoURL) as Data else { return }
// Call method to share video
backgroundVideo(backgroundVideoData: backgroundVideoData, appID: appIDString)
}
// Method to share video
func backgroundVideo(backgroundVideoData: Data, appID: String) {
if let urlScheme = URL(string: "instagram-reels://share"), UIApplication.shared.canOpenURL(urlScheme) {
// Add background video and appID to pasteboard items
let pasteboardItems: [[String: Any]] = [
["com.instagram.sharedSticker.backgroundVideo": backgroundVideoData],
["com.instagram.sharedSticker.appID": appID]
]
// Set pasteboard options
let pasteboardOptions = [UIPasteboard.OptionsKey.expirationDate: Date().addingTimeInterval(60 * 5)]
// Attach the pasteboard items
UIPasteboard.general.setItems(pasteboardItems, options: pasteboardOptions)
UIApplication.shared.open(urlScheme)
} else {
// Handle error cases
}
}
- (void)shareBackgroundVideo
{
// Identify your App ID
NSString *const appIDString = @"1234567890";
// Identify your video content
NSURL *const backgroundVideoURL = [[NSBundle bundleForClass:[self class]]URLForResource:@"your-video-url-goes-here" withExtension:@"mp4"];
NSData *const backgroundVideoData = [NSData dataWithContentsOfURL:backgroundVideoURL];
// Call method to share video
[self backgroundVideo: backgroundVideoData
appID: appIDString];
}
// Method to share video
- (void)backgroundVideo:(NSData *)backgroundVideo
appID:(NSString *)appID
{
NSURL *urlScheme = [NSURL URLWithString:@"instagram-reels://share"];
if ([[UIApplication sharedApplication] canOpenURL:urlScheme])
{
// Add background video and appID to pasteboard items
NSArray *pasteboardItems = @[@{@"com.instagram.sharedSticker.backgroundVideo" : backgroundVideo,
@"com.instagram.sharedSticker.appID" : appID}];
// Set pasteboard options
NSDictionary *pasteboardOptions = @{UIPasteboardOptionExpirationDate : [[NSDate date] dateByAddingTimeInterval:60 * 5]};
// Attach the pasteboard items
// This call is iOS 10+, can use 'setItems' depending on what versions you support
[[UIPasteboard generalPasteboard] setItems:pasteboardItems options:pasteboardOptions];
[[UIApplication sharedApplication] openURL:urlScheme options:@{} completionHandler:nil];
}
else
{
// Handle error cases
}
}
The following code example sends a video to Instagram so the user can edit and publish it to their Instagram Reels, and includes an optional sticker.
func shareBackgroundVideoWithSticker() {
// Identify your App ID
let appIDString = "1234567890"
// Identify your video content
guard let backgroundVideoURL = URL(string: "your-video-url-goes-here") else { return }
guard let backgroundVideoData = try? Data.init(contentsOf: backgroundVideoURL) as Data else { return }
// Identify your sticker content
guard let stickerImage = URL(string: "your-sticker-url-goes-here") else { return }
guard let stickerImageData = try? Data.init(contentsOf: stickerImage) as Data else { return }
// Call method to share video
backgroundVideoWithSticker(backgroundVideoData: backgroundVideoData, stickerImageData: stickerImageData, appID: appIDString)
}
// Method to share video with sticker
func backgroundVideoWithSticker(backgroundVideoData: Data, stickerImageData: Data, appID: String) {
if let urlScheme = URL(string: "instagram-reels://share"), UIApplication.shared.canOpenURL(urlScheme) {
// Add background video, sticker, and appID to pasteboard items
let pasteboardItems: [[String: Any]] = [
["com.instagram.sharedSticker.backgroundVideo": backgroundVideoData],
["com.instagram.sharedSticker.stickerImage": stickerImageData],
["com.instagram.sharedSticker.appID": appID]
]
// Set pasteboard options
let pasteboardOptions = [UIPasteboard.OptionsKey.expirationDate: Date().addingTimeInterval(60 * 5)]
// Attach the pasteboard items
UIPasteboard.general.setItems(pasteboardItems, options: pasteboardOptions)
UIApplication.shared.open(urlScheme)
} else {
// Handle error cases
}
}
- (void)shareBackgroundVideoWithSticker
{
// Identify your App ID
NSString *const appIDString = @"1234567890";
// Identify your video content
NSURL *const backgroundVideoURL = [[NSBundle bundleForClass:[self class]]URLForResource:@"your-video-url-goes-here" withExtension:@"mp4"];
NSData *const backgroundVideoData = [NSData dataWithContentsOfURL:backgroundVideoURL];
// Identify your sticker content
NSURL *const stickerImageURL = [[NSBundle bundleForClass:[self class]]URLForResource:@"your-sticker-url-goes-here" withExtension:@"png"];
NSData *const stickerImageData = [NSData dataWithContentsOfURL:stickerImageURL];
// Call method to share video
[self backgroundVideoWithSticker: backgroundVideoData
stickerImage: stickerImageData
appID: appIDString];
}
// Method to share video with sticker
- (void)backgroundVideoWithSticker:(NSData *)backgroundVideo
stickerImage:(NSData *)stickerImage
appID:(NSString *)appID
{
NSURL *urlScheme = [NSURL URLWithString:@"instagram-reels://share"];
if ([[UIApplication sharedApplication] canOpenURL:urlScheme])
{
// Add background video, sticker, and appID to pasteboard items
NSArray *pasteboardItems = @[@{@"com.instagram.sharedSticker.backgroundVideo" : backgroundVideo,
@"com.instagram.sharedSticker.stickerImage" : stickerImage,
@"com.instagram.sharedSticker.appID" : appID}];
// Set pasteboard options
NSDictionary *pasteboardOptions = @{UIPasteboardOptionExpirationDate : [[NSDate date] dateByAddingTimeInterval:60 * 5]};
// Attach the pasteboard items
// This call is iOS 10+, can use 'setItems' depending on what versions you support
[[UIPasteboard generalPasteboard] setItems:pasteboardItems options:pasteboardOptions];
[[UIApplication sharedApplication] openURL:urlScheme options:@{} completionHandler:nil];
}
else
{
// Handle error cases
}
}
To make it more convenient for developers, Meta has published sample code for Instagram Share to Reels on GitHub at fbsamples/share_to_reels_ios. Watch the following video to learn how to use the GitHub Sample.