SoraiDocs
GuidesAPI reference

Overview

Run your Sorai store from the terminal with the sorai CLI.

sorai lists and updates products, prices, pages and orders, opens checkout links and reads sales analytics, from your terminal. Every command prints JSON, so it works as well in a script or for an AI agent as it does for you. It is one small binary with no runtime to install.

New here? The quickstart takes you from install to a product on sale. Every command and flag is in the command reference.

Install

brew install sorai-ai/tap/sorai

Or, on macOS and Linux, into ~/.local/bin:

curl -fsSL https://sorai.ai/install.sh | sh

On Windows, download the zip for your CPU from the releases page.

Check it runs with sorai version.

Sign in

The CLI acts with a secret key. Create one in the Sorai console under Organization, API keys: pick Secret and the permissions the key needs. Its permissions decide what sorai can do. Then:

sorai login

sorai login asks for the key without showing it, checks it, lets you pick a default store when you have several, and saves it on this machine, readable only by you. Every later command uses it.

  • sorai auth status shows the key you are signed in with.
  • sorai logout forgets the key on this machine. The key keeps working until you revoke it in the console.
  • For more than one account, sign in with sorai login --profile work, then pass --profile work (or set SORAI_PROFILE=work) on any command.

The key is never printed.

Scripts and CI

Pipe the key in with --with-key, or set SORAI_API_KEY. When SORAI_API_KEY is set, the saved login is not used at all.

echo "$SORAI_KEY" | sorai login --with-key
VariableWhat it does
SORAI_API_KEYThe secret key every request uses, instead of the saved login.
SORAI_STOREThe default --store, as an id or a slug.
SORAI_PROFILEThe saved login to use.

How commands behave

  • Commands read sorai <group> <command> --flags. Every input is a flag.
  • --store takes a store id or a slug. Left out, it uses SORAI_STORE, the store saved at login, or your only store.
  • Output is JSON on stdout: indented on a terminal, one line in a pipe. Filter it with jq.
  • A failure writes {"error":{"code","message"}} to stderr. Exit code 2 means the command or a flag was wrong; exit code 1 means Sorai refused the request.
  • Flag values are whole numbers, true or false, null to clear a field that allows it, and JSON for object flags such as --settings. Pass an empty value as --description="".
  • Updates change only the flags you pass. A JSON flag replaces the whole object, so read it first, change it, and send it back.
  • Every command that changes data takes --dry-run, which prints what it would do and changes nothing.
  • Amounts are in the currency's smallest unit: 1500 is USD 15.00, and since IDR has no decimals, 150000 is IDR 150,000. Sorai never converts between currencies.

For AI agents

sorai guide prints a Markdown guide to every command and flag, generated from the binary you run. Point your agent at it. Each release also ships a SKILL.md next to the binary for agent harnesses that read skills.

Verify a release

Each release's checksums.txt is signed with Sorai's release key. Fetch the public key from sorai.ai, not from where you downloaded the release, then check with cosign:

curl -fsSLO https://sorai.ai/cosign.pub
cosign verify-blob checksums.txt --bundle checksums.txt.sigstore.json --key cosign.pub
shasum -a 256 -c --ignore-missing checksums.txt

install.sh checks each download against checksums.txt; the signature is what proves a release is genuine.

On this page