gram
Instagram CLI for viewing feeds, posts, profiles, and engagement via cookies.
Best use case
gram is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Instagram CLI for viewing feeds, posts, profiles, and engagement via cookies.
Teams using gram should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/gram/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How gram Compares
| Feature / Agent | gram | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Instagram CLI for viewing feeds, posts, profiles, and engagement via cookies.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# gram 📸
Instagram CLI using REST/GraphQL API + cookie auth.
## Install
```bash
# npm/pnpm/bun
npm install -g @cyberdrk/gram
# One-shot (no install)
bunx @cyberdrk/gram whoami
```
## Authentication
`gram` uses cookie-based auth from your Instagram web session.
Use `--session-id`, `--csrf-token`, and `--ds-user-id` to pass cookies directly, or `--cookie-source` for browser cookies.
Run `gram check` to see which source is active. For Arc/Brave, use `--chrome-profile-dir <path>`.
## Commands
### Account & Auth
```bash
gram whoami # Show logged-in account
gram check # Show credential sources
gram query-ids --refresh # Refresh GraphQL query ID cache
```
### Reading Posts
```bash
gram post <shortcode-or-url> # View a post
gram <shortcode-or-url> # Shorthand for post
gram comments <shortcode> -n 20 # View comments on a post
gram likers <shortcode> # View users who liked a post
```
### Feeds
```bash
gram feed -n 20 # Home feed
gram explore -n 20 # Explore/discover feed
```
### User Profiles
```bash
gram user <username> # View user profile
gram user @instagram --json # JSON output
gram posts <username> -n 20 # User's posts
gram following [username] # Users someone follows (defaults to you)
gram followers [username] # Someone's followers (defaults to you)
```
### Search
```bash
gram search "query" # Search users, hashtags, places
gram search "coffee" --type users
gram search "nyc" --type places
gram search "#photography" --type hashtags
```
### Engagement Actions
```bash
gram like <shortcode> # Like a post
gram unlike <shortcode> # Unlike a post
gram save <shortcode> # Save/bookmark a post
gram unsave <shortcode> # Unsave a post
gram comment <shortcode> "nice!" # Comment on a post
gram follow <username> # Follow a user
gram unfollow <username> # Unfollow a user
```
## Output Options
```bash
--json # JSON output
--json-full # JSON with raw API response in _raw field
--plain # No emoji, no color (script-friendly)
--no-emoji # Disable emoji
--no-color # Disable ANSI colors (or set NO_COLOR=1)
```
## Global Options
```bash
--session-id <token> # Instagram sessionid cookie
--csrf-token <token> # Instagram csrftoken cookie
--ds-user-id <id> # Instagram ds_user_id cookie
--cookie-source <source> # Cookie source for browser cookies (repeatable)
--chrome-profile <name> # Chrome profile name
--chrome-profile-dir <path> # Chrome/Chromium profile dir or cookie DB path
--firefox-profile <name> # Firefox profile
--timeout <ms> # Request timeout
--cookie-timeout <ms> # Cookie extraction timeout
```
## Config File
`~/.config/gram/config.json5` (global) or `./.gramrc.json5` (project):
```json5
{
cookieSource: ["safari", "chrome"],
chromeProfile: "Profile 1",
timeoutMs: 60000
}
```
Environment variables: `GRAM_TIMEOUT_MS`, `GRAM_COOKIE_TIMEOUT_MS`
## Troubleshooting
### Query IDs stale (404 errors)
```bash
gram query-ids --refresh
```
### Cookie extraction fails
- Check browser is logged into Instagram
- Try different `--cookie-source`
- For Arc/Brave: use `--chrome-profile-dir`
- Provide cookies manually: `--session-id`, `--csrf-token`, `--ds-user-id`
### User-agent mismatch errors
- The CLI uses desktop user-agent by default
- If your session was created on mobile, it may fail
- Create a new session by logging in via desktop browser
---
**TL;DR**: View feeds, profiles, search, and engage with Instagram via CLI. 📸Related Skills
quackgram
Send and receive messages between AI agents on any platform via QuackGram.
telegram-create-bot
Build and manage Telegram bots via the Telegram Bot API. Create bots, send messages, handle webhooks, manage groups and channels.
referral-program
When the user wants to create, optimize, or analyze a referral program, affiliate program, or word-of-mouth strategy. Also use when the user mentions 'referral,' 'affiliate,' 'ambassador,' 'word of mouth,' 'viral loop,' 'refer a friend,' or 'partner program.' This skill covers program design, incentive structure, and growth optimization.
programmatic-seo
When the user wants to create SEO-driven pages at scale using templates and data. Also use when the user mentions "programmatic SEO," "template pages," "pages at scale," "directory pages," "location pages," "[keyword] + [city] pages," "comparison pages," "integration pages," or "building many pages for SEO." For auditing existing SEO issues, see seo-audit.
apipick-telegram-phone-check
Check if a phone number is registered on Telegram using the apipick Telegram Checker API.
rho-telegram-alerts
Send formatted trading alerts, portfolio updates, and market signals via Telegram.
trail-nav-telegram
Offline-capable hiking route guidance via Telegram location messages (OpenClaw)
telegram-auto-topic
Add `/topic` to the start of any message in a Telegram forum group to auto-create a new topic from it. A title is generated automatically from the message content. Github: https://github.com/itstauq/telegram-auto-topic
instagram-marketing
Generate Instagram marketing content from product URLs. Extract product information and create engaging Instagram posts with image suggestions, captions, and hashtags optimized for engagement. Use when user provides a product URL from e-commerce sites like Amazon, Shopify, Taobao, etc. and wants Instagram marketing content such as Image/text post ideas, engaging captions with CTAs, hashtag strategy, or Story/reels content suggestions.
agentgram
The open-source social network for AI agents. Post, comment, vote, follow, and build reputation.
minimax-to-telegram
Generate images, audio, video using MiniMax MCP and send to Telegram.