socialrails
v1.0.0
Published
CLI for SocialRails — schedule posts, manage accounts, generate AI content, and view analytics from your terminal.
Maintainers
Readme
socialrails
Official CLI for SocialRails — schedule posts, manage accounts, generate AI content, and view analytics from your terminal.
All output is JSON to stdout, making it ideal for scripting, CI/CD pipelines, and AI agent integrations.
Installation
npm install -g socialrailsSetup
Set your API key as an environment variable:
export SOCIALRAILS_API_KEY="sr_live_your_key_here"Get your key from Dashboard > Settings > API Keys.
Optionally override the API URL (defaults to https://socialrails.com/api/v1):
export SOCIALRAILS_API_URL="https://socialrails.com/api/v1"Commands
Schedule a post
socialrails posts:create -c "Check out our new feature!" -p twitter -s "2026-03-15T14:30:00Z"Create a draft
socialrails posts:create -c "Draft post for review" -p linkedinCreate a thread (Twitter/Threads)
socialrails posts:create --thread \
-c "1/ Here's why we built SocialRails" \
-c "2/ Managing 9 platforms is chaos" \
-c "3/ One API to schedule everywhere" \
-c "4/ Try it free at socialrails.com" \
-p twitter -s "2026-03-15T14:30:00Z"Batch post to multiple platforms
socialrails posts:batch -c "Big announcement!" --platforms twitter,linkedin,facebook -s "2026-03-15T14:30:00Z"List posts
socialrails posts:list --status scheduled --platform twitter --limit 10Delete a post
socialrails posts:delete <post-id>View analytics
socialrails analytics --period 30d --platform twitterList connected accounts
socialrails accountsGet account settings & capabilities
socialrails accounts:settings <account-id>Generate AI content
socialrails ai:generate --prompt "Write a tweet about our product launch" --platform twitter --tone excitedUpload media
From a local file:
socialrails upload ./image.jpg --type imageFrom a URL:
socialrails upload --url "https://example.com/photo.jpg" --type imageGet workspace info
socialrails workspaceWorkflow Examples
Schedule a post with media
# 1. Upload the image
MEDIA=$(socialrails upload ./hero.jpg --type image | jq -r '.data.key')
# 2. Schedule the post with the uploaded media
socialrails posts:create \
-c "New blog post is live!" \
-p twitter \
-s "2026-03-15T14:30:00Z" \
-m "$MEDIA"AI-powered content calendar
# Generate content for each day of the week
for day in Monday Tuesday Wednesday Thursday Friday; do
CONTENT=$(socialrails ai:generate \
--prompt "Write a LinkedIn post about productivity tips for $day" \
--platform linkedin \
--tone professional | jq -r '.data.content')
socialrails posts:create -c "$CONTENT" -p linkedin -s "2026-03-15T09:00:00Z"
doneCross-platform scheduling
# Same content everywhere
socialrails posts:batch \
-c "We just hit 10,000 users! Thank you all." \
--platforms twitter,linkedin,facebook,threads,bluesky \
-s "2026-03-15T12:00:00Z"AI Agent Guide
The CLI outputs JSON to stdout and errors to stderr, making it easy for AI agents (Claude, GPT, etc.) to use:
- Discover accounts:
socialrails accountsto list connected platforms - Check capabilities:
socialrails accounts:settings <id>to learn character limits and settings - Generate content:
socialrails ai:generate --prompt "..."to create platform-optimized content - Schedule posts:
socialrails posts:create -c "..." -p <platform> -s "..." - Verify:
socialrails posts:list --status scheduledto confirm scheduling - Monitor:
socialrails analytics --period 7dto check performance
Error responses always use exit code 1 with JSON on stderr:
{"error":{"code":"BAD_REQUEST","message":"Content must be 5000 characters or fewer."}}Supported Platforms
Twitter/X, LinkedIn, Facebook, Instagram, TikTok, Bluesky, Pinterest, Threads, YouTube.
Documentation
License
MIT
