Log inStart Free Trial
easyCoexistence Official APIs

How to let your customers connect Instagram to your app

Your backend calls easyCoexistence's POST /connect-sessions with channel instagram and sends the customer to the returned url, where they sign in with Instagram Login on a Business or Creator account. They come back to your redirect_url with a channel_id, and GET /channels/{id}?credentials=1 returns a token for graph.instagram.com, so your app can publish, read comments and reply to DMs.

100 posts

API-published posts an Instagram account can make in a moving 24 hours; a carousel counts as one.

JPEG

The only image format Meta supports for publishing to Instagram through the API.

24 hours

Standard window for replying to a person's Instagram DM, for most user actions; they have to write first.

1 private reply

Messages an account can send to a commenter through a private reply, within 7 days of the comment.

1 hour

How long an easyCoexistence connect link works before its session expires.

What does the customer do to connect?

Press one button. Your app creates the session with channel set to instagram, a redirect_url and your customer's id as external_ref, then sends the customer to its url. The hosted page shows your name and Continue with Instagram, which opens Instagram's own login in the same tab, so it works on phones. The customer approves access and lands on your redirect_url with status=connected and the channel_id, which your backend confirms with GET /connect-sessions/{id}.

1Your appPOST /connect-sessions with channel instagram
2Hosted pageYour name and Continue with Instagram
3Instagram LoginThe professional account approves access
4Back to youredirect_url with status and channel_id

Which Instagram accounts can connect?

Professional accounts, Business or Creator, which is what Meta's Instagram API serves. An account already connected through another service that uses easyCoexistence is refused, and the session's last_error says so; the customer removes it there first or signs in with another one. For DMs, the account also turns on Allow access to messages in the Instagram app, and the Instagram connection guide gives the path.

What token does your app get?

An Instagram user token for graph.instagram.com/v25.0, with account_id_on_meta, the account's Instagram ID, from GET /channels/{id}?credentials=1. easyCoexistence refreshes it well before its 60 days run out, and refreshing issues a new token, so fetch credentials at the start of each job rather than keeping one copy.

How does your app publish to the account?

With POST /channels/{id}/posts. ig_type picks IMAGE, CAROUSEL, REELS or STORIES, and is worked out from the media when you leave it out: several files make a carousel and one video makes a Reel. A carousel here takes 2 to 10 items, images must be JPEG, the text takes up to 2,200 characters and an Instagram post has no link field. Without publish_at it goes out now; with it, at that time, up to 90 days ahead.

A carousel on the customer's Instagram account
curl -X POST https://easycoexistence.com/api/v1/channels/$CHANNEL_ID/posts \
  -H "Authorization: Bearer $EC_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: ig_post_2291" \
  -d '{
    "text": "Three looks for the weekend.",
    "ig_type": "CAROUSEL",
    "media": [
      { "url": "https://cdn.example.com/look-1.jpg", "type": "image" },
      { "url": "https://cdn.example.com/look-2.jpg", "type": "image" },
      { "url": "https://cdn.example.com/look-3.jpg", "type": "image" }
    ]
  }'

How do comments and DMs reach your app?

Once you set a destination. PUT /channels/{id}/webhook with your URL returns that account's signing secret, and from then on its comments, mentions and DMs are forwarded as they arrive, signed with X-EC-Signature. The body holds platform, account_id, external_id and Meta's webhook entry unchanged, with changes for comments and mentions and messaging for DMs.

How does your app reply to comments and DMs?

Through Meta's Instagram API at graph.instagram.com, with the customer's token, so each reply comes from the customer's account:

  • Reply to a comment: POST /<IG_COMMENT_ID>/replies with a message.
  • Reply to a DM: POST /<IG_ID>/messages with recipient set to the person's ID and the message text, within 24 hours of their last message.
  • Private reply to a comment: the same messages edge with recipient comment_id, once per comment, within 7 days of it.
  • Hide or delete a comment: POST or DELETE on /<IG_COMMENT_ID>.

What happens when the customer's access ends?

Your events URL receives channel.disconnected when Instagram refuses the token or the owner withdraws access in Instagram's settings. A new connect session for that customer brings the account back. To end it from your side, DELETE /channels/{id} revokes access at the network and cancels the posts still waiting in the queue, and billing stops at the end of the cycle.

Common mistakes

  • Sending PNG or WebP images to Instagram. Meta publishes JPEG only, so the post is refused before it is queued; convert images first.
  • Putting a link field on an Instagram post. Instagram posts carry no link, so the request is refused; put the URL in the text.
  • Showing a Reply button on DMs older than 24 hours. Meta allows replies within the window that the person's last message opened.
  • Sending a second private reply to the same comment. Meta allows one; a follow-up waits until the person answers.
Doing this with EasyCoexistence

easyCoexistence lets your customers connect Instagram to your app through one hosted sign-in, then gives your backend a renewed token, a posts endpoint and their comments and DMs by webhook, with every connection monitored 24/7. The same calls cover WhatsApp, Facebook, TikTok, YouTube, LinkedIn and more channels. US$ 9 to US$ 0.75 per connection per month, falling as you add connections, with the first 3 days free.

easyCoexistence is a multichannel API and MCP server that connects AI agents such as Claude and ChatGPT to WhatsApp, Instagram, TikTok, Facebook and more. On WhatsApp it uses Coexistence: the business keeps using its number in the WhatsApp Business app while the AI works through Meta's official API.

Frequently asked questions

Do I need my own Meta app to connect customers' Instagram accounts?

No. Customers sign in through easyCoexistence's app, and your backend receives the token for Meta's Instagram API through the credentials call.

Can a customer connect several Instagram accounts?

Yes, one per sign-in. Create a connect session for each account with the same external_ref, and GET /channels?external_ref= lists them all for that customer.

Can my app schedule Instagram Stories?

Yes. Set ig_type to STORIES with one image or video and a publish_at time, and the queue publishes it then.

How much does easyCoexistence cost per Instagram account?

Each connected account costs US$ 9 to US$ 0.75 a month, by the band of your total connections, with the first 3 days free.

Keep reading

Connect your first channel in two minutes.

No platform reviews to wait for. Connect WhatsApp, Instagram, TikTok or another channel, then ask your AI to post, reply or report, and watch it work.

  • 3 days free
  • Cancel any time
  • Official APIs only
  • Monitored 24/7

Verified on