• Start
Sign In

surrealctl

/

Commands

spectron

Reference for surrealctl spectron — managing Spectron contexts, API keys, scoped keys, access tokens, principals and grants, packages, and the scope and provider catalogues.

surrealctl spectron manages Spectron: contexts, the API keys and access tokens that reach them, and the principals and grants that decide what those credentials may do.

Usage
surrealctl spectron <COMMAND> [OPTIONS]
Sub-commandPurpose
contextManage Spectron contexts
keyManage a context's API keys
scoped-keyMint keys attenuated below a principal
access-tokenMint short-lived access tokens
principalManage principals and their grants
packageManage context packages
scopesList a context's scope tree
verbsList the verbs a grant can name
providersList the model providers a context can use
usageShow a context's token usage
configShow a context's configuration
Note

Every route in this group answers 501 on a deployment that does not have Spectron. That is reported as not_available and exits 9 — deliberately not a failure, because nothing is broken. It cannot be predicted locally, so the first Spectron command you run is how you find out.

Every context-scoped route needs both an organisation and a context, and no route accepts a context by name — contexts have no slug, so a name costs one lookup. Commands whose noun lives inside a context take --context <REF>; the spectron context verbs take a positional instead.

The inference chain is deliberately shorter than the organisation chain: there is no spectron context use, no server default and nothing persisted.

  1. No contexts at all is an error naming --context.

  2. Exactly one context is used silently.

  3. Several, in a non-interactive session, is a usage error, exit 2:

Several Spectron contexts are available and none was chosen.
Pass --context.

Available:
  research
  production
  1. Several, on a terminal, opens a picker.

spectron context list is the one command in the group that needs no context of its own, so it is what to run when --context has just failed to resolve.

Grants are written <noun>:<verb>=<pattern>[,<pattern>] and --grant is repeatable. Repeats merge rather than overwrite, so --grant memory:read=/a --grant memory:read=/b grants both patterns.

--grant memory:read=/projects/acme
--grant memory:read=/projects/acme,/projects/shared
--grant memory:write=/projects/acme --grant memory:read=/

A malformed grant is a usage error, exit 2, and the message repeats the expected shape. Run spectron verbs for the verbs a grant may name and spectron scopes for the paths a pattern may match.

List the Spectron contexts in an organisation.

Usage
surrealctl spectron context list [OPTIONS]

This command takes no positional arguments and no options of its own.

Accepts the list presentation flags. Column ids are name, state, region and id, with host and organization_id under --wide.

surrealctl spectron context list
Output
NAME        STATE   REGION    ID
research    ready   aws-euw1  67upif0m8sh1cn1p2c8t
production  ready   aws-use1  6a2k9lqzt4v8bn3m1x5c

Show one Spectron context.

Usage
surrealctl spectron context get [OPTIONS] [CONTEXT]

Arguments

NameDescription
[CONTEXT]
The context, by id or name. Defaults to the only one.

This command has no options of its own.

surrealctl spectron context get research

Create a Spectron context.

Usage
surrealctl spectron context create [OPTIONS] --region <REGION> <NAME>

Arguments

NameDescription
<NAME>
required
A name for the context.

Options

NameDescription
--region<REGION>
required
The region to create the context in.
surrealctl spectron context create research --region aws-euw1

Region slugs come from catalog regions.

Rename a Spectron context.

Usage
surrealctl spectron context update [OPTIONS] --name <NAME> [CONTEXT]

Arguments

NameDescription
[CONTEXT]
The context, by id or name. Defaults to the only one.

Options

NameDescription
--name<NAME>
required
The new name.
surrealctl spectron context update research --name "Research and development"

Delete a Spectron context.

Usage
surrealctl spectron context delete [OPTIONS] [CONTEXT]

Arguments

NameDescription
[CONTEXT]
The context, by id or name.

Options

NameDescription
--force
Delete without confirming.
surrealctl spectron context delete research

Note that this positional does not fall back to "the only one" the way the read verbs do. A delete that infers its target is a delete in the wrong terminal tab.

Refusals. The confirmation names the context. Declining exits 0. In a non-interactive session without --force or --yes, it exits 2 having sent nothing.

List a context's API keys.

Usage
surrealctl spectron key list [OPTIONS]

This command takes no positional arguments.

Options

NameDescription
--context<REF>
The Spectron context, by id or name. Defaults to the only one.

Also accepts the list presentation flags. Column ids are name and id, with spectron_context_id and organization_id under --wide.

surrealctl spectron key list --context research

Only the name and the id are stored. The secret exists once, at creation.

Create an API key.

Usage
surrealctl spectron key create [OPTIONS] <NAME>

Arguments

NameDescription
<NAME>
required
A name for the key.

Options

