CLI & Tooling
A running app
These commands talk to a running app over its own API, so row-level security, field access, hooks and storage policies decide what they may do, as they do for the SDK. They reach the local rebase dev, a server you name, or a Rebase Cloud project, with the same flags everywhere.
Choosing the server and the credential
Section titled “Choosing the server and the credential”| Flag | Where requests go, and as whom |
|---|---|
| (none) | REBASE_BASE_URL (shell, then .env), else the rebase dev this checkout is running; with the service key from .env |
--url <server> |
That server, with the service key from .env |
--project <slug> |
A Rebase Cloud project, through the console’s Studio proxy: you sign in with rebase cloud login, and the control plane attaches the app’s key on its side, so no key reaches your machine. Organization owners and admins, on a project whose Studio access is on (rebase cloud settings set --studio on) |
--cloud |
The Rebase Cloud project this directory is linked to |
--token <bearer> |
Send this bearer instead: an rk_ key, or a user’s access token. On a Cloud project it goes to the app’s own address |
--session |
Send the person session rebase auth login stored for that server |
--anon |
Send nothing: what a visitor gets |
Nothing else is guessed: with no REBASE_BASE_URL and no running rebase dev, a command refuses rather than send the service key to whatever listens on a port. Every command takes --json (and is JSON whenever stdout is not a terminal, as rebase cloud is) and --yes, which answers the confirmation that every destructive one asks; with no terminal it refuses with confirmation_required instead of prompting.
rebase api-keys, rebase storage orphans|move and rebase schema reconcile take the same flags.
rebase api
Section titled “rebase api”Any route the app serves, with the project’s credential — the long tail that has no command of its own: a materialized view’s refresh, the RLS audit, /api/meta/contract, a route a plugin adds.
rebase api data/posts -f status=eq.published -f limit=5 # GET /api/data/posts?status=eq.published&limit=5rebase api POST data/posts -F title=Hello -F published=truerebase api /api/admin/rls-audit --project acmerebase api PATCH data/posts/42 --input change.json --includeA path without a leading / is under /api. -f key=value is a string field and -F a typed one (true, false, null, numbers, JSON, @file); fields are the query string of a GET, HEAD or DELETE and a JSON body otherwise. Unlike gh api, a field alone never makes the request a POST: a write names its method or carries --input. The answer is printed as it came — JSON pretty-printed — and a non-2xx answer is printed and exits 1. An Authorization header is refused; the target flags choose the credential.
rebase data
Section titled “rebase data”The rows of a table, through /api/data. Filters are the API’s own (?status=eq.published), passed through as written: --where status=eq.published, --where price=gte.10, and a bare --where status=draft for equality.
rebase data query posts --where status=eq.published --order-by created_at:desc -n 10rebase data query orders --all --format csv > orders.csvrebase data get posts 42 --include authorrebase data count posts --where status=eq.draftrebase data aggregate orders --select "count(),sum(total)" --group-by statusrebase data insert posts --data '{"title":"Hello"}'rebase data update posts 42 --data '{"title":"Renamed"}'rebase data delete posts --where status=eq.draft --yesrebase data import posts --file seed.csv --upsert slugrebase data history posts 42 && rebase data revert posts 42 <historyId>rebase data watch posts --where status=eq.published| Action | Notes |
|---|---|
query <table> |
--where, --or, --order-by col[:desc] (repeatable), --limit, --offset, --fields a,b, --include, --search, --deleted include|only; --all walks every page; --format table|json|ndjson|csv (csv and ndjson stream with --all) |
get <table> <id> |
One row, with --fields and --include |
count <table> |
The rows --where matches |
aggregate <table> |
--select and --group-by, the API’s own |
insert <table> |
--data <json> or --file <path|->; an array is several rows in one bulk write; --upsert <column> |
update <table> [<id>] |
One row, or every row --where matches after a count and a confirmation; --if-match <etag> |
delete <table> [<id>] |
Asks first; --hard on a soft-delete table |
import <table> |
--file (JSON array, NDJSON or CSV by extension, or --format), in batches (--batch); --upsert, --ignore-duplicates. What query --format json writes reads back |
history <table> <id>, revert <table> <id> <historyId> |
Tables with history on |
watch <table> |
The matching rows each time they change, over the realtime socket. Not through the Studio proxy: on a Cloud project pass --token or --session |
The service key is the admin role: row-level security still runs, as that role. Pass --token, --session or --anon to see the table as somebody else does.
rebase schema show
Section titled “rebase schema show”The tables, or one table’s columns, relations and row-level security — from backend/schema by default, or with --remote (or any target flag) as the running server describes them to this credential. A credential without schema:read sees no policies, and a table it cannot read is not listed.
rebase schema showrebase schema show posts --remote --project acmerebase users
Section titled “rebase users”The accounts, through /api/admin/users, /roles and /guests. An account is named by its uid or its email (an exact match, never the first fuzzy hit).
rebase users list --search adarebase users create ada@example.com --role adminrebase users update bob@example.com --add-role editorrebase users update bob@example.com --disablerebase users reset-password bob@example.comrebase users mfa-reset bob@example.comrebase users rolesrebase users guests prune --older-than 30d --yescreate emails an invitation, or answers a temporary password once when no mail can be sent. --no-invite creates the account with no password and sends nothing, for an app that signs in by magic link, an email code or a provider (POST /api/admin/users with invite: false). Granting a role, --disable, delete and mfa-reset ask first. No caller may grant a role above its own, or act on an account that outranks it. rebase auth reset-password is the older spelling, and still falls back to the database when the server is not running.
rebase cron
Section titled “rebase cron”The app’s scheduled jobs (backend/crons/*).
rebase cron listrebase cron logs nightly-backup -n 5rebase cron run cleanup-sessions --yesrebase cron disable nightly-backup --yesrebase cron reset nightly-backup # the job's code decides againenable and disable override the job’s code on every process, across redeploys; run asks first, and --async answers once the run has started. On a Cloud project rebase cron needs no Studio access for reads: it asks the control plane for a short cron:read platform token, which any member with log access holds. run, enable, disable and reset ask for cron:write, which an organization owner or admin holds on a project with Studio on. rebase cloud cron is the older, read-only spelling.
rebase logs
Section titled “rebase logs”The server’s request and application log — the buffer the Studio Logs Explorer reads — once, or followed with -f.
rebase logs -n 50 --level warnrebase logs -f --source auth --search "sign-in"The buffer is one process’s. With --project or --cloud this is rebase cloud logs --runtime: every replica’s output, through the control plane.
rebase functions
Section titled “rebase functions”The app’s own routes, one per file in backend/functions/.
rebase functions listrebase functions invoke hello --anonrebase functions invoke billing webhook -X POST --input event.jsoninvoke takes the fields, body and headers rebase api takes, and prints the answer as it came. Functions decide their own access, so the credential matters: --anon shows what a visitor gets.
rebase storage
Section titled “rebase storage”Stored files, through the storage policies. The stored side starts with a colon: :avatars/me.png in the default source, media:avatars/me.png in the source keyed media.
rebase storage ls :avatarsrebase storage cp ./me.png :avatars/me.pngrebase storage cp :avatars/me.png ./me.pngrebase storage url :avatars/me.png # a signed link: whoever holds it reads the file until it expiresrebase storage stat :avatars/me.pngrebase storage rm :avatars/me.png --yescp --public uploads under the public prefix (a permanent, token-less URL), --content-type sets the type, and --force overwrites a local file on download. orphans and move are the whole-store maintenance half of the group.
rebase rls simulate
Section titled “rebase rls simulate”What another identity would see, from the app’s RLS simulator — the one Studio’s “view as” uses: per table, the rows it reads against the rows you read, the tables its scopes shut it out of, and the columns it cannot read. Read-only.
rebase auth login --email you@example.comrebase rls simulate --role anonrebase rls simulate --user 3f0c9a7e-… --table postsrebase rls simulate --key <api-key-id>rebase rls optionsThe simulator answers an administrator’s own session and never a key, so this sends the session rebase auth login stored. rebase verify --live checks the policies themselves, with no identity in mind.
rebase auth login, emails and keys
Section titled “rebase auth login, emails and keys”Some routes answer a person and never a machine: the RLS simulator, personal keys, live schema apply. rebase auth login signs in to a running app — through the browser when the server offers device sign-in, else with --email and a password (--code for a second factor) — and keeps the session in ~/.rebase/sessions.json, by server, never in the project. auth whoami says who the server takes you to be and the scopes you hold; auth logout ends the session there too.
rebase auth login --email you@example.comrebase auth whoami --sessionrebase auth emails --latest --links # the dev mailbox: sign-in, reset and magic-link mail with no SMTP_HOSTrebase auth keys create --name ci --scopes data:read:posts --expires-in 30rebase auth keys revoke <id> --yesauth emails reads the development mailbox a server with no SMTP_HOST keeps instead of sending; --clear empties it. auth keys manages your own rk_ keys, which act as you, narrowed to the scopes named; the server answers it only when the auth table sets auth.personalKeys: true. Service keys are rebase api-keys, which also gained update <id>.
Next steps
Section titled “Next steps”- Endpoint index — every route these commands reach, and the scope each needs
- REST API — the filter, sort and paging syntax
rebase datapasses through - rebase cloud — the project itself on Rebase Cloud: deploys, environment, backups, Studio access
- CLI Reference — every other command