# CLI recipes

Copy-paste Zernio CLI commands for everyday jobs: schedule a video, list what's scheduled, check your accounts and find your best posts.

Each recipe is one or two commands. Replace the ids with yours from `zernio accounts:list`. Output is JSON, so `jq` trims it to what you need.

## Schedule a video

Upload the file first, then schedule a post that uses its URL. The first command keeps the URL in `$URL` for the second.

```bash
URL=$(zernio media:upload launch-teaser.mp4 | jq -r .url)

zernio posts:create \
  --text "Our launch teaser." \
  --title "Launch teaser" \
  --media "$URL" \
  --accounts <accountId> \
  --scheduledAt "2027-01-15T10:00:00" \
  --timezone "Europe/Madrid"
```

`--title` is needed for YouTube. Add more ids to `--accounts`, separated by commas, to post the same video everywhere.

<StepVideo src="/videos/for-you/cli-recipe-1-schedule-video.mp4" caption="Uploading a video and scheduling it" />

## See what's scheduled

```bash
zernio posts:list --profileId <profileId> --status scheduled \
  | jq '.posts[] | {_id, title, scheduledFor}'
```

Use `--status failed` to find posts that didn't go out, then `zernio posts:retry <id>`.

<StepVideo src="/videos/for-you/cli-recipe-2-list-scheduled.mp4" caption="Listing a profile's scheduled posts" />

## Check your accounts

```bash
zernio accounts:health --profileId <profileId> | jq .summary
```

Anything under `needsReconnect` has to be reconnected in the dashboard before it can post again.

<StepVideo src="/videos/for-you/cli-recipe-3-health.mp4" caption="Checking account health" />

## Find your best posts

```bash
zernio analytics:posts --profileId <profileId> --sortBy engagement --limit 3 \
  | jq '.posts[] | {post: .content[0:28], views: .analytics.views}'
```

Add `--from` and `--to` with dates to look at one period.

<StepVideo src="/videos/for-you/cli-recipe-4-top-posts.mp4" caption="Top posts by engagement" />

## Next steps

- [Zernio CLI](/for-you/cli): install it and log in.
- [Post images and videos](/for-you/media): the same upload from an AI assistant.
- [Troubleshooting](/for-you/troubleshooting): 401 errors and accounts that need reconnecting.