NameDescription
--reveal
Print the key even when stdout is a terminal.
--context<REF>
The Spectron context, by id or name. Defaults to the only one.
Capture the key
surrealctl spectron key create "agent runtime" --context research > /run/secrets/spectron-key
Keep the id and name alongside the secret
surrealctl spectron key create "agent runtime" --json > key.json

Output is the bare key on stdout in text modes, and the whole body under --json so the id and name survive for a later revoke. It is never a table — a secret in a table is a secret in a screenshot.

Refusals. The secret guard fires before the request, so a forgotten --reveal never costs a key nobody can recover.

Delete an API key.

Usage
surrealctl spectron key delete [OPTIONS] <KEY>

Arguments

NameDescription
<KEY>
required
The key, by id or name.

Options

NameDescription
--force
Delete without confirming.
--context<REF>
The Spectron context, by id or name. Defaults to the only one.
surrealctl spectron key delete "agent runtime" --context research --force

Replace an API key's secret, keeping its id and name.

Usage
surrealctl spectron key rotate [OPTIONS] <KEY>

Arguments

NameDescription
<KEY>
required
The key, by id or name.

Options

NameDescription
--reveal
Print the new key even when stdout is a terminal.
--force
Rotate without confirming.
--context<REF>
The Spectron context, by id or name. Defaults to the only one.
surrealctl spectron key rotate "agent runtime" --force > /run/secrets/spectron-key

Rotation invalidates the previous secret, so redeploy whatever holds it. Like create, the secret guard fires before the request.

Mint a scoped key for a principal — a key attenuated below what that principal itself may do.

Usage
surrealctl spectron scoped-key create [OPTIONS] --principal <REF> <NAME>

Arguments

NameDescription
<NAME>
required
A name for the key.

Options

NameDescription
--principal<REF>
required
The principal to bind the key to, by id or name.
--grant<GRANT>
Attenuate to this grant, as <noun>:<verb>=<pattern>[,<pattern>]. Repeatable.
--reveal
Print the key even when stdout is a terminal.
--context<REF>
The Spectron context, by id or name. Defaults to the only one.
A read-only key below an agent principal
surrealctl spectron scoped-key create "read-only worker" \
    --principal "research agent" \
    --grant memory:read=/projects/acme \
    --context research \
    > /run/secrets/worker-key

This group has one verb on purpose. A renamed command is a broken script, so scoped-key stays a group even with nothing to sit beside create.

Mint a short-lived access token.

Usage
surrealctl spectron access-token create [OPTIONS]

This command takes no positional arguments.

Options

NameDescription
--ttl<DURATION>
How long the token should live, such as 15m or 2h. The server clamps it.
--reveal
Print the token even when stdout is a terminal.
--context<REF>
The Spectron context, by id or name. Defaults to the only one.
TOKEN=$(surrealctl spectron access-token create --ttl 15m --context research)

--ttl uses the standard duration syntax. The server clamps whatever you ask for to its own maximum, so read the expiry from the answer rather than assuming your value was taken.

List a context's principals.

Usage
surrealctl spectron principal list [OPTIONS]

This command takes no positional arguments.

Options

NameDescription
--context<REF>
The Spectron context, by id or name. Defaults to the only one.

Also accepts the list presentation flags. Column ids are display_name, kind, id and verbs, with grants under --wide.

surrealctl spectron principal list --context research --wide

Create a principal.

Usage
surrealctl spectron principal create [OPTIONS] --kind <KIND> <NAME>

Arguments

NameDescription
<NAME>
required
A display name for the principal.

Options

NameDescription
--kind<KIND>
required
What the principal is: human, agent, service or unknown.
--grant<GRANT>
Grant this authority, as <noun>:<verb>=<pattern>[,<pattern>]. Repeatable.
--context<REF>
The Spectron context, by id or name. Defaults to the only one.
surrealctl spectron principal create "research agent" \
    --kind agent \
    --grant memory:read=/projects \
    --grant memory:write=/projects/acme \
    --context research

--kind is a free-form string rather than a closed set, because the four values above are a convention and a closed set would need a new release before anyone could use a kind Cloud added.

Rename a principal or change its kind.

Usage
surrealctl spectron principal update [OPTIONS] <PRINCIPAL>

Arguments

NameDescription
<PRINCIPAL>
required
The principal, by id or name.

Options

NameDescription
--name<NAME>
A new display name.
--kind<KIND>
A new kind.
--context<REF>
The Spectron context, by id or name. Defaults to the only one.
surrealctl spectron principal update "research agent" --kind service

Grants are not changed here. Use principal grants set for those.

Delete a principal.

Usage
surrealctl spectron principal delete [OPTIONS] <PRINCIPAL>

Arguments

NameDescription
<PRINCIPAL>
required
The principal, by id or name.

Options

NameDescription
--force
Delete without confirming.
--context<REF>
The Spectron context, by id or name. Defaults to the only one.
surrealctl spectron principal delete "research agent" --force

Replace a principal's grants.

