Instagram

Learn how to use Instagram with Composio

Overview

SLUG: INSTAGRAM

Description

Instagram is a social media platform for sharing photos, videos, and stories. Only supports Instagram Business and Creator accounts, not Instagram Personal accounts.

Authentication Details

client_id
stringRequired
client_secret
stringRequired
oauth_redirect_uri
stringDefaults to https://backend.composio.dev/api/v1/auth-apps/add
scopes
stringDefaults to instagram_business_basic,instagram_business_manage_messages,instagram_business_manage_comments,instagram_business_content_publish,instagram_business_manage_insights

Connecting to Instagram

Create an auth config

Use the dashboard to create an auth config for the Instagram toolkit. This allows you to connect multiple Instagram accounts to Composio for agents to use.

1

Select App

Navigate to Instagram.

2

Configure Auth Config Settings

Select among the supported auth schemes of and configure them here.

3

Create and Get auth config ID

Click “Create Instagram Auth Config”. After creation, copy the displayed ID starting with ac_. This is your auth config ID. This is not a sensitive ID — you can save it in environment variables or a database. This ID will be used to create connections to the toolkit for a given user.

Connect Your Account

Using OAuth2

1from composio import Composio
2
3# Replace these with your actual values
4instagram_auth_config_id = "ac_YOUR_INSTAGRAM_CONFIG_ID" # Auth config ID created above
5user_id = "0000-0000-0000" # UUID from database/application
6
7composio = Composio()
8
9
10def authenticate_toolkit(user_id: str, auth_config_id: str):
11 connection_request = composio.connected_accounts.initiate(
12 user_id=user_id,
13 auth_config_id=auth_config_id,
14 )
15
16 print(
17 f"Visit this URL to authenticate Instagram: {connection_request.redirect_url}"
18 )
19
20 # This will wait for the auth flow to be completed
21 connection_request.wait_for_connection(timeout=15)
22 return connection_request.id
23
24
25connection_id = authenticate_toolkit(user_id, instagram_auth_config_id)
26
27# You can also verify the connection status using:
28connected_account = composio.connected_accounts.get(connection_id)
29print(f"Connected account: {connected_account}")

Tools

Executing tools

To prototype you can execute some tools to see the responses and working on the Instagram toolkit’s playground

For code examples, see the Tool calling guide and Provider examples.

Tool List

Tool Name: Create Media Container

Description

Create a draft media container for photos/videos/reels before publishing.

Action Parameters

caption
string
content_type
string
cover_url
string
graph_api_version
stringDefaults to v21.0
ig_user_id
string
image_url
string
is_carousel_item
boolean
media_type
string
video_url
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Create Post

Description

Publish a draft media container to Instagram (final publishing step).

Action Parameters

creation_id
stringRequired
graph_api_version
stringDefaults to v21.0
ig_user_id
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Delete Comment

Description

Tool to delete a comment on Instagram media. Use when you need to remove a comment that was created by your Instagram Business or Creator Account. Note: You can only delete comments that your account created - you cannot delete other users' comments unless they are on your own media.

Action Parameters

graph_api_version
stringDefaults to v21.0
ig_comment_id
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get Conversation

Description

Get details about a specific Instagram DM conversation (participants, etc).

Action Parameters

conversation_id
stringRequired
graph_api_version
stringDefaults to v21.0

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get IG Comment Replies

Description

Get replies to a specific Instagram comment. Returns a list of comment replies with details like text, username, timestamp, and like count. Use when you need to retrieve child comments (replies) for a specific parent comment.

Action Parameters

after
string
before
string
fields
stringDefaults to id,text,username,timestamp,like_count,hidden,from,media,parent_id,legacy_instagram_comment_id
graph_api_version
stringDefaults to v21.0
ig_comment_id
stringRequired
limit
integerDefaults to 25

Action Response

data
array
error
string
paging
object
successful
booleanRequired

Tool Name: Get Instagram Media

Description

Get Instagram Media object (photo, video, story, reel, or carousel). Use when you need to retrieve detailed information about a specific Instagram post including engagement metrics, caption, media URLs, and metadata.

Action Parameters

fields
stringDefaults to id,caption,comments_count,is_comment_enabled,like_count,media_product_type,media_type,media_url,owner,permalink,shortcode,thumbnail_url,timestamp,username
graph_api_version
stringDefaults to v21.0
ig_media_id
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get IG Media Children

Description

Tool to get media objects (images/videos) that are children of an Instagram carousel/album post. Use when you need to retrieve individual media items from a carousel album post. Note: Carousel children media do not support insights queries - for analytics, query metrics at the parent carousel level.

