Skip to content
Scalekit Docs

Instagram

scalekit30 toolsOAuth 2.0MarketingCommunication

Instagram Graph API for Business and Creator accounts — publish media (image/video/carousel/reels), read media and insights, manage comments, track...

Instagram connector

  1. Terminal window
    npm install @scalekit-sdk/node

    Full SDK reference: Node.js | Python

  2. Add your Scalekit credentials to your .env file. Find values in app.scalekit.com > Developers > API Credentials.

    .env
    SCALEKIT_ENVIRONMENT_URL=<your-environment-url>
    SCALEKIT_CLIENT_ID=<your-client-id>
    SCALEKIT_CLIENT_SECRET=<your-client-secret>
  3. Register your Instagram credentials with Scalekit so it handles the token lifecycle. You do this once per environment.

    Dashboard setup steps

    Create a Meta app with Facebook Login enabled so Scalekit can authorize access to your Instagram Business or Creator account on behalf of your users. You’ll register the Scalekit redirect URI in the app, then add the app’s ID and secret to your Scalekit connection.

    1. Create or open a Meta app

      • Go to the Meta for Developers dashboard.

      • Select an existing app or click Create App and choose the Business app type.

        Meta app dashboard showing app ID, app mode, and available products

    2. Add the Instagram Graph API and Facebook Login products

      • From the app’s Add Product page, add Instagram Graph API so the app can read and publish content on Instagram Business and Creator accounts.

      • Add Facebook Login as well, since Scalekit uses it to run the OAuth authorization flow.

        App switcher dropdown for selecting or creating a Meta app

    3. Copy the redirect URI from Scalekit

      • In the Scalekit dashboard, go to AgentKit > Connections > Create Connection. Find Instagram and click Create.

      • Click Use your own credentials and copy the redirect URI. It looks like https://<SCALEKIT_ENVIRONMENT_URL>/sso/v1/oauth/<CONNECTION_ID>/callback.

    4. Add the redirect URI to Facebook Login settings

      • In your Meta app, go to Facebook Login > Settings.

      • Paste the redirect URI you copied into Valid OAuth Redirect URIs and save changes.

        Facebook Login settings showing the Valid OAuth Redirect URIs list

    5. Copy your App ID and App secret

      • Go to App settings > Basic.

      • Copy the App ID and click Show to reveal and copy the App secret.

        App settings Basic page showing App ID and App secret fields

    6. Add credentials in Scalekit

      • Return to the connection you created in Scalekit and enter:

        • Client ID — your Meta app’s App ID
        • Client Secret — your Meta app’s App secret
      • Click Save.

  4. quickstart.ts
    import { ScalekitClient } from '@scalekit-sdk/node'
    import 'dotenv/config'
    const scalekit = new ScalekitClient(
    process.env.SCALEKIT_ENV_URL,
    process.env.SCALEKIT_CLIENT_ID,
    process.env.SCALEKIT_CLIENT_SECRET,
    )
    const actions = scalekit.actions
    const connector = 'instagram'
    const identifier = 'user_123'
    // Generate an authorization link for the user
    const { link } = await actions.getAuthorizationLink({ connectionName: connector, identifier })
    console.log('Authorize Instagram:', link)
    process.stdout.write('Press Enter after authorizing...')
    await new Promise(r => process.stdin.once('data', r))
    // Make your first call
    const result = await actions.executeTool({
    connector,
    identifier,
    toolName: 'instagram_comment_replies_list',
    toolInput: { comment_id: 'YOUR_COMMENT_ID' },
    })
    console.log(result)

Connect this agent connector to let your agent:

  • Get user, oembed, media insights — Get an Instagram Business/Creator account’s profile info (username, bio, follower count, media count, etc.)
  • List tagged media, stories, recently searched hashtags — List media where the connected Instagram professional account has been photo-tagged by other accounts
  • Send sender action, message, message attachment — Send a typing indicator or mark-as-seen signal in an Instagram Direct conversation
  • Publish media — Step 2 of the Instagram publish flow: publish a previously created media container (from instagram_media_container_create) to the account’s feed
  • Create media container, comment reply, comment private reply — Step 1 of the Instagram publish flow: create a media container (image, video, reel, or carousel item) from a source URL
  • Search hashtag — Look up an Instagram hashtag by name to get its hashtag ID

