InstaWP CLI Overview
The InstaWP CLI brings your entire WordPress workflow into the terminal. Create sites, run WP-CLI on them, SSH in, sync files and databases, spin up local sandboxes, and tear everything down again — without opening the dashboard.
It is published to npm as @instawp/cli under the MIT license, and every command can emit JSON, which makes it equally usable by humans, CI pipelines, and AI coding agents.
Why a CLI
The dashboard is great for one-off work. A CLI is what you need when the work repeats:
- Scriptable. Provision a preview site for every pull request, then delete it when the PR merges.
- No manual SSH keys. The CLI generates, uploads, and caches the key for you the first time you run
instawp sshorinstawp wp. - Local and cloud in one tool. Build locally with WordPress Playground (no Docker, no MySQL), then push the same site to InstaWP hosting.
- Agent-friendly. AI assistants such as Claude Code, Cursor, and Codex can drive it, because every step is a shell command with parseable output.
Requirements
- Node.js 18 or higher
- An InstaWP account (an API token if you are running in CI)
Install
npm install -g @instawp/cli@betaCheck that it is working:
instawp --versionTo update later:
instawp upgradeThe CLI checks for a new version once a day and prints a hint when one is available. Set INSTAWP_NO_UPDATE_NOTIFIER=1 to silence that check.
Log in
instawp loginThis opens your browser, completes the handshake, and stores the session locally. Confirm who you are signed in as:
instawp whoamiLogging in without a browser
On a server, in a container, or in CI there is no browser to open. Use a token instead — either pass it to login or export it as an environment variable:
instawp login --token <your-api-token>export INSTAWP_TOKEN=<your-api-token>Create the token in the InstaWP dashboard under API Tokens. See API Overview for details.
Two-minute quickstart
npm install -g @instawp/cli@beta
instawp login
instawp create --name my-site --php 8.3The site is provisioned on InstaWP infrastructure and is live in seconds. From there:
instawp sites creds my-site # WP admin username, password, magic login URL
instawp open my-site --magic # open an auto-logged-in admin session
instawp wp my-site plugin list # run WP-CLI against it
instawp sites delete my-site # remove it when you are doneWhat you can do
| Area | Commands | What it covers |
|---|---|---|
| Auth | login, whoami | Browser or token-based authentication |
| Sites | create, sites list, sites creds, sites php, sites delete, open | Provision and manage hosted sites |
| Versions | versions create, versions list, versions restore, versions delete | Restorable point-in-time copies |
| Remote access | wp, ssh, exec, sql, logs, cache purge, plugin install | Work directly on a hosted site |
| Sync | sync push/pull, db push/pull | Move files and databases between local and cloud |
| Local | local create, local clone, local start/stop, local push/pull | WordPress Playground sandboxes on your machine |
| Migration | migrate push | Mirror an existing local WordPress install to a new hosted site |
| Teams | teams list, teams switch, teams members | Switch the team commands run against |
Every command is documented in the Command Reference.
JSON output
Add --json to any command to get machine-readable output instead of the formatted terminal view:
instawp create --name my-site --php 8.4 --jsonThis is what makes the CLI usable from scripts, CI jobs, and AI agents. See CI/CD and AI Agents.
Where to go next
- Command Reference — every command, flag, and example
- Local Development with the CLI — Playground sandboxes and pushing local work to the cloud
- CI/CD and AI Agents — per-PR preview sites and agent workflows