Command-line (sc)
sc is a small command-line client over the REST API, for clinic IT, automation scripts, and terminal-based AI agents. It speaks the same contract as REST and uses the same sk_live_... keys.
#Install
bash
cd cli
bun install
bun link # exposes the `sc` command
#Authenticate
Log in once to store a key locally, or pass it via environment variables per invocation.
Interactive login
sc login # prompts for a key, stores it in ~/.sc/config.json
Environment
export SC_API_KEY=sk_live_...
export SC_BASE_URL=https://api.smile-app.co.il
sc whoami
#Common commands
bash
sc whoami # clinic id + scopes
sc patients list --phone 0521234567 # search patients
sc patients get 8842 # one patient
sc appointments list --branch 1 --from 2026-07-01 --to 2026-07-07
sc availability --branch 1 --from 2026-07-01 --to 2026-07-07
sc catalog branches # reference data
#Analytics
Run server-side aggregations instead of fetching and summing rows. sc metrics lists what's queryable; sc query runs one GROUP BY. See Analytics.
bash
sc metrics # all datasets, measures, dimensions, filters
sc metrics treatments # one dataset
# net revenue + count per provider, H1 2026, top 50
sc query treatments \
-m net_revenue -m treatment_count \
-b provider \
-f effective_date:between:2026-01-01..2026-06-30 \
-o net_revenue:desc --limit 50
-m/--measure and -b/--by are repeatable; -f/--filter is field:op:value (a comma list for in/not_in, an a..b range for between).
#Output formats
A global --format flag controls output:
| Format | Description |
|---|---|
table (default) | Human-friendly aligned tables. |
json | Pretty-printed JSON. |
agents | Minified JSON; large payloads spill to a temp file path, ideal for AI agents. |
bash
sc appointments list --branch 1 --format json
#Self-discovery for agents
sc schema emits the full command tree as JSON, so an AI agent can discover available commands and flags without guessing:
bash
sc schema