Instagram API: how to publish posts

Last checked:

Start with a professional account

You can publish images and carousels to an Instagram professional account through Meta’s API. Create a media container, then publish it.

Instagram in cometpost: 1–10 JPEG images per post, up to 8 MiB each, with aspect ratios from 4:5 to 1.91:1 and captions up to 2,200 characters. We publish feed images and carousels to professional accounts. We do not publish Instagram Stories, Reels, video or text-only posts, or convert PNG files. See our Instagram product guide.

You need a business or creator account and a login setup with the right permissions. Instagram Login uses instagram_business_basic and instagram_business_content_publish. Page requirements depend on the login setup; Instagram Login does not require a linked Facebook Page. See Meta’s platform overview.

With media fetched by URL, the file must be publicly reachable when Meta fetches it. In Page-linked setups, complete Page Publishing Authorization if required. See Meta’s publishing guide.

Create, check and publish

  1. Create a container with POST /<IG_ID>/media and an image_url. For a carousel, make child containers and a parent with media_type=CAROUSEL and their IDs in children.
  2. Read GET /<CONTAINER_ID>?fields=status_code and wait for FINISHED.
  3. Call POST /<IG_ID>/media_publish with the container ID in creation_id.

See Meta’s media endpoint reference, Meta’s container reference and Meta’s publish endpoint reference. Unpublished containers expire after 24 hours; avoid creating them long before publication.

Images, carousels and alt text

Images must be JPEG. A carousel can contain up to 20 items. The alt_text field applies to single images and image items in carousels; its exclusion of Stories is a field restriction, not a ban on publishing Stories. The same reference documents media_type=STORIES. See Meta’s media endpoint reference.

Product tagging depends on the login setup. Meta’s overview lists it for Facebook Login, but not Instagram Login. Check your setup before building that feature. See Meta’s setup comparison.

Read the account’s publishing quota

Meta’s guide states both 100 and 50 published posts in a moving 24-hour period. A carousel counts as one. See Meta’s publishing guide.

Query GET /<IG_ID>/content_publishing_limit?fields=config,quota_usage. Read config.quota_total, config.quota_duration and quota_usage to use the account’s returned limit. See Meta’s publishing-limit endpoint.

Schedule in your application

The documented create-and-publish flow does not provide a future-publish parameter. An application can retain the post and call the publishing endpoints when it is due. This is our implementation guidance based on Meta’s media endpoint reference and Meta’s publish endpoint reference, rather than a native scheduling parameter.

Common failure points are an unreachable media URL, an invalid image format, missing account authorization, an exhausted publishing quota or an expired container. Check the endpoint response before retrying.

Meta Content Publishing API vs. cometpost

Two ways to publish Instagram images and carousels
TaskMeta API directlycometpost REST API
Account accessImplement a supported login flow, permissions and token management for your app.Connect your professional account in the dashboard; use a scoped bearer Credential.
Media publishingCreate media containers, check readiness and publish the parent container.Upload media, attach ready media IDs to a Post and track its Delivery. We handle the containers.
SchedulingYour application calls the publishing endpoints when the post is due.Send scheduledFor with scheduling permission, or create a draft for human review.
CarouselsUp to 20 image or video items in the documented API flow.Up to 10 JPEG images. No Instagram Stories or video.

See Meta’s publishing guide, our post API reference and media workflow.

Use cometpost’s API

We handle Instagram publishing behind a REST API and hosted MCP connection. The public OpenAPI description describes the API contract.

  • GET /v1/platforms returns capabilities.
  • GET /v1/channels lists connected accounts.
  • POST /v1/media accepts a public media URL and returns an ID for the post.

Our Instagram implementation reads the live publishing quota and reports Page Publishing Authorization errors when Meta returns them. It cannot detect that authorization requirement in advance. See our API reference.

Our limits: JPEG images, up to 10 carousel items, no Instagram Stories. YouTube uploads publish publicly with title and description only alongside the video. See our YouTube product guide.

An assistant starts with scheduling permission off. You choose its account access and review its drafts before release, unless you separately grant scheduling permission. See our API reference.

Create an Instagram draft with curl

Use a Credential with scheduling permission off for this example. Set COMETPOST_API_KEY in your shell and generate a request key once with COMETPOST_REQUEST_KEY=$(uuidgen). Keep that key if you retry this request. Replace the Channel and media IDs with your connected Instagram Channel and ready JPEG asset, then send:

curl --request POST https://api.cometpost.app/v1/posts \
  --header "Authorization: Bearer $COMETPOST_API_KEY" \
  --header "Content-Type: application/json" \
  --header "Idempotency-Key: $COMETPOST_REQUEST_KEY" \
  --data '{
    "body": "A caption for the image.",
    "channelIds": ["YOUR_INSTAGRAM_CHANNEL_ID"],
    "mediaIds": ["YOUR_READY_MEDIA_ID"]
  }'

Find the Channel with GET /v1/channels. For the media ID, upload a JPEG through the media workflow or reuse a ready asset. The quickstart covers both preparation and human review. Reuse the same idempotency key if you retry the same request after an uncertain response.

With scheduling permission off, the Post stays a draft for you to review and release. With scheduling permission on, omitting scheduledFor means publish now; to schedule ahead, include a future ISO timestamp with Z or an explicit offset. Check media expiry and your scheduling horizon before choosing the time. See Posts and the MCP guide for assistant access.

Sign in