Use the exact tool names from the Tool list below when you call execute_tool. If you’re not sure which name to use, list the tools available for the current user first.

instagram_account_insights_get#Get account-level Instagram insights (impressions, reach, profile views, follower count) over a period or date range.5 params

Get account-level Instagram insights (impressions, reach, profile views, follower count) over a period or date range.

NameTypeRequiredDescription
ig_user_idstringrequiredThe Instagram professional account ID.
metricstringrequiredComma-separated list of metric names to retrieve.
periodstringoptionalAggregation period for the metrics.
sinceintegeroptionalStart of the date range (Unix timestamp).
untilintegeroptionalEnd of the date range (Unix timestamp).
instagram_business_discovery_get#Look up the public profile and recent media of any other Instagram professional (Business or Creator) account by username, without needing to connect that account. Returns username, name, website, followers_count, media_count, biography, profile_picture_url, and recent media summaries for the target account. Use this for competitor or influencer research. Use instagram_user_get_profile instead when looking up the connected account's own profile. Requires the connected account's ig_user_id and the instagram_basic permission; the target account must itself be a public Business or Creator account.2 params

Look up the public profile and recent media of any other Instagram professional (Business or Creator) account by username, without needing to connect that account. Returns username, name, website, followers_count, media_count, biography, profile_picture_url, and recent media summaries for the target account. Use this for competitor or influencer research. Use instagram_user_get_profile instead when looking up the connected account's own profile. Requires the connected account's ig_user_id and the instagram_basic permission; the target account must itself be a public Business or Creator account.

NameTypeRequiredDescription
ig_user_idstringrequiredThe connected Instagram professional account's ID performing the lookup.
target_usernamestringrequiredThe Instagram username of the other public Business or Creator account to look up (without the @ symbol).
instagram_comment_delete#Permanently delete a comment or reply on an Instagram media object.1 param

Permanently delete a comment or reply on an Instagram media object.

NameTypeRequiredDescription
comment_idstringrequiredThe Instagram comment ID to delete.
instagram_comment_hide_update#Hide or unhide a comment on an Instagram media object without deleting it.2 params

Hide or unhide a comment on an Instagram media object without deleting it.

NameTypeRequiredDescription
comment_idstringrequiredThe Instagram comment ID to hide or unhide.
hidebooleanrequiredSet true to hide the comment, false to unhide it.
instagram_comment_private_reply_create#Send a private Instagram Direct message to the author of a public comment, without posting a visible public reply. Returns the recipient id and the new message id. Use this to move a public conversation to DMs (e.g. for order support or sensitive details). Use instagram_comment_reply_create instead for a visible public reply. Requires the comment_id being replied to and the instagram_manage_messages permission; only available within a limited window after the comment was posted.2 params

Send a private Instagram Direct message to the author of a public comment, without posting a visible public reply. Returns the recipient id and the new message id. Use this to move a public conversation to DMs (e.g. for order support or sensitive details). Use instagram_comment_reply_create instead for a visible public reply. Requires the comment_id being replied to and the instagram_manage_messages permission; only available within a limited window after the comment was posted.

NameTypeRequiredDescription
comment_idstringrequiredThe ID of the public comment to send a private reply to.
messagestringrequiredText content of the private message.
instagram_comment_replies_list#List replies to a specific Instagram comment, cursor-paginated.4 params

List replies to a specific Instagram comment, cursor-paginated.

NameTypeRequiredDescription
comment_idstringrequiredThe Instagram comment ID to list replies for.
afterstringoptionalPagination cursor to fetch the next page of results.
fieldsstringoptionalComma-separated list of fields to return per reply.
limitintegeroptionalMax number of replies to return per page.
instagram_comment_reply_create#Reply to a comment on an Instagram media object.2 params

Reply to a comment on an Instagram media object.

NameTypeRequiredDescription
comment_idstringrequiredThe Instagram comment ID to reply to.
messagestringrequiredThe reply text.
instagram_comments_list#List top-level comments on an Instagram media object, cursor-paginated.4 params

List top-level comments on an Instagram media object, cursor-paginated.

