---
title: "How to Use the MagicSync CLI for Social Media Automation"
description: "Automate your social media publishing workflow with MagicSync's CLI tool. Validate content, schedule posts, and integrate with CI/CD pipelines from your terminal."
canonical_url: "https://magicsync.dev/blogs/magicsync-cli-social-media-automation"
---

> Index of every page on this site: [llms.txt](https://magicsync.dev/llms.txt)

<base-blog-hero>



</base-blog-hero>

### Command-Line Power for Your Social Media Workflow

Developers and DevOps engineers know that the command line is the most efficient way to automate repetitive tasks. MagicSync extends this philosophy to social media management with a powerful **CLI API** that lets you check connectivity, validate content, and schedule posts directly from your terminal.

---

### Getting Started

The MagicSync CLI API is available at `/api/v1/cli` and requires an API key for authentication. You can generate your API key from the MagicSync dashboard under Settings > API Keys.

```bash
# Test connectivity
curl -X GET \
  -H "X-Api-Key: your-api-key" \
  https://magicsync.dev/api/v1/cli/ping

# Response: {"apiKey": {"valid": true, "businessId": "biz_xxx"}, ...}
```

---

### Available Commands

**Ping — Test Authentication**
Verify that your API key is valid and the service is reachable.

```bash
curl -X GET -H "X-Api-Key: your-key" https://magicsync.dev/api/v1/cli/ping
```

**Info — Discover Platforms**
Retrieve connected platforms, account details, and platform-specific posting rules like character limits and supported media types.

```bash
curl -X GET -H "X-Api-Key: your-key" https://magicsync.dev/api/v1/cli/info
```

**Validate — Check Content**
Before publishing, verify that your content meets platform-specific constraints including text length, image count, video length, and aspect ratios.

```bash
curl -X POST \
  -H "Content-Type: application/json" \
  -H "X-Api-Key: your-key" \
  -d '{"content": "Your post text", "platforms": ["twitter", "bluesky"]}' \
  https://magicsync.dev/api/v1/cli/validate
```

**Post — Create and Schedule**
Create a post immediately, schedule it for a future time, or add it to a review queue.

```bash
curl -X POST \
  -H "Content-Type: application/json" \
  -H "X-Api-Key: your-key" \
  -d '{
    "content": "Check out our new feature!",
    "platforms": ["twitter", "linkedin"],
    "scheduleAt": "2026-07-17T09:00:00Z"
  }' \
  https://magicsync.dev/api/v1/cli/post
```

---

### CI/CD Integration

The real power of the CLI API emerges when you integrate it into your continuous deployment pipeline. For example, you can automatically post release notes to social media whenever you deploy a new version:

```yaml
# GitHub Actions example
deploy:
  steps:
    - run: ./deploy.sh
    - name: Post release to social media
      run: |
        curl -X POST \
          -H "X-Api-Key: ${{ secrets.MAGICSYNC_API_KEY }}" \
          -H "Content-Type: application/json" \
          -d '{
            "content": "New release v${{ github.ref_name }} is live!",
            "platforms": ["twitter", "linkedin"]
          }' \
          https://magicsync.dev/api/v1/cli/post
```

---

### Why Use the CLI

- **Scriptable:** Integrate social media posting into any scripting language or automation tool.
- **Idempotent:** Safe to run multiple times — validation catches issues before publishing.
- **Lightweight:** No GUI overhead, no browser automation, no dependencies beyond curl.
- **Auditable:** Every CLI action is logged in your MagicSync dashboard.

Bring the power of the command line to your social media workflow. Start using the MagicSync CLI API today.

## Sitemap

See the full [sitemap](https://magicsync.dev/sitemap.md) for all pages.
