01 Software

CLI

Manage your data from the command line with @01.software/cli

CLI

@01.software/cli is a standalone command-line tool for interacting with your 01.software collections and ecommerce APIs. It wraps the SDK and provides 28 commands for authentication, CRUD, orders, returns, carts, stock, transactions, tenant management, schema inspection, and MCP.

Installation

npm install -g @01.software/cli

Or run directly with npx:

npx @01.software/cli query products --limit 5

Authentication

Log in via browser to automatically store credentials:

01 login

This opens your browser, lets you log in and select a tenant, then saves credentials locally at ~/.01software/credentials.json.

# Check current auth status
01 whoami

# Remove stored credentials
01 logout

Set environment variables in your shell:

export SOFTWARE_CLIENT_KEY="your-client-key"
export SOFTWARE_SECRET_KEY="your-secret-key"

Find your keys in the 01.software Console under tenant settings.

Pass a Base64-encoded API key directly:

01 --api-key <base64> query products

Generate the key:

echo -n "your-client-key:your-secret-key" | base64

Or programmatically:

import { createApiKey } from '@01.software/sdk'

const apiKey = createApiKey(clientKey, secretKey)

Priority: --api-key flag > environment variables > stored credentials (01 login)

Global Options

OptionDescription
--api-key <base64>Base64-encoded API key (clientKey:secretKey)
--format <format>Output format: json (default), table, or ndjson
--dry-runValidate inputs without executing (supported by all mutating commands)
-V, --versionShow version
-h, --helpShow help

Commands

Auth (3)

# Login via browser
01 login

# Show current auth status
01 whoami

# Remove stored credentials
01 logout

CRUD (7)

Query, get, create, update, and delete documents in any collection.

# List products with filtering
01 query products --where '{"status":{"equals":"active"}}' --limit 10 --sort "-createdAt"

# Get a single document
01 get products <id>

# Create a document
01 create products --data '{"title":"New Product","price":1000}'

# Update a document
01 update products <id> --data '{"price":2000}'

# Delete a document
01 delete products <id>

# Bulk update
01 update-many products --where '{"status":{"equals":"draft"}}' --data '{"status":"active"}'

# Bulk delete
01 delete-many products --where '{"status":{"equals":"archived"}}'
CommandArgumentsRequired Options
query <collection>collection name--where, --limit, --page, --sort, --depth, --select (all optional)
get <collection> <id>collection, document ID
create <collection>collection name--data <json>
update <collection> <id>collection, document ID--data <json>
delete <collection> <id>collection, document ID
update-many <collection>collection name--where <json>, --data <json>
delete-many <collection>collection name--where <json>

Order (5)

# Create an order
01 order create \
  --payment-id "pay_123" \
  --order-number "ORD-001" \
  --email "customer@example.com" \
  --shipping-address '{"address1":"123 Main St","recipientName":"John"}' \
  --products '[{"product":"prod_1","variant":"var_1","option":"opt_1","quantity":2}]' \
  --total-amount 50000

# Get order details
01 order get ORD-001

# Update order status
01 order update ORD-001 --status shipped

# Checkout (cart → order)
01 order checkout \
  --cart-id "cart_123" \
  --payment-id "pay_456" \
  --order-number "ORD-002" \
  --customer '{"email":"customer@example.com"}'

# Create fulfillment
01 order fulfill ORD-001 \
  --items '[{"orderProduct":"op_1","quantity":1}]' \
  --carrier "FedEx" \
  --tracking-number "TRACK123"

Return (3)

# Create return request
01 return create ORD-001 \
  --products '[{"orderProduct":"op_1","quantity":1}]' \
  --refund-amount 25000 \
  --reason defective

# Update return status
01 return update <returnId> --status approved

# Return with refund (combined)
01 return refund ORD-001 \
  --products '[{"orderProduct":"op_1","quantity":1}]' \
  --refund-amount 25000 \
  --payment-id "pay_123"

Cart (3)

# Add item to cart
01 cart add <cartId> \
  --product "prod_1" \
  --variant "var_1" \
  --option "opt_1" \
  --quantity 2

# Update quantity
01 cart update <cartItemId> --quantity 3

# Remove item
01 cart remove <cartItemId>

Stock (1)

01 stock check --items '[{"optionId":"opt_1","quantity":5}]'

Transaction (1)

01 transaction update \
  --payment-id "pay_123" \
  --status paid \
  --payment-method "card" \
  --receipt-url "https://example.com/receipt"

Tenant (2)

# List cached tenants
01 tenant list

# Switch active tenant
01 tenant use <name>

# Switch and save locally (project-scoped)
01 tenant use <name> --local

Schema (2)

# List all available collections
01 schema list

# Inspect fields of a collection
01 schema show <collection>

MCP (1)

# Start MCP server (stdio transport)
01 mcp

Output Formats

01 query products --limit 2
{
  "docs": [
    { "id": "abc", "title": "Product A", "price": 1000 },
    { "id": "def", "title": "Product B", "price": 2000 }
  ],
  "totalDocs": 50,
  "page": 1,
  "totalPages": 25
}
01 query products --limit 2 --format table
id   title      price
---  ---------  -----
abc  Product A  1000
def  Product B  2000

50 total | page 1/25
01 query products --limit 2 --format ndjson
{"id":"abc","title":"Product A","price":1000}
{"id":"def","title":"Product B","price":2000}

Newline-delimited JSON — useful for piping into jq or other stream processors.

You can also set OUTPUT_FORMAT environment variable as a fallback.

Supported Collections

All 67 SDK-accessible collections are available. See Collections for details.

All CLI operations require both a Client Key and Secret Key (full read/write access).

Next Steps

On this page