NameTypeRequiredDescription
media_idstringrequiredThe Instagram media ID to list comments on.
afterstringoptionalPagination cursor to fetch the next page of results.
fieldsstringoptionalComma-separated list of fields to return per comment.
limitintegeroptionalMax number of comments to return per page.
instagram_content_publishing_limit_get#Check how much of the Instagram account's daily content publishing quota has been used. Returns the configured quota (config) and current usage count (quota_usage) — accounts can typically publish up to 25 posts within a rolling 24-hour window. Use this before a bulk-publishing run to confirm quota is available, avoiding failed instagram_media_publish calls. Requires the account's ig_user_id and the instagram_content_publish permission.2 params

Check how much of the Instagram account's daily content publishing quota has been used. Returns the configured quota (config) and current usage count (quota_usage) — accounts can typically publish up to 25 posts within a rolling 24-hour window. Use this before a bulk-publishing run to confirm quota is available, avoiding failed instagram_media_publish calls. Requires the account's ig_user_id and the instagram_content_publish permission.

NameTypeRequiredDescription
ig_user_idstringrequiredThe Instagram professional account ID to check the publishing quota for.
fieldsstringoptionalComma-separated list of fields to return. Defaults to config and quota_usage.
instagram_conversation_messages_list#List the messages within a single Instagram Direct conversation. Returns the conversation id along with a messages array containing each message's id, created_time, from, to, and text. Use this after instagram_conversations_list to read a specific thread's message history. Requires the conversation_id from instagram_conversations_list and the instagram_manage_messages permission.2 params

List the messages within a single Instagram Direct conversation. Returns the conversation id along with a messages array containing each message's id, created_time, from, to, and text. Use this after instagram_conversations_list to read a specific thread's message history. Requires the conversation_id from instagram_conversations_list and the instagram_manage_messages permission.

NameTypeRequiredDescription
conversation_idstringrequiredThe ID of the conversation to fetch messages for, from instagram_conversations_list.
fieldsstringoptionalComma-separated list of fields to return, typically the nested messages field expansion.
instagram_conversations_list#List Instagram Direct conversations for a connected professional account. Returns a paginated array of conversations with id, updated_time, and participants. Use this to see who has messaged the account. Use instagram_conversation_messages_list to fetch the messages inside one conversation. Requires the instagram_manage_messages permission.3 params

List Instagram Direct conversations for a connected professional account. Returns a paginated array of conversations with id, updated_time, and participants. Use this to see who has messaged the account. Use instagram_conversation_messages_list to fetch the messages inside one conversation. Requires the instagram_manage_messages permission.

NameTypeRequiredDescription
ig_user_idstringrequiredThe Instagram professional account ID whose Direct conversations should be listed.
fieldsstringoptionalComma-separated list of conversation fields to return per item.
limitintegeroptionalMaximum number of conversations to return in this page.
instagram_hashtag_recent_media_list#List the most recent public media posts tagged with a given Instagram hashtag. Returns a paginated array of media objects with id, caption, media_type, media_url, permalink, and timestamp. Use this to monitor fresh activity around a hashtag. Use instagram_hashtag_top_media_list for the hashtag's most popular posts instead. Requires the hashtag_id from instagram_hashtag_search and the account's ig_user_id.3 params

List the most recent public media posts tagged with a given Instagram hashtag. Returns a paginated array of media objects with id, caption, media_type, media_url, permalink, and timestamp. Use this to monitor fresh activity around a hashtag. Use instagram_hashtag_top_media_list for the hashtag's most popular posts instead. Requires the hashtag_id from instagram_hashtag_search and the account's ig_user_id.

NameTypeRequiredDescription
hashtag_idstringrequiredThe ID of the hashtag to fetch recent media for, from instagram_hashtag_search.
ig_user_idstringrequiredThe Instagram professional account ID performing the query.
fieldsstringoptionalComma-separated list of media fields to return per item.
instagram_hashtag_top_media_list#List the most popular public media posts tagged with a given Instagram hashtag. Returns a paginated array of media objects with id, caption, media_type, media_url, permalink, and timestamp. Use this for competitive or trend analysis of a hashtag's top-performing content. Use instagram_hashtag_recent_media_list for the newest posts instead. Requires the hashtag_id from instagram_hashtag_search and the account's ig_user_id.3 params

