The Potions CLI
The potions command deploys your Phoenix app from a terminal, a CI job or a coding agent. It logs in through your browser, finds your app from the git repository you're in, deploys the last commit you pushed and waits for the result.
potions login
potions deploy
Install
Homebrew (macOS 15 or newer, and Linux):
brew install potionsio/tap/potions
Install script (macOS 15 or newer, and Linux). It installs to ~/.potions/cli and ~/.local/bin/potions, without sudo, and checks the download against the release's checksums:
curl -fsSL https://potions.io/install.sh | sh
Hex, anywhere Elixir runs (including older macOS, Alpine and other musl Linux, older Linux and Windows):
mix escript.install hex potions_cli
This builds potions with your own Elixir and Erlang into ~/.mix/escripts; add that directory to your PATH. An escript runs on the Erlang it was built with or a newer one, so if your projects pin different Erlang versions, install it with the oldest one.
The Homebrew and install script builds include Erlang. On macOS they need macOS 15 or newer. On Linux they need glibc 2.35 or newer and OpenSSL 3 (Ubuntu 22.04, Debian 12, Fedora 36 or newer).
Log in
potions login
The CLI shows a one-time code and opens Potions in your browser. Check that the page shows the same code, choose what this computer may do, and approve. You can limit the login to one app. The CLI then saves a token in your system keychain (the macOS Keychain, or the Secret Service on Linux; otherwise a file only you can read). The token lasts 90 days and appears in API tokens, where you can revoke it.
A login can see your apps and servers, deploy and roll back, create apps and servers, set non-secret variables and ask you to confirm deleting an app. Untick any of these on the approval page. Setting secrets is off unless you ask for it with potions login --force --scopes read,deploy,create,env:config,servers:create,apps:delete,env:secret and tick it on the approval page.
potions whoami shows the account, abilities and expiry. potions logout revokes the token and removes it.
Deploy
potions deploy
From your project directory, potions deploy:
-
Takes the last commit of your current branch that is on GitHub. If you have commits you haven't pushed, it says so and deploys the last pushed one; uncommitted changes are never deployed. A branch that isn't on GitHub yet stops with the
git pushto run. -
Finds the app for this repository and directory. If Potions has none yet, it asks to create one (
--server NAMEanswers for you) and writespotions.toml. - Deploys that exact commit and waits, printing each build step. When it finishes, it prints the app's URL.
If your branch isn't the one the app deploys, the CLI stops and asks you to switch, or to say --branch NAME to deploy it anyway. If a deploy of the same commit is already running (for example because your push started one), it follows that one instead of starting another.
Useful flags: --no-wait prints the deployment's id and returns at once, --logs streams the build log while waiting, --timeout SECONDS stops waiting (the deploy keeps going), and --sha SHA deploys a specific pushed commit.
When a deploy fails, the CLI shows the step that failed, Potions' AI summary and the last log lines. When the app is missing environment variables, it names them and gives you the link to add them.
potions.toml
potions.toml links a directory to a Potions app:
version = 1
app_id = "6f1c3a52-0d8e-4f6b-9a51-2b7f6f7d3c10"
app_name = "shop"
Commit it, so teammates and CI deploy the same app. It holds no secrets, and the CLI never reads a Potions address from it, so a repository you clone can't send your login anywhere else. potions link writes it for an existing app; --app ID|NAME or POTIONS_APP overrides it for one command.
Logs, status and rollbacks
-
potions logsprints the latest deployment's log;potions logs ID -ffollows a running one. -
potions statusshows the latest deployment;potions status ID --waitwaits for it to finish. -
potions rollbackswitches back to the previous successful release after you confirm. It doesn't undo database migrations. -
potions apps,potions serversandpotions open(the app in the dashboard, or--urlfor the live site).
Environment variables
potions env list
potions env set POOL_SIZE=20
potions env set STRIPE_SECRET_KEY
potions env generate LIVE_VIEW_SALT
env list shows names and kinds, never values. env set NAME=VALUE sets a config variable; Potions refuses values that look like secrets there. env set NAME asks for a secret with a hidden prompt (it needs a terminal and a login with the secrets ability). env generate has Potions create a random value. Every change applies on the next deploy.
Use it in CI
Create a token in API tokens with the CI deploy preset, limited to the app, and store it in your CI's secrets as POTIONS_TOKEN. Then:
potions deploy --app shop --sha "$GITHUB_SHA" --branch "$GITHUB_REF_NAME"
To set a secret from CI, use the CI secrets preset and pipe the value in. The CLI strips one trailing newline and refuses empty or multi-line values:
printf '%s' "$STRIPE_SECRET_KEY" | potions env set STRIPE_SECRET_KEY --stdin
Coding agents
When Claude Code, Codex, Cursor or another agent runs potions, it answers in JSON, never prompts and never opens a browser. When it needs a login, it prints the approval link and code for the agent to show you, and finishes once you approve. Agents never set secrets with the CLI: they give you the link to the app's Environment page instead.
potions setup agent
This installs the Potions plugin for Claude Code and the deploy skill for Codex. With --mcp it also connects the Potions MCP server: Claude Code gets potions auth headers as its headers helper, so your token is never written to its config, and Codex gets a [mcp_servers.potions] entry. See Deploy with Your Agent.
potions auth headers prints the Authorization header for that helper. Any program that can run it can read your token, like gh auth token, so never ask an agent to run it.
Output and exit codes
Every command takes --json, which prints one JSON document: {"ok": true, "data": ...}, or {"ok": false, "error": {"code", "message", "next", "url", "details"}} where next is the command to run. Without --json, results go to stdout and progress to stderr, so URL=$(potions deploy) captures the app's URL.
| Exit | Meaning |
|---|---|
| 0 | Success |
| 1 | The deploy, rollback or request failed |
| 2 |
A bad command or flag, or a confirmation that needs --yes |
| 3 | You need to log in, or this login can't do that |
| 4 | Something has to change first: push, give Potions access, choose a server or app, add variables |
| 124 | Waiting timed out; the deployment is still running |
Settings
| Setting | Use |
|---|---|
POTIONS_TOKEN |
A token to use instead of the saved login (CI) |
POTIONS_APP |
The app to use, by id or name |
POTIONS_API_URL |
Another Potions address |
POTIONS_CREDENTIAL_STORE=file |
Save the login in a file instead of the keychain |
POTIONS_NO_UPDATE_CHECK=1 |
Don't check for a newer version |
--non-interactive, --yes |
Never prompt; answer yes to confirmations |