Skip to main content

Instagram

Publish images, videos, reels and carousels to an Instagram Business account, moderate its comments, and read post and account insights.

Connect an Instagram Business or Creator account through Meta's Graph API to publish and measure: stage and publish photos, videos, reels, stories and carousels, check the rolling publishing quota before a batch, list and read published posts, read and reply to comments, hide or delete them, and read reach and engagement for a post or the account. Publishing is a two-step stage-then-publish flow because that is what Instagram's API is - direct messages and hashtag search are not part of this integration.

Connect

Credential fieldRequiredWhere it comes from
Access token (ACCESS_TOKEN)YesA long-lived access token with the Instagram permissions, derived from a long-lived user token. Not the Graph API Explorer's token - that one expires in about an hour.
SettingRequiredWhat it is
Instagram account ID (IG_USER_ID)YesThe numeric Instagram Business Account id, from GET /{page-id}?fields=instagram_business_account. Not the @handle and not the Facebook Page id.

Tools

ToolAccessWhat it does
Get account (yekar.instagram.get-account)ReadThe Instagram Business account this connection is configured for: handle, name, bio, website, and Instagram's own follower, following and media counts. Call it first when something is not working - an id belonging to the linked Facebook Page rather than the Instagram account fails every other tool with an unhelpful 'no such id'.
List media (yekar.instagram.list-media)ReadA page of the account's published posts, newest first - id, caption, permalink, type, and Instagram's own like and comment counts. STORIES are not included (they live on a separate edge and vanish after 24 hours). Graph returns no total for a page; for the account's real post count use Get account.
Get media (yekar.instagram.get-media)ReadRead one published post: caption, permalink, type, timestamp and Instagram's own like and comment counts. A null like count means Instagram did not report one (accounts can hide likes) rather than zero. Pass a media id - a container id from Create media container is not a post and returns nothing useful here.
Create media container (yekar.instagram.create-media-container)WriteStep 1 of 2 of publishing to Instagram: stage a post and get a container id. NOTHING IS PUBLISHED by this call. Instagram downloads the media from your public URL, so images must be JPEG (PNG and WebP are rejected) and videos MP4/MOV. For an IMAGE the container is usually ready at once; for VIDEO, REELS and STORIES it is transcoded asynchronously, so poll Get container status until FINISHED before calling Publish media. A carousel is built by creating each item's container with isCarouselItem, then one CAROUSEL container listing those ids as children. Containers expire 24 hours after creation, published or not.
Get container status (yekar.instagram.get-container-status)ReadWhether a staged container is ready to publish. Step 2 of 3 for video: Instagram transcodes VIDEO, REELS and STORIES asynchronously, and Publish media fails while the status is IN_PROGRESS. Poll this until readyToPublish is true (status FINISHED). ERROR carries Instagram's own sentence explaining what went wrong with the media - the only place it says. EXPIRED means the container passed its 24-hour life unpublished and must be created again.
Publish media (yekar.instagram.publish-media)WriteStep 2 of 2: publish a staged container, which is the moment the post goes live and becomes visible to followers. This is where Instagram's rolling 24-hour publishing quota is spent - a container that is still transcoding is rejected, so check Get container status first for video and reels. Returns the real media id and the post's permalink; the container id is not a media id and never was.
Get publishing limit (yekar.instagram.get-publishing-limit)ReadHow much of the account's rolling publishing quota is used and how much is left, as INSTAGRAM reports it - not a number this integration assumes. Instagram caps API-published posts over a rolling window (typically 24 hours), and hitting it fails a publish for up to a day rather than for a moment, so check this before a batch. remaining is null when Instagram did not report both halves - a guessed remainder would decide whether a batch runs.
List comments (yekar.instagram.list-comments)ReadA page of top-level comments on a post, each with the id needed to reply, hide or delete it, and whether it is already hidden. Replies are summarised as a count, not expanded. For the post's real total comment count use Get media - this returns a page, never a census.
Reply to comment (yekar.instagram.reply-to-comment)WriteComment on a post, or reply to an existing comment by passing its id, as the connected Instagram account. The comment is public immediately. Instagram allows only one level of replies - replying to a reply attaches to the same thread - and refuses comments on media whose comments are turned off.
Hide comment (yekar.instagram.hide-comment)WriteHide a comment from everyone but its author, or unhide one. Instagram does not tell the author their comment was hidden, and the action is fully reversible - which makes it the right moderation default. Deleting is the permanent alternative. Hiding a comment also hides its replies.
Delete comment (yekar.instagram.delete-comment)WritePermanently delete a comment and its replies. There is no undo, and unlike hiding, the author can tell. Only comments on the connected account's own media can be deleted. Use Hide comment when the judgement might be wrong; use this for spam and abuse.
Get media insights (yekar.instagram.get-media-insights)ReadReach and engagement for one post - reach, likes, comments, saves and shares by default. Needs instagram_manage_insights. Metric names differ by media type and Meta renames them between Graph versions (impressions became views); anything requested that Instagram does not return is listed as unavailable rather than rendered as a zero. Insights are unavailable for posts published before the account became a business account.
Get account insights (yekar.instagram.get-account-insights)ReadAccount-level reach, follower growth and profile views over a window. Needs instagram_manage_insights and an account with enough activity - Instagram withholds insights entirely for accounts under 100 followers, which returns an empty report rather than an error. Instagram keeps only about two years of history and backfills the most recent day, so the latest window is routinely incomplete rather than low.

Notes

  • The account must be an Instagram BUSINESS or CREATOR account linked to a Facebook Page. A personal account cannot use this API at all, and no permission will change that.
  • In the Meta app dashboard add Instagram, then request the permissions you need: instagram_basic (read), instagram_content_publish (publish), instagram_manage_comments (moderate), instagram_manage_insights (analytics), plus pages_read_engagement on the linked Page. On an account your app does not own, each needs App Review.
  • Get a LONG-LIVED token: sign in as a Page admin, exchange the short-lived user token (/oauth/access_token?grant_type=fb_exchange_token), and use that. Do NOT paste the token shown directly in the Graph API Explorer - it dies in about an hour, so the connection works during setup and is broken by the afternoon.
  • Find the Instagram account id with GET /{page-id}?fields=instagram_business_account. It is a numeric id and is NOT the @handle and NOT the Page id - putting the Page id here is the single most common setup mistake.
  • Publishing is TWO steps: Create media container, then Publish media. For VIDEO, REELS and STORIES there is a step between them - poll Get container status until FINISHED, because Instagram transcodes asynchronously and publishing early fails.
  • Containers expire 24 hours after creation whether or not they were published, so do not stage content far ahead of posting it.
  • Instagram downloads the media from your URL, so it must be publicly reachable. Images must be JPEG - PNG, WebP and HEIC are rejected - and videos MP4/MOV with H.264 and AAC.
  • A carousel is built by creating each item's container with isCarouselItem, then one CAROUSEL container listing those ids as children (2–10 items). The caption goes on the carousel, never on an item.
  • Instagram caps API-published posts over a rolling 24-hour window. Run Get publishing limit before a batch - hitting the ceiling blocks publishing for up to a day, not for a moment.
  • There is no scheduling in Instagram's API and no way to edit a published caption. Schedule the automation instead, and get the caption right before publishing.
  • Everything is posted AS THE ACCOUNT, never as the person who triggered the automation. Bind automations using it as a service connection.
  • INCOMING comments and mentions cannot be watched here - Instagram delivers them by webhook. Point your Meta webhook at your own endpoint, verify its X-Hub-Signature-256 header, and have it call Yekar.AI's fire endpoint.