List the most popular public media posts tagged with a given Instagram hashtag. Returns a paginated array of media objects with id, caption, media_type, media_url, permalink, and timestamp. Use this for competitive or trend analysis of a hashtag's top-performing content. Use instagram_hashtag_recent_media_list for the newest posts instead. Requires the hashtag_id from instagram_hashtag_search and the account's ig_user_id.

NameTypeRequiredDescription
hashtag_idstringrequiredThe ID of the hashtag to fetch top media for, from instagram_hashtag_search.
ig_user_idstringrequiredThe Instagram professional account ID performing the query.
fieldsstringoptionalComma-separated list of media fields to return per item.
instagram_media_children_list#List the child media items (photos/videos) inside an Instagram carousel album post. Returns an array of child media objects with id, media_type, media_url, and permalink. Use this to enumerate a carousel's individual items directly. instagram_media_get with fields=children{...} returns the same data inline if you're already fetching the parent post. Requires the media_id of a CAROUSEL_ALBUM item, typically obtained from instagram_media_list.2 params

List the child media items (photos/videos) inside an Instagram carousel album post. Returns an array of child media objects with id, media_type, media_url, and permalink. Use this to enumerate a carousel's individual items directly. instagram_media_get with fields=children{...} returns the same data inline if you're already fetching the parent post. Requires the media_id of a CAROUSEL_ALBUM item, typically obtained from instagram_media_list.

NameTypeRequiredDescription
media_idstringrequiredThe ID of the parent CAROUSEL_ALBUM media item whose children should be listed.
fieldsstringoptionalComma-separated list of fields to return per child media item.
instagram_media_container_create#Step 1 of the Instagram publish flow: create a media container (image, video, reel, or carousel item) from a source URL. Poll instagram_media_container_status_get before publishing, then call instagram_media_publish with the returned container id.7 params

Step 1 of the Instagram publish flow: create a media container (image, video, reel, or carousel item) from a source URL. Poll instagram_media_container_status_get before publishing, then call instagram_media_publish with the returned container id.

NameTypeRequiredDescription
ig_user_idstringrequiredThe Instagram professional account ID to create the container under.
captionstringoptionalCaption text for the post (ignored for carousel item containers — set it on the parent carousel container instead).
childrenstringoptionalComma-separated list of child container IDs (max 10) — only used when media_type is CAROUSEL.
image_urlstringoptionalPublicly accessible URL of the image to post. Required unless video_url is given.
is_carousel_itembooleanoptionalSet true when this container is a child item of a carousel (do not publish it directly).
media_typestringoptionalMedia type of the container: VIDEO, REELS, or CAROUSEL. Omit for a plain image post.
video_urlstringoptionalPublicly accessible URL of the video to post. Required unless image_url is given.
instagram_media_container_status_get#Poll the processing status of a media container before publishing it — required for video/reels containers, which process asynchronously.1 param

Poll the processing status of a media container before publishing it — required for video/reels containers, which process asynchronously.

NameTypeRequiredDescription
container_idstringrequiredThe media container ID to check.
instagram_media_get#Get details of a single Instagram media object (image, video, carousel, or reel) by ID.2 params

Get details of a single Instagram media object (image, video, carousel, or reel) by ID.

NameTypeRequiredDescription
media_idstringrequiredThe Instagram media ID.
fieldsstringoptionalComma-separated list of fields to return.
instagram_media_insights_get#Get performance metrics for a single Instagram media object (engagement, impressions, reach, saved, likes, comments, shares, plays).2 params

Get performance metrics for a single Instagram media object (engagement, impressions, reach, saved, likes, comments, shares, plays).

NameTypeRequiredDescription
media_idstringrequiredThe Instagram media ID to get insights for.
metricstringrequiredComma-separated list of metric names to retrieve.
instagram_media_list#List media (posts, reels, stories) published on an Instagram account, cursor-paginated.4 params

List media (posts, reels, stories) published on an Instagram account, cursor-paginated.

NameTypeRequiredDescription
ig_user_idstringrequiredThe Instagram professional account ID.
afterstringoptionalPagination cursor to fetch the next page of results.
fieldsstringoptionalComma-separated list of fields to return per media item.
limitintegeroptionalMax number of media items to return per page.
instagram_media_publish#Step 2 of the Instagram publish flow: publish a previously created media container (from instagram_media_container_create) to the account's feed.2 params

