Command-line Interface

fob-mdm does from the terminal everything the MDM API does: define objects and fields, create and edit golden records, read their history, connect apps, and check and fix conformance. It prints tables for people and JSON for scripts and AI agents.

The same package is also a JavaScript client you can import in workers and agents. See JavaScript Client.

Install

npm install -g @finopsbricks/fob-mdm

It needs Node.js 18 or later. The package is @finopsbricks/fob-mdm on npm, and the source is at github.com/finopsbricks/fob-mdm.

Check it works:

fob-mdm --version
fob-mdm getting-started

Set up a profile

The CLI uses an API key saved as a profile, one per organization. It doesn't read keys from environment variables or flags.

  1. In the app, open Settings → API Keys and create a key. Choose Full Access if you'll change data; Read Only is enough to look.
  2. Save it. You'll be asked for the key and the secret, and the key is checked before it's saved:
fob-mdm config profiles add acme
✔ API key (fob_mdm_…) fob_mdm_xxxxxxxxxxxxxxxxxx
✔ API secret ************************
Saved profile 'acme' (https://mdm.finopsbricks.com). The key works.
It is the current profile.

Every command now uses acme. If you have more than one organization, add a profile for each, then switch with fob-mdm config profiles use <name>, or pick one for a single command with --profile <name>:

fob-mdm records list --object vendor --profile acme-labs

Profiles are kept in ~/.fob/fob-mdm/config.yml, readable only by you. See config.

Command pattern

fob-mdm <resource> <action> [target] [options]

The action is always named: fob-mdm objects lists the actions for objects rather than guessing one. Every level has --help:

fob-mdm --help
fob-mdm records --help
fob-mdm records edit --help
ResourceActionsWhat it's for
objectslist, show, create, edit, deleteThe kinds of record you keep, such as Vendor
fieldslist, show, create, edit, deleteAn object's attributes, such as Name or GSTIN
recordslist, show, create, edit, delete, historyGolden records, their values and their history
integrationslist, show, create, edit, delete, pull, lookupsConnected apps, and the links between their records and yours
contractslist, show, create, edit, deleteWhich fields an app's copy must match, and how drift is fixed
conformancerun, status, enforce, confirm, eventsFind where apps differ from golden, and fix it
configprofiles add, profiles list, profiles use, profiles removeSaved API keys

Objects can be given by id or slug (vendor). Values are set by field key: --set bank_ifsc=HDFC0005678.

A first session

fob-mdm objects list
fob-mdm fields list --object vendor
fob-mdm records list --object vendor --where gstin=29ABCDE1234F1Z5
fob-mdm records edit 100 --set bank_ifsc=HDFC0005678
fob-mdm records history 100

100 stands for a record id: take a real one from records list.

To connect an app and check it matches, follow Check and Fix Drift.

JSON output

Every command that reads, creates or changes data takes --json and prints the API's response instead of text, ready for jq or an AI agent. (delete and the config commands don't.)

fob-mdm records show 100 --json | jq '.values.bank_ifsc'

A list prints one page (100 rows unless you pass --limit, up to 500) as { "data": [...], "page_context": {...} }, the same as the API. When there are more pages, a hint saying so goes to stderr. Add --all to fetch every page, up to 15,000 rows; with --json it then prints just the array of rows.

Data goes to stdout and hints, prompts and errors go to stderr, so piping the output never picks up anything else.

Deleting

delete asks before it deletes. Without a terminal to ask on, such as in a script or an agent, it refuses and says to pass --yes:

fob-mdm records delete 100 --yes

Deleting a field retires it instead: its values and history stay.

Errors

A failed command prints the error to stderr and exits with code 1. A command that worked exits 0. Errors from the API show their code and the details that say what to fix:

$ fob-mdm records edit 100 --set ifsc=HDFC0005678
Error [VALIDATION_ERROR]: Unknown field: ifsc

  unknown:     ["ifsc"]
  fields:      ["name","gstin","bank_ifsc"]

Common ones:

ErrorWhat to do
No profile set up. Run fob-mdm config profiles add <name>, then try again.Add a profile, as in Set up a profile
Profile 'acme-labs' doesn't exist. Run fob-mdm config profiles add acme-labs.Check the name with fob-mdm config profiles list, or add the profile
Error [NOT_FOUND]: Record not foundThe id or slug isn't in this profile's organization. Find it with fob-mdm records list --object vendor (or objects list, fields list)
Error [UNAUTHORIZED]: Invalid API credentialsThe key was revoked or mistyped. Create a new one and run fob-mdm config profiles add again with the same name
Error [FORBIDDEN]: API key lacks records:edit permissionThe key is Read Only. Create a Full Access key
Error [FIELD_RETIRED]: Retired field: bank_ifscThe field was retired. List the live ones with fob-mdm fields list --object vendor
error: required option '--object <object>' not specifiedAdd the option. --help on the command lists them

Set FOB_DEBUG=1 to print the stack trace as well.

Using an AI agent? Give it the raw Markdown of this page, or the docs index.