datumctl command runs against a single scope — either one organization or one project inside that organization. Understanding how datumctl chooses that scope is the key to getting the results you expect. If a command returns nothing or the wrong resources, the cause is almost always the active scope.
In short:
datumctl remembers an active context (an org or a project). Any command uses that context unless you override it for a single command with --organization or --project.The scope model
Datum Cloud is organized as a two-level hierarchy:- Organizations are the top level. You belong to one or more organizations.
- Projects live inside an organization. Most day-to-day resources (DNS zones, networking, and so on) belong to a project.
- An org context points at an organization (for example, resources that live at the organization level).
- A project context points at a specific project inside an organization.
datumctl discovers the organizations and projects you can access from the API and stores them locally as a list of contexts. One of them is the active context — the scope commands use by default.
Listing your contexts
Rundatumctl ctx (alias: datumctl context) to see every context available to your active user:
org or project), and a * marking the current active context. Projects are nested under their organization:
datumctl ctx use: a bare organization ID for an org context (datum), or org/project for a project context (datum/datum-cloud).
datumctl ctx list (alias datumctl ctx ls) prints the same table. Running datumctl ctx with no subcommand is the shortcut most people use.Keeping the list current
The context list is cached locally so listing is instant. When you rundatumctl ctx and the cache is more than an hour old, datumctl refreshes it from the API automatically before printing. To force a refresh at any time — for example, right after you have been granted access to a new project — use the --refresh flag:
--refresh re-runs discovery using your existing session; it does not require you to log in again. There is no separate refresh subcommand — refreshing is a flag on datumctl ctx.Switching the active context
Usedatumctl ctx use to change which context is active. You can name the context directly, or run it with no argument to pick from an interactive list:
- Interactive picker
- By name
datum/datum-cloud) or by its display name (for example, the human-friendly project name shown in the table). Resource IDs always take precedence, and a display name is only accepted when it matches exactly one context. If a name is ambiguous or not found, datumctl tells you and suggests running datumctl ctx to see the available choices.
On success you’ll see a confirmation of the new scope:
How scope is resolved for each command
When you run a command,datumctl determines its scope by checking these sources in order and using the first one that applies:
Per-command flags
--organization <org> or --project <project> on the command line. These override everything else, but only for that single command.Environment variables
DATUM_PROJECT or DATUM_ORGANIZATION, if set. Useful in CI or scripts. You cannot set both at once.datumctl falls back to your personal user scope.
Overriding scope for a single command
The flags let you target a different org or project without changing your active context:For advanced access to the platform root rather than a specific project or organization, an opt-in
--platform-wide flag is also available. Most users never need it.When a command returns nothing
An empty result is almost always a scope mismatch, not an error. The resource you’re looking for probably lives in a different project or organization than the one your command targeted. Work through this checklist:Confirm the active context
Run
datumctl ctx and look for the *. Make sure it points at the org or project that actually contains your resource.Check for an override you forgot about
An exported
DATUM_PROJECT or DATUM_ORGANIZATION environment variable silently redirects every command. Unset it if it isn’t what you want:Target the right scope explicitly
Re-run the command with an explicit flag to rule out the active context:
Remember that a project’s resources aren’t visible from its parent org context (and vice versa). Switching to the correct project scope with
datumctl ctx use org/project resolves most “nothing found” surprises.Contexts and users
Contexts are tied to the user you’re authenticated as. Each stored user session has its own set of discovered contexts. When you switch users, your active context follows that user’s most recently used context. To log in, see Logging in; to switch between stored accounts, see Managing accounts & tokens.Related
- Logging in — sign in, verify your identity with
whoami, and sign out. - Managing accounts & tokens — switch the active user and how each session maps to a context.
- Reading resources — the
getanddescribecommands that run against the scope you set here. - Output formats & scripting — pinning
--organizationand--projectexplicitly and readingDATUM_PROJECT/DATUM_ORGANIZATIONin CI. - Overview — how
datumctlis structured and talks to the Datum API. datumctl ctx --helpfor the context commands and the--organization/--projectflags.