Instagram API
The Instagram API for posts, comments and DMs
Instagram is the one network where postpeg covers everything it offers: publishing, scheduling, post and account analytics, comments and direct messages. It all goes through Instagram’s official API, behind the same REST endpoints you use for the other nine networks.
- Publish
- Schedule
- Analytics
- Comments
- Messages
- Instagram88/2200image
New this week: oat flat whites and a Sunday brunch menu. Come by from 9. #coffee #brunch
Ready
The example below, checked against Instagram’s rules
That makes it a fit for products that manage Instagram for someone else: a booking tool that posts the week’s openings, a store that publishes new stock, or a support inbox that answers DMs and comments in one place.
What you can do on Instagram
- Publish. Publish to Instagram now with
POST /v1/posts, alone or in the same request as any of the other networks. More on the Posting API. - Schedule. Schedule up to a year ahead with
scheduled_at, and cancel withDELETE /v1/posts/{id}any time before it goes out. More on the Scheduling API. - Analytics. Read impressions, likes, shares and more per post with
GET /v1/posts/{id}/analytics, and follower growth withGET /v1/accounts/{id}/analytics. More on the Analytics API. - Comments. List comments on your posts, reply to them, and hide the ones you don’t want shown, with
/v1/posts/{id}/comments. More on the Comments API. - Messages. Read direct-message conversations and reply within 24 hours with
/v1/accounts/{id}/conversations. More on the Instagram DM API.
Instagram is the one network with every feature postpeg offers. The coverage table shows the rest.
Instagram’s rules, checked before sending
A Instagram post can have up to 2,200 characters, counted as people see them (an emoji is one). Media is required: up to 10 images and videos, mixed. postpeg runs these checks on every request, so a post that won’t fit Instagram is refused with a 400 before anything is published, on any network.
| Max text | 2,200 characters |
|---|---|
| Media | Required |
| Images | 10 |
| Videos | 10 |
| Images and video together | Yes |
| Required options | None |
| Connects with | Hosted OAuth |
Connecting Instagram accounts
Call POST /v1/accounts/connect with a profile and "platform": "instagram", and send the account’s owner to the URL you get back. It’s valid for 15 minutes. They approve access on Instagram’s own screen and land on your redirect_url with status=success and the new account_id.
Instagram’s official API works with professional accounts, so the owner connects a business or creator account through the hosted OAuth screen.
If Instagram ever expires a login, the account turns reconnect_required so you can ask its owner to connect again. More in Profiles and accounts.
Example: a scheduled Instagram post
One request, with an Idempotency-Key so a retry on your side never posts twice. To post to Instagram and other networks together, add more ids to account_ids.
curl https://api.postpeg.com/v1/posts \
-H "Authorization: Bearer $POSTPEG_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: instagram-example-2026-10-01" \
-d '{
"account_ids": [
"acc_mfz20b5n1s8f4j7xv2p9r6hu1c"
],
"content": "New this week: oat flat whites and a Sunday brunch menu. Come by from 9. #coffee #brunch",
"media": [
{
"url": "https://example.com/flat-white.jpg",
"type": "image",
"alt_text": "An oat flat white"
},
{
"url": "https://example.com/brunch.jpg",
"type": "image",
"alt_text": "The brunch menu"
}
],
"scheduled_at": "2026-10-01T09:00:00Z",
"platform_options": {}
}'{
"id": "post_mfz2k3v8q1w5e9r4t7y0u2i6o3",
"content": "New this week: oat flat whites and a Sunday brunch menu. Come by from 9. #coffee #brunch",
"media": [
{
"url": "https://example.com/flat-white.jpg",
"type": "image",
"alt_text": "An oat flat white"
},
{
"url": "https://example.com/brunch.jpg",
"type": "image",
"alt_text": "The brunch menu"
}
],
"platform_options": {},
"status": "scheduled",
"scheduled_at": "2026-10-01T09:00:00.000Z",
"targets": [
{
"account_id": "acc_mfz20b5n1s8f4j7xv2p9r6hu1c",
"platform": "instagram",
"status": "pending",
"platform_post_id": null,
"url": null,
"error": null,
"attempts": 0,
"published_at": null
}
],
"created_at": "2026-09-24T14:02:11.418Z"
}From 09:00 the target moves through queued and publishing to published with the live url, or to failed with the reason in error. Temporary failures are retried, up to 5 attempts with growing waits. See Publishing for every status.
Questions
- How do I schedule a Instagram post?
- Add
scheduled_at(ISO 8601, up to a year ahead) toPOST /v1/posts. The post waits asscheduledand goes out within a minute of that time.DELETE /v1/posts/{id}cancels it any time before. - What happens if a post breaks Instagram’s rules?
- postpeg checks the text (up to 2,200 characters), the media before anything is sent. A post that doesn’t fit comes back as a
400with every problem listed inissues, and nothing is published on any network. - Which Instagram features does postpeg support?
- Publishing, scheduling, analytics, comments, direct messages.
- Can I post text-only to Instagram?
- No. Every Instagram post needs at least one image or video. postpeg refuses a text-only Instagram post with a
400before anything is sent, so you can tell the user straight away. - How do Instagram carousels work?
- Send more than one item in
media: up to 10 images and videos, mixed freely. Instagram is one of only two networks (with Threads) where images and video can share a post. - Can I send the first DM to someone?
- No. Messages are for replying to people who wrote to the account first, and Instagram only allows a reply within 24 hours of their last message. Cold or bulk messages are not allowed.
Also on the line
The same request publishes to all ten networks. Often paired with Instagram:
Or see all 10: X, Facebook, LinkedIn, TikTok, YouTube, Threads, Pinterest, Bluesky and Google Business, in the platform reference.
Send your first post in a few minutes
The 7-day trial has every feature and 3 connected accounts, with no card. The quickstart takes you from a key to a published post.