Usage
surrealctl spectron principal grants set [OPTIONS] <PRINCIPAL>

Arguments

NameDescription
<PRINCIPAL>
required
The principal, by id or name.

Options

NameDescription
--grant<GRANT>
Grant this authority, as <noun>:<verb>=<pattern>[,<pattern>]. Repeatable.
--revoke<VERB>
Remove every pattern granted for this verb. Repeatable.
--clear
Start from nothing, so --grant describes the whole result. Conflicts with --revoke.
--force
Replace without confirming.
--context<REF>
The Spectron context, by id or name. Defaults to the only one.

The grants route is a full replacement, so this command reads the current set, applies your flags, and confirms the result before writing.

Add a pattern to an existing verb
surrealctl spectron principal grants set "research agent" \
    --grant memory:read=/projects/contoso
Drop write access entirely
surrealctl spectron principal grants set "research agent" --revoke memory:write
Declare the whole grant set, ignoring what was there
surrealctl spectron principal grants set "research agent" \
    --clear \
    --grant memory:read=/projects \
    --force

--clear is what makes this command declarative: with it, the flags describe the complete result rather than a change to what exists. Without it, --grant merges and --revoke subtracts.

List every context package this deployment offers.

Usage
surrealctl spectron package list [OPTIONS]

This command takes no positional arguments and no options of its own — not even --context. The catalogue is a property of the deployment, so it answers even when nothing else is resolvable.

Accepts the list presentation flags. Column ids are name, cost, billing_period, token_limit, storage_gb, contexts_limit and trial_days, with id, public and description under --wide.

surrealctl spectron package list

List the packages an organisation has enabled.

Usage
surrealctl spectron package org-list [OPTIONS]

This command takes no positional arguments and no options of its own.

Accepts the list presentation flags. Column ids are package_id, enabled_at, trial_ends_at and subscription_ends_at, with disabled_at and organization_id under --wide.

surrealctl spectron package org-list --org acme

Enable a package for an organisation.

Usage
surrealctl spectron package enable [OPTIONS] <PACKAGE>

Arguments

NameDescription
<PACKAGE>
required
The package, by id or name.

Options

NameDescription
--coupon<CODE>
A coupon code to apply to the subscription.
surrealctl spectron package enable "scale" --coupon LAUNCH2026

Enabling a package starts a subscription and affects billing. Check package list for what each one includes first.

Cancel an organisation's package subscription.

Usage
surrealctl spectron package cancel [OPTIONS] <PACKAGE>

Arguments

NameDescription
<PACKAGE>
required
The package, by id or name.

Options

NameDescription
--force
Cancel without confirming.
surrealctl spectron package cancel "scale"

Refusals. The confirmation names the package. Declining exits 0. In a non-interactive session without --force or --yes, it exits 2 having sent nothing.

List a context's scope tree.

Usage
surrealctl spectron scopes [OPTIONS]

This command takes no positional arguments.

Options

NameDescription
--context<REF>
The Spectron context, by id or name. Defaults to the only one.

Also accepts the list presentation flags. Column ids are path, name, depth, children and value_policy, with created_at, parent and tombstoned_at under --wide.

surrealctl spectron scopes --context research --sort path

These paths are what a grant pattern matches.

List the verbs a grant can name.

Usage
surrealctl spectron verbs [OPTIONS]

This command takes no positional arguments.

Options

NameDescription
--context<REF>
The Spectron context, by id or name. Defaults to the only one.

Also accepts the list presentation flags. Column ids are name, noun and description.

surrealctl spectron verbs --context research

The noun and name columns are the two halves of the <noun>:<verb> prefix in a grant.

List the model providers a context can use.

Usage
surrealctl spectron providers [OPTIONS]

This command takes no positional arguments.

Options

NameDescription
--context<REF>
The Spectron context, by id or name. Defaults to the only one.

Also accepts the list presentation flags. Column ids are provider and models, with count under --wide.

surrealctl spectron providers --context research

Show a context's token usage.

Usage
surrealctl spectron usage [OPTIONS]

This command takes no positional arguments.

Options

NameDescription
--context<REF>
The Spectron context, by id or name. Defaults to the only one.

Also accepts the list presentation flags. Column ids are model, token_kind, origin and tokens.

Heaviest models first
surrealctl spectron usage --context research --sort tokens --reverse

A one-line total is printed on stderr in text modes, computed before --limit is applied. A context with no ceiling gets its own sentence rather than a hole where the limit would be.

Show a context's configuration.

Usage
surrealctl spectron config [OPTIONS]

This command takes no positional arguments.

Options

NameDescription
--context<REF>
The Spectron context, by id or name. Defaults to the only one.

This command carries no list presentation flags — its answer is a detail view, not a table.

surrealctl spectron config --context research

Not to be confused with surrealctl config, which reads and writes the CLI's own configuration file on this machine.

Was this page helpful?