# CLI reference (/docs/cli)



```sh
npx liftbay <command>
```

In CI, set `LIFTBAY_TOKEN` to an organization API token instead of running `liftbay login`.

## JSON output [#json-output]

Add `--json` to any command, or set `LIFTBAY_JSON=1`, to get machine-readable output. These are the rules:

* Stdout holds exactly one JSON document: the command's result, or `{"error": {"code", "message", ...}}` with exit code 1.
* Progress, build logs and notes go to stderr.
* The CLI never prompts. When input is missing, it fails with a message naming the flag to pass.

The same rules apply without `--json` when there's no terminal, for example in CI or when an [AI agent](/docs/agents) runs the CLI.

## Account [#account]

| Command          | What it does                                                                                                                                                                                                                                                                                             |
| ---------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `liftbay login`  | Sign in: in the browser, or with a code sent by email (`--email <address>` sends it; add `--code <code>` to sign in without a prompt). Signing in for the first time creates your account. Browser: `--no-open` prints the link; `--no-wait` starts the sign-in and exits, then `liftbay login` finishes |
| `liftbay logout` | Sign out and remove the saved token                                                                                                                                                                                                                                                                      |
| `liftbay whoami` | Show the signed-in user and organizations                                                                                                                                                                                                                                                                |

## Setup [#setup]

| Command            | What it does                                                                                                                      |                          |
| ------------------ | --------------------------------------------------------------------------------------------------------------------------------- | ------------------------ |
| `liftbay init`     | Link the project, set up builds, then OTA updates (`--no-ota` to skip updates)                                                    |                          |
| `liftbay ci init`  | Build profiles, environments, app identifiers, the GitHub workflow and repository                                                 |                          |
| `liftbay ota init` | Update channels, plus `expo-updates`, the Liftbay config plugin and the runtime version policy for Expo apps (\`--client codepush | hot-updater\` for those) |

Shared options: `--org`, `--project`, `--platforms ios|android|all`, `--ios-engine github-actions|xcode-cloud` (the project's default for iOS store builds, also in the dashboard's project settings), `--runtime-policy appVersion|fingerprint`, `--no-eas`, `-y` (accept defaults).

For agents and scripts: `liftbay init --questions --json` lists every question `init` asks, with the choices for this app. Answer them in a JSON file and run `liftbay init --answers <file>` to set up without any prompts. See [AI agents](/docs/agents#setting-up-an-app).

With an `eas.json` in the app, `init` and `ci init` use its build profiles (names, channels, distribution) and import each profile's `env` into the environment of the same name. See [Coming from EAS](/docs/environments#coming-from-eas).

## Environment variables [#environment-variables]

| Command                         | What it does                                                                                                                                                                                                                             |
| ------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `liftbay env list`              | Environments and their variable counts; `-e <slug>` lists one environment's variables (sensitive masked, secrets never shown)                                                                                                            |
| `liftbay env import <files...>` | Import `.env` files, each into the environment it's named for (`.env.production` → `production`), or `-e <slug>`; or `eas.json` to import every EAS profile's env. `--visibility` for all keys, `--no-overwrite` to keep existing values |
| `liftbay env set KEY=value...`  | Set variables (`-e <slug>`, `--visibility`). Values end up in shell history: prefer `env import` for secrets                                                                                                                             |
| `liftbay env unset KEY...`      | Remove variables (`-e <slug>`)                                                                                                                                                                                                           |
| `liftbay env export`            | Print an environment as a `.env` file, or write it with `--out` (secret values are never exported)                                                                                                                                       |

Without `--visibility`, each key gets one: `EXPO_PUBLIC_*` is plain, names like `*_TOKEN`, `*_SECRET`, `*_PASSWORD` or `*_KEY` are secret, and the rest are sensitive.

## GitHub [#github]

| Command                   | What it does                                                                                                 |
| ------------------------- | ------------------------------------------------------------------------------------------------------------ |
| `liftbay github status`   | Is the repository linked, the Liftbay GitHub App installed, and the workflow on the default branch?          |
| `liftbay github connect`  | Install the GitHub App: opens GitHub and follows the install until it's linked (`--no-wait` prints the link) |
| `liftbay github workflow` | Optional: open a pull request that adds `.github/workflows/liftbay.yml` to the default branch (`--no-wait`)  |

Builds run the workflow from the branch you build, so it doesn't have to be on your default branch. Until it's there, Liftbay starts each build through a temporary `liftbay/build/<platform>/<build id>` branch at your branch's commit, and deletes that branch once the build has started. `liftbay init` and `liftbay build` walk you through installing the GitHub App.

## Builds [#builds]

`liftbay build` queues builds on your GitHub Actions or Xcode Cloud and follows their logs. In a terminal, it asks for the profile and platform when you don't pass them. Before queuing, it checks that the Liftbay setup is committed and the branch is pushed, offering to do both, and that the GitHub App is installed.

| Option                                   | Meaning                                                                                                                                 |
| ---------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------- |
| `--platform <ios\|android\|all>`         | Asked in a terminal; otherwise the profile's platforms                                                                                  |
| `--profile <name>`                       | Build profile from `liftbay.json`; asked in a terminal, otherwise `production`                                                          |
| `--ref <ref>`                            | Branch, tag or commit (default: current branch)                                                                                         |
| `-m, --message <text>`                   | Build message                                                                                                                           |
| `--simulator`                            | iOS simulator build, no signing                                                                                                         |
| `--no-wait`                              | Queue and exit without following the build                                                                                              |
| `--logs`                                 | Show the whole build log as it runs. By default, `build` shows each step as it finishes, and the end of the log if the build fails      |
| `--submit`                               | Submit store builds when they succeed ([store submission](/docs/builds/submit))                                                         |
| `--track <track>`                        | Play track for `--submit`: `internal`, `alpha`, `beta`, `production`                                                                    |
| `--engine <github-actions\|xcode-cloud>` | Where this iOS store build runs. In a terminal it's asked, defaulting to the project's setting; otherwise the project's setting is used |

The exit code is non-zero if any build didn't succeed.

## Looking at builds [#looking-at-builds]

| Command                            | What it does                                                                   |
| ---------------------------------- | ------------------------------------------------------------------------------ |
| `liftbay builds list`              | Recent builds (`--platform`, `--status failed,cancelled`, `--limit`)           |
| `liftbay builds view <number>`     | Status, phases and artifacts; the install or download link of a finished build |
| `liftbay builds logs <number>`     | The build log (`--follow` until it ends, `--tail <n>` for the last lines)      |
| `liftbay builds download <number>` | Save the artifacts (`--kind ipa\|apk\|aab`, `--out <dir>`)                     |
| `liftbay builds cancel <number>`   | Cancel a queued or running build                                               |

## Submit [#submit]

`liftbay submit` uploads a successful store build to TestFlight or a Google Play track and follows it.

| Option                           | Meaning                                                                       |
| -------------------------------- | ----------------------------------------------------------------------------- |
| `--build <number>`               | Build to submit (default: the newest successful store build of each platform) |
| `--platform <ios\|android\|all>` | Platforms when no `--build` is given (default `all`)                          |
| `--track <track>`                | Play track: `internal` (default), `alpha`, `beta`, `production`               |
| `--rollout <percent>`            | Play staged rollout percentage                                                |
| `--no-wait`                      | Queue and exit                                                                |

Follow submissions with `liftbay submissions list` and `liftbay submissions view <id>`.

## Xcode Cloud [#xcode-cloud]

| Command                          | What it does                                                                                                                                                            |
| -------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `liftbay xcode-cloud connect`    | Link the app's Xcode Cloud product and create the Liftbay workflow; waits for the one-time App Store Connect step (`--team-id`, `--workspace`, `--scheme`, `--no-wait`) |
| `liftbay xcode-cloud status`     | Connection and this month's estimated hours                                                                                                                             |
| `liftbay xcode-cloud disconnect` | Remove the Liftbay workflow; iOS builds go back to GitHub Actions                                                                                                       |

## Credentials [#credentials]

| Command                              | What it does                                                                                                                                                                                |
| ------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `liftbay credentials`                | Show the organization's Apple keys and the project's signing                                                                                                                                |
| `liftbay credentials ios`            | Set up iOS signing: Apple ID sign-in, or a `.p8` key                                                                                                                                        |
| `liftbay credentials android`        | Google Play service account: `--play-key <file>` to save, `--remove` to delete                                                                                                              |
| `liftbay credentials android import` | Use your existing upload keystore: `--keystore <file> --alias <alias>`, passwords from `LIFTBAY_KEYSTORE_PASSWORD` / `LIFTBAY_KEY_PASSWORD` or prompts, `--replace` to replace a stored key |
| `liftbay credentials android export` | Back up the upload keystore and a `.properties` file with its passwords (owners and admins): `--out <file>`, `--force`                                                                      |

`credentials ios` options: `--apple-id`, `--team-id`, `--bundle-id` (repeatable), `--adhoc`, `--p8`, `--key-id`, `--issuer-id`, `--sign-out`, `-y`.

## Devices [#devices]

| Command                      | What it does                                                                                                                                   |
| ---------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
| `liftbay device add`         | Register an iPhone or iPad with a QR code it opens (`--udid` and `--name` to add by UDID, `--team-id`, `--no-wait` to print the link and exit) |
| `liftbay device list`        | Registered devices                                                                                                                             |
| `liftbay device remove <id>` | Remove a device (disabled at Apple)                                                                                                            |

`LIFTBAY_APPLE_ID` and `LIFTBAY_APPLE_PASSWORD` are read from the environment if set.

## Updates [#updates]

| Command                            | What it does                                                                                                      |
| ---------------------------------- | ----------------------------------------------------------------------------------------------------------------- |
| `liftbay update publish`           | Export and publish an update, signed when a signing key is found ([options](/docs/updates/publishing#options))    |
| `liftbay update signing init`      | Create the update signing key and certificate, register the certificate ([signed updates](/docs/updates/signing)) |
| `liftbay update list`              | Release history of a channel (`--channel`)                                                                        |
| `liftbay update rollout <percent>` | Change the active release's rollout (`--channel`)                                                                 |
| `liftbay update rollback`          | Roll back the active release (`--channel`)                                                                        |
| `liftbay channels`                 | List update channels                                                                                              |

## Environment variables [#environment-variables-1]

| Variable                     | Meaning                                         |
| ---------------------------- | ----------------------------------------------- |
| `LIFTBAY_TOKEN`              | Organization API token, for CI                  |
| `LIFTBAY_JSON`               | `1` for [JSON output](#json-output)             |
| `LIFTBAY_UPDATE_PRIVATE_KEY` | Update signing key (the PEM, or a path), for CI |
| `LIFTBAY_API_URL`            | API URL (self-hosted or local development)      |
| `LIFTBAY_DASHBOARD_URL`      | Dashboard URL                                   |
