CLI reference

The fgai command-line interface is a thin, uniform front end over the same public trustmint capability API you can call directly over HTTPS. Every generated command maps one-to-one to a /<capability>/v1/... endpoint on api.flexgalaxy.ai — the CLI adds nothing the API does not expose, and exposes nothing the API does not. A small set of hand-written composite verbs chains those same endpoints under your own credential; they add no route and no authority (see Composite operations).

The trustmint commands ship inside the single fgai binary alongside the other FlexGalaxy.AI tiers. Download it from the releases channel.

Command shape

fgai <group> <verb> [--<id> <value> …] [--body <json> | --body-file <path>]
  • <group> is a capability domain (below), not a service name.

  • <verb> is the operation within that domain (fgai <group> --help lists them).

  • Path identifiers are passed as flags named after the path parameter (--repository, --thing, --template, …); there is no generic --id.

  • Write operations (POST/PUT/PATCH) take a JSON body via --body or --body-file (- reads stdin).

  • Responses are printed as pretty JSON; a successful empty response prints ok.

Authentication

The CLI resolves credentials from your active fgai profile — configure it once with fgai configure. Two credential kinds are supported, matching the two public auth planes:

Credential

Header

Who uses it

Interactive user

Authorization: Bearer <token>

tenant users (SSO login)

Access key / secret key

Authorization: FGAI-HMAC-SHA256 …

factory & integrator services

See Registration to mint an AK/SK pair and for the FGAI-HMAC signing scheme.

Capability groups

Group

Product

What it drives

provisioning

ThingMake

registrars, enrollments, registrar access requests, factory integrations, factory registrations, thing provisioning/activation lifecycle, async factory result callbacks, state-change feeds, identity blacklist

registry

ThingMake

vendor / device-model / software registry

regions

ThingMake

the region catalogue — what exists in which region, and provisioning readiness

access

ThingHub

repositories, scopes, cross-account access grants, caller identity (whoami)

attributes

ThingIO

device attribute buckets (server / shared / client)

telemetry

ThingIO

device telemetry query

twins

ThingIO

device twin read + desired-state set (a command send is a desired-state write with --scope-id)

attribute-pushes

ThingIO

shared-attribute dispatch status (the push log) — observed dispatch state; an ack is not an applied state

consumer-apps

ThingIO

consumer-app registry — your registered applications and their one-shot credentials

rules

ThingLogic

rule authoring (threshold / windowed / deadman) + sink bindings

pipelines

ThingLogic

pipeline DAG authoring, validate, deploy, stop

alarms

ThingLogic

operator alarm lifecycle (ack / shelve / resolve) for rules bound to the alarm-lifecycle sink

destinations

ThingBand

destination registry

connect

ThingFeed

ingest connect adapters + data streams

simulation

ThingLab

virtual-device templates (including publishing and sharing them), virtual devices, profiles, rigs, runs

connectivity

ThingMint

whether a connectivity restriction applies to one of your Things (see Device connectivity)

pki

—

public PKI discovery (JWKS, CA chain) — no credential

Run fgai <group> --help for the full verb list of any group.

Composite operations

A few outcomes span several endpoints, so they are published as hand-written composite verbs. A composite verb calls only endpoints listed above, with your credential, through the same gateway — it adds no route, no authority and no capability the API does not already expose.

Verb

What it chains

fgai simulation virtual-devices-enroll

find-or-create a per-model sim registrar (ThingMake) → enroll the virtual device as a real device (ThingMake) → add the resulting thing to a ThingHub repository and bind a scope (ThingHub) → record the thing and scope on the virtual device (ThingLab)

fgai pipelines validate -f <file>

POST /pipelines/v1/validate on the DOCUMENT in the file; nothing is written. YAML or JSON (- = stdin); a refusal is printed as file:line:column code detail and exits 1

fgai pipelines diff -f <file>

reads the named pipeline’s draft (or --against deployed / --against rev:<n>) and reports node- and edge-level changes; exits 1 when a difference exists, 0 when the file matches

fgai pipelines apply -f <file>

creates the pipeline when metadata.name is new, otherwise writes the document as a validated DRAFT through the PATCH route; an unchanged file is a no-op. --deploy deploys after the write

fgai pipelines export <pipeline>

writes the canonical document as YAML (-o json for JSON), including canvas-built pipelines; pipes into apply -f - for a round trip

The four file-first verbs are FILE-FIRST by contract: validate and diff shadow the generated verbs only when -f/--file is present; without a file they keep their stored-pipeline behaviour. Exit codes are part of the contract: 0 valid / no difference / applied (including the idempotent no-op), 1 the document is invalid or a difference exists, 2 transport, authentication or a usage error.

A composite verb is resumable: if a step fails, re-run it. Any registrar, repository or scope it already resolved is reused, and an instance that is already enrolled is reported as an observed no-change rather than written twice. --help on the verb lists every step, its defaults and its refusal conditions.

Examples

# List your repositories, then read one
fgai access repositories-list
fgai access repositories-get --repository repo-123

# Create the registrar your factory is built around
fgai provisioning registrars-create --body '{"name":"acme-robotics","display_name":"ACME Robotics"}'

# Query things by attribute (integrator AK/SK) — the filter is required
fgai attributes things-query --body '{"filter":{"match_all":true}}'

# Fetch the public signing keys — no credential required
fgai pki jwks
fgai pki ca

# Publish a ThingLab template's current content, then share the offering with one account
fgai simulation templates-publications --template tmpl-01
fgai simulation templates-audiences --template tmpl-01 --body '{"audience_kind":"account","audience_id":"acc-partner-01"}'

# Enroll a ThingLab virtual device as a real device and group it: sim registrar ->
# enrollment -> repository reference -> scope. Re-run to resume a partial failure.
fgai simulation virtual-devices-enroll --instance-id inst-01 --thing-id SN-0001

Note

Platform-administration surfaces split by audience: certificate/CA management and cross-account grant governance are console-only for tenant/integrator users, while the operator CLI (fgai-admin, audience platform-operator) carries the gatewayed governance verbs (governance grants-* — see the capability map’s cli_group: governance).