SoraiDocs
GuidesAPI reference

Quickstart

Install the CLI, sign in, and put a product and its page on sale.

This walks through selling an ebook from your terminal: install sorai, sign in, add a product with a price and a file, give it a page, and publish. It takes about ten minutes.

1. Install

brew install sorai-ai/tap/sorai

No Homebrew? Use curl -fsSL https://sorai.ai/install.sh | sh on macOS and Linux, or see Install for Windows. Then check it runs:

sorai version

2. Create a store

Stores are created in the console. Sign up at console.sorai.ai: the first-run setup asks for your business and creates your first store. Already have one? Skip ahead. To add another store later, use New store in the store switcher.

3. Create a secret key

In the console, open Organization, then API keys, and choose Create key. Pick Secret, and give it these permissions for this guide:

  • View products, prices and discount codes
  • Manage products, prices, media and discount codes
  • View stores and pages
  • Manage stores, themes and pages, including publishing

Copy the key (it starts with ssk_). It is shown only once.

4. Sign in

sorai login

Paste the key when asked; it is not shown as you type. With more than one store, pick the one commands should use by default. Check who you are signed in as:

sorai auth status

The commands below leave out --store and use that default. Add --store <slug> to any of them to work on another store.

5. Create a product

Upload a cover image. The command prints the new image's id:

sorai media upload --file cover.png

Create the product with that image as its cover. It starts as a draft, so nobody can buy it yet. Note the product id it prints:

sorai products create --slug my-ebook --name "My Ebook" --kind file \
  --cover-media-id <media id>

Give it a price. Amounts are in the currency's smallest unit, so for IDR 150,000:

sorai prices create --product-id <product id> --currency IDR \
  --amount-minor 150000 --kind one_time

Upload the file buyers get after paying, then check on it until its status is ready:

sorai products upload-file --product-id <product id> --file my-ebook.pdf
sorai products files --product-id <product id>

6. Create a page

Create a landing page for the product. It starts as an unpublished draft with no content:

sorai pages create --slug my-ebook --kind landing --mode blocks

Its content is built in the console: open Pages, pick my-ebook, and add your blocks in the page builder.

7. Publish

Put the product on sale. Try it with --dry-run first, which shows the change and makes none:

sorai products update --product-id <product id> --status active --dry-run
sorai products update --product-id <product id> --status active

Then publish the page from the page builder in the console with Publish. Your product is live, and sorai products list shows it as active.

Next steps

On this page