Step 2 of the Instagram publish flow: publish a previously created media container (from instagram_media_container_create) to the account's feed.

NameTypeRequiredDescription
creation_idstringrequiredThe container ID returned from instagram_media_container_create.
ig_user_idstringrequiredThe Instagram professional account ID publishing the container.
instagram_mentions_list#Discover @mentions of this Instagram account in a specific comment or media caption, via Graph API field-expansion on the account node.2 params

Discover @mentions of this Instagram account in a specific comment or media caption, via Graph API field-expansion on the account node.

NameTypeRequiredDescription
fieldsstringrequiredGraph API field-expansion string naming the mentioned comment or media, and which sub-fields to return.
ig_user_idstringrequiredThe Instagram professional account ID that was mentioned.
instagram_message_attachment_send#Send an image, video, or audio attachment via Instagram Direct message from a connected professional account to a specific recipient. Returns the recipient id and the new message id. Use this instead of instagram_message_send when sharing media rather than plain text, within the standard 24-hour messaging window. Requires the recipient's Instagram-scoped user ID (IGSID), a publicly accessible attachment URL, and the instagram_manage_messages permission.4 params

Send an image, video, or audio attachment via Instagram Direct message from a connected professional account to a specific recipient. Returns the recipient id and the new message id. Use this instead of instagram_message_send when sharing media rather than plain text, within the standard 24-hour messaging window. Requires the recipient's Instagram-scoped user ID (IGSID), a publicly accessible attachment URL, and the instagram_manage_messages permission.

NameTypeRequiredDescription
attachment_typestringrequiredThe type of media being sent.
attachment_urlstringrequiredPublicly accessible URL of the image, video, or audio file to send.
ig_user_idstringrequiredThe Instagram professional account ID sending the attachment.
recipient_idstringrequiredThe Instagram-scoped user ID (IGSID) of the message recipient, obtained from a prior conversation or message webhook.
instagram_message_send#Send an Instagram Direct text message from a connected professional account to a specific recipient. Returns the recipient id and the new message id. Use this to reply within the standard 24-hour messaging window after a user has messaged the account. Use instagram_conversations_list and instagram_conversation_messages_list to find the recipient's scoped ID first. Requires the recipient's Instagram-scoped user ID (IGSID) and the instagram_manage_messages permission.3 params

Send an Instagram Direct text message from a connected professional account to a specific recipient. Returns the recipient id and the new message id. Use this to reply within the standard 24-hour messaging window after a user has messaged the account. Use instagram_conversations_list and instagram_conversation_messages_list to find the recipient's scoped ID first. Requires the recipient's Instagram-scoped user ID (IGSID) and the instagram_manage_messages permission.

NameTypeRequiredDescription
ig_user_idstringrequiredThe Instagram professional account ID sending the message.
recipient_idstringrequiredThe Instagram-scoped user ID (IGSID) of the message recipient, obtained from a prior conversation or message webhook.
textstringrequiredText content of the message to send.
instagram_oembed_get#Get embeddable HTML and thumbnail info for any public Instagram post or reel URL. Returns oEmbed fields such as html (the embed markup), author_name, thumbnail_url, width, and height. Use this to embed an Instagram post/reel in a webpage or preview its thumbnail, without needing the account's own ig_user_id. Works for any public post URL; the connected account's own access token is used to authorize the request.4 params

Get embeddable HTML and thumbnail info for any public Instagram post or reel URL. Returns oEmbed fields such as html (the embed markup), author_name, thumbnail_url, width, and height. Use this to embed an Instagram post/reel in a webpage or preview its thumbnail, without needing the account's own ig_user_id. Works for any public post URL; the connected account's own access token is used to authorize the request.

NameTypeRequiredDescription
urlstringrequiredThe public URL of the Instagram post or reel to embed, e.g. https://www.instagram.com/p/Cabcdefghij/.
hidecaptionbooleanoptionalWhether to omit the post's caption from the returned embed HTML.
maxwidthintegeroptionalMaximum width in pixels for the returned embed HTML/thumbnail.
omitscriptbooleanoptionalWhether to omit the embed.js script tag from the returned HTML (set true if the page already loads it once).
instagram_recently_searched_hashtags_list#List the hashtags this Instagram account has recently searched for via instagram_hashtag_search. Returns each hashtag's id and name — the Hashtag Search API allows only 30 unique hashtags to be queried per rolling 7-day window per account. Use this to check remaining hashtag-search quota before calling instagram_hashtag_search again with a new hashtag. Requires the account's ig_user_id.2 params