Action Parameters

fields
stringDefaults to id,media_type,media_url,permalink,timestamp
graph_api_version
stringDefaults to v21.0
ig_media_id
stringRequired

Action Response

data
array
error
string
successful
booleanRequired

Tool Name: Get IG Media Comments

Description

Tool to retrieve comments on an Instagram media object. Use when you need to fetch comments from a specific Instagram post, photo, video, or carousel. Supports cursor-based pagination for navigating through large comment lists.

Action Parameters

after
string
before
string
fields
stringDefaults to id,text,username,timestamp,like_count,from,hidden,media,parent_id
graph_api_version
stringDefaults to v21.0
ig_media_id
stringRequired
limit
integerDefaults to 25

Action Response

data
array
error
string
paging
object
successful
booleanRequired

Tool Name: Get IG Media Insights

Description

Tool to get insights and metrics for Instagram media objects (photos, videos, reels, carousel albums). Use when you need to retrieve performance data such as views, reach, likes, comments, saves, and shares for specific media. Note: Insights data is only available for media published within the last 2 years, and the account must have at least 1,000 followers.

Action Parameters

graph_api_version
stringDefaults to v21.0
ig_media_id
stringRequired
metric
arrayRequired
period
stringDefaults to lifetime

Action Response

data
arrayRequired
error
string
paging
object
successful
booleanRequired

Tool Name: Get IG User Content Publishing Limit

Description

Get an Instagram Business Account's current content publishing usage. Use this to monitor quota usage and avoid hitting rate limits when publishing content via the API.

Action Parameters

fields
stringDefaults to quota_usage,config
graph_api_version
stringDefaults to v21.0
ig_user_id
string

Action Response

data
array
error
string
successful
booleanRequired

Tool Name: Get IG User Live Media

Description

Get live media objects during an active Instagram broadcast. Returns the live video media ID and metadata when a live broadcast is in progress on an Instagram Business or Creator account. Use this to monitor active live streams and access real-time engagement data.

Action Parameters

fields
stringDefaults to id,media_type,media_url,timestamp,permalink
graph_api_version
stringDefaults to v21.0
ig_user_id
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get IG User Media

Description

Get Instagram user's media collection (posts, photos, videos, reels, carousels). Use when you need to retrieve all media published by an Instagram Business or Creator account with support for pagination and time-based filtering.

Action Parameters

after
string
before
string
fields
stringDefaults to id,caption,media_type,media_url,permalink,thumbnail_url,timestamp,username
ig_user_id
stringRequired
limit
integerDefaults to 25
since
integer
until
integer

Action Response

data
array
error
string
paging
object
successful
booleanRequired

Tool Name: Get IG User Stories

Description

Get active story media objects for an Instagram Business or Creator account. Returns stories that are currently active within the 24-hour window. Use this to retrieve story content, metadata, and engagement metrics for monitoring or analytics purposes.

Action Parameters

after
string
before
string
fields
stringDefaults to id,media_type,media_url,permalink,timestamp
graph_api_version
stringDefaults to v21.0
ig_user_id
string
limit
integer

Action Response

data
array
error
string
paging
object
successful
booleanRequired

Tool Name: Get IG User Tags

Description

Get Instagram media where the user has been tagged by other users. Use when you need to retrieve all media in which an Instagram Business or Creator account has been tagged, including tags in captions, comments, or on the media itself.

Action Parameters

after
string
before
string
fields
stringDefaults to id,caption,media_type,media_url,permalink,timestamp,username
ig_user_id
stringRequired
limit
integerDefaults to 25

Action Response

data
array
error
string
paging
object
successful
booleanRequired

Tool Name: Get Post Comments

Description

Get comments on an Instagram post.

Action Parameters

after
string
graph_api_version
stringDefaults to v21.0
ig_post_id
stringRequired
limit
integerDefaults to 25

Action Response

data
array
error
string
paging
object
successful
booleanRequired

Tool Name: Get Post Insights

Description

Get Instagram post insights/analytics (impressions, reach, engagement, etc.).

Action Parameters

graph_api_version
stringDefaults to v21.0
ig_post_id
stringRequired
metric
array
metric_preset
stringDefaults to auto_safe

Action Response

data
arrayRequired
error
string
paging
object
successful
booleanRequired

Tool Name: Get Post Status

Description

Check the processing status of a draft post container.

Action Parameters

