KosmoKrator

marketing

Instagram CLI for AI Agents

Use the Instagram CLI from KosmoKrator to call Instagram tools headlessly, return JSON, inspect schemas, and automate workflows from coding agents, scripts, and CI.

7 functions 6 read 1 write Manual OAuth token auth

Instagram CLI Setup

Instagram can be configured headlessly with `kosmokrator integrations:configure instagram`.

# Install KosmoKrator first if it is not available on PATH.
curl -fsSL https://raw.githubusercontent.com/OpenCompanyApp/kosmokrator/main/install.sh | bash

# Configure and verify this integration.
kosmokrator integrations:configure instagram --set access_token="$INSTAGRAM_ACCESS_TOKEN" --enable --read allow --write ask --json
kosmokrator integrations:doctor instagram --json
kosmokrator integrations:status --json

Credentials

Authentication type: Manual OAuth token oauth2_manual_token. Configure credentials once, then use the same stored profile from scripts, coding CLIs, Lua code mode, and the MCP gateway.

KeyEnv varTypeRequiredLabel
access_token INSTAGRAM_ACCESS_TOKEN Secret secret yes Access Token
url INSTAGRAM_URL URL url no API Base URL

Call Instagram Headlessly

Use the generic call form when another coding CLI or script needs a stable universal interface.

kosmo integrations:call instagram.instagram_list_media '{
  "limit": 1,
  "after": "example_after",
  "before": "example_before",
  "fields": "example_fields"
}' --json

Use the provider shortcut form for shorter human-facing commands.

kosmo integrations:instagram instagram_list_media '{
  "limit": 1,
  "after": "example_after",
  "before": "example_before",
  "fields": "example_fields"
}' --json

Agent Discovery Commands

These commands return structured output for coding agents that need to inspect capabilities before choosing a function.

kosmo integrations:docs instagram --json
kosmo integrations:docs instagram.instagram_list_media --json
kosmo integrations:schema instagram.instagram_list_media --json
kosmo integrations:search "Instagram" --json
kosmo integrations:list --json

All CLI Functions

Every function below can be called headlessly. The generic form is stable across all integrations; the provider shortcut is shorter but specific to Instagram.

instagram.instagram_list_media

Read read

List media published by the authenticated Instagram user. Returns media IDs, captions, types, URLs, and timestamps. Supports cursor-based pagination.

Parameters
limit, after, before, fields

Generic CLI call

kosmo integrations:call instagram.instagram_list_media '{"limit":1,"after":"example_after","before":"example_before","fields":"example_fields"}' --json

Provider shortcut

kosmo integrations:instagram instagram_list_media '{"limit":1,"after":"example_after","before":"example_before","fields":"example_fields"}' --json

instagram.instagram_get_media

Read read

Get details of a specific Instagram media item by its ID. Returns caption, media type, URL, timestamp, like count, and comment count.

Parameters
mediaId, fields

Generic CLI call

kosmo integrations:call instagram.instagram_get_media '{"mediaId":"example_mediaId","fields":"example_fields"}' --json

Provider shortcut

kosmo integrations:instagram instagram_get_media '{"mediaId":"example_mediaId","fields":"example_fields"}' --json

instagram.instagram_create_media

Write write

Publish a new media item (photo or video) to Instagram. Provide the media URL and an optional caption. The media is published immediately unless publish is set to false.

Parameters
imageUrl, caption, mediaType, publish

Generic CLI call

kosmo integrations:call instagram.instagram_create_media '{"imageUrl":"example_imageUrl","caption":"example_caption","mediaType":"example_mediaType","publish":true}' --json

Provider shortcut

kosmo integrations:instagram instagram_create_media '{"imageUrl":"example_imageUrl","caption":"example_caption","mediaType":"example_mediaType","publish":true}' --json

instagram.instagram_list_comments

Read read

List comments on a specific Instagram media item. Returns comment IDs, text, timestamps, usernames, and like counts. Supports pagination.

Parameters
mediaId, limit, after

Generic CLI call

kosmo integrations:call instagram.instagram_list_comments '{"mediaId":"example_mediaId","limit":1,"after":"example_after"}' --json

Provider shortcut

kosmo integrations:instagram instagram_list_comments '{"mediaId":"example_mediaId","limit":1,"after":"example_after"}' --json

instagram.instagram_get_comment

Read read

Get details of a specific Instagram comment by its ID. Returns the comment text, timestamp, username, and like count.

Parameters
commentId

Generic CLI call

