POST /<YOUR_APP_USERS_INSTAGRAM_USER_ID>/media
Steps to publish a media object include the following:
Type | Description |
---|---|
If creating containers for product tagging, the app user must have an admin role on the Business Manager that owns the IG User's Instagram Shop. | |
If the app user was granted a role on the Page via the Business Manager, you will also need one of:
If creating containers for product tagging, you will also need: | |
Your app user must be able to perform the |
The following are the specifications for Reels:
The following are the specifications for a Reels cover photo:
POST https://graph.facebook.com/v21.0
/<YOUR_APP_USERS_INSTAGRAM_USER_ID>/media
?image_url=<IMAGE_URL>
&is_carousel_item=<TRUE_OR_FALSE>
&caption=<IMAGE_CAPTION>
&location_id=<LOCATION_PAGE_ID>
&user_tags=<ARRAY_OF_USERS_FOR_TAGGING>>
&product_tags=<ARRAY_OF_PRODUCTS_FOR_TAGGING>
&access_token=<USER_ACCESS_TOKEN>
POST https://graph.facebook.com/v21.0
/<YOUR_APP_USERS_INSTAGRAM_USER_ID>/media
?media_type=REELS
&video_url=<REEL_URL>
&caption=<IMAGE_CAPTION>
&share_to_feed=<TRUE_OR_FALSE>
&collaborators=<COLLABORATOR_USERNAMES>
&cover_url=<COVER_URL>
&audio_name=<AUDIO_NAME>
&user_tags=<ARRAY_OF_USERS_FOR_TAGGING>>
&location_id=<LOCATION_PAGE_ID>
&thumb_offset=<THUMB_OFFSET>
&share_to_feed=<TRUE_OR_FALSE>
&access_token=<USER_ACCESS_TOKEN>
POST https://graph.facebook.com/v21.0
/<YOUR_APP_USERS_INSTAGRAM_USER_ID>/media
?media_type=REELS
&upload_type=resumable
&caption=<IMAGE_CAPTION>
&collaborators=<COLLABORATOR_USERNAMES>
&cover_url=<COVER_URL>
&audio_name=<AUDIO_NAME>
&user_tags=<ARRAY_OF_USERS_FOR_TAGGING>>
&location_id=<LOCATION_PAGE_ID>
&thumb_offset=<THUMB_OFFSET>
&access_token=<USER_ACCESS_TOKEN>
On success, an ig-container-id
and a uri
is returned in the response, which will be used in subsequent steps, such as:
{
"id": "<IG_CONTAINER_ID>",
"uri": "https://rupload.facebook.com/ig-api-upload/v21.0
/<IG_CONTAINER_ID>"
}
Carousel containers only. To create carousel item containers, create image or video containers instead (reels are not supported). See Carousel Posts for complete publishing steps.
POST https://graph.facebook.com/v21.0
/<YOUR_APP_USERS_INSTAGRAM_USER_ID>/media
?media_type=CAROUSEL
&caption=<IMAGE_CAPTION>
&share_to_feed=<TRUE_OR_FALSE>
&collaborators=<COLLABORATOR_USERNAMES>
&location_id=<LOCATION_PAGE_ID>
&product_tags=<ARRAY_OF_PRODUCTS_FOR_TAGGING>
&children=<ARRAY_OF_CAROUSEL_CONTAINTER_IDS>
&access_token=<USER_ACCESS_TOKEN>
POST https://graph.facebook.com/v21.0
/<YOUR_APP_USERS_INSTAGRAM_USER_ID>/media
?media_type=VIDEO
&is_carousel_item=true
&upload_type=resumable
&access_token=<USER_ACCESS_TOKEN>
On success, an ig-container-id
and a uri
is returned in the response, which will be used in subsequent steps.
POST https://graph.facebook.com/v21.0
/<YOUR_APP_USERS_INSTAGRAM_USER_ID>/media
?image_url=<IMAGE_URL>
&media_type=STORIES
&access_token=<USER_ACCESS_TOKEN>
POST https://graph.facebook.com/v21.0
/<YOUR_APP_USERS_INSTAGRAM_USER_ID>/media
?video_url=<VIDEO_URL>
&media_type=STORIES
&access_token=<USER_ACCESS_TOKEN>
POST https://graph.facebook.com/v21.0
/<YOUR_APP_USERS_INSTAGRAM_USER_ID>/media
?media_type=STORIES
&upload_type=resumable
&access_token=<USER_ACCESS_TOKEN>
On success, an Instagram container ID and a URI is returned in the response, which will be used in subsequent steps.
Once the Instagram container ID returns from a resumable upload session call, send a POST
request to the https://rupload.facebook.com/ig-api-upload/
v21.0
/<IG_CONTAINER_ID>
endpoint.
ig-container-id
is the ID from the resumable reels, carousel and video container upload session examples above.access-token
is the same one used in other steps.offset
is set to the first byte being upload, generally 0
.file_size
is set to the size of your file in bytes.Your_file_local_path
sets to the file path of your local file, for example, if uploading a file from the Downloads folder on macOS, the path is @Downloads/example.mov.
curl -X POST "https://rupload.facebook.com/ig-api-upload/v21.0
/<IG_CONTAINER_ID>" \
-H "Authorization: OAuth <USER_ACCESS_TOKEN>" \
-H "offset: 0" \
-H "file_size: Your_file_size_in_bytes" \
--data-binary "@Your_local_file_path.extension"
On success, you should see response like this example:
{ "success":true, "message":"Upload successful. ..." }
This service can also support video upload from a hosted URL.
curl -X POST "https://rupload.facebook.com/ig-api-upload/v21.0
/<IG_CONTAINER_ID>" \
-H "Authorization: OAuth <USER_ACCESS_TOKEN>" \
-H "file_url: <VIDEO_URL>"
Placeholder | Value |
---|---|
` v21.0 ` | API version. |
| App user's app-scoped user ID. |
Key | Placeholder | Description |
---|---|---|
|
| Required. App user's User access token. |
|
| For Reels only. Name of the audio of your Reels media. You can only rename once, either while creating a reel or after from the audio page. |
|
| A caption for the image, video, or carousel. Can include hashtags (example: Not supported on images or videos in carousels. |
|
| For Feed image, Reels and Carousels only. A list of up to 3 instagram usernames as collaborators on an ig media. Not supported for Stories. |
|
| Required for carousels. Applies only to carousels. An array of up to 10 container IDs of each image and video that should appear in the published carousel. Carousels can have up to 10 total images, vidoes, or a mix of the two. |
|
| For Reels only. The path to an image to use as the cover image for the Reels tab. We will cURL the image using the URL that you specify so the image must be on a public server. If you specify both |
|
| For images only and required for images. The path to the image. We will cURL the image using the URL that you specify so the image must be on a public server. |
|
| Applies only to images and video. Set to |
|
| The ID of a Page associated with a location that you want to tag the image or video with. Use the Pages Search API to search for Pages whose names match a search string, then parse the results to identify any Pages that have been created for a physical location. Include the Not supported on images or videos in carousels. |
|
| Required for carousels, stories, and reels. Indicates container is for a carousel, story or reel. Value can be:
|
|
| Required for product tagging. Applies only to images and videos. An array of objects specifying which product tags to tag the image or video with (maximum of 5; tags and product IDs must be unique). Each object should have the following information:
For example:
|
|
| For Reels only. When Neither value determines whether the reel actually appears in the Reels tab because the reel may not meet eligibilty requirements or may not be selected by our algorithm. See reel specifications for eligibility critera. |
|
| For videos and reels. Location, in milliseconds, of the video or reel frame to be used as the cover thumbnail image. The default value is |
|
| An optional parameter for users want to upload video through the rupload protocol, values can be set to lowercase string value: |
|
| Required for user tagging in images and videos. Videos in carousels are not supported. An array of public usernames and
|
|
| Required for videos and reels. Applies only to videos and reels. Path to the video. We cURL the video using the passed-in URL, so it must be on a public server. |
A JSON-formatted object containing an IG Container ID which you can use to publish the container.
Video uploads are asynchronous, so receiving a container ID does not guarantee that the upload was successful. To verify that a video has been uploaded, request the status_code
field on the IG Container. If its value is FINISHED
, the video was uploaded successfully.
{ "id":"<IG_CONTAINER_ID>" }
POST graph.facebook.com/17841400008460056/media ?image_url=curls//www.example.com/images/bronzed-fonzes.jpg &caption=#BronzedFonzes! &collaborators= [‘username1’,’username2’] &user_tags=[ { username:'kevinhart4real', x: 0.5, y: 0.8 }, { username:'therock', x: 0.3, y: 0.2 } ]
{ "id": "17889455560051444" }
GET /<YOUR_APP_USERS_INSTAGRAM_USER_ID>/media
Get all IG Media on an IG User.
GET /<YOUR_APP_USERS_INSTAGRAM_USER_ID>/stories
endpoint instead.Type | Description |
---|---|
If the app user was granted a role on the Page via the Business Manager, you will also need one of: |
This endpoint supports time-based pagination. Include since
and until
query-string parameters with Unix timestamp or strtotime
data values to define a time range.
GET graph.facebook.com/v21.0
/17841405822304914/media
{ "data": [ { "id": "17895695668004550" }, { "id": "17899305451014820" }, { "id": "17896450804038745" }, { "id": "17881042411086627" }, { "id": "17869102915168123" } ] }
This operation is not supported.
This operation is not supported.