# Publishing to Instagram with the Graph API: Containers, Status Polling, Carousels and Reels

> How Instagram Graph API publishing works in 2026: media containers, status polling, carousels, Reels, limits, token refresh and the errors that break real apps.

Canonical: https://tesselith.com/blog/instagram-graph-api-publishing
Last updated: 2026-11-27

**Publishing to Instagram through the Graph API is always two steps.** First you create a media container by POSTing a public URL to `/<IG_ID>/media`. Instagram fetches the file and processes it. When the container's `status_code` is `FINISHED`, you POST its id to `/<IG_ID>/media_publish` and the post goes live. Carousels repeat the container step once per slide plus once for the album. An account can publish 100 posts through the API in a rolling 24 hours and create 400 containers in the same window. Images must be JPEG.

**Key takeaways**
- Create a container, wait for status_code FINISHED, then call media_publish. Publishing early fails.
- Only JPEG images are accepted. PNG fails at container creation.
- Carousels take 2 to 20 items. A video inside a carousel is media_type VIDEO, never REELS.
- Limits: 100 API-published posts and 400 containers per account per rolling 24 hours. Containers expire after 24 hours.
- Long-lived tokens last 60 days. Refresh them before they expire or the user has to log in again.

## Pick your login flavor first

Meta offers two ways to reach the same publishing endpoints, and the choice decides your host name, your token type and which features you get.

|  | Instagram API with Instagram Login | Instagram API with Facebook Login |
| --- | --- | --- |
| Host | graph.instagram.com | graph.facebook.com |
| Needs a linked Facebook Page | No | Yes |
| Account types | Business or Creator | Business or Creator linked to a Page |
| Token | Instagram user token | Facebook user token, then the Page's IG account |
| Resumable video upload (rupload) | No | Yes |
| Collaborators on posts | No | Yes |

We built Tesselith's [Instagram integration](https://tesselith.com/schedule/instagram) on Instagram Login because most small accounts don't have, or can't find, the Facebook Page linked to their profile. The cost is two missing features: resumable uploads and collaborators. If your users are agencies with tidy Business Manager setups, Facebook Login is fine. If they're creators, Instagram Login removes the most common support ticket.

With Instagram Login, request `instagram_business_basic` and `instagram_business_content_publish`. Add `instagram_business_manage_comments` and `instagram_business_manage_insights` if you'll post first comments or read metrics. Every one of them goes through Meta's App Review before real users can grant it.

## Step 1: create a media container

The container call doesn't take file bytes. It takes a URL, and Meta's servers download from it. The URL must be public, must not redirect to a login page, and must stay up until processing finishes. Signed URLs with a 60-second expiry are a classic way to fail here. Give them at least an hour.

```bash
curl -X POST "https://graph.instagram.com/v27.0/$IG_ID/media" \
  -d "image_url=https://cdn.example.com/posts/bake-0700.jpg" \
  --data-urlencode "caption=Sourdough out of the oven at 7. Back at 2 for focaccia." \
  --data-urlencode "alt_text=Six sourdough loaves cooling on a wire rack" \
  -d "access_token=$IG_ACCESS_TOKEN"

# {"id": "17889455560051444"}  <- the container id, not a post id
```

v27.0 is the current Graph API version as of November 2026. Pin it explicitly. Meta changes container parameters between versions, and an unversioned call falls back to your app's default version, which may not be the one you tested.

## Step 2: poll the container status

Read `status_code` on the container. It returns one of five values:

| status_code | Meaning | What to do |
| --- | --- | --- |
| IN_PROGRESS | Meta is still fetching or transcoding | Wait and poll again |
| FINISHED | Ready to publish | Call media_publish |
| PUBLISHED | Already published | Treat as success, don't publish again |
| ERROR | Processing failed | Stop. Read the status field for the reason |
| EXPIRED | Not published within 24 hours | Create a new container |

