This document shows you how to integrate sharing into your iOS app so that users can share video content to Reels on Instagram.
Reels LayersThe Reels composer has a background video layer and an optional sticker layer.
Sharing Icon
|
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
}
}
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
}
}
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.