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
| Publishing | Yes |
|---|---|
| Scheduling | Yes |
| Comments | Yes |
| Direct messages | Yes |
| Mentions | Partly |
| Reviews | No |
| Analytics | Yes |
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.
| Key | Type | What it does |
|---|---|---|
content_type | feed | reel | carousel | stories | What 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_text | string | Alt text of the first image. Up to 1,000 characters. |
location_id | digits | Location to tag. Feed posts, Reels and carousels; not Stories. |
collaborators | string 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_url | URL | Reels: a public JPEG used as the cover. Wins over the two offsets below. |
thumb_offset | number (ms) | Reels: the frame used as the cover. `video_cover_timestamp_ms` means the same; thumb_offset wins. |
share_to_feed | boolean | Reels: also show the Reel in the profile grid. Default: Instagram's own. |
audio_name | string | Reels: 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_generated | boolean | Adds 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.
| Code | Meaning |
|---|---|
account.already_linked | The 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_limit | No 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.receiveddm.receiveddm.sent(also replies typed in the Instagram app)dm.postbackdm.referraldm.deleted(the sender unsent it)dm.status.delivered/ dm.status.readmention.received
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.
- Create an app at developers.facebook.com → My Apps → Create app → type Business.
- Add the Instagram (API setup with Instagram login) product to the app.
- Paste the Callback address shown below into Valid OAuth Redirect URIs.
- Under Webhooks, subscribe with the Webhook address below and your META_WEBHOOK_VERIFY_TOKEN.
- App settings → Basic: add Privacy Policy URL, Terms URL, User data deletion URL, app icon and category.
- 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_basicinstagram_business_content_publishinstagram_business_manage_commentsinstagram_business_manage_messagesinstagram_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)
- Business verification of your company in Meta Business Manager (documents + domain).
- App Review: request Advanced Access for every permission listed below, each with a screencast of the feature and test instructions.
- 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.