```ts
async function waitForContainer(id: string, token: string, budgetMs: number) {
  const deadline = Date.now() + budgetMs
  while (Date.now() < deadline) {
    const url = "https://graph.instagram.com/v27.0/" + id +
      "?fields=status_code,status&access_token=" + encodeURIComponent(token)
    const data = await fetch(url).then((r) => r.json())
    if (data.status_code === "FINISHED" || data.status_code === "PUBLISHED") return
    if (data.status_code === "ERROR" || data.status_code === "EXPIRED") {
      throw new Error("Container " + data.status_code + ": " + data.status)
    }
    await new Promise((r) => setTimeout(r, 3000))
  }
  throw new Error("Still processing. Check the account before retrying.")
}
```

Meta's guide suggests checking about once a minute for no more than five minutes. That's tuned for video. A JPEG is usually ready within a few seconds, so we poll every three seconds with a 45-second budget for images and a 5-minute budget for video. Whatever you choose, make the budget depend on the media type. A 15-minute Reel genuinely takes minutes.

Treat `ERROR` and `EXPIRED` as final. Retrying the same container does nothing, and creating a fresh one for a file Meta already rejected burns another slot from your 400-a-day allowance. A timeout is different: the container may finish a minute later and publish fine, so mark it retryable and tell the user to check the account first.

## Step 3: publish

```bash
curl -X POST "https://graph.instagram.com/v27.0/$IG_ID/media_publish" \
  -d "creation_id=$CONTAINER_ID" \
  -d "access_token=$IG_ACCESS_TOKEN"

# {"id": "18027939643016070"}  <- the published media id
```

The 100-posts-a-day limit is enforced here, on media_publish, and a carousel counts as one post. Check current usage with `GET /<IG_ID>/content_publishing_limit` before a big batch. One section of Meta's own guide still says 50 posts per 24 hours while the rate-limit section says 100, so read the endpoint rather than hard-coding either number.

## Publishing a carousel

A carousel is 2 to 20 child containers plus one parent. Create each child with `is_carousel_item=true` and no caption, wait for each to finish, then create the parent with `media_type=CAROUSEL`, the caption, and a comma-separated `children` list. Publish the parent.

```bash
# Child (repeat per slide)
curl -X POST "https://graph.instagram.com/v27.0/$IG_ID/media" \
  -d "image_url=https://cdn.example.com/slide-1.jpg" \
  -d "is_carousel_item=true" \
  -d "access_token=$IG_ACCESS_TOKEN"

# A video slide is VIDEO, not REELS
curl -X POST "https://graph.instagram.com/v27.0/$IG_ID/media" \
  -d "video_url=https://cdn.example.com/slide-2.mp4" \
  -d "media_type=VIDEO" -d "is_carousel_item=true" \
  -d "access_token=$IG_ACCESS_TOKEN"

# Parent
curl -X POST "https://graph.instagram.com/v27.0/$IG_ID/media" \
  -d "media_type=CAROUSEL" \
  -d "children=$CHILD_1,$CHILD_2,$CHILD_3" \
  --data-urlencode "caption=Three ways to use leftover starter" \
  -d "access_token=$IG_ACCESS_TOKEN"
```

Gotchas from production: every image in a carousel is cropped to the first image's aspect ratio, so put your 4:5 image first if you want a 4:5 carousel. Caption, location and the AI-generated label belong on the parent only, and some of them error if you set them on a child. If one child fails, the whole carousel fails, so validate every file before you create the first container.

## Publishing Reels and Stories

A Reel is a container with `media_type=REELS` and a `video_url`. Meta's reference, as of November 2026, allows MOV or MP4 between 3 seconds and 15 minutes, up to 300 MB, 23-60 fps, at most 1920 pixels wide, with the moov atom at the front of the file and no edit lists. 9:16 avoids cropping.

- `cover_url` sets a custom cover image (JPEG, up to 8 MB). If you send it, Meta ignores `thumb_offset`, so send one or the other.
- `share_to_feed=false` keeps the Reel off the main grid. It's true by default.
- `trial_params` makes it a trial Reel shown to non-followers first, with a graduation strategy of MANUAL or SS_PERFORMANCE.
- `alt_text` is for images only. Sending it on a Reel or Story returns an error rather than being ignored.

Stories use `media_type=STORIES` with either an image or a video URL. They take no caption. Link stickers, polls and music aren't available through the API. Our guide to [scheduling Instagram Reels](https://tesselith.com/blog/how-to-schedule-instagram-reels) covers the creative side, and the [image size cheat sheet](https://tesselith.com/blog/social-media-image-sizes) has the ratios.

## Image rules that fail at container creation

| Rule | Value (Meta docs, Nov 2026) |
| --- | --- |
| Format | JPEG only (no PNG, MPO or JPS) |
| File size | 8 MB max |
| Aspect ratio | 4:5 to 1.91:1 |
| Width | Scaled to 320-1440 px |
| Caption | 2,200 characters |
| Hashtags | 5 in the app since the December 2025 change; the API reference still says 30 |
| User tags | 20 per image |

Convert PNGs to JPEG on upload, not at publish time. A scheduled post can sit for days, and you want the failure while the author is still looking at the composer, not at 7am on launch day. We validate twice: in the composer, and again right before creating the first container, because the media attached to a scheduled post can change after it was approved.

## Tokens: 60 days, then gone

Instagram Login gives you a short-lived token from the code exchange. Swap it straight away for a long-lived one with `grant_type=ig_exchange_token`. Long-lived tokens last 60 days and can be refreshed once they're at least 24 hours old with `GET https://graph.instagram.com/refresh_access_token?grant_type=ig_refresh_token`. Note that token exchange and refresh live at the unversioned host root, while everything else is versioned. Building one URL by string-editing the other breaks the day you bump versions.

Run a daily job that refreshes any token expiring in the next week or so. If a refresh fails with an auth error, stop retrying and ask the user to reconnect. A scheduler that lets tokens lapse finds out when a week of posts fails at once.

## Errors worth classifying

Meta returns errors in a JSON body with a numeric `code`, sometimes with HTTP 200 around it. Classify on the body, not the status.

| Code | Meaning | Retry? |
| --- | --- | --- |
| 190 | Token expired or revoked | No. Flag the account for reconnection |
| 4, 17, 32, 613 | App, user or account rate limiting | Yes, with a long backoff |
| 1, 2 | Transient Meta error | Yes |
| 100 | Invalid parameter (bad URL, wrong field for the media type) | No. Fix the payload |
| Any 5xx | Meta's side | Yes |

Don't retry a publish that might have succeeded. If media_publish times out, read the account's latest media before trying again, or you'll post twice.

## When to use a scheduling API instead of building it yourself

The container flow is about 50 lines. The rest is what takes months: App Review, token refresh, JPEG conversion, carousel validation, publishing-limit tracking, retries that don't double-post, and the same work again for Facebook, Threads and YouTube. If Instagram is one of several networks you need, a scheduling API that already handles it is usually the cheaper path.

Tesselith's [API](https://tesselith.com/product/api) publishes to Instagram (feed, carousels, Reels and Stories) through the same post model as every other live network, with idempotency keys and [webhooks](https://tesselith.com/blog/social-media-webhooks) for publish results. Start with our [scheduling API checklist](https://tesselith.com/blog/social-media-scheduling-api), the [automation walkthrough](https://tesselith.com/blog/automate-social-media-posting-api), or the [docs](https://tesselith.com/docs).

## Questions people ask

### How do you publish to Instagram with the Graph API?

Create a media container with POST /<IG_ID>/media and a public media URL, poll the container until status_code is FINISHED, then call POST /<IG_ID>/media_publish with the container id as creation_id.

### How many posts can you publish per day with the Instagram API?

Meta's rate-limit section allows 100 API-published posts per account in a rolling 24 hours, with a carousel counting as one. Check GET /<IG_ID>/content_publishing_limit for live usage.

### Can the Instagram API post PNG images?

No. The Content Publishing API accepts JPEG only. Convert PNGs before creating the container.

### How many images can an Instagram API carousel have?

Between 2 and 20 images, videos or a mix, per Meta's November 2026 documentation. All slides are cropped to the first image's aspect ratio.

### Why does media_publish fail right after creating a container?

The container isn't FINISHED yet. Instagram processes media asynchronously, so poll the container's status_code before publishing.

### Do I need a Facebook Page to use the Instagram API?

Not with the Instagram API with Instagram Login, which works with Business and Creator accounts directly. The Facebook Login version requires a linked Page.

---
Tesselith · https://tesselith.com · Full site index: https://tesselith.com/llms.txt
