Get started
Developer guideUpdated

Instagram API: how to publish reels, step by step

To publish a reel through Instagram's API, host the video at a public URL, create a container with POST /{ig-user-id}/media and media_type=REELS, wait until its status_code is FINISHED, then call POST /{ig-user-id}/media_publish with the container's ID. You need a Business or Creator account and the instagram_content_publish permission.

Calls to publish a reel
3: create, check, publish
Permission
instagram_content_publish (or instagram_business_content_publish)
Account
Instagram Business or Creator
Posts per account
50 in 24 hours (Meta's guide also says 100)

What you need

  • An Instagram Business or Creator account. Personal accounts can't publish through the API.
  • A Meta app with one of three logins and its permissions:
    • Unified login (Facebook Login for Business with a login configuration): instagram_basic and instagram_content_publish; calls go to graph.facebook.com. When AgenticPost set up its app in late October 2026, Meta's dashboard offered new apps only this one, saying "Your app uses API setup with Unified login instead". AgenticPost uses it in production.
    • Facebook Login: instagram_basic, instagram_content_publish and pages_read_engagement; calls go to graph.facebook.com.
    • Instagram Login: instagram_business_basic and instagram_business_content_publish; calls go to graph.instagram.com instead, with the same paths.
    The last two are from Meta's content publishing guide (read 1 December 2026).
  • App Review. Until Meta's App Review approves your app for these permissions, only accounts with a role on your app can use it.
  • A public URL for the video. Meta fetches the file itself: "We cURL media used in publishing attempts, so the media must be hosted on a publicly accessible server at the time of the attempt."

Publish a reel in four steps

These are the calls AgenticPost makes in production, on API version v27.0 with a Unified login token. With Instagram Login, use graph.instagram.com in place of graph.facebook.com. Replace the values in angle brackets.

1. Create a container. Meta starts fetching and processing the video.

curl -X POST "https://graph.facebook.com/v27.0/<IG_USER_ID>/media" \
  -d media_type=REELS \
  -d video_url=https://example.com/reel.mp4 \
  --data-urlencode "caption=Pour-over in 30 seconds #coffee" \
  -d share_to_feed=true \
  -d access_token=<TOKEN>

The answer is the container's ID: {"id": "<CONTAINER_ID>"}. Set share_to_feed=false to keep the reel in the Reels tab only.

2. Wait until it's ready. Check the container's status:

curl "https://graph.facebook.com/v27.0/<CONTAINER_ID>?fields=status_code,status&access_token=<TOKEN>"

The status_code is one of IN_PROGRESS, FINISHED, ERROR, EXPIRED (not published within 24 hours) or PUBLISHED. Meta's guide says: "We recommend querying a container's status once per minute, for no more than 5 minutes."

3. Publish it. When the status is FINISHED:

curl -X POST "https://graph.facebook.com/v27.0/<IG_USER_ID>/media_publish" \
  -d creation_id=<CONTAINER_ID> \
  -d access_token=<TOKEN>

The answer is the new media's ID.

4. Get its link.

curl "https://graph.facebook.com/v27.0/<MEDIA_ID>?fields=permalink&access_token=<TOKEN>"

Limits

VideoMP4 or MOV, H.264 or HEVC, AAC audio, 3 seconds to 15 minutes, at most 300 MB. All limits: Instagram reel size.
Caption2,200 characters, 30 hashtags and 20 @-mentions in Meta's reference; Instagram's app has allowed 5 hashtags since December 2025 (hashtag limit).
Posts per accountMeta's guide says "100 API-published posts within a 24-hour moving period" in one place and "50 published posts within a 24-hour period" in another. AgenticPost plans for 50.
ContainerExpires if not published within 24 hours.

The account's current quota:

curl "https://graph.facebook.com/v27.0/<IG_USER_ID>/content_publishing_limit?fields=quota_usage,config&access_token=<TOKEN>"

Errors and fixes

Meta returns an error with a code and often an error_subcode. Read the subcode first: the 2207xxx numbers are Instagram's subcodes, and the same code (for example 4) can mean a rate limit or, with subcode 2207051, spam. These are the ones AgenticPost handles, with what to do; the full list is Meta's error-codes page.

Code or subcodeMeaningFix
2207026Instagram refuses this video format.Re-encode as an MP4 with H.264 video and AAC audio, and create a new container.
2207052Instagram couldn't fetch the video from its URL.Make sure the URL is public and reachable from the internet, then try again.
2207003Instagram timed out downloading the video.Check the host is fast and public, then try again.
2207020The container expired or doesn't exist.Create a new container; one lasts 24 hours.
2207008A temporary error while publishing the container.Try again once or twice in the next 30 seconds to 2 minutes. If it still fails, create a new container.
2207027The video wasn't ready to publish.Wait until status_code is FINISHED, then publish.
2207010The caption is too long.Shorten it to 2,200 characters.
2207040The caption has more than 20 @-mentions.Remove @-mentions.
2207042The account reached its posting limit for 24 hours.Wait until 24 hours after the earliest of the recent posts.
2207050The account is restricted, checkpointed or inactive.The owner opens Instagram and clears the warning.
2207051 (with code 4)Instagram flagged the post as spam.Don't retry the same content.
190The access token expired or was revoked.The account owner signs in again.
4 or 17, with no Instagram subcodeToo many calls.Back off and retry later.

A 5xx answer, or no answer at all, doesn't mean the call failed: a publish may have gone through. Check the account's recent media before you publish again, or you may post twice.

Or let an AI agent do it

If you'd rather not run this yourself, AgenticPost does it for your AI agent. Claude, ChatGPT or Cursor uploads the video with media_upload and calls post_create with the caption. AgenticPost checks the video and caption against these limits when the post is made, creates the container 15 minutes before the time slot, publishes at the slot and tells the agent the fix in plain words if Meta refuses. Instagram is in early access: until Meta approves AgenticPost's app, only invited accounts can connect.

Questions

Can you post reels through the Instagram API?

Yes, to Instagram Business and Creator accounts. You create a container with media_type REELS and a public video URL, wait until its status_code is FINISHED, then publish it with media_publish.

Which permission do I need?

It depends on the login. Unified login (Facebook Login for Business), which Meta's dashboard gives new apps: instagram_basic and instagram_content_publish. Facebook Login: those two plus pages_read_engagement. Instagram Login: instagram_business_basic and instagram_business_content_publish, with calls to graph.instagram.com. For accounts without a role on your app, Meta's App Review has to approve these first.

How many reels can I publish a day?

Meta's content publishing guide says 100 API-published posts in a 24-hour moving period in one place and 50 in another, and the content_publishing_limit endpoint reports the account's quota. Plan for 50.

Does the video have to be online?

Yes, for video_url: Meta fetches the file, so it must be on a public server when you create the container. Meta's guide also describes resumable uploads through rupload.facebook.com for large videos.

How long can a reel be through the API?

3 seconds to 15 minutes, MP4 or MOV, H.264 or HEVC video with AAC audio, at most 300 MB. The full specification is on our Instagram reel size page.

Can I schedule a reel for later with the API?

Not with one call: the API publishes when you call media_publish. To post at a set time, your own code waits and publishes then, which is what a scheduler does. A container lasts 24 hours.

AgenticPost

Run your social media with AI agents.

Connect Claude, Cursor or any agent that speaks MCP. It plans the week, writes the captions, uploads the videos and schedules each post. You stay in charge of what goes out.

  • Your agent sees your accounts, the queue and what failed
  • Every post is checked against the platform's limits before its slot
  • You choose what each agent may do: read, draft or schedule

No credit card needed.