## Command-line interface

The `postlane` command wraps the [REST API](/docs/api): every command prints JSON and exits with a code a pipeline can gate on. It runs the same checks as the web app and the assistant tools — the same preflight, the same delivery guards, the same receipt. It is the console script of the A1 Lane Python package (also runnable as `python -m postlane`) and uses the Python standard library only.

### Configure

- `POSTLANE_URL` — the server to talk to (or `--url`).

- `POSTLANE_TOKEN` — a workspace API token (`plt_…`, scopes `read ⊂ write ⊂ publish`) for pipelines, or a session token (`ses_…`, printed by `postlane auth login`) for your own account actions (or `--token`).

- `POSTLANE_WORKSPACE` — the default workspace id (or `--workspace` / `-w`). `--pretty` indents the JSON.

```
export POSTLANE_URL=https://a1lane.ai
postlane auth login --email you@example.com      # prints a session token
export POSTLANE_TOKEN=ses_…
postlane workspaces list
export POSTLANE_WORKSPACE=ws-…
postlane tokens create pipeline --scope read --scope write --scope publish   # shown once
export POSTLANE_TOKEN=plt_…                       # pipelines use the workspace token
postlane create --caption "Today's clip" --to acc_… --at 2026-11-07T09:00:00-08:00
postlane status post_… --wait                     # exit 0 only when every destination is live
```

### Exit codes

| Code | Meaning |
| `0` | Done — every destination settled as asked. |
| `1` | Error — the request was refused or failed; the JSON says why. |
| `2` | Not done yet — destinations are still active. |
| `3` | Attention needed — a failed, uncertain or blocked destination, or an unhealthy account. |

### Commands

41 commands, read from the CLI's own argument parser on this request.

| Command | What it does | Usage |
| `platforms` |  | `postlane platforms [-h]` |
| `auth` | sign up / log in as an ordinary user; prints a session token |  |
| `auth signup` |  | `postlane auth signup [-h] --email EMAIL [--name NAME]
                            [--password PASSWORD] [--code CODE]` |
| `auth login` |  | `postlane auth login [-h] --email EMAIL [--name NAME]
                           [--password PASSWORD] [--code CODE]` |
| `auth logout` |  | `postlane auth logout [-h]` |
| `auth me` |  | `postlane auth me [-h]` |
| `workspaces list` |  | `postlane workspaces list [-h]` |
| `workspaces create` |  | `postlane workspaces create [-h] name` |
| `workspaces delete` |  | `postlane workspaces delete [-h] id` |
| `workspaces settings` | key=value (require_approval=true, timezone=…) | `postlane workspaces settings [-h] [fields ...]` |
| `tokens` | workspace API tokens (session token required) |  |
| `tokens list` |  | `postlane tokens list [-h]` |
| `tokens create` |  | `postlane tokens create [-h] [--scope SCOPE] name` |
| `tokens revoke` |  | `postlane tokens revoke [-h] id` |
| `members list` |  | `postlane members list [-h]` |
| `members invite` |  | `postlane members invite [-h] [--role ROLE] email` |
| `batch` | A-4: submit many posts from a JSON file; print the roll-up | `postlane batch [-h] [--wait] [--timeout TIMEOUT] source` |
| `approval` | request | approve | reject | `postlane approval [-h] [--note NOTE] id {request,approve,reject}` |
| `release` | G-4: release a post held for same-asset confirmation | `postlane release [-h] id` |
| `handoff` | print the handoff pack(s) for a post | `postlane handoff [-h] id` |
| `accounts list` |  | `postlane accounts list [-h]` |
| `accounts connect` |  | `postlane accounts connect [-h] [--reconnect RECONNECT]
                                 [--from-file FROM_FILE]
                                 platform [fields ...]` |
| `accounts probe` |  | `postlane accounts probe [-h] id` |
| `accounts disconnect` |  | `postlane accounts disconnect [-h] id` |
| `accounts show` |  | `postlane accounts show [-h] id` |
| `accounts settings` |  | `postlane accounts settings [-h] id [fields ...]` |
| `media add` |  | `postlane media add [-h] source` |
| `media list` |  | `postlane media list [-h]` |
| `media delete` |  | `postlane media delete [-h] id` |
| `create` | create a post | `postlane create [-h] [--caption CAPTION] [--media MEDIA] [--to TO]
                       [--at AT] [--draft] [--label LABEL] [--json JSON]
                       [--wait] [--timeout TIMEOUT]` |
| `status` |  | `postlane status [-h] [--receipts] [--wait] [--timeout TIMEOUT] id` |
| `list` |  | `postlane list [-h] [--status STATUS] [--limit LIMIT] [--offset OFFSET]` |
| `attention` |  | `postlane attention [-h]` |
| `retry` |  | `postlane retry [-h] [--force] [--acknowledge]
                      [--destination DESTINATION]
                      id` |
| `cancel` |  | `postlane cancel [-h] id` |
| `delete` |  | `postlane delete [-h] id` |
| `duplicate` |  | `postlane duplicate [-h] id` |
| `publish` | queue a draft | `postlane publish [-h] [--at AT] id` |
| `resolve` | run the A-3 probe for an uncertain destination | `postlane resolve [-h] post destination` |
| `events` |  | `postlane events [-h] [--after AFTER] [--limit LIMIT] [--follow]` |
| `export` |  | `postlane export [-h]` |

### Self-hosted operator commands

These act on a deployment's own data directory or its admin token. They are for people running their own server, not for the hosted service.

| Command | What it does | Usage |
| `serve` | run the engine + API in this process | `postlane serve [-h]` |
| `seed-reviewer` | R-29: create/refresh the reviewer test workspace offline (2FA-exempt, no live platform) | `postlane seed-reviewer [-h] --email EMAIL --password PASSWORD
                              [--workspace-name WORKSPACE_NAME]` |
| `backup` | snapshot every database (SQLite backup API) + sync media/logs append-only to POSTLANE_BACKUP_TARGET | `postlane backup [-h] [--target TARGET]` |
| `backup-drill` | restore the newest snapshot into a scratch dir, integrity-check it and compare receipt counts | `postlane backup-drill [-h] [--target TARGET]` |
| `restore` | restore a snapshot + the newer journal into the data dir (engine stopped); the next start quarantines | `postlane restore [-h] [--snapshot SNAPSHOT] [--target TARGET]
                        [--no-journal]` |
| `restore-boot` | container boot: empty data dir + a backup set on POSTLANE_BACKUP_TARGET -> restore snapshot + journal (staged, verified, promoted); fails closed | `postlane restore-boot [-h]` |
| `mfa-reset` | operator recovery: turn off a user's 2FA and revoke their sessions (offline; no email path exists) | `postlane mfa-reset [-h] --email EMAIL` |
| `deletion-records` | Q-Del-5: list platform data-deletion (and deauthorize) records past 12-month retention (offline); --purge deletes them | `postlane deletion-records [-h] [--purge]` |
| `token` | show where the API token lives | `postlane token [-h] [--reveal]` |
| `health` |  | `postlane health [-h]` |

---
HTML version: https://a1lane.ai/docs/cli
Tool surface: v1.4, generated from the running server
