Automate Instagram with Codex
Schedule feed posts, stories, and reels, manage trial reels and collaborator tags, and grow your Instagram presence — all from the command line or through your AI agent.
Please make sure there is always a human in the loop.
Post to Instagram in Seconds
Terminal
# Install the skill
npx skills add gitroomhq/postiz-agent
# Set your API key
export POSTIZ_API_KEY=your_api_key
# Find your Instagram integration
postiz integrations:list
# Upload an image
RESULT=$(postiz upload photo.jpg)
IMAGE_URL=$(echo "$RESULT" | jq -r '.path')
# Schedule an Instagram feed post
postiz posts:create \
-c "New post! #photography #instagood" \
-m "$IMAGE_URL" \
-s "2025-01-15T10:00:00Z" \
--settings '{"post_type":"post"}' \
-i "your-instagram-integration-id"Instagram-Specific Features
Feed Posts
Publish photo and video posts to your Instagram feed with captions, hashtags, and location tags. Schedule for optimal engagement times.
Stories
Share ephemeral content with Instagram Stories. Upload images or videos that disappear after 24 hours.
Trial Reels
Test content with trial reels that have limited initial reach. Graduate to full distribution manually or automatically based on performance.
Collaborator Tags
Tag collaborators on your posts to co-author content. The post appears on both profiles, doubling your reach.
Graduation Strategy
Control how trial reels graduate to full reach. Choose MANUAL for hands-on control or SS_PERFORMANCE for automatic promotion.
Scheduled Posting
Schedule posts and stories with precise timestamps. Plan your Instagram content calendar and let Postiz handle the publishing.
How It Works
Find Your Instagram Integration
List your connected accounts and grab your Instagram integration ID. You can also fetch available settings to see what options are supported.
Discovery
# List all integrations
postiz integrations:list
# Filter for Instagram
postiz integrations:list | jq \
'.[] | select(.identifier=="instagram")'
# Get Instagram settings schema
postiz integrations:settings <instagram-id>Upload Your Media
Upload your photo or video to get a public URL. Instagram requires media to be accessible via HTTPS. Supports JPG, PNG, MP4, and more.
Upload
# Upload image and extract URL
RESULT=$(postiz upload photo.jpg)
IMAGE_URL=$(echo "$RESULT" | jq -r '.path')
echo $IMAGE_URL
# https://uploads.postiz.com/photo.jpgCreate Your Post
Schedule an Instagram post with your media, caption, hashtags, and platform-specific settings like post type, trial reels, and collaborators.
Post Creation
postiz posts:create \
-c "Sunset vibes #photography #nature" \
-m "$IMAGE_URL" \
-s "2025-03-01T18:00:00Z" \
--settings '{
"post_type": "post",
"collaborators": [
{"label": "photographer_friend"}
]
}' \
-i "instagram-id"Instagram Settings Reference
Every Instagram post accepts these platform-specific settings via the --settings flag.
| Field | Type | Description |
|---|---|---|
__type | string | Must be "instagram" or "instagram-standalone" |
post_type | string | Content type: "post" (feed) or "story" |
is_trial_reel | boolean | Post as a trial reel with limited initial reach |
graduation_strategy | string | Trial reel graduation: "MANUAL" or "SS_PERFORMANCE" (auto based on performance) |
collaborators | array | List of collaborator objects, e.g. [{"label":"username"}] |
Common Configurations
Copy-paste these settings for common Instagram posting scenarios.
Simple Feed Post
settings.json
{
"post_type": "post"
}Story Post
settings.json
{
"post_type": "story"
}Trial Reel with Auto Graduation
settings.json
{
"post_type": "post",
"is_trial_reel": true,
"graduation_strategy": "SS_PERFORMANCE"
}Collaborator Post
settings.json
{
"post_type": "post",
"collaborators": [
{"label": "cofounder"},
{"label": "designer_jane"}
]
}What is Codex?
Codex is OpenAI's autonomous coding agent that handles software engineering tasks — writing features, fixing bugs, and answering questions about your codebase. It works via CLI and IDE integrations, and can execute shell commands like Postiz.
CLI & IDE Native
Codex runs from your terminal or IDE. It executes shell commands directly, making Postiz integration seamless — no extra configuration needed.
Autonomous Execution
Codex works in sandboxed cloud environments, autonomously running commands, reading output, and chaining multi-step workflows like social media posting.
Parallel Tasks
Run multiple Codex tasks simultaneously. Schedule posts to different platforms in parallel while Codex handles other coding work.
How Postiz Works with Codex
Codex discovers Postiz when you install it globally. It reads the SKILL.md to understand available commands and can autonomously chain them for social media workflows.
- ✓Install Postiz Agent globally with npx skills add
- ✓Codex reads the SKILL.md and learns all Postiz commands
- ✓POSTIZ_API_KEY must be set in environment
- ✓Codex executes commands in sandboxed environments
- ✓Works alongside your coding tasks in parallel
Install Postiz
# Install the Postiz skill
npx skills add gitroomhq/postiz-agent
# Set your API key
export POSTIZ_API_KEY=your_api_key
# Codex discovers Postiz commands
# from the SKILL.md automatically
codex "list my social media integrations"Instagram Posting with Codex
Tell Codex what to post from your terminal or IDE — it discovers your integrations via Postiz and handles the entire publishing workflow.
CLI Workflow
Terminal and IDE integration
Tell Codex what to post from your terminal or IDE — it discovers your integrations via Postiz and handles the entire publishing workflow.
Codex CLI
$ codex "Post to Instagram about our
new feature launch, schedule for
tomorrow at 9am"
Codex: I'll handle that.
Running: postiz integrations:list
Found your Instagram integration.
Running: postiz posts:create ...
Done! Your post is scheduled.
Post ID: abc-123Parallel Tasks
Multiple tasks at once
Codex can handle multiple tasks in parallel. Schedule posts to different platforms while it works on other coding tasks simultaneously.
Codex Parallel Tasks
# Run multiple posting tasks in parallel
$ codex "Schedule a post about our
launch to X for tomorrow 9am" &
$ codex "Write a LinkedIn article
about our new feature and schedule
for tomorrow noon" &
$ codex "Fix the bug in auth.ts"
# All three tasks run simultaneouslyWhy Codex + Postiz for Instagram
Codex's autonomous execution makes Postiz a natural fit. The agent reads the SKILL.md to understand every available command, then autonomously chains them together for Instagram workflows.
- ✓CLI-native — runs from your terminal or IDE
- ✓Autonomous execution in sandboxed environments
- ✓Parallel task support — post while coding
- ✓Trial reels and graduation strategies applied automatically
- ✓Cross-post to Instagram + other platforms in a single session
- ✓Powered by OpenAI's most capable models
SKILL.md (auto-discovered)
---
name: postiz
description: Social media automation
CLI for scheduling posts across
30+ platforms including Instagram
metadata:
codex:
requirements:
env:
- POSTIZ_API_KEY
binaries:
- postiz
---
# Available Commands
- postiz integrations:list
- postiz integrations:settings <id>
- postiz posts:create
- postiz upload <file>
- postiz analytics:platform <id>
# Instagram Settings
post_type, is_trial_reel,
graduation_strategy,
collaboratorsAlso Works with Claude Code
Postiz Agent works as a CLI tool with any AI agent that can execute shell commands — including Anthropic's Claude Code.
Claude Code
by Anthropic
Claude reads the SKILL.md file to learn all available Postiz commands, then autonomously discovers your Instagram integration, uploads your photo, applies post type and collaborator settings, and schedules the post.
Claude Code
> Post my product photo to Instagram
as a feed post with collaborator tags,
schedule for tomorrow evening
Claude will automatically run:
postiz integrations:list
postiz upload ./product.jpg
postiz posts:create \
-c "Launching something new!" \
-m "uploaded-url" \
-s "2025-03-02T18:00:00Z" \
--settings '{"post_type":"post",
"collaborators":[
{"label":"cofounder"}
]}' \
-i "instagram-id"Instagram + Other Platforms
Schedule the same content to Instagram and other platforms in a single command. Each platform gets its own settings.
Terminal
# Post to Instagram and Facebook simultaneously
postiz posts:create \
-c "New product photo! #launch #startup" \
-m "$IMAGE_URL" \
-s "2025-03-01T18:00:00Z" \
--settings '{"post_type":"post"}' \
-i "instagram-id,facebook-id"
# Batch schedule a week of Instagram content
for day in 1 2 3 4 5; do
postiz posts:create \
-c "Day $day of our launch week! #countdown" \
-m "day${day}-image-url" \
-s "2025-03-0${day}T18:00:00Z" \
--settings '{"post_type":"post"}' \
-i "instagram-id"
donePost Types
Feed Post
postStory
storyStart posting to Instagram
Install Postiz Agent and automate your Instagram content strategy with AI-powered scheduling and publishing.
Ready to get started?
Grow your social media presence with Postiz.
Schedule, analyze, and engage with your audience.
Open-source social media scheduling tool