RelayAPI

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/cli

Or run directly without installing:

bunx relay --help

Authenticate

Manual API Key (Recommended)

relay auth set-key

This prompts you for your API key interactively (masked input). You can also pass it directly:

relay auth set-key rlay_live_your_api_key

Get your API key from relayapi.dev under Settings > API Keys.

Verify Setup

relay auth status

This 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.png

Commands

Authentication

CommandDescription
relay auth set-key [key]Save an API key (interactive if no key provided)
relay auth statusShow API key, plan, usage, and rate limits
relay auth logoutRemove saved credentials

Accounts

CommandDescription
relay accounts listList connected social accounts
relay accounts get <id>Get account details
relay accounts healthCheck health of all accounts
relay accounts health <id>Check health of a single account

Posts

CommandDescription
relay posts createCreate a post (interactive or via flags)
relay posts listList 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

CommandDescription
relay media listList 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 now

Interactive 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 later

Schedule 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 now

Updating 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 --yes

Uploading 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 --table
id           platform  username     display_name
-----------  --------  ----------   ------------
acc_abc123   twitter   @mycompany   My Company
acc_def456   linkedin  mycompany    My Company Page

Configuration

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:

VariableDescriptionRequired
RELAYAPI_API_KEYYour API keyYes
RELAYAPI_API_URLCustom API endpointNo

Supported Platforms

Instagram, TikTok, X (Twitter), LinkedIn, Facebook, Threads, YouTube, Bluesky, Pinterest, Reddit, Snapchat, Telegram, Google Business Profile, WhatsApp, Mastodon, Discord, and SMS.

Found something wrong? Help us improve this page.

On this page

Submit an Issue
Requires a GitHub account.View repo