Sixteen flags are accepted by every surreal cloud command. They may appear anywhere after cloud - before the group, between the group and the verb, or after the verb - so all three of these are the same invocation:
surreal cloud --json instance list
surreal cloud instance --json list
surreal cloud instance list --json--help groups them under four headings, and this page keeps those groups.
Context
Authentication
--token has no short form on purpose: -t reads as --type on the instance commands, and a credential belongs in the environment or a file rather than in argv. See Authentication.
A base URL with a path of its own is refused as a usage error, because the client appends its own routes and the path would be silently prepended to every one of them:
Ensure the API base has no path, such as https://api.surrealdb.comOutput
--color is the one flag with no SURREAL_CLOUD_* variable. Colour also honours the NO_COLOR, FORCE_COLOR and CLICOLOR_FORCE conventions.
--json and --plain are independent axes: --json chooses the encoding, --plain the decoration. Passing both is accepted and --plain is ignored, because CI scripts pass both and erroring on that is hostile.
Logging
--help files the request timeout and the retry budget under this heading alongside the log level.
The effective per-request timeout is never shorter than 21 seconds, because the API's own upstream timeout is 20 seconds and giving up sooner abandons requests that are still being worked on.
The precedence chain
Every value that can come from more than one place is resolved once, before the command runs, in this order - highest first:
A command-line flag
An environment variable
The profile in
config.tomlThe persisted context, written by
org useYour account's default organisation, as the API reports it
The only candidate, when exactly one exists
An interactive picker, when a person is present
An error naming the flag that would have settled it
Layers 5 to 7 apply to the organisation specifically. Exactly one candidate is not a choice, so it is used silently; several candidates in a non-interactive session is an error rather than a guess:
Several organizations are available and none was chosen.
Pass --org, set SURREAL_CLOUD_ORG, or run `surreal cloud org use <name>`.
Available:
acme
contoso--debug prints which layer won each value, and context show reports it as part of its answer:
| Layer | Reported as |
|---|---|
| Command-line flag | command-line flag |
| Environment variable | environment variable |
Profile in config.toml | profile in config.toml |
| Persisted context | persisted context (org use) |
| Account default | your account's default organization |
| Single candidate | the only candidate |
| Interactive picker | interactive choice |
An organisation reference that already looks like an id is used with no lookup at all. A name or slug costs one request to resolve, and an unrecognised one is answered with did-you-mean candidates.
A configured api value applies only when --api was not given. Because the flag has a default, the CLI cannot distinguish "absent" from "passed exactly the default", so passing --api https://api.surrealdb.com explicitly leaves the configured value unused.
Duration syntax
--timeout and --wait-timeout accept the same syntax. A bare number means seconds.
| Suffix | Unit |
|---|---|
(none), s, sec, secs, second, seconds | Seconds |
ms | Milliseconds |
m, min, mins, minute, minutes | Minutes |
h, hr, hrs, hour, hours | Hours |
d, day, days | Days |
surreal cloud --timeout 90 instance list
surreal cloud instance create api --type shared-1 --region aws-euw1 --wait-timeout 5m The SURREAL_CLOUD_ prefix
Every environment variable this component reads is prefixed SURREAL_CLOUD_, and never plain SURREAL_.
Reusing the database's prefix would be harmful. SURREAL_TOKEN in a shell means a database JWT for one instance; reading it as a control-plane credential would send database tokens to api.surrealdb.com on every command.
The only SURREAL_* variables involved are ones surreal cloud sets for the database process during the handoff in instance sql, import and export: SURREAL_TOKEN, and SURREAL_NAMESPACE and SURREAL_DATABASE when given.
Variables that mirror a flag
| Variable | Flag |
|---|---|
SURREAL_CLOUD_PROFILE | --profile |
SURREAL_CLOUD_CONFIG | --config |
SURREAL_CLOUD_ORG | --org |
SURREAL_CLOUD_TOKEN | --token |
SURREAL_CLOUD_TOKEN_FILE | --token-file |
SURREAL_CLOUD_API | --api |
SURREAL_CLOUD_JSON | --json |
SURREAL_CLOUD_PLAIN | --plain |
SURREAL_CLOUD_YES | --yes |
SURREAL_CLOUD_NO_INPUT | --no-input |
SURREAL_CLOUD_LOG | --log |
SURREAL_CLOUD_DEBUG | --debug |
SURREAL_CLOUD_TIMEOUT | --timeout |
SURREAL_CLOUD_RETRIES | --retries |
Variables with no flag
| Variable | Effect |
|---|---|
SURREAL_CLOUD_CONFIG_DIR | Overrides the configuration and credential directory |
SURREAL_CLOUD_AGENT | 1 or 0, forcing agent detection on or off |
SURREAL_CLOUD_SESSION_TOKEN | Supplies an already-minted Cloud session token, for support reproduction |
SURREAL_CLOUD_AUTH_CLIENT_ID | Overrides the OAuth client id, for a non-production tenant |
SURREAL_CLOUD_AUTH_ISSUER | Overrides the OAuth issuer, for a non-production tenant |
Launcher variables
surreal cloud runs under the launcher, which sets SURREAL_CLI_LAUNCHER to its own path so that the handoff commands can reach the database through it. SURREAL_CLI_HOME (default ~/.surrealdb) moves the directory that holds both the launcher's files and the cloud configuration directory, and SURREAL_CLI_OFFLINE=1 forbids all network use by the launcher. The launcher reference documents these.
Conventions it honours
| Variable | Effect |
|---|---|
NO_COLOR | Disables colour |
FORCE_COLOR, CLICOLOR_FORCE | Enables colour, even when piped |
CI | Selects plain, structural output. CI=false, CI=0 and an empty value all mean not CI |
TERM=dumb | Selects plain output with no colour |
SSH_CONNECTION, SSH_TTY | Skips the browser login flow |
HOME, SURREAL_CLI_HOME | Locate the configuration directory |
HTTPS_PROXY, NO_PROXY | Proxy the API connection |
VISUAL, EDITOR | Used by config edit, in that order |
Deprecated SURREALCTL_ aliases
Before it became surreal cloud, the tool was surrealctl and every variable above carried the prefix SURREALCTL_ instead. The old names keep working, so a CI job that exports SURREALCTL_TOKEN does not break when it picks up the new release. The old name is consulted only when the new one is unset, and a run that uses any of them prints one warning on stderr listing each old name with its replacement:
SURREALCTL_* variables are deprecated. Rename SURREALCTL_TOKEN to SURREAL_CLOUD_TOKEN.Two variables are not a plain prefix swap. SURREALCTL_CLOUD_TOKEN is now SURREAL_CLOUD_SESSION_TOKEN, because SURREAL_CLOUD_CLOUD_TOKEN would read as a typo. SURREALCTL_SURREAL_BINARY and the surreal_binary configuration key no longer exist, because the database is reached only through the launcher. Variables under the old prefix that never had a meaning are not mentioned.
Configuration file equivalents
Four values can be persisted per profile with config set. Each is outranked by its environment variable, and config set warns when that variable is exported.
| Key | Environment variable |
|---|---|
org | SURREAL_CLOUD_ORG |
api | SURREAL_CLOUD_API |
json | SURREAL_CLOUD_JSON |
plain | SURREAL_CLOUD_PLAIN |
Related pages
Output and exit codes - what
--json,--plainand--quietactually produceconfigcommands - reading and writing the configuration filecontextcommands - switching profilessurreal cloud reference - the rest of the reference
Database environment variables - the
SURREAL_*set this component never reads