kosmo integrations:call instagram.instagram_get_comment '{"commentId":"example_commentId"}' --json

Provider shortcut

kosmo integrations:instagram instagram_get_comment '{"commentId":"example_commentId"}' --json

instagram.instagram_list_insights

Read read

Get account-level insights and performance metrics for the authenticated Instagram user. Supports metrics like impressions, reach, follower count, and profile views with configurable time periods.

Parameters
metric, period, since, until

Generic CLI call

kosmo integrations:call instagram.instagram_list_insights '{"metric":"example_metric","period":"example_period","since":"example_since","until":"example_until"}' --json

Provider shortcut

kosmo integrations:instagram instagram_list_insights '{"metric":"example_metric","period":"example_period","since":"example_since","until":"example_until"}' --json

instagram.instagram_get_current_user

Read read

Get the currently authenticated Instagram user profile. Returns user ID, username, name, account type, media count, and follower/following counts.

Parameters
none

Generic CLI call

kosmo integrations:call instagram.instagram_get_current_user '{}' --json

Provider shortcut

kosmo integrations:instagram instagram_get_current_user '{}' --json

Function Schemas

Use these parameter tables when building CLI payloads without calling integrations:schema first.

instagram.instagram_list_media

List media published by the authenticated Instagram user. Returns media IDs, captions, types, URLs, and timestamps. Supports cursor-based pagination.

Operation
Read read
Schema command
kosmo integrations:schema instagram.instagram_list_media --json
ParameterTypeRequiredDescription
limit integer no Number of media items to return per page.
after string no Pagination cursor — return items after this cursor.
before string no Pagination cursor — return items before this cursor.
fields string no Comma-separated list of fields to return (e.g. "id,caption,media_type,media_url,permalink,timestamp,username").

instagram.instagram_get_media

Get details of a specific Instagram media item by its ID. Returns caption, media type, URL, timestamp, like count, and comment count.

Operation
Read read
Schema command
kosmo integrations:schema instagram.instagram_get_media --json
ParameterTypeRequiredDescription
mediaId string yes The media ID to retrieve.
fields string no Comma-separated list of fields to return.

instagram.instagram_create_media

Publish a new media item (photo or video) to Instagram. Provide the media URL and an optional caption. The media is published immediately unless publish is set to false.

Operation
Write write
Schema command
kosmo integrations:schema instagram.instagram_create_media --json
ParameterTypeRequiredDescription
imageUrl string yes URL of the image or video to publish.
caption string no Caption text for the media post.
mediaType string no Type of media: "IMAGE", "VIDEO", or "CAROUSEL". Defaults to "IMAGE".
publish boolean no Whether to publish immediately (default true). Set to false to create a container only.

instagram.instagram_list_comments

List comments on a specific Instagram media item. Returns comment IDs, text, timestamps, usernames, and like counts. Supports pagination.

Operation
Read read
Schema command
kosmo integrations:schema instagram.instagram_list_comments --json
ParameterTypeRequiredDescription
mediaId string yes The media ID to list comments for.
limit integer no Number of comments to return per page.
after string no Pagination cursor — return comments after this cursor.

instagram.instagram_get_comment

Get details of a specific Instagram comment by its ID. Returns the comment text, timestamp, username, and like count.

Operation
Read read
Schema command
kosmo integrations:schema instagram.instagram_get_comment --json
ParameterTypeRequiredDescription
commentId string yes The comment ID to retrieve.

instagram.instagram_list_insights

Get account-level insights and performance metrics for the authenticated Instagram user. Supports metrics like impressions, reach, follower count, and profile views with configurable time periods.

Operation
Read read
Schema command
kosmo integrations:schema instagram.instagram_list_insights --json
ParameterTypeRequiredDescription
metric string no Comma-separated list of insight metrics (e.g. "impressions,reach,profile_views,follower_count").
period string no Aggregation period: "day", "week", "days_28", "month", or "lifetime". Defaults to "day".
since string no Start date for the insight data (UNIX timestamp or ISO date).
until string no End date for the insight data (UNIX timestamp or ISO date).

instagram.instagram_get_current_user

Get the currently authenticated Instagram user profile. Returns user ID, username, name, account type, media count, and follower/following counts.

Operation
Read read
Schema command
kosmo integrations:schema instagram.instagram_get_current_user --json
ParameterTypeRequiredDescription
No parameters.

Permissions

Headless calls still follow the integration read/write permission policy. Configure read/write defaults with integrations:configure. Add --force only for trusted automation that should bypass that policy.