List the hashtags this Instagram account has recently searched for via instagram_hashtag_search. Returns each hashtag's id and name — the Hashtag Search API allows only 30 unique hashtags to be queried per rolling 7-day window per account. Use this to check remaining hashtag-search quota before calling instagram_hashtag_search again with a new hashtag. Requires the account's ig_user_id.

NameTypeRequiredDescription
ig_user_idstringrequiredThe Instagram professional account ID to check recently searched hashtags for.
fieldsstringoptionalComma-separated list of fields to return per hashtag. Defaults to id and name.
instagram_sender_action_send#Send a typing indicator or mark-as-seen signal in an Instagram Direct conversation. Returns a success confirmation; no message is created. Use this to show the recipient a typing indicator (TYPING_ON/TYPING_OFF) or to mark their last message as seen (MARK_SEEN), around instagram_message_send or instagram_message_attachment_send calls. Requires the recipient's Instagram-scoped user ID (IGSID) and the instagram_manage_messages permission.3 params

Send a typing indicator or mark-as-seen signal in an Instagram Direct conversation. Returns a success confirmation; no message is created. Use this to show the recipient a typing indicator (TYPING_ON/TYPING_OFF) or to mark their last message as seen (MARK_SEEN), around instagram_message_send or instagram_message_attachment_send calls. Requires the recipient's Instagram-scoped user ID (IGSID) and the instagram_manage_messages permission.

NameTypeRequiredDescription
ig_user_idstringrequiredThe Instagram professional account ID sending the sender action.
recipient_idstringrequiredThe Instagram-scoped user ID (IGSID) of the conversation participant.
sender_actionstringrequiredThe sender action to send.
instagram_stories_list#List the currently active (not yet expired) stories posted by a connected Instagram professional account. Returns an array of story media objects with id, media_type, media_url, permalink, and timestamp. Stories drop off this list 24 hours after posting. Use this to review or archive active stories. Use instagram_media_list for the account's permanent feed posts instead. Requires the account's ig_user_id.2 params

List the currently active (not yet expired) stories posted by a connected Instagram professional account. Returns an array of story media objects with id, media_type, media_url, permalink, and timestamp. Stories drop off this list 24 hours after posting. Use this to review or archive active stories. Use instagram_media_list for the account's permanent feed posts instead. Requires the account's ig_user_id.

NameTypeRequiredDescription
ig_user_idstringrequiredThe Instagram professional account ID whose active stories should be listed.
fieldsstringoptionalComma-separated list of story fields to return per item.
instagram_tagged_media_list#List media where the connected Instagram professional account has been photo-tagged by other accounts. Returns a paginated array of media objects with id, caption, media_type, media_url, permalink, timestamp, and the tagging account's username. Use this to monitor photo tags of the account. Use instagram_mentions_list instead to look up a specific @mention inside a known comment or caption by ID. Requires the account's ig_user_id.3 params

List media where the connected Instagram professional account has been photo-tagged by other accounts. Returns a paginated array of media objects with id, caption, media_type, media_url, permalink, timestamp, and the tagging account's username. Use this to monitor photo tags of the account. Use instagram_mentions_list instead to look up a specific @mention inside a known comment or caption by ID. Requires the account's ig_user_id.

NameTypeRequiredDescription
ig_user_idstringrequiredThe Instagram professional account ID whose tags should be listed.
fieldsstringoptionalComma-separated list of media fields to return per item.
limitintegeroptionalMaximum number of tagged media items to return in this page.
instagram_user_get_profile#Get an Instagram Business/Creator account's profile info (username, bio, follower count, media count, etc.).2 params

Get an Instagram Business/Creator account's profile info (username, bio, follower count, media count, etc.).

NameTypeRequiredDescription
ig_user_idstringrequiredThe Instagram professional (Business/Creator) account ID.
fieldsstringoptionalComma-separated list of fields to return.