Instagram requirements
Account requirements
- The Instagram account must be a professional account — Business or Creator. Personal accounts cannot publish through the API, and Relay rejects them during the connect flow rather than letting you discover it at publish time.
- Relay connects through Instagram Login (the direct Instagram business login), so you don't need a linked Facebook Page.
- Two permissions are requested:
instagram_business_basic(read the profile) andinstagram_business_content_publish(create and publish media). - Accounts in some regions or with certain restrictions may be excluded by Meta from API publishing entirely — that surfaces as a Graph error on the first publish.
Connecting an account
Start the flow from Accounts → Connect Instagram. Relay exchanges the authorization code for a long-lived token, reads the profile, and stores:
| Stored | Why |
|---|---|
| access token | Encrypted at rest with AES-256-GCM. Required for every publish call; never returned by any API. |
| Instagram user ID | The Graph-scoped account ID every publish call is addressed to. |
| username, name, avatar | Shown in the dashboard and on targets. |
| follower & media counts | Refreshed once a day for the dashboard; never used for publishing. |
| token expiry | Drives the refresh job and the connection health badge. |
Optional permissions
Publishing needs only the base permissions; first comments and turning comments off need the comment permission (instagram_business_manage_comments), which Relay asks for too. Two more unlock account management through the API and MCP: insights (post and account metrics, follower demographics) and direct messages (read threads, reply within Instagram's 24-hour window). Replying to, hiding, and deleting comments and turning comments off on a post use the comment permission Relay already asks for. An account shows what it granted as can_read_insights and can_message; one connected before a permission was available has to be reconnected to grant it.
Token lifecycle
Long-lived Instagram tokens last 60 days and can be refreshed — but only while they're still alive. Relay runs a weekly refresh for every token expiring within 14 days, which in normal operation means a connection never lapses.
| Health | Meaning | Can publish? |
|---|---|---|
| connected | Token valid, more than 7 days left. | Yes |
| expiring | Under 7 days left and the refresh has not succeeded yet. | Yes — the token is valid until it actually expires. |
| reconnect_required | The token expired, was revoked, or Instagram rejected it (Graph error 190 / subcode 463). It cannot be refreshed. | No — reconnect the account. |
| disconnected | Removed from Relay, or revoked from the Instagram side via Meta’s deauthorize callback. | No |
disconnected. Meta's data-deletion request is honoured the same way — the account is deleted, or fully anonymized when post history prevents a hard delete.Post types
| Type | Media | Notes |
|---|---|---|
| feed | Exactly 1 JPEG image | Aspect ratio must be between 4:5 and 1.91:1. Relay checks this at upload. Takes alt text, the AI label and comments off. |
| carousel | 2–20 images or videos, mixed allowed | Instagram crops every slide to the first item’s ratio. Each image takes its own alt text. Counts as one post against the quota. |
| reel | Exactly 1 video, 3 seconds to 15 minutes | Set share_to_feed: false to keep it off the profile grid; Instagram defaults to showing it. The only type with a cover (an image or a frame) and the only one that can be a trial Reel. |
| story | 1 image, or a video of 3 to 60 seconds | Instagram displays no caption on stories — a caption you send is stored on the post but not shown. No AI label, no comments, no cover. Must be requested explicitly; never inferred. |
Omit the type and Relay infers it: one image is a feed post, one video is a reel, two or more items is a carousel. Stories are the exception — ask for them by name.
Instagram settings
Everything below is optional and off unless you set it. The instagram object applies to every Instagram account on the post; the cover and alt text are the post’s and the file’s, shared with the other platforms that take them.
| Field | What it does | Rules |
|---|---|---|
| alt_text | What an image shows, for people who can’t see it. Sent on a feed post’s image and on each image of a carousel. | The file’s own (a media entry’s alt_text, media_upload’s, or PATCH /v1/media/:id), 1–1,000 characters, so it is the same in every post that uses the file. Never sent on Reels, stories or videos. |
| cover_image | A Reel’s cover: an image from the library, or a public URL (sent to Instagram as cover_url). | Reels only; a JPEG. Instagram shows it on the profile grid and in the Reels tab. |
| cover_frame_ms | A Reel’s cover as a frame of the video, in milliseconds (sent as thumb_offset). | Reels only, before the video’s end, and only when there is no cover_image. With neither, Instagram uses the first frame. |
| instagram.ai_generated | Adds Instagram’s “AI info” label (is_ai_generated). Relay reads it back after publishing. | Feed posts, carousels and Reels; not stories. Set it when the image or video was made or changed with AI. |
| instagram.trial_graduation | Makes the Reel a trial Reel, shown to people who don’t follow the account first. manual: the person graduates it in Instagram. performance: Instagram graduates it if it does well. | Reels only, and not with share_to_feed: true (a trial isn’t shared to the feed). |
| instagram.comments_off | Turns comments off right after the post goes live, after any first comment. | Not on stories. Needs the comment permission (can_comment); a draft may wait for the reconnect. |
| share_to_feed | Reels: false keeps it off the profile grid. | Its own field, beside the instagram object. Not sent on a trial Reel. |
| first_comment | A comment posted the moment the post is live. | See First comment. |
Comments off and the follow-ups
Turning comments off happens after the post is live, as a follow-up: it waits for the first comment, then calls Instagram once (doing it again is harmless). It can never fail the post. The target lists it in followups as instagram_comments_off, pending then done or failed with a message; Instagram’s passing trouble is retried 1, 5, 15 and 30 minutes apart (five tries in all, about 51 minutes). A published post’s comments can also be turned on or off later from its page in the dashboard or the mobile app, or with ig_media_comments_toggle. Either way a pending comments-off follows the choice: comments turned back on stay on.
| The follow-up’s message | What to do |
|---|---|
| Reconnect Instagram and allow comments to turn them off. | The account didn’t allow Relay to manage comments (can_comment false). Reconnect it, then turn comments off in Instagram or from the post’s page. |
| Instagram authorization expired or was revoked — reconnect the account, then turn comments off in Instagram. | Reconnect the account; the post stays live with comments on until then. |
| Instagram is busy — Relay will try again shortly. | Nothing while it is pending: Relay tries again. If it is still busy after five tries, the follow-up fails with this message; turn comments off in Instagram. |
| Instagram wouldn’t turn comments off (…). Turn them off in Instagram. | Instagram refused, with its reason in brackets. Turn them off in Instagram. |
Media specifications
The left column is Instagram's published specification. The right is what Relay enforces before accepting an upload, so a file that passes here will not be rejected later for format reasons.
Images
| Enforced by Relay | |
|---|---|
| JPEG only — PNG, HEIC, MPO, and JPS are rejected | Yes for the API. The dashboard converts in your browser — drop any format and it uploads as JPEG. |
| 8 MB maximum | Yes |
| Aspect ratio 4:5 – 1.91:1 (feed and carousel) | Yes — parsed from the JPEG at upload. The dashboard fits images to the nearest accepted shape as you add them, and its editor can crop them instead. |
| Width 320–1440 px (scaled outside that range) | The dashboard exports at 1080 px wide; the API leaves it to Instagram |
| sRGB colour space | No |
| 9:16 recommended for stories | No — stories accept any ratio |
Video (reels and stories)
| Property | Enforced by Relay | |
|---|---|---|
| Container | MP4 or MOV | Yes — image/jpeg, video/mp4, video/quicktime only |
| Video codec | H.264 or HEVC | No |
| Audio codec | AAC, ≤ 48 kHz, 1–2 channels, 128 kbps | No |
| Frame rate | 23–60 FPS | No |
| Resolution | ≤ 1920 px wide | No |
| Bitrate | VBR, ≤ 25 Mbps | No |
| Duration | Reels 3 s – 15 min; stories 3 – 60 s | Yes, when Relay could read the length from the file at upload (otherwise Instagram rejects at processing time) |
| File size | Reels ≤ 300 MB; stories ≤ 100 MB | Yes — before the post is queued (a carousel's videos are held to a Reel's 300 MB). Relay stores videos up to 2 GB |
container_error with Instagram's own message. Instagram also runs a copyright check on video: a match doesn’t stop the post, and the target says so (instagram_copyright_match).Captions
- 1–2,200 characters. Relay rejects longer captions before they reach Instagram.
- Hashtags and @mentions work inline; there is no markdown or rich text. Instagram takes at most 30 hashtags and 20 @mentions, and Relay refuses a caption with more (
instagram_caption) rather than letting Instagram refuse it at publish time. - Stories ignore the caption entirely.
- Per-slide captions are deprecated. A carousel entry’s
captionis still accepted and kept, but Instagram shows none, so Relay sends it nowhere.
First comment
first_comment is posted as a comment on the post the moment it goes live — the usual home for a hashtag block you would rather keep out of the caption. It is posted once per target account, on that account's own copy of the post, 1–2,200 characters. Stories take none: Instagram has no comments there, and Relay rejects one rather than dropping it. A TikTok, YouTube or Threads account on the same post gets none, and a post without an Instagram account can’t have one. Threads has no first comment, so text meant for Threads goes in the next post of the Threads thread instead (see Multi-post threads).
It is attempted after the post is published, so it can never hold up or fail a publish. If Instagram refuses the comment, the post stays published with its permalink and the target carries a breadcrumb saying why; transient refusals are retried with a backoff for up to five attempts. Poll first_comment_status on the target (pending, posted, or failed) to see how it went.
instagram_business_manage_comments scope, which is granted separately from publishing. An account connected before Relay asked for it does not have it — a token refresh never widens a granted scope, so the account has to be reconnected. Until then that account publishes normally and skips the first comment, and the composer says so next to the field. accounts_list reports it as can_comment.Publishing quota
Instagram allows 50 API-published posts per account per rolling 24 hours (Relay reads the figure from Instagram each time, and uses 50 when Instagram doesn’t say). A carousel counts as one post regardless of how many items it holds. Relay checks the remaining quota before creating a media container.
At the ceiling, the post is not failed. The target keeps a quota_exceeded breadcrumb, the post stays in publishing, and the scheduler retries until a slot frees up — which happens automatically as older posts age out of the 24-hour window. If the account is still at the limit a day after the post was due, the target fails with quota_timeout. When Instagram itself says the account is at its limit as the post goes out (2207042, a post made elsewhere took the last slot), the post waits the same way and keeps its container.
"error": {
"code": "quota_exceeded",
"message": "Instagram allows 50 API-published posts per 24h and this account is at the limit — Relay will keep retrying until a slot frees up"
}Timing & retries
Publishing is a two-step handshake with Instagram: create a media container, wait for it to finish processing, then publish it. Relay drives that from a scheduler tick.
| Behaviour | Value |
|---|---|
| Scheduler interval | Every minute |
| Posts claimed per tick | 10, oldest scheduled time first |
| Stalled-post reclaim | A post stuck in publishing for 2 minutes is picked up again |
| Processing poll budget | 30 ticks (~30 minutes) before a container is declared timed out |
| Transient error retries | 5 attempts for HTTP 429 / 5xx, Graph rate limits and the errors Instagram documents as passing (2207001, 2207003, 2207032, 2207027), then the target fails. A spam flag (2207051) is never retried |
| Container validity | 24 hours, per Instagram — after that it expires |
- Images normally publish within the tick that claims them — a few seconds after
schedule_at. - Video is transcoded by Instagram asynchronously. Expect a minute or several; the target sits in
processinguntil it's ready. - Carousels create one child container per item, wait for all of them to finish, then create the parent. Each image’s alt text rides on its child container, and Relay reads each video item’s copyright check; the post caption and the AI label go on the parent. A single bad item fails the whole carousel.
- Retries never duplicate a post: container IDs are persisted as they're created, so a reclaimed post resumes rather than starting over. When Instagram loses a container before it is published (2207008 after two tries, or 2207020), Relay makes a new one, and only while nothing of the post is live; the target says
instagram_new_containermeanwhile. - After it is live, Relay reads the post back once for its permalink and AI label. What Instagram did with the post is a breadcrumb on the published target, never a reason to send it again: the caption not attached (
instagram_caption_dropped), the AI label missing (instagram_ai_label_missing), or a copyright match (instagram_copyright_match).
Failure reference
When a target fails, error.code tells you whose fault it was and whether to retry. Codes beginning graph_ are Instagram's own error codes, passed through with Instagram's message.
| Code | Cause | What to do |
|---|---|---|
| quota_exceeded | The account hit 50 API posts in 24 hours. | Nothing — Relay keeps retrying. Not a terminal failure. |
| quota_timeout | The account stayed at its limit for a day after the post was due. | Retry the post once the account has room. |
| instagram_spam_flagged | Instagram flagged the publish as possible spam (2207051). Relay stops and doesn’t retry: repeating it can deepen the restriction. | Wait a few hours, check the account in the Instagram app, then retry. |
| instagram_account_restricted | Instagram says the account is inactive, checkpointed or restricted (2207050). | Sort it out in the Instagram app, then retry. |
| instagram_carousel_count | Instagram refused the carousel’s number of items (2207028): it takes 2–20. | Change the items and recreate the post. |
| instagram_video_format | Instagram doesn’t take the video’s format (2207026, error 352). | Convert it to MP4 or MOV and recreate the post. |
| instagram_cover_frame | The Reel’s cover frame is past the end of the video (2207057). | Duplicate the post, pick a frame inside the video and schedule it. |
| instagram_image_too_large | An image is over Instagram’s 8 MB (2207004). | Duplicate the post with a smaller image and schedule it. |
| instagram_caption_limits | Instagram refused the caption (2207010, 2207040): over 2,200 characters, 30 hashtags or 20 @mentions. | Duplicate the post, shorten the caption and schedule it. |
| instagram_server_error, instagram_download_timeout, instagram_create_failed, instagram_not_ready | Instagram’s own passing trouble (2207001, 2207003, 2207032, 2207027), still there after 5 tries. | Retry later. |
| instagram_container_missing, instagram_media_expired | Instagram lost the media before it was published (2207008, 2207020), and making it again didn’t help after 5 tries. | Retry later; re-upload the media if it persists. |
| auth_reconnect_required | The token expired or the user revoked access (Graph 190 / subcode 463). | Reconnect the account, then create the post again. |
| account_disconnected | The account was disconnected before the post ran. | Reconnect and recreate. |
| container_error | Instagram rejected the media while processing it — bad codec, unsupported duration, corrupt file. | Read the message, fix the file, upload again. |
| container_expired | The media container went unpublished for 24 hours. | Recreate the post. |
| child_error / child_expired | One carousel item failed or expired. | Fix that item and recreate the carousel. |
| processing_timeout | The container never finished processing within ~30 minutes. | Usually an oversized or unusual video — re-encode and retry. |
| published_unverified | The post went live but Relay lost the media ID mid-publish. | Nothing — the post is live. The permalink is missing from the timeline. |
| instagram_caption_dropped | On a published target: Instagram published the post but didn’t attach the caption (config_issue CAPTION_NOT_ATTACHED). | Edit the post in Instagram to add the caption. Never post it again. |
| instagram_ai_label_missing | On a published target: Relay asked for the AI info label, and the post reads without it. | Check the post in Instagram; say in its caption that it was made with AI if the label is missing. |
| instagram_copyright_match | On a published target: Instagram’s copyright check matched material in the video. It published it, but may mute or limit it. | Check the post in Instagram. |
| graph_<code> | A semantic rejection from Instagram, message included verbatim. | Read the message — it is the actionable part. |
| http_<status> | Instagram returned a non-JSON error. | Retry later; contact support if it persists. |
| internal | An unexpected error inside Relay. | Send the post ID to support@lantean.tech. |
Not supported
- PNG and other image formats. Instagram's publishing API takes JPEG only.
- Text-only posts. Every Instagram post needs at least one media item. Threads takes them, so a post to Threads accounts alone may be text only.
- Filters. Not exposed by the publishing API.
- Product tags, paid partnership labels, licensed music, caption polls and comment prompts, resumable uploads and deleting a published post. Instagram offers them only to apps on Facebook Login, and Relay connects through Instagram Login, so none can be sent from Relay. Delete a post in the Instagram app.
- Collaborators. Instagram lists collaborators as Facebook Login only, so Relay doesn’t offer them until a test publish through Instagram Login shows they work.
- People tags and locations. Not yet. Instagram Login’s support for people tags is unconfirmed, and finding a location needs a Facebook token.
- Naming a Reel’s audio. Not offered: Instagram allows renaming it once, and Instagram Login’s publishing doesn’t list it.
- Editing a published post. Once it's live, use the Instagram app (comments can still be turned on or off from Relay). Relay can only cancel posts that haven't published yet.
- Changing media or targets on an existing post through the API or MCP. Cancel it and create a new one; the post’s caption, first comment, share to feed, cover, Instagram settings and schedule are editable there, and the dashboard edits media and targets too. A file’s alt text is changed on the file (PATCH /v1/media/:id, media_update).
- TikTok, YouTube and Threads here. Each has its own rules — see TikTok requirements, YouTube requirements and Threads requirements. A post can target all four.
For the request and response shapes behind all of this, see the REST API reference or the MCP tool reference.