creation_id
stringRequired
graph_api_version
stringDefaults to v21.0

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get User Info

Description

Get Instagram user info including profile details and statistics.

Action Parameters

graph_api_version
stringDefaults to v21.0
ig_user_id
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get User Insights

Description

Get Instagram account-level insights and analytics (profile views, reach, follower count, etc.). metric_type (time_series or total_value): When set to total_value, the API returns a total_value object instead of values. breakdown: Only applicable when metric_type=total_value and only for supported metrics. timeframe: Required for demographics-related metrics and overrides since/until for those metrics.

Action Parameters

breakdown
string
graph_api_version
stringDefaults to v21.0
ig_user_id
string
metric
array
metric_type
string
period
stringDefaults to day
since
integer
timeframe
string
until
integer

Action Response

data
array
error
string
paging
object
successful
booleanRequired

Tool Name: Get User Media

Description

Get Instagram user's media (posts, photos, videos).

Action Parameters

after
string
graph_api_version
stringDefaults to v21.0
ig_user_id
string
limit
integerDefaults to 25

Action Response

data
array
error
string
paging
object
successful
booleanRequired

Tool Name: List All Conversations

Description

Get all Instagram DM conversations for the authenticated user.

Action Parameters

after
string
graph_api_version
stringDefaults to v21.0
ig_user_id
string
limit
integerDefaults to 25

Action Response

data
array
error
string
paging
object
successful
booleanRequired

Tool Name: List All Messages

Description

List all messages from a specific Instagram DM conversation.

Action Parameters

after
string
conversation_id
stringRequired
graph_api_version
stringDefaults to v21.0
limit
integerDefaults to 25

Action Response

data
array
error
string
paging
object
successful
booleanRequired

Tool Name: Mark Seen

Description

Mark Instagram DM messages as read/seen for a specific user.

Action Parameters

graph_api_version
stringDefaults to v21.0
recipient_id
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Post IG Comment Replies

Description

Tool to create a reply to an Instagram comment. Use when you need to reply to a specific comment on an Instagram post owned by a Business or Creator account. The reply must be 300 characters or less, contain at most 4 hashtags and 1 URL, and cannot consist entirely of capital letters.

Action Parameters

graph_api_version
stringDefaults to v21.0
ig_comment_id
stringRequired
message
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Post IG Media Comments

Description

Tool to create a comment on an Instagram media object. Use when you need to post a comment on a specific Instagram post, photo, video, or carousel. The comment must be 300 characters or less, contain at most 4 hashtags and 1 URL, and cannot consist entirely of capital letters.

Action Parameters

graph_api_version
stringDefaults to v21.0
ig_media_id
stringRequired
message
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Post IG User Media

Description

Tool to create a media container for Instagram posts. Use this to create a container for images, videos, Reels, or carousels. This is the first step in Instagram's two-step publishing process - after creating the container, use the media_publish endpoint to publish it.

Action Parameters

audio_name
string
caption
string
children
array
collaborators
array
cover_url
string
graph_api_version
stringDefaults to v21.0
ig_user_id
stringRequired
image_url
string
is_carousel_item
boolean
location_id
string
media_type
string
share_to_feed
boolean
thumb_offset
integer
user_tags
array
video_url
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Publish IG User Media

Description

Tool to publish a media container to an Instagram Business account. Use this after creating a media container and confirming it has status 'FINISHED'. This is the second step in Instagram's two-step publishing process. Rate limited to 25 API-published posts per 24-hour moving window.

Action Parameters

creation_id
stringRequired
graph_api_version
stringDefaults to v21.0
ig_user_id
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Reply to IG User Mentions

Description

Tool to reply to a mention of your Instagram Business or Creator account. Use when you need to respond to comments or media captions where your account has been @mentioned by another Instagram user. This creates a comment on the media or comment containing the mention.

Action Parameters

comment_id
string
graph_api_version
stringDefaults to v21.0
ig_user_id
stringRequired
media_id
stringRequired
message
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Reply To Comment

Description

Reply to a comment on Instagram media.

Action Parameters

graph_api_version
stringDefaults to v21.0
ig_comment_id
stringRequired
message
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Send Image

Description

Send an image via Instagram DM to a specific user.

Action Parameters

caption
string
graph_api_version
stringDefaults to v21.0
image_url
stringRequired
recipient_id
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Send Text Message

Description

Send a text message to an Instagram user via DM.

Action Parameters

graph_api_version
stringDefaults to v21.0
ig_user_id
string
recipient_id
stringRequired
reply_to_message_id
string
text
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired