fun CLI
This page lists every command of the fun CLI with its flags, the configuration files it reads and writes, and the environment variables it understands. For a task-oriented introduction, read The fun CLI.
The authoritative help for your installed version is always fun <command> --help. The full generated command reference is published at https://cli.fundamentum-iot.com/reference/fun.html.
Global flags
| Flag | Description |
|---|---|
--config <dir> |
Read and write configuration in this directory instead of the default lookup |
-v, --version |
Print the CLI version (root command only) |
-h, --help |
Help for any command |
--context <name> selects a saved context (default default). It is accepted by every command that calls Fundamentum: fun api operations, fun api refresh, fun functions …, fun devices port-forward and fun devices transfer ….
Command tree
Session and configuration
| Command | Description |
|---|---|
fun login |
Sign in through your browser and save the token in a context. Prompts for the context name, the API endpoint (default https://api.fundamentum-iot.com) and the OAuth endpoint (default https://oauth.fundamentum-iot.com). Run it again on an existing context to refresh its token |
fun login --override |
Change the endpoints of an existing context |
fun login --no-check |
Skip the endpoint health check |
fun config contexts list |
List saved contexts. Keys are masked |
fun config dir |
Print the configuration directory in use |
fun check-update |
Compare your version with the latest release on cli.fundamentum-iot.com |
fun install-skills |
Install the bundled AI agent skills, see AI agents and skills |
fun completion bash|zsh|fish|powershell |
Print a shell completion script, including the fun api commands |
Devices
| Command | Flags | Description |
|---|---|---|
fun devices port-forward (alias pf) |
-p, --project, -r, --registry, -s, --serial, -l, --local-port, -d, --remote-port (all required) |
Forward a port of the device to a local port. Press any key to stop |
fun devices transfer cloud-to-device |
-p, --project, -r, --registry, -d, --device or -s, --serial, --remote-path, -f, --file |
Send a local file to the device. --file must be a relative path inside the current directory |
fun devices transfer device-to-cloud |
-p, --project, -r, --registry, -d, --device or -s, --serial, --remote-path, -n, --name |
Fetch a file from the device and save it locally as --name. Waits up to 2 minutes for the upload |
--device (numeric device ID) and --serial are mutually exclusive; give one. Serial numbers contain only lowercase letters, digits, _ and -.
See Remote terminal and port forwarding and File transfers.
Functions
| Command | Flags | Description |
|---|---|---|
fun functions list |
--project (required), --per-page (default 25, max 100) |
List the functions of a project |
fun functions new <name> [definition.json] |
--project, --language, --description, --connector <in>:<out> (repeatable), --variable KEY=VALUE (repeatable), --ask, --override |
Create a function and save it locally under <name> |
fun functions edit <name> [definition.json] |
Edit a function's definition | |
fun functions upload <name> <file.wasm> |
Upload a new WebAssembly binary | |
fun functions invoke |
-n, --name, or -p, --project with -f, --function-id; -i, --input-file |
Invoke a function. Without --input-file, the input is read from stdin |
fun functions executions list |
-n, --name, or -p, --project with -f, --function-id; --per-page |
List recent executions with their logs and errors |
fun functions names list |
List the function names saved locally | |
fun functions names add <name> |
-p, --project, -f, --function (both required), --override |
Save an existing function under a local name |
Without a definition file, fun functions new needs --project, --language and --description, or --ask to prompt for them. See Cloud functions: runtime and SDK.
Public API
| Command | Description |
|---|---|
fun api refresh |
Download and cache the Public API specs (/v1/api/swagger.json and /v2/api/openapi.json) for the active context |
fun api v1 --help, fun api v2 --help |
List the groups of a version |
fun api <version> <group> <operation> [flags] |
Call one operation |
Groups come from the spec tags and operations from the operation IDs, both in kebab-case. For example, the v2 tag Service Accounts becomes service-accounts and the operation listServiceAccounts becomes list-service-accounts.
Operation flags:
| Flag | Description |
|---|---|
--<parameter> |
One flag per path, query or header parameter, in kebab-case (project_id and projectId both become --project-id). Path parameters are required |
--body '<json>' |
Request body as inline JSON |
--body-file <path> |
Request body from a file, or - for stdin |
--dry-run |
Print the request without sending it: the request line and headers on stderr, the body on stdout |
--data-only |
Print only the data field of the response |
--page <n> |
On paginated operations, fetch one page instead of opening the interactive pager |
--context <name> |
Use this context |
Output rules:
- Response JSON goes to stdout. The active context and the HTTP status go to stderr.
- In a terminal, paginated
GEToperations open an interactive pager unless you pass--page,--data-onlyor--dry-run. - The
fun apitree follows the published specs, so group and operation names can change when the specs change. For automation that must keep working across releases, prefer the curated commands (fun devices,fun functions).
Configuration files
The CLI looks for its configuration directory in this order and uses the first one found:
--config <dir>$FUN_CONFIG_DIRECTORY$XDG_CONFIG_HOME/fun/(default~/.config/fun/)$XDG_CONFIG_DIRS/fun/(default/etc/xdg/fun/)./.fun/
| File | Content |
|---|---|
contexts.json |
Your contexts: endpoints and credentials, keyed by context name |
functions.json |
Local function names: context (optional), project and id for each name |
contexts.json:
{
"default": {
"fundamentum_iot_endpoint": "https://api.fundamentum-iot.com",
"oauth_endpoint": "https://oauth.fundamentum-iot.com",
"auth": { "type": "apikey", "key": "<token>" }
}
}
auth.type is apikey (a bearer token, which fun login writes for you) or none. Keep this file private: it contains your token.
The cached API specs are stored in your user cache directory, under fun/openapi/.
Environment variables
| Variable | Effect |
|---|---|
FUN_CONFIG_DIRECTORY |
Configuration directory, see the lookup order above |
FUN_CONTEXT_NAME |
Default answer to the context-name prompt of fun login |
FUN_CONTEXT_FUNDAMENTUM_IOT_ENDPOINT |
API endpoint. When set, the CLI uses a context built from the environment instead of contexts.json. Also the default answer to the endpoint prompt of fun login |
FUN_CONTEXT_API_KEY |
Bearer token for the environment context, for example a service-account token in CI |
FUN_OAUTH_FUNDAMENTUM_ENDPOINT |
Default answer to the OAuth endpoint prompt of fun login |
FUN_PROJECT_ID |
Project used by fun functions new; takes precedence over --project |
Every request carries Authorization: Bearer <token>.