How the Postsale CLI Works
What the CLI is for, how direct commands and natural language relate, and how a safe first session unfolds.
Available by invitation
The Postsale CLI is in an invitation-only release. Your invitation includes a signed program for your platform and its checksum, and new versions reach you the same way until the public release channel opens. To request access, email support@postsale.com.
Postsale is built for the work that happens after checkout: orders, rates, labels, and the operations around them. The Postsale CLI (postsale) gives you that same platform from the terminal, with structured results that scripts and AI agents can trust.
This article explains how the CLI is put together, when to use direct commands versus natural language, and how safety and output fit together. We will stay practical.
In this article, we will explain what the CLI is designed for, compare direct commands with postsale run, walk through a safe first session, and point you to deeper articles for auth, safety, shipping, and agents.
What Is the Postsale CLI?
The CLI is an agent-first command-line client for Postsale. In practice that means:
- JSON on stdout for results you can pipe and parse
- Structured errors on stderr with stable codes and exit codes
- Direct commands when you already know the operation (
orders,shipments,labels, and more) - Natural language via
postsale runwhen the work takes several steps
Same account, different jobs
| Surface | Best for |
|---|---|
| Web app | Day-to-day visual shipping, configuration, investigation with eyes |
| CLI | Repeatable ops, unattended runs, pipes, multi-step plain-language intents, agent hosts with machine contracts |
Same Postsale account and carriers. The CLI is not a full replacement for Dock-heavy UX. Product help for the web app: postsale.com/help. Other surfaces (browser Anywhere, MCP) are documented separately when you need them.
Tip
This library is specifically for the CLI.
Two Ways to Work
| Approach | You provide | Best when |
|---|---|---|
| Direct commands | Exact group, subcommand, and flags or JSON | Scripts, unattended runs, known IDs, pipes |
postsale run | A plain-language intent | Multi-step work, discovery, "cheapest carrier for this order" |
Both paths use the same Postsale account, carriers, and safety rules. Natural language does not bypass confirmation for label purchases or deletes.
Before We Begin
This article assumes that:
- You can run
postsale --version(the CLI reports its own semver;postsale doctoradds the build commit underchecks.build) - You can sign in or set a token
- (Optional) You have set
ANTHROPIC_API_KEY(orANTHROPIC_AUTH_TOKEN) orOPENAI_API_KEYif you want to trypostsale run
We recommend rehearsing with Test Without Spending while you learn.
How the Pieces Fit Together
You, CI, or an AI host
│
├─► Direct commands (orders, shipments, labels, ...)
│
└─► postsale run (LLM chooses tools and sequences them)
│
▼
Safety gates + HTTP client
│
▼
Postsale APIs- You sign in once per machine, or give unattended runs and agents an API key.
- Direct commands map straight to operations.
postsale runasks a model to pick from the CLI agent tool set (see agent tools reference for the live list), runs them with the same gates, and returns one JSON envelope (or a stream of events).- Money-moving and destructive actions require explicit authorization. parallel batches have an extra batch approval. See Safety.
Try a Safe First Session
Here's how:
- Confirm the install:
postsale --version- Check auth and environment:
postsale auth status
postsale account env- Run preflight:
postsale doctor --human- Read a little data (no labels purchased):
postsale account whoami
postsale orders search --query "orders from last 7 days" --page-size 5- (Optional) Ask the agent a read-only question:
postsale run "how many carriers and origin addresses do I have?"Success looks like this: doctor is healthy enough for your environment, search returns JSON on stdout, and postsale run prints one JSON line on stdout while progress stayed on stderr.
Note
If postsale run fails before it starts (missing LLM key, bad resume id), stdout can be empty. Always check the exit code and stderr in that case.
Good to Know
Install and keeping current
The released CLI is a single signed, self-contained program: nothing else to install and no runtime needed. Install newer signed releases as they ship; pin the exact build you're on with postsale doctor → checks.build.commit.
Output contract in one sentence
stdout is data. stderr is everything human-facing (progress, prompts, error envelopes). Details: Output and Exit Codes.
Domain objects
Orders, shipments, and labels are related but not the same record. Order search does not embed full shipment payloads. Shipment reference holds the parent order id. Details: Orders, shipments, and labels.
Versioning
Document and report the CLI version from postsale --version.
Additional Reading
- Sign In and Credentials
- Safety model
- The agent loop (
postsale run) - First hour workflow
- Ship one order
- Runtime agent contract: AGENTS.md
On this page
Related