# Posting commands

Choose the right command to create, schedule, update, edit, or remove posts, upload media, and inspect queue slots.

Use `posts:create` for new content, `posts:update` for drafts or scheduled posts, and `posts:edit` for supported published content. Authenticate through the [CLI setup](/cli) first.

## First command

Start with a read, then copy the intended account ID into `ACCOUNT_ID`:

```bash
zernio accounts:list --pretty
```

Create a draft rather than publishing immediately:

```bash
zernio posts:create --text "The spring collection is live." \
  --accounts "$ACCOUNT_ID" --draft --pretty
```

Save the returned post ID as `POST_ID`. Run `zernio posts:get "$POST_ID" --pretty` and confirm its content, draft status, and target accounts.

## Commands

Variables below contain IDs copied from listing responses. **Write** changes remote state; **destructive** requires explicit approval.

| Task | Command | Effect |
|---|---|---|
| Find profiles | `zernio profiles:list` | Read |
| Find connected accounts | `zernio accounts:list --profileId "$PROFILE_ID"` | Read |
| Check connection health | `zernio accounts:health` | Read |
| Start connecting a platform | `zernio connect:get-url instagram --profileId "$PROFILE_ID"` | Starts an authorization flow |
| Inspect scheduled posts | `zernio posts:list --status scheduled --page 1 --limit 10` | Read |
| Inspect a single post | `zernio posts:get "$POST_ID"` | Read |
| Change draft text | `zernio posts:update "$POST_ID" --content "Revised text"` | Write |
| Schedule a draft | `zernio posts:update "$POST_ID" --draft=false --scheduledAt "2027-06-01T12:00:00Z"` | Write |
| Publish a draft now | `zernio posts:update "$POST_ID" --draft=false --publishNow` | Public write |
| Edit published text | `zernio posts:edit "$POST_ID" --platform linkedin --content "Corrected text"` | Public write, where supported |
| Remove a published platform post | `zernio posts:unpublish "$POST_ID" --platform linkedin` | Destructive, where supported |
| Delete the Zernio post | `zernio posts:delete "$POST_ID"` | Destructive; distinct from platform unpublishing |
| Retry a failed post | `zernio posts:retry "$POST_ID"` | Write; inspect existing target results first |
| Upload a local file | `zernio media:upload ./photo.jpg` | Write; returns hosted media URL |
| Inspect queue slots | `zernio queue:list-slots --profileId "$PROFILE_ID"` | Read |
| Validate a CSV import | `zernio posts:bulk-upload --file ./posts.csv --dryRun` | Command-specific preview |

### Create options

`posts:create` requires both `--text` and `--accounts`. `posts:update` uses `--content`, not `--text`.

| Flag | Input and outcome |
|---|---|
| `--accounts` | Comma-separated connected-account IDs; CLI resolves each platform |
| `--draft` | Save a draft; takes precedence over `--scheduledAt` |
| `--scheduledAt` | ISO 8601 time; use a future date for scheduling |
| `--timezone` | IANA timezone when using a local scheduled time |
| `--media` | Comma-separated public media URLs, not local paths |
| `--media-json` | JSON array of media objects; overrides `--media` |
| `--platform-data` | JSON object keyed by platform for platform-specific fields |
| `--queuedFromProfile` | Profile ID whose queue supplies a slot |
| `--queueId` | Select a queue with `--queuedFromProfile` |
| `--title`, `--tags`, `--hashtags` | Title or comma-separated tags and hashtags |

### Schedule with media

Upload first. Copy `url` from the upload response into `MEDIA_URL`, then create the post:

```bash
zernio media:upload ./photo.jpg
zernio posts:create --text "Launch day" --accounts "$ACCOUNT_ID" \
  --media "$MEDIA_URL" --scheduledAt "2027-06-01T12:00:00Z"
```

For alt text or explicit media types, replace `--media` with:

```bash
zernio posts:create --text "Draft with alt text" --accounts "$ACCOUNT_ID" --draft \
  --media-json '[{"type":"image","url":"https://example.com/photo.jpg","altText":"Spring collection"}]'
```

Replace the example URL with your uploaded URL before running the command.

## How it behaves

- To promote an existing draft, include `--draft=false` with `--scheduledAt` or `--publishNow`. Without it, the post keeps its draft status even when the update succeeds.
- Omitting `--draft`, `--scheduledAt`, and queue scheduling from `posts:create` publishes immediately. There is no confirmation prompt in that handler.
- `media:upload` takes a positional file path, not `--file`. Its JSON result includes `url`, `key`, `filename`, `size`, and `contentType`.
- `posts:list --from ... --to ...` filters the date range; these map to the API's `dateFrom` and `dateTo`.
- Inspect `post.status` and each target result after writes. Partial success is not a reason to create the same post again.
- `posts:delete` removes a non-published Zernio record, not content already live on a platform. Fully published posts require unpublishing instead.
- After an ambiguous failure, read current state before retrying. [Agent safety](/cli/agents) applies to scripts too.
- For platform requirements and timezone behavior, use the [create-post reference](/posts/create-post). CLI help determines which fields have flags.

## Related

- [Post lifecycle](/guides/post-lifecycle)
- [Create post](/posts/create-post)
- [Media uploads](/guides/media-uploads)
- [Queue scheduling](/guides/queue-scheduling)
- [CLI for agents](/cli/agents)