Platforms / Instagram

Instagram API

Publish feed posts, carousels, Reels and Stories, and answer comments and DMs on Instagram professional accounts.

At a glance

Platform id
instagram
Connects
professional account
Sign-in
OAuth: the user approves on the platform's own page
Post types
Image · Carousel (2-10, photos and videos) · Reel / video · Story (one photo or video)

Capabilities

What Instagram supports here
PublishingYes
SchedulingYes
CommentsYes
Direct messagesYes
MentionsPartly
ReviewsNo
AnalyticsYes

Required on every post

  • At least one image or video: Instagram has no text-only posts.

Options

Send these in platform_data.instagram on the post, or flat in a target's own platform_data (the target's keys win). See Publishing.

platform_data options for Instagram
KeyTypeWhat it does
content_typefeed | reel | carousel | storiesWhat to publish. Default feed: one image, a carousel, or a single video as a Reel. `story` is accepted for stories. The older name `media_type` (reel | story) wins when both are sent.
alt_textstringAlt text of the first image. Up to 1,000 characters.
location_iddigitsLocation to tag. Feed posts, Reels and carousels; not Stories.
collaboratorsstring or string[]Up to 3 usernames invited as collaborators. A leading @ is removed. Feed posts, Reels and carousels.
user_tags{ username, x, y }[]People to tag. Feed image: x and y from 0 to 1. Reel: username only. Not on carousels.
cover_urlURLReels: a public JPEG used as the cover. Wins over the two offsets below.
thumb_offsetnumber (ms)Reels: the frame used as the cover. `video_cover_timestamp_ms` means the same; thumb_offset wins.
share_to_feedbooleanReels: also show the Reel in the profile grid. Default: Instagram's own.
audio_namestringReels: the name shown for the audio.
trial_params{ graduation_strategy }Reels: publish as a trial Reel. graduation_strategy is MANUAL or SS_PERFORMANCE.
is_ai_generatedbooleanAdds Instagram's AI info label (feed post, Reel, Story or the whole carousel).

Limits

  • Caption 2,200 characters, 30 hashtags and 20 @mentions. Stories carry no caption.
  • Images JPEG up to 8 MB. Videos MP4 or MOV, 3 seconds to 15 minutes, up to 300 MB.
  • Story video: 3 to 60 seconds, up to 100 MB.
  • Carousels hold 2 to 10 items.
  • Instagram allows about 50 posts per account per rolling 24 hours. This server caps each account at 25 posts an hour and 45 a day.

Text over the limit fails validation before anything is sent. The caps of this server are explained in Rate limits.

Good to know

  • Connects with Instagram Login: Business or Creator accounts only, no Facebook Page needed. A personal account is refused with a hint to switch it to a professional account in the Instagram app.
  • DMs: you can only answer people who wrote to the account, within 24 hours of their last message. Starting a new conversation is not possible.
  • A published post cannot be edited or deleted through the API (Instagram Login has no call for it): change it in the Instagram app.
  • Comments: read, reply (one level deep), hide, delete and one private reply per comment within 7 days. Liking comments is not available with Instagram Login.
  • Media is fetched by Instagram from a public URL, so uploads go to the public media bucket.
  • Accounts connected before insights were requested must reconnect to read them.

Publish with the API

curl https://api.zaynstack.com/v1/posts \
  -H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \
  -d '{
    "text": "Hello from SocialWire",
    "media": [{ "type": "image", "source_type": "url", "source": "https://example.com/file.jpg" }],
    "targets": [{ "account_id": "<Instagram account id>" }],
    "publish_now": true
  }'

An operation Instagram cannot do answers 501 resource.not_supported. Agents can do the same through the MCP server.

Connection errors

A connection that fails comes back to your redirect_uri with status=error, error=<code> and error_description, or as the error of the connect call. All codes: Connect accounts.

Connection error codes for Instagram
CodeMeaning
account.already_linkedThe brand already holds a different account on this platform, or the account belongs to another brand while lock_accounts_to_brand is on.
billing.brands_limitNo brand_id was sent, so a new brand was needed, and the plan has no room for another brand.

Webhook events

Every platform sends the post.* and account.* events. Instagram also sends:

  • comment.received
  • dm.received
  • dm.sent (also replies typed in the Instagram app)
  • dm.postback
  • dm.referral
  • dm.deleted (the sender unsent it)
  • dm.status.delivered / dm.status.read
  • mention.received

Webhook events and their payloads

Not supported yet

  • Connecting Instagram through Facebook Login (an Instagram account linked to a Page): only Instagram Login is built.
  • Editing or deleting a published post.
  • Liking comments.
  • Starting a new DM conversation.

Developer setup (self-hosting)

Only the operator of this server does this, once. Users then just click Connect.

  1. Create an app at developers.facebook.com → My Apps → Create app → type Business.
  2. Add the Instagram (API setup with Instagram login) product to the app.
  3. Paste the Callback address shown below into Valid OAuth Redirect URIs.
  4. Under Webhooks, subscribe with the Webhook address below and your META_WEBHOOK_VERIFY_TOKEN.
  5. App settings → Basic: add Privacy Policy URL, Terms URL, User data deletion URL, app icon and category.
  6. Copy the Instagram app ID and secret (shown inside the Instagram product) into INSTAGRAM_APP_ID / INSTAGRAM_APP_SECRET.
Callback address
https://api.zaynstack.com/api/connect/instagram/callback
Webhook address
https://api.zaynstack.com/api/hooks/instagram
Server variables
INSTAGRAM_APP_ID, INSTAGRAM_APP_SECRET, META_WEBHOOK_VERIFY_TOKEN
Developer console
Instagram developer console

Permissions requested

  • instagram_business_basic
  • instagram_business_content_publish
  • instagram_business_manage_comments
  • instagram_business_manage_messages
  • instagram_business_manage_insights

When a reconnect grants fewer permissions than before, an account.updated event with change permissions_reduced is sent. Accounts connected before a permission was added keep working but must reconnect to use the features it unlocks.

Before anyone can connect (review)

  1. Business verification of your company in Meta Business Manager (documents + domain).
  2. App Review: request Advanced Access for every permission listed below, each with a screencast of the feature and test instructions.
  3. Switch the app to Live mode after approval.

Typical wait: Usually 1-3 weeks including business verification. Until then the app works for your own accounts and the testers you add in the console.

Other platforms

Free to start

Your next post can go everywhere at once.

No card. Connect a profile, send a post, see it land.