CLI
Schedule and manage social media posts across 21 platforms from the terminal.
Schedule and manage social media posts across 21 platforms from the terminal. Built for developers and AI agents. Outputs JSON by default.
Setup
Install the CLI
The CLI runs on Bun. Install it globally from the monorepo:
bun install -g @relayapi/cliOr run directly without installing:
bunx relay --helpAuthenticate
Manual API Key (Recommended)
relay auth set-keyThis prompts you for your API key interactively (masked input). You can also pass it directly:
relay auth set-key rlay_live_your_api_keyGet your API key from relayapi.dev under Settings > API Keys.
Verify Setup
relay auth statusThis confirms your API key is valid and displays your plan, usage, and rate limits.
Quick Example
# Create a post and publish immediately
relay posts create \
--content "Hello from the RelayAPI CLI!" \
--targets acc_twitter_123,acc_linkedin_456 \
--schedule now
# List your connected accounts as a table
relay accounts list --table
# Upload media and get the URL
relay media upload ./banner.pngCommands
Authentication
| Command | Description |
|---|---|
relay auth set-key [key] | Save an API key (interactive if no key provided) |
relay auth status | Show API key, plan, usage, and rate limits |
relay auth logout | Remove saved credentials |
Accounts
| Command | Description |
|---|---|
relay accounts list | List connected social accounts |
relay accounts get <id> | Get account details |
relay accounts health | Check health of all accounts |
relay accounts health <id> | Check health of a single account |
Posts
| Command | Description |
|---|---|
relay posts create | Create a post (interactive or via flags) |
relay posts list | List posts |
relay posts get <id> | Get post details |
relay posts update <id> | Update a draft or scheduled post |
relay posts delete <id> | Delete a draft or scheduled post |
relay posts retry <id> | Retry failed targets on a post |
relay posts unpublish <id> | Unpublish from all platforms |
Media
| Command | Description |
|---|---|
relay media list | List uploaded media files |
relay media get <id> | Get media details |
relay media upload <filepath> | Upload a file |
relay media delete <id> | Delete a media file |
Usage
Creating Posts
With flags (non-interactive):
relay posts create \
--content "Launching our new feature today!" \
--targets acc_twitter_123,acc_linkedin_456 \
--schedule nowInteractive mode — just run relay posts create without flags and the CLI will prompt you for content, targets, and scheduling:
relay posts create◆ Post content
│ Launching our new feature today!
│
◆ Select target accounts
│ ◻ twitter — @mycompany
│ ◼ linkedin — My Company Page
│ ◼ bluesky — @mycompany.bsky.social
│
◆ When to publish?
│ ○ Publish now
│ ● Save as draft
│ ○ Schedule for laterSchedule for later:
relay posts create \
--content "Coming soon!" \
--targets twitter \
--schedule "2026-04-01T09:00:00Z" \
--timezone "America/New_York"With media:
relay posts create \
--content "Check out this photo" \
--targets instagram \
--media "https://media.relayapi.dev/image.jpg" \
--schedule nowUpdating Posts
Update content, targets, or schedule of a draft or scheduled post:
relay posts update post_abc123 \
--content "Updated content" \
--schedule "2026-04-02T12:00:00Z"Listing Resources
All list commands support pagination:
relay posts list --limit 10
relay posts list --cursor "next_cursor_value"Deleting Resources
Delete commands prompt for confirmation by default. Skip with --yes:
relay posts delete post_abc123
relay posts delete post_abc123 --yesUploading Media
Upload files directly from your local filesystem:
relay media upload ./photo.jpg{
"filename": "photo.jpg",
"size": 245760,
"type": "image/jpeg",
"url": "https://media.relayapi.dev/ws_abc/photo.jpg"
}Output Formats
JSON (default) — all commands output JSON, making the CLI suitable for scripting and AI agents:
relay accounts list{
"data": [
{
"id": "acc_abc123",
"platform": "twitter",
"username": "@mycompany",
"display_name": "My Company"
}
],
"has_more": false,
"next_cursor": null
}Table — add --table for a human-readable format:
relay accounts list --tableid platform username display_name
----------- -------- ---------- ------------
acc_abc123 twitter @mycompany My Company
acc_def456 linkedin mycompany My Company PageConfiguration
The CLI stores settings in ~/.relayapi/config.json:
{
"api_key": "rlay_live_your_api_key",
"base_url": "https://api.relayapi.dev"
}You can also use environment variables, which override the config file:
| Variable | Description | Required |
|---|---|---|
RELAYAPI_API_KEY | Your API key | Yes |
RELAYAPI_API_URL | Custom API endpoint | No |
Supported Platforms
Instagram, TikTok, X (Twitter), LinkedIn, Facebook, Threads, YouTube, Bluesky, Pinterest, Reddit, Snapchat, Telegram, Google Business Profile, WhatsApp, Mastodon, Discord, and SMS.
Links
Found something wrong? Help us improve this page.