Dynamic API commands (fun api)
Call any Fundamentum public API endpoint straight from the CLI.
The fun api command exposes every endpoint of the Fundamentum
public APIs as CLI commands. The command tree is generated at runtime from the
platform's OpenAPI documents (the /v1 and /v2 specs),
so it stays in sync with the API without a new CLI release.
The fun api command tree is not a stable
interface.
Group and operation names come from the API specs themselves — their
tags and operation ids — so they change whenever the platform
republishes its OpenAPI documents, for example when endpoints are regrouped
or an operation is renamed. A CLI upgrade is not required for a name to
change; a fun api refresh is enough.
Use fun api to explore the platform and for one-off calls. For
automation that must keep working across releases, prefer the curated
commands (fun functions, fun devices, …),
whose names are versioned with the CLI.
Caching the specs
Run this once for the active context to download and cache the specs:
fun api refresh
The specs are cached on disk (per version) and reused on subsequent runs.
Re-run fun api refresh whenever you want to pick up newly published
endpoints. If nothing is cached yet, fun api guides you to run this
command.
Running an operation
Commands are grouped by API version and tag, then by operation:
fun api <version> <tag> <operation> [flags]
For example:
fun api v2 functions list-function --project-id 1
fun api v1 device get-device --project-id 1 --device-id 42
Each operation's path, query and header parameters are exposed as flags (path
parameters are required). Flags are always kebab-case (for example a
project_id or projectId spec parameter becomes
--project-id), regardless of how the underlying API names them. Run
any command with --help to see its parameters.
Request bodies
Operations that accept a body take one of:
--body '<json>'— inline JSON, or--body-file <path>— a file (use-to read from stdin).
Output and scripting
Informational output (the active context and the HTTP status) is written to stderr, so stdout stays clean JSON when redirected or piped:
fun api v2 licenses list-licenses --project-id 1 > licenses.json
Additional flags:
--data-only— print only the response envelope'sdatafield, ideal for piping intojqor saving raw data.--dry-run— print the request that would be sent without sending it.
fun api v2 licenses list-licenses --project-id 1 --data-only | jq '.[].id'
Pagination
Paginated GET operations open an interactive pager when run in a
terminal. Press Space, Enter or PgDown to
load more, and q to quit. To fetch a single page non-interactively,
pass an explicit --page (or use --data-only to print the
raw data without the pager).
Fundamentum