---
title: "AdaptlyPost CLI"
description: "Install the AdaptlyPost CLI, log in with an API token, and run every part of AdaptlyPost from your terminal or a script. JSON output and real exit codes."
url: "https://adaptlypost.com/features/cli/docs"
---

[Back to AI agents](https://adaptlypost.com/features/agents)

# AdaptlyPost CLI

Drive AdaptlyPost from your terminal or a script. One binary, no runtime to manage, and every command can print JSON.

## Install

Pick whichever fits your machine. The Homebrew and curl routes install a standalone binary, so Node is not needed.

npm

```
npm install -g @adaptlypost/cli
```

Homebrew (macOS, Linux)

```
brew trust adaptlypost/tap && brew install adaptlypost/tap/adaptlypost
```

Install script (macOS, Linux)

```
curl -fsSL https://adaptlypost.com/install.sh | sh
```

Run once, without installing

```
npx -p @adaptlypost/cli adaptlypost --help
```

Homebrew 7 refuses to load a formula from a third-party tap until you trust it, which is what brew trust does. Skip it and both install and upgrade stop with "Refusing to load formula from untrusted tap".

The install gives you two names for the same program. The short one is `apost`.

## Authentication

Create an API token and hand it to login. Tokens live in your workspace settings: [API & AI Agents](https://adaptlypost.com/api-tokens).

```
adaptlypost login
```

The command opens the token page, reads the token from a hidden prompt, checks the `adaptly_` prefix locally, then verifies it with one API call before writing it to disk at mode 0600\. Nothing is stored if the check fails.

In CI, pipe the token in and skip the prompt

```
echo "$MY_SECRET" | adaptlypost login --token-stdin
```

Or skip storage entirely and pass it per command

```
ADAPTLYPOST_API_TOKEN=adaptly_your_token adaptlypost whoami
```

## Quick start

Schedule one post to two platforms. Account ids come from adaptlypost accounts list.

```
adaptlypost post --caption "Shipping today"   --accounts acc_123 --platforms LINKEDIN,TWITTER   --schedule "2026-10-02T09:00:00Z"
```

## Commands

Every command takes --help, and most take --json. Run adaptlypost doctor first if something looks wrong.

Getting in

| adaptlypost login  | Store an API token on this machine, after checking it works |
| ------------------ | ----------------------------------------------------------- |
| adaptlypost logout | Remove the stored token                                     |
| adaptlypost whoami | Show which token is in use and what it can see              |

Everyday work

| adaptlypost post      | Create, schedule, publish, update and delete posts |
| --------------------- | -------------------------------------------------- |
| adaptlypost accounts  | List connected social accounts and their ids       |
| adaptlypost analytics | Reach, engagement and per-platform breakdowns      |
| adaptlypost media     | Upload images and video for a post                 |

Escape hatches

| adaptlypost api  | Send an authenticated request to any API endpoint |
| ---------------- | ------------------------------------------------- |
| adaptlypost mcp  | Print the MCP server config for your editor       |
| adaptlypost open | Open a page of the web app in your browser        |

This machine

| adaptlypost config     | Read and write CLI preferences                   |
| ---------------------- | ------------------------------------------------ |
| adaptlypost doctor     | Check this machine, the config files and the API |
| adaptlypost completion | Print the shell completion script                |

Each command lists its own flags under `adaptlypost <command> --help`.

## Scripting

Add --json to any command and you get a stable envelope with ok, command and data, ready for jq.

```
adaptlypost whoami --json
```

You rarely need the flag. Output switches to JSON on its own when stdout is not a terminal or CI is set, so a piped command already gives you JSON.

Exit codes

| 0 | Success                                        |
| - | ---------------------------------------------- |
| 2 | Usage error, such as a missing or unknown flag |
| 3 | The token was rejected or is missing           |
| 4 | Nothing matched that id                        |
| 5 | The API rejected the input                     |
| 7 | Too many requests                              |
| 8 | Network failure or timeout                     |
| 9 | Plan or quota limit reached                    |

## Next steps

Create a token, or wire the same account into an AI agent instead.

[Create an API token](https://adaptlypost.com/api-tokens)[AI agents and MCP](https://adaptlypost.com/features/agents)
