Command Reference
This page documents every command group the Foir CLI registers. Commands follow a consistent foir <group> <action> pattern. All commands support the global --json, --jsonl, --quiet, and --project-id flags described in the CLI Overview.
Authentication & Setup
login
Authenticate the CLI via browser-based OAuth. Opens your default browser to sign in and writes a session token to ~/.foir/credentials.json once you complete the flow. Run this first on any new machine.
foir login [options]| Option | Description |
|---|---|
--device | Use the device flow: approve on any device with a short code (for SSH, containers, CI). Auto-selected when no local browser is detected. |
--no-browser | Authenticate without a local browser callback by pasting a one-time code back into the terminal. |
The default login flow:
- Opens your default browser at the Foir sign-in page.
- You sign in (or pick an existing session).
- The browser hands a short-lived authorization code back to the CLI listening on a local port.
- The CLI exchanges the code for a session token and saves it to
~/.foir/credentials.json.
When no local browser is detected (SSH, containers, CI), foir login automatically falls back to the device flow — it prints a short code and a URL to approve on any other device, then waits for approval. Pass --device to force this, or --no-browser to paste a one-time code back into the terminal instead.
Examples
# Default: opens a local browser
foir login
# Headless: approve a short code on any device (SSH / containers / CI)
foir login --device
# Out-of-band: paste a one-time code back into the terminal
foir login --no-browserlogout
End your session and clear stored credentials. The session is ended on the platform first, so anything still holding it is refused on its next call: a foir mcp that is already running stops acting as you. Then ~/.foir/credentials.json is removed.
If the platform cannot be reached, the file is still removed and the command exits with a failure. It says that the session is still live and when it expires. A foir mcp that is already running keeps acting as you until then: stop it to end that.
foir logoutwhoami
Show the current authentication status — which user is signed in, which tenant + project are active, and which credentials file is in use.
foir whoamiAuthentication Status
────────────────────────────────────────
Endpoint: https://rpc.foir.io (default)
Minted: https://rpc.foir.io
Session: ✓ Verified by the server
User: Matt <matt@example.com>
Selected Project (this repo)
────────────────────────────────────────
Name: Storefront
Standing: the project itselfUseful for confirming you’re operating on the project you think you are before running a destructive command. Combine with --json to script against the output.
Two lines are worth knowing about:
Endpoint: names which source answered — --api-url, FOIR_API_URL, or default. When the CLI is talking to somewhere you did not expect, this is the line that says why, rather than leaving you to work out whether a shell profile is exporting something.
Minted: is the endpoint your session was authenticated against. If it differs from Endpoint:, whoami marks it ✗ MISMATCH and says what to do. It matters because a mismatch makes every command that sends the session refuse, for a reason none of those commands can explain — so whoami prints it even on its own failure path, since a mismatch is the most likely cause of the failure you were investigating. The fix is either foir login against the endpoint you want, or set FOIR_API_URL to the one you were minted against.
account
Your own account. Each subcommand acts as you, on your stored session, and asks no permission. Only leave needs a project selected.
| Command | What it does |
|---|---|
foir account show | Your name, id and email addresses |
foir account profile --first-name <name> --last-name <name> --locale <tag> | Change your name or the language you read |
foir account addresses | The addresses you sign in with |
foir account addresses primary <email> | Make a proven address the one your account uses. The old one is emailed |
foir account addresses remove <email> | Remove an address. The one your account uses stays |
foir account sessions | Where you’re signed in, and your personal access tokens |
foir account sessions end <id> | Sign out of one session, or revoke a token |
foir account sessions sign-out-everywhere [--keep-this] | Sign out of every session and app. Tokens stay |
foir account token --name <name> [--days 90] | Make a personal access token. Its value is shown once |
foir account sign-ins | The providers you sign in with |
foir account sign-ins disconnect <provider> | Stop signing in with a provider |
foir account apps | The apps you agreed may act for you |
foir account apps revoke <id> | Take back an app’s authority |
foir account invitations | Invitations sent to you |
foir account leave [--workspace] | Leave where the command stands: the organization --org-id names, or the selected project. --workspace leaves the whole workspace |
foir account export [--out <file>] | Save a copy of your own data as one JSON file |
Adding an address, changing your password, second factors and deleting your account each prove something in the browser, so they’re on the console’s account page.
leave is refused, with the reason, where you’re the last manager of a workspace or the last person who can staff an organization. It’s also refused where it would leave you nowhere to sign in: a project’s people sign in only where they stand.
# Leave an organization
foir account leave --org-id org_leeds
# Keep a copy of your data
foir account export --out my-data.jsonselect-project
Pick the active project for subsequent CLI calls. Lists every project your session has access to and writes the selection to .foir/project.json at your repository root, so later commands act on it.
Selecting a project makes no API key. Commands act as your signed-in session, with exactly what your roles give you, and foir types reads the surface a credential is served through a token your session mints. A key is made only when you ask for one, with foir api-keys create and the grants you choose.
An older CLI minted a key named Foir CLI on each project it selected and kept it in the context file. That key was made with no permissions, so it holds nothing, and nothing uses it now. If your context still holds one, select-project says so and gives its id: revoke it with foir api-keys revoke <id>.
foir select-project [options]| Option | Description |
|---|---|
--project-id <id> | Skip the interactive picker and select a project directly. |
--save-as <name> | Save the selection as a named profile (see foir profiles). |
Examples
# Interactive picker
foir select-project
# Switch without the prompt
foir select-project --project-id prj_abc123
# Save the selection as a profile so you can switch back later
foir select-project --project-id prj_abc123 --save-as client-aprofiles
Manage profiles: bookmarks for the projects you work in, so you can move between them without re-running select-project each time. Each profile is a saved { tenantId, projectId } pair under a name. For a config deployed to a staging and a production project, declare them as named projects instead: a profile is a personal shortcut, and it cannot stop a push landing in the wrong project.
| Command | Description |
|---|---|
foir profiles list | List all saved profiles |
foir profiles show [name] | Show details of a profile (or the active one if no name) |
foir profiles default [name] | Show or set the default profile |
foir profiles delete <name> | Delete a named profile |
| Option | Applies to | Description |
|---|---|---|
--confirm | delete | Skip confirmation prompt. |
Activate a saved profile with the global --profile <name> flag, or skip profiles entirely and target one project for one command with --project-id <id> (see CLI Overview).
Examples
# List profiles
foir profiles list
# Inspect the active profile
foir profiles show
# Set the default profile so bare CLI calls use it
foir profiles default client-a
# Remove a profile
foir profiles delete old-tenant --confirmworkspaces create
Create a workspace from the terminal. You become its owner, and it comes with a default project, as the console’s New workspace does. It starts on Free, the plan taken up with no card. A paid plan is bought in a browser: start the workspace at /workspaces/create in the console, then pass the session_id Stripe returns as --checkout-session. An account holds one workspace with no card on file at a time, so a second one on Free is refused. While public sign-ups are closed, workspace creation is declined server-side (your account and any workspaces you’ve been invited to are unaffected).
foir workspaces create --name <name> [options]| Option | Description |
|---|---|
--name <name> | Workspace name (required). |
--project-name <name> | Name for the default project. Defaults to "<name> Project". |
--select | Make the new workspace’s default project the active CLI context (same save path as select-project). |
--plan <slug> | A plan taken up with no card to start on. Defaults to Free. A plan bought with a card is refused here and asks for --checkout-session. |
--checkout-session <id> | The paid Stripe Checkout session that bought the workspace. Its name and plan come from the checkout. |
Examples
# Create a workspace on Free and start pushing immediately
foir workspaces create --name "Acme Studio" --select
foir push
# Scripting-friendly output
foir workspaces create --name "Acme Studio" --jsonprojects list
List the projects you can reach, across every workspace you hold a role in.
Reads only: nothing is selected and the saved context is untouched. This is where the ids --project-id takes come from.
foir projects list [options]| Option | Description |
|---|---|
--tenant <id> | Only this workspace. Defaults to every workspace you can see. |
--status <status> | Filter by status. Defaults to ACTIVE. |
--all-statuses | Do not filter by status. |
--first <n> | Max results per workspace (default 100). |
A workspace you hold no role in refuses the read rather than answering empty, and those workspaces are named under the table instead of being dropped — a quietly shorter list cannot be told apart from the whole list.
Examples
# Every project you can reach
foir projects list
# Just the ids, for a script
foir projects list --json | jq -r '.projects[].id'projects status
Show what each named project the directory’s
foir.config.ts declares holds, side by side: the manifest hash its last push
recorded, whether that is the config checked out here, and its drift (resources
the project holds that the config does not declare). It reads: nothing is
pushed, moved, copied or pruned in any project.
foir projects status [--config <path>]| Option | Description |
|---|---|
--config <path> | Path to the config file. Default: the one governing this directory. |
The checked-out config is the reference. A project whose recorded hash matches it holds this config; one that does not holds another, and the summary line says which projects are ahead of which. The hash is taken without destinations, so two projects holding one commit hold one hash. A project that cannot be read is reported as unreadable rather than dropped.
It reads every declared project in one run, each on the control plane it
declares, so it needs a signed-in session. FOIR_API_KEY is refused: an API key
belongs to one project and would answer for every project as that one.
# After pushing a new commit to staging only
foir projects status
# staging prj_... sha256:4be1... this config 0
# production prj_... sha256:9c02... another config 0
# staging is ahead of production: it holds this config, and production holds another.
# For a pipeline
foir projects status --json | jq '.projects[] | {name, current, drift}'projects create
Create a project in a workspace you own. Requires the projects:create permission in that workspace (owners have it).
foir projects create --name <name> [options]| Option | Description |
|---|---|
--name <name> | Project name (required). |
--tenant <id> | Workspace to create the project in. Defaults to your active session workspace; with several workspaces and no default, an interactive picker opens. |
--select | Make the new project the active CLI context. |
Examples
# Create in the active workspace and switch to it
foir projects create --name "Marketing Site" --select
# Target a specific workspace
foir projects create --name "Marketing Site" --tenant ten_abc123projects delete
Delete a project. Requires the projects:delete permission in its workspace.
Deleting stops the project within a minute: its API keys are refused, anyone
working in it is moved out, its files are no longer served and its schedules no
longer run.
Its data is kept for the retention period the command states before it asks, and
projects reactivate undoes the deletion until then.
After that the data is destroyed. A workspace’s default project cannot be
deleted.
foir projects delete <id> [options]| Option | Description |
|---|---|
--tenant <id> | Look only in this workspace. By default the project is looked for in every workspace you can reach. |
--confirm-name <name> | The project’s name, in place of typing it when asked. |
The command says what stops, then asks you to type the project’s name, as the
console does. A script answers with --confirm-name: the name is compared with
the one the platform holds, so a mistyped id is still caught. With no terminal
and no --confirm-name, nothing is deleted.
Examples
# Asks for the project's name
foir projects delete prj_abc123
# From a script
foir projects delete prj_abc123 --confirm-name "Marketing Site" --jsonprojects reactivate
Undo a deletion while the project’s data is still kept. Its API keys, its files
and its schedules work again. It asks nothing, because it destroys nothing.
Requires the projects:delete permission in the project’s workspace, as
deleting does.
foir projects reactivate <id> [--tenant <id>]--tenant <id> looks only in that workspace; by default the project is looked
for in every workspace you can reach.
A deleted project is not listed by default: find its id with
foir projects list --status DELETED.
projects purge
Destroy a deleted project’s data now, giving up what is left of the time it
would have been kept. It cannot be undone. Requires the projects:delete
permission in the project’s workspace.
Only a project that is already deleted can be purged, so no single command takes
a live project to nothing: run projects delete first.
foir projects purge <id> [options]| Option | Description |
|---|---|
--tenant <id> | Look only in this workspace. By default the project is looked for in every workspace you can reach. |
--reason <text> | Why, for the record of the purge. |
--confirm-name <name> | The project’s name, in place of typing it when asked. |
Content Management
records
Manage content records within a model.
| Command | Description |
|---|---|
foir records list <modelKey> | List records for a model |
foir records get <modelKey> <idOrKey> | Get a record by ID or natural key |
foir records create <modelKey> | Create a record |
foir records update <modelKey> <id> | Update a record’s data column directly, bypassing versioning. Refused on a versioned record unless you pass --replace — see below |
foir records save <modelKey> <id> | Atomic draft save (data + new version + currentVersionId bump) |
foir records delete <modelKey> <id> | Delete a record |
foir records publish <versionId> | Publish a record version |
foir records unpublish <id> | Unpublish a record |
foir records revert <versionId> | Revert a record to one of its versions, as a new version |
foir records duplicate <modelKey> <id> | Duplicate a record |
foir records versions <recordId> | List versions for a record |
foir records variants <recordId> | List variants for a record |
foir records create-version <parentId> | Low-level: create a version row without touching the parent |
foir records create-variant <recordId> | Create a variant |
| Option | Applies to | Description |
|---|---|---|
--filter <expr> | list | Filter expression (e.g. status=active). See Filtering. |
--first <n> | list, versions | Page size. Default: 20. |
--validate-only | revert | Report what the revert would convert, drop or refuse, and write nothing. Exits non-zero if it would be refused. |
--after <cursor> | list | Cursor for the next page (from prior pageInfo). |
--published | list | List published content only. Without it the list includes unpublished records, which takes drafts:read. |
--resolved | get | Include resolved content (published version). |
--preview | get | Resolve the latest draft instead of the published version. Takes drafts:read. |
--locale <locale> | get | Locale for field translations. |
-d, --data <json> | create, update, save, create-version | Data as a JSON string. |
-f, --file <path> | create, update, save, create-version | Read data from a file. |
-m, --message <msg> | save, create-version | Change description. |
--variant <key> | save | Save into a specific variant. |
--replace | update | Write a version from the update rather than merging into the data column. Required for a content update on a versioned record. |
--natural-key <key> | update, duplicate | Set the record’s natural key. On update this is allowed on its own even for a versioned record, because it writes a column that is read back. |
--key <variantKey> | create-variant | Variant key (required). |
--confirm | delete | Skip confirmation prompt. |
records updateis refused on a versioned record. A merge update writes thedatacolumn directly without creating a version, so on a versioned record the write would be stored and never read back —records getwould keep returning the old value. Rather than let that happen silently, the CLI refuses it before sending anything.Two ways through:
records saveto write content that reads back, which is what you almost always want, or--replaceto write a version from the update itself.--natural-keyon its own needs neither and still works, because it writes a column readers do resolve.
Reverting appends.
records revertdoes not move the record back onto an old version row. The named version’s content is replayed as a new version, through the same validated write as any other edit — so history moves forwards and the record can only end up in a shape an ordinary save could have produced.That matters because a snapshot is history, and the schema may have moved under it. On the way back the platform can re-spell a value into the type the model now declares (the same conversion a
retypemigration performs), drop a key the model declares nowhere (exactly as an ordinary save does), or refuse a value no conversion reaches. None of those is the caller’s choice, because the caller did not write the payload — run--dry-runfirst to see all three before the version exists.
updatevssave:records updatewrites the record’sdatacolumn directly and does not create a version or movecurrentVersionId— preview/storefront won’t see the change.records saveis the console “Save Draft” equivalent: it replaces data, writes an immutable version row, and advancescurrentVersionIdin one atomic step.
Examples
# List published records, page size 10
foir records list blog-post --published --first 10
# Get a record by natural key (model key is positional)
foir records get page hello-world
# Get the resolved published content
foir records get page hello-world --resolved
# Create a record from a JSON file
foir records create page --file page.json
# Atomic draft save (data + version + currentVersionId)
foir records save page clx123 --file page.json --message "Update hero copy"
# Publish a version by its version ID
foir records publish ver_abc123
# List all versions of a record
foir records versions clx1234567890
# See what reverting to a version would change — writes nothing
foir records revert ver_abc123 --validate-only
# Revert: the version's content comes back as a NEW version
foir records revert ver_abc123models
Manage content models (schemas).
| Command | Description |
|---|---|
foir models list | List all models |
foir models get <key> | Get a model by key |
foir models create | Create a model |
foir models update <key> | Update a model |
foir models delete <key> | Delete a model |
foir models versions <key> | List schema versions for a model |
| Option | Applies to | Description |
|---|---|---|
--category <cat> | list | Filter by category. |
--search <term> | list | Search by name. |
--first <n> | list, versions | Max results. Default: 50 for list, 20 for versions. |
--after <cursor> | list | Opaque cursor from a previous page. |
-d, --data <json> | create, update | Model data as a JSON string. |
-f, --file <path> | create, update | Read model data from a file. |
--confirm | delete | Skip confirmation prompt. |
Examples
# List models in a category
foir models list --category content
# Search models by name
foir models list --search blog
# Create a model from a JSON file
foir models create --file blog-post-model.json
# Update a model by key
foir models update blog-post --file blog-post-model.json
# View schema version history (by model key)
foir models versions blog-postlocales
Manage locales for content localization.
| Command | Description |
|---|---|
foir locales list | List the locales being served. Add --include-inactive for the deactivated ones too |
foir locales get <idOrCode> | Get a locale by ID or code |
foir locales default | Get the default locale |
foir locales create | Create a locale |
foir locales update <id> | Update a locale |
foir locales delete <id> | Delete a locale |
Examples
# List the locales being served
foir locales list
# Include the ones that have been deactivated
foir locales list --include-inactive
# Get a locale by code
foir locales get en-US
# Get the default locale
foir locales default
# Create a new locale
foir locales create --data '{"locale":"fr-FR","displayName":"French","nativeName":"Francais"}'media
Upload and manage media files. The media group handles file uploads via the storage service, while file metadata commands are available through the dynamic files group.
| Command | Description |
|---|---|
foir media upload <filepath> | Upload a file |
foir media list | List files |
foir media get <id> | Get file details |
foir media update <id> | Update file properties |
foir media update-metadata <id> | Update alt text, caption, description |
foir media delete <id> | Delete a file |
foir media restore <id> | Restore a deleted file |
foir media usage | Get storage usage stats |
Examples
# Upload a file to a specific folder
foir media upload ./images/hero.jpg --folder banners
# List files filtered by folder
foir media list --folder banners
# Search for files
foir media list --search "hero"
# Update file metadata
foir media update-metadata clx123 --alt-text "Hero banner image" --caption "Welcome banner"
# Check storage usage
foir media usage
# Permanently delete a file (cannot be restored)
foir media delete clx123 --confirm --permanentfiles
Inspect and manage files in the media library. For uploads use foir media upload; this group covers everything after upload — listing, renaming, tagging, moving between folders, editing alt text and captions, and reporting storage usage.
| Command | Description |
|---|---|
foir files list | List files |
foir files get <id> | Get a file by ID |
foir files usage | Storage usage statistics |
foir files update <id> | Update file properties (filename, folder, tags) |
foir files update-metadata <id> | Update alt text, caption, description |
foir files delete <id> | Delete a file |
| Option | Applies to | Description |
|---|---|---|
--folder <folder> | list, update | Filter by folder / move to folder. |
--mime-type <type> | list | Filter by MIME type. |
--search <term> | list | Search by filename. |
--first <n> | list | Max results. Default: 50. |
--after <cursor> | list | Opaque cursor from a previous page. |
--filename <name> | update | New filename. |
--tags <tags> | update | Comma-separated tags. |
--alt-text <text> | update-metadata | Alt text. |
--caption <text> | update-metadata | Caption. |
--description <text> | update-metadata | Description. |
--confirm | delete | Skip confirmation prompt. |
Examples
# List images in the /banners folder
foir files list --folder banners --mime-type image/jpeg
# Search by filename
foir files list --search hero
# Move a file to a different folder
foir files update clx123 --folder archive
# Tag a file
foir files update clx123 --tags "homepage,launch,q2"
# Add alt text + caption for accessibility / SEO
foir files update-metadata clx123 \
--alt-text "A woman walking through a field of barley at sunrise" \
--caption "Spring '26 campaign"
# Storage usage summary
foir files usage --jsonsearch
Search across all records globally.
foir search <query> [options]| Option | Description |
|---|---|
--models <keys> | Filter to specific model keys (comma-separated) |
--first <n> | Maximum number of results (default: 20) |
Examples
# Search across all content
foir search "getting started"
# Search within specific models
foir search "pricing" --models page,blog-post --first 5
# Output as JSON for scripting
foir search "hello" --jsonmigrations
Answer and settle the record migrations a schema change creates. A removed field’s values are held for a grace period while you decide what happens to them; these are the commands for that ledger.
| Command | Description |
|---|---|
foir migrations status | What has run, and anything still waiting on a decision, with the time left on it |
foir migrations discard <id> --reason <text> | Write off a failed migration nobody will resolve |
| Option | Applies to | Description |
|---|---|---|
--limit <n> | status | How much history to show. |
--reason <text> | discard | Why it is being written off. Required, and worth writing properly — it is what makes the entry readable a year later. |
status exits non-zero when anything is unfinished, so it works as a CI gate on its own. FAILED, RUNNING and PENDING all count as unfinished; DISCARDED deliberately does not. So a failure you cannot fix keeps your build red until you settle it one way or the other.
discard settles the ledger entry and touches no records: it does not undo the schema change, convert anything, or roll anything back. The <id> is the ledger row id, printed by status. See Migrations.
cache
Drop cached responses by hand. Ordinary writes invalidate their own entries, so this is for the cases they cannot cover — a bulk change made outside the normal path, or a cache you want cleared while debugging.
| Command | Description |
|---|---|
foir cache purge [modelKey] [record] | Purge cached responses, narrowing by model, and by one record (its id or its key) if you name one |
| Option | Description |
|---|---|
--all | Purge the whole project rather than a model or a record. |
--confirm | Skip the confirmation prompt. |
geometry
Query and maintain geopoint fields, which Foir materialises into PostGIS so records can be found by distance.
| Command | Description |
|---|---|
foir geometry search --lat <lat> --lng <lng> | Records near a point, ordered by true distance |
foir geometry nearest <recordId> | Records nearest to an existing record |
foir geometry backfill <modelKey> | Materialise the points for records that are missing them |
| Option | Applies to | Description |
|---|---|---|
--lat <lat> / --lng <lng> | search | The query point. Both required. |
--radius <meters> | search, nearest | Limit matches to this distance. |
--model-key <key> | search, nearest | Restrict to one model. |
--key <key> | search | The geopoint field, when a model has more than one. |
--first <n> | search, nearest | How many to return. |
To see which records have no point yet, list them: foir records list --model-key <modelKey> --missing-geometry "" (name a geopoint field instead of "" to check that one). That list, then backfill, is the pair to reach for after adding a geopoint field to a model that already has records: declaring the field does not populate the points for rows written before it existed.
Users and Targeting
users
Manage the project’s users.
| Command | Description |
|---|---|
foir users list | List users |
foir users get <idOrEmail> | Get a user by ID or email |
foir users create --email <email> | Create a user |
foir users import <file> | Import people from another sign-in provider, with their bcrypt password hashes (see Migrating to Foir) |
foir users delete <id> | Delete a user (hard delete for GDPR) |
| Option | Applies to | Description |
|---|---|---|
--status <status> | list | Filter by status (ACTIVE, PENDING, SUSPENDED). |
--search <term> | list | Search by email. |
--first <n> | list | Max results. Default: 20. |
--after <cursor> | list | Opaque cursor from a previous page. |
--email <email> | create | The user’s email (required). |
-d, --data <json> | create | Additional user data as a JSON string. |
--format <csv|json> | import | The file’s format. Default: its extension’s. |
--dry-run | import | Say what an import would do for each person, changing nothing. |
--pool <id> | list, get, create | The pool: platform for the console’s own accounts. Default: the project’s. |
--confirm-email <address> | delete | The account’s address, typed. Required: the platform compares it before it deletes anything. |
--confirm | delete | Skip confirmation prompt. |
Examples
# List active users
foir users list --status active
# Get a user by email
foir users get user@example.com
# Create a user
foir users create --email new@example.com
# Create a user with extra data
foir users create --email new@example.com --data '{"firstName":"New","lastName":"User"}'Profiles: A user’s profile is a record of a user-owned model, declared in
foir.config.tslike any other model and reconciled withfoir push. Its fields change with the model; see Users.
roles
Manage the project’s roles: what a signed-in user may do. A user’s access token carries everything their roles give, and a role marked default gives what it lists to every user with no assignment. The declarative equivalent is the userRoles block in foir.config.ts, reconciled by foir push; this group is for one-off CRUD and assignment management.
| Command | Description |
|---|---|
foir roles list | List the roles in the current project |
foir roles create | Create a role |
foir roles update <id> | Update a role’s name, grants, or default flag |
foir roles disable <id> | Disable a role |
foir roles assign | Assign a role to a specific user |
foir roles revoke <assignmentId> | Revoke a role assignment |
foir roles assignments | List role assignments for a user or a role |
| Option | Applies to | Description |
|---|---|---|
--first <n> | list | Max results. Default: 100. |
--key <key> | create | Stable role key (e.g. default). Required. |
--name <name> | create, update | Display name. Required for create. |
--grants <grants> | create, update | Comma-separated grants the role gives, in the permission catalogue’s names (e.g. records:read:order,operations:execute). Required for create; on update it replaces everything the role gives, and an empty value empties it. |
--default | create, update | Make this the project default role (every user inherits it). |
--no-default | update | Clear the project-default flag. |
--user <id> | assign, assignments | User ID (required for assign). |
--role <id> | assign, assignments | Role ID (required for assign). |
--confirm | disable, revoke | Skip confirmation prompt. |
For
assignments, pass at least one of--user <id>or--role <id>. A user picks up a role they are given, or a change to one, the next time their sign-in is refreshed.
A role is written by --grants and by nothing else: --permissions is gone. Writing a role takes roles:write and giving or taking one takes members:write. A role is written with, and given by, only a caller that holds everything it gives, so a key that manages user accounts and holds nothing else can write a role that gives nothing else.
Examples
# List roles
foir roles list
# Create a default role that reads, changes and creates the user's own orders
foir roles create --key default --name "Default" --grants "records:read:order,records:write:order,records:create:order" --default
# Add operation execution to a role
foir roles update clx_role_123 --grants "records:read:order,operations:execute"
# Assign a role to a specific user
foir roles assign --user clx_user_456 --role clx_role_123
# List a user's role assignments
foir roles assignments --user clx_user_456
# Revoke an assignment
foir roles revoke clx_assign_789 --confirmorgs
Manage the organizations of the current project: the tree, its members and its caps. Nothing here reads an organization’s data; that is the row layer’s job.
On these commands the organization is an argument, never ambient. orgs suspend, orgs delete and orgs members remove take their organization as a positional argument and never act on the one you are standing in — this is the command set that suspends and deletes tenants, and a target you can leave set is a target you can forget is set.
Everywhere else you stand in an organization the way you stand in a project: foir context switch-org <id> to stay in one, --org-id <id> to act in one for a single command, --org-id - for the project itself, and foir context show or foir whoami to see which. The project is targeted the same way as everywhere else, with --project-id or the saved context (see Project Resolution Order).
Addressed by id. An organization has one identifier, its id, and names are not unique. A wrong id is answered with the organizations this credential can read, ids beside names (one page of them, with a count of the rest), rather than with a bare refusal.
| Command | Description |
|---|---|
foir orgs list | List the organizations in the current project |
foir orgs show <id> | Show one organization, including where it sits in the tree |
foir orgs create --name <name> | Create an organization, at the top of the tree or under a parent |
foir orgs move <id> [newParentId] | Re-parent an organization; everything nested under it moves with it |
foir orgs pool show <id> | Say which pool its people sign in to: its own, an organization’s above it, or the project’s |
foir orgs pool start <id> | Start its own pool, which it and everything beneath it sign their people in to. Without --move-people, refused while people of the pool it signs in to now stand there, naming how many. With it, those who stand only there move whole, and those who also stand elsewhere are given a new user there. --dry-run says what would move and changes nothing |
foir orgs pool drop <id> | Drop its own pool, so it signs its people in to the pool above it. Refused while the pool holds anybody |
foir orgs update <id> | Change its name, or how it presents on mail and to its users |
foir orgs suspend <id> | Suspend an organization and, through it, everything nested under it |
foir orgs resume <id> | Return an organization to active, cancelling any scheduled deletion for it and everything nested under it |
foir orgs delete <id> | Schedule an organization and everything nested under it for deletion |
foir orgs usage | Per-organization usage across the project |
foir orgs members list <id> | List an organization’s members |
foir orgs members add <id> <userId> | Attach a user of the project to an organization as a member |
foir orgs members remove <id> <userId> | Detach a user from an organization |
foir orgs limits list [id] | Every cap the project has set, or what one organization is capped at |
foir orgs limits set <id> <metric> <value> | Cap one metric for one organization |
foir orgs limits clear <id> <metric> | Remove a cap |
foir orgs limits usage [id] | What an organization and everything beneath it have used, against the cap closest to its limit |
Provisioning
foir orgs provision stands an organization up in one call a script can retry: the organization and its brand, and optionally its settings record, its first member and a credential confined to it. --provision-id is the idempotency key, so running the same command again resumes from the first step that did not complete and does nothing once every step has; a different request under the same id is refused. See Organization Provisioning.
| Command | Description |
|---|---|
foir orgs provision --provision-id <id> --name <name> | Provision an organization, or resume the provision with this id |
foir orgs provision-status <provisionId> | Show where a provision stands, step by step |
| Option | Description |
|---|---|
--provision-id <id> | Your id for this provision. Required. Use a UUID or the id of the signup it is for. |
--name <name> | The organization’s name. Required. |
--parent <id> | Provision it under an existing organization rather than at the top. |
--display-name, --logo-url, --primary-color, --from-name, --reply-to, --support-email, --app-base-url | Its brand. A field left out is inherited. |
--settings-model <key> | Write its settings record, a singleton model on the organization owner plane. Needs --settings-data or --settings-file. |
--settings-data <json> / --settings-file <path> | The settings record. |
--own-pool, --users <joined|everyone>, --joining <invitation|open|request> | Its own pool, where somebody who comes in at it stands, and who may join it, as on orgs create. |
--member <userId> / --member-role <roleKey> | Its first member and their role. Given together. |
--member-email <address> | Instead of --member: somebody the provision makes its first member, in the pool that serves it. --member-first-name and --member-last-name give their name. |
--credential-name <name> / --credential-grants <grants> | Mint a credential confined to it, holding these grants. Given together. |
--credential-kind <kind> | publishable, server or admin. Required with a credential: nothing is assumed. --credential-type is refused. |
--credential-baseline-grants <grants> | What the credential gives whoever comes through it. Nothing is filled in. |
The credential’s secret is printed once, by the run that minted it. A later run shows the key without it and prints the foir api-keys rotate command that recovers a lost one. When a run is refused part-way, the command shows the steps that completed and where it stopped.
| Option | Applies to | Description |
|---|---|---|
--tree | list | Draw the nesting instead of one flat list. |
--first <n> | list | Max results. Default: 20. |
--after <cursor> | list | Opaque cursor from a previous page. |
--name <name> | create, update | Display name. Required for create. |
--parent <id> | create | Create it under an existing organization rather than at the top. |
--own-pool | create | It signs its own people in, to a pool of its own apart from its parent’s and the project’s. Chosen when it is made. |
--to-root | move | Put it at the top of the tree, under no organization. |
--from-name <name> | update | Sender name on mail sent for this organization. |
--reply-to <email> | update | Reply-to address on that mail. |
--support-email <email> | update | Support address shown to its users. |
--logo-url <url> | update | Logo URL. |
--primary-color <hex> | update | Primary colour, as hex. |
--app-base-url <url> | update | The address its application is served at. |
--display-name <name> | update | The name its own members see, where it differs from its name. |
--users <joined|everyone>, --joining <invitation|open|request> | create, update | Where somebody who comes in at it stands, and who may join it without an invitation. See Organizations. |
--joining-role <roleId> | update | The role somebody who joins it is given. Empty clears it. |
--sign-in-methods <methods>, --require-second-factor, --lock-accounts <on|off> | update | Its sign-in rules. See How an organization’s people sign in. |
--confirm | delete | Skip the confirmation prompt. |
--role <roleId> | members add | Role to grant on the membership. |
Listing and showing
list is flat by default, one row per organization with its name, id and status, so a project that never nested anything reads the same as it always has. --tree draws the nesting with connectors under each parent. A listing is one page read under one credential, so an organization’s parent can be missing from it, either on another page or unreadable by this credential; such an organization is drawn at the top marked ⋯ rather than hung off a row that happens to be present, and a line under the table says what the mark means.
show prints the name, id and status. For an organization that has a parent it also prints its path (the ancestors root first, then the organization; an ancestor this credential cannot read appears as its id), its parent and its depth. It prints how many organizations sit below it, at every level, when there are any, and a scheduled deletion together with the command that cancels it.
With --json or --jsonl, list, show, create and move print each organization with parentId, ancestorIds and depth.
Creating and moving
create --parent <id> places the new organization under an existing one. The parent is resolved first, so a wrong parent id is answered with the organizations that exist before anything is written, and one in another project answers exactly as one that does not exist. The output gives the new id, and for a nested organization its depth and a reminder that caps, suspension and scheduled deletion above it reach it too.
move re-parents one organization and takes its whole subtree with it: every descendant keeps its own parent. Say where it goes, either as a parent id or with --to-root. The command refuses to run with neither, because the platform reads an absent parent as “make it a root” and never as “leave it where it is”, and it refuses both together as two different destinations.
The platform refuses three placements: under itself, under one of its own descendants, and under a parent it cannot resolve in this project. A key confined to an organization moves organizations only within its own subtree and cannot make one a root. After a move the command says how many nested organizations came along when any did, that caps, suspension, reach and usage now come from the new position, and prints the command that puts it back:
Put it back with: foir orgs move <id> <previousParentId>or foir orgs move <id> --to-root when it was a root. A move revokes no key or session; see Moving an organization for what changes and what is purged.
Suspending, resuming and deleting
suspend stops an organization and everything nested under it without writing to any of them, and every row stays. resume makes it active again; an organization inside one that is still not active cannot be resumed on its own, and the refusal names the organization above it.
delete asks for confirmation naming the organization, its id and that every organization nested under it is scheduled too; --confirm skips the prompt. It schedules the deletion rather than removing anything, and resume cancels it for the whole set, putting each organization back to the status it held before. See Deleting a subtree.
Usage and caps
usage prints users, records, storage and emails this month per organization, a (project-shared) row, and the project totals. Each row counts only the organization it names, so the rows add up to the totals.
The metrics that take a cap are records, media_storage, active_users, emails_per_month and ai_credits. A cap has three states, and none of them is the same as another:
| State | How it is written | What it means |
|---|---|---|
| A number | foir orgs limits set <id> records 5000 | A ceiling, narrowed against the project’s. 0 is a real cap of zero. |
| Uncapped | foir orgs limits set <id> records uncapped | Stored as -1: no cap of this organization’s own. It is still held to the project’s ceiling — uncapped does not escape it. |
| No row | foir orgs limits clear <id> records | No organization-level check at all; this organization’s usage is not compared against anything. |
set accepts a whole number or the word uncapped. A bare -1 is read by the argument parser as an option, so write it after -- if you use the stored value directly. clear says when there was no cap to remove rather than reporting success.
The two ways to stop capping an organization are not the same, and uncapped is the stricter one. It keeps the organization-level check alive and points it at the project’s ceiling, so the organization’s own usage is measured against that number. clear removes the level from the chain, and nothing measures the organization at all. Caps only ever narrow: no value written here lets an organization consume more than its project holds.
limits list with no id lists every cap somebody wrote, across the project. With an id it answers a different question, what that organization is capped at, with a column for the value set on it, the value in force and the organization it comes from: a cap set on an ancestor binds everything beneath it.
limits usage answers how close an organization is to being refused. For each metric it shows what the organization and everything beneath it have used, over the period the cap counts, and the cap closest to its limit with the organization that set it. A cap counts everything beneath the organization that set it, so the closest cap can be one set higher up, with siblings’ use counted against it. With no id it reads the organization you stand in. AI credits are shown as credits, rounded up to the hundredth.
A caller standing in an organization manages the caps of the organizations beneath it, never its own and never an ancestor’s or a sibling’s; see Per-organization limits.
Members
members add attaches a user of the project to an organization as a member. The user stays a user of the project, and one user may act for several organizations. A membership in an organization also lets that user stand in every organization beneath it. members remove reports when the user was not a member rather than reporting success.
Examples
# The tree, drawn
foir orgs list --tree
# A reseller, and a client under it
foir orgs create --name "Northwind"
foir orgs create --name "Northwind Leeds" --parent org_d72zr40bcbei7ddgwwc96zft
# A reseller that signs its own people in, apart from the project's
foir orgs create --name "Acme" --own-pool
# Move a client under a different reseller, then promote another to the top
foir orgs move org_k3m8qz1hb2wi9x7a4c0v5ntr org_p2y6ls9ew4df8u1j3g7q0mzk
foir orgs move org_h8r2vn5xc0bq7t4k9w1ys6fe --to-root
# Cap a reseller's records; every client beneath it counts towards the cap
foir orgs limits set org_d72zr40bcbei7ddgwwc96zft records 50000
foir orgs limits list org_d72zr40bcbei7ddgwwc96zft
# Schedule a deletion without the prompt, then cancel it
foir orgs delete org_d72zr40bcbei7ddgwwc96zft --confirm
foir orgs resume org_d72zr40bcbei7ddgwwc96zftcontext-dimensions
Manage context dimensions — the home of segments (sourceType: 'segment', a
rule evaluated into segment.<key>), user-context sources
(sourceType: 'model') and values sent with the request
(sourceType: 'request'). Prefer declaring them in your config (see
Defining Context Dimensions); this command is for one-off
inspection and edits. Aliased as foir context-dims.
A context dimension, new or changed, stays a draft until it is released:
foir push --publish releases the ones your config declares, and
foir release publish context_dimension:<key> releases one.
| Command | Description |
|---|---|
foir context-dimensions list | List context dimensions |
foir context-dimensions get <idOrKey> | Get a dimension by ID or key |
foir context-dimensions create | Create a dimension (--data <json> / --file <path>) |
foir context-dimensions update <id> | Update a dimension |
foir context-dimensions delete <id> | Delete a dimension |
Examples
# List context dimensions (segments + model sources)
foir context-dimensions list
# Create a segment from JSON
foir context-dimensions create --data '{
"key": "gold",
"name": "Gold",
"sourceType": "segment",
"evaluationRules": { "type": "group", "logicalOperator": "AND", "conditions": [] }
}'variant-catalog
Manage the variant catalog for content personalization.
| Command | Description |
|---|---|
foir variant-catalog list | List variant catalog entries |
foir variant-catalog get <idOrKey> | Get an entry by ID or key |
foir variant-catalog create | Create a variant catalog entry |
foir variant-catalog update <id> | Update a variant catalog entry |
foir variant-catalog delete <id> | Delete a variant catalog entry |
Examples
# List all variant catalog entries
foir variant-catalog list
# Get a variant by key
foir variant-catalog get premium-users
# Create a new variant catalog entry
foir variant-catalog create --data '{"key":"mobile","name":"Mobile Users","isActive":true}'context
Inspect and switch the CLI’s session context — the tenant and project subsequent commands run against. This is session/project management, not targeting data; the active project is persisted in .foir/project.json (see the CLI Overview).
| Command | Description |
|---|---|
foir context show | The project and organization a command here would act in, and how the project was selected: --project or FOIR_PROJECT for a named project (with its control plane), a flag, a variable, a profile or the saved context |
foir context projects | List projects your session can access (the active one is marked) |
foir context switch <projectId> | Switch the active project |
foir context tenants | List tenants your session can access |
Examples
# See which projects you can use and which is active
foir context projects
# Switch to a different project
foir context switch prj_abc123
# List available tenants
foir context tenants
context switchwrites the same repository contextselect-projectdoes, so later commands here act in the project it names.
Automation
operations
Run and inspect server-side operations. Operations themselves are declared in foir.config.ts and reconciled with foir push — this group executes them and manages their dead-letter queue.
| Command | Description |
|---|---|
foir operations list | List operations |
foir operations get <key> | Get an operation by key |
foir operations execute <key> | Execute an operation |
foir operations dev | Forward this project’s dispatches to a local server |
foir operations dead-letters | List failed operations in the dead letter queue |
foir operations retry-dead-letter <id> | Retry a failed operation |
foir operations dismiss-dead-letter <id> | Dismiss a failed operation without retrying |
| Option | Applies to | Description |
|---|---|---|
--category <cat> | list | Filter by category. |
--active | list | Only active operations. |
--first <n> | list, dead-letters | Max results. Default: 50 for list, 20 for dead-letters. |
-d, --data <json> | execute | Input data as a JSON string. |
-f, --file <path> | execute | Read input from a file. |
--async | execute | Execute asynchronously. |
--operation <key> | dead-letters | Filter the queue by operation key. |
--port <port> | dev | Required. The local port your operation server listens on. |
--host <host> | dev | Local host to forward to. Default: localhost. |
--tunnel <kind> | dev | cloudflared, ngrok, or none with --url. Omit it to hold a session instead, which exposes nothing. |
--url <url> | dev | With --tunnel none: the public https URL already forwarding to your port. |
--operation <key> | dev | Take only this operation. Repeatable. Omit to take every operation in the project. |
Examples
# Forward this project's dispatches to a server on port 8787
foir operations dev --port 8787 --tunnel cloudflared
# Take only two operations, against a tunnel you are already running
foir operations dev --port 8787 --tunnel none --url https://dev.example.com \
--operation send-welcome --operation sync-inventory
# List all operations
foir operations list
# Execute an operation with input data (key is positional)
foir operations execute send-welcome-email --data '{"userId":"clx123"}'
# Execute asynchronously
foir operations execute long-running-report --data '{"month":"2026-05"}' --async
# View the dead letter queue
foir operations dead-letters
# Retry a failed operation
foir operations retry-dead-letter clx_dl_456hooks
Manage lifecycle hooks — webhooks that fire on platform events (record.published, record.deleted, etc.). Hooks can also be declared in foir.config.ts and reconciled with foir push; this group is for one-off CRUD and for inspecting delivery history that lives outside the config file.
| Command | Description |
|---|---|
foir hooks list | List hooks |
foir hooks get <keyOrId> | Get a hook by key or ID |
foir hooks create | Create a hook |
foir hooks update <id> | Update a hook |
foir hooks delete <id> | Delete a hook |
foir hooks deliveries <hookId> | List recent deliveries for a hook |
foir hooks retry-delivery <deliveryId> | Retry a failed delivery |
foir hooks test <hookId> | Send a test delivery |
| Option | Applies to | Description |
|---|---|---|
--event <event> | list | Filter by event name. |
--active | list, update | List only active hooks / activate a hook. |
--inactive | list | List only inactive hooks. |
--no-active | update | Deactivate a hook. |
--first <n> | list, deliveries | Page size. |
--after <cursor> | list, deliveries | Opaque cursor from a previous page. |
--status <status> | deliveries | Filter deliveries by status (success, failed, pending). |
-d, --data <json> | create, update, test | Payload as a JSON string. |
--file <path> | create, update, test | Payload from a JSON file. |
--confirm | delete | Skip confirmation prompt. |
Examples
# List active hooks for a specific event
foir hooks list --event record.published --active
# Create a hook from a JSON file
foir hooks create --file ./hooks/on-publish.json
# Inline create
foir hooks create --data '{"key":"on-publish","name":"On Publish","event":"record.published","url":"https://example.com/webhook"}'
# Deactivate without removing
foir hooks update hook_abc123 --no-active
# Recent failed deliveries for a hook
foir hooks deliveries hook_abc123 --status failed --first 20
# Send a synthetic delivery to verify the receiver
foir hooks test hook_abc123 --data '{"message":"test"}'
# Retry one failed delivery
foir hooks retry-delivery del_456schedules
Manage scheduled tasks with cron expressions.
| Command | Description |
|---|---|
foir schedules list | List schedules |
foir schedules get <key> | Get a schedule by key |
foir schedules create | Create a schedule |
foir schedules update <key> | Update a schedule |
foir schedules trigger <key> | Trigger a schedule immediately |
foir schedules pause <key> | Pause a schedule |
foir schedules resume <key> | Resume a paused schedule |
foir schedules delete <key> | Delete a schedule |
Examples
# List all schedules
foir schedules list
# Create a scheduled task
foir schedules create --file daily-sync.json
# Trigger a schedule immediately (outside its cron)
foir schedules trigger daily-sync
# Pause a schedule
foir schedules pause daily-syncManagement
design-tokens
Manage the project’s design tokens document.
| Command | Description |
|---|---|
foir design-tokens get | Print the current document |
foir design-tokens apply <path> | Apply a W3C-formatted JSON document from disk, as the draft |
foir design-tokens unpublish | Remove the published snapshot |
| Option | Applies to | Description |
|---|---|---|
--channel <draft|published> | get | Channel to read. Default: draft. |
--resolved | get | Print the server-resolved view (typed arrays, references expanded) instead of the raw W3C document. |
An applied document is a draft until a release carries it: foir release publish design_tokens:design_tokens releases it on its own.
Examples
# Print the draft document as JSON
foir design-tokens get
# Print the resolved view (groups expanded into flat arrays)
foir design-tokens get --resolved
# Diff what the storefront is serving against the draft
foir design-tokens get --channel published > published.json
foir design-tokens get --channel draft > draft.json
diff published.json draft.json
# Apply a hand-authored or generated tokens document
foir design-tokens apply ./tokens.json
# Release the applied draft
foir release publish design_tokens:design_tokensTip: For projects that track tokens in
foir.config.ts, usefoir push --publishinstead — it applies models, operations, and design tokens (and publishes them) in one step.
login-page
Read and write the sign-in page of the level you stand in: the project’s, or an organisation’s with --org-id or after foir context switch-org. The file is the page in the form a config’s loginPage takes.
| Command | Description |
|---|---|
foir login-page get | Print the page this level sets, or write it to a file |
foir login-page apply <path> | Save a page from a JSON file as the draft |
| Option | Applies to | Description |
|---|---|---|
--app <clientId> | both | An app’s own page, at the project. |
--channel <draft|published> | get | Channel to read. Default: draft. |
--out <path> | get | Write the page to a file instead of printing it. |
Applying the page the draft already holds changes nothing. An applied page is a draft until a release carries it: foir release publish login_page:login_page releases the level’s page, and login_page:<clientId> an app’s.
Examples
# Keep an organisation's page in source control
foir login-page get --org-id org_northwind --out northwind-page.json
foir login-page apply northwind-page.json --org-id org_northwind
foir release publish login_page:login_page --org-id org_northwind
# An app's own page
foir login-page get --app rota-kioskTip: The project’s page and its apps’ pages also live in
foir.config.ts, and travel withfoir pushandfoir pull. A config belongs to the project, so an organisation’s page is kept with these commands.
secrets
Manage vault secrets — opaque references your app code resolves to plaintext at runtime. Plaintext values never leave your machine; the CLI stores only encrypted blobs on the platform.
| Command | Description |
|---|---|
foir secrets put | Store a new secret and print its ref |
foir secrets list | List secret metadata (no plaintext) |
foir secrets rotate <ref> | Replace plaintext for an existing ref; returns a new ref |
foir secrets delete <ref> | Soft-delete a secret (recoverable until purged) |
foir secrets restore <ref> | Undo a soft-delete (only valid before the purge window passes) |
foir secrets push | Reconcile a foir.secrets.ts declaration file with the vault |
foir secrets purge | Drop every soft-deleted secret past its TTL |
| Option | Applies to | Description |
|---|---|---|
--label <label> | put | Optional human-readable label. |
--app <name> | put, list | Owner: app name. Default: project-owned. |
--file <path> | put, rotate | Read plaintext from file (binary-safe). |
--value <plaintext> | put, rotate | Plaintext value (string only; prefer --file for binary). |
--include-soft-deleted | list | Include soft-deleted entries. |
--config <path> | push | Path to foir.secrets.ts (default: auto-discover). |
--plaintext <path> | push | Path to local.foir.secrets.ts (default: auto-discover). |
--rotate | push | Rotate plaintext for secrets that already exist. |
--dry-run | push | Show what would change without writing. |
--confirm | rotate, delete, purge | Skip confirmation prompt. |
Examples
# Store a new secret from a file (binary-safe)
foir secrets put --file ./stripe.key --label "Stripe API key"
# Store a string value
foir secrets put --value "sk_test_..." --label "Stripe (test)"
# List project-owned secrets
foir secrets list
# Reconcile a declarative secrets file
foir secrets push --config foir.secrets.ts --plaintext local.foir.secrets.ts
# Rotate (returns a new ref — update your app code)
foir secrets rotate vault:abc123 --file ./new-stripe.key
# Soft-delete and undo
foir secrets delete vault:abc123 --confirm
foir secrets restore vault:abc123api-keys
Manage API keys for programmatic access.
| Command | Description |
|---|---|
foir api-keys list | List API keys, with each key’s reach |
foir api-keys create | Create an API key |
foir api-keys update <id> | Change what a key holds or gives in place: same key, same secret, live at once |
foir api-keys renew <id> | Give an admin key a new expiry, with the same secret |
foir api-keys rotate <id> | Mint a new secret, keeping the current one live for 24 hours |
foir api-keys retire-previous <id> | Retire the previous secret early |
foir api-keys revoke <id> | Revoke an API key |
foir api-keys revoke-confined <orgId> | Revoke every live key confined to an organization and to every organization beneath it |
| Option | Applies to | Description |
|---|---|---|
--name <name> | create | API key name. Required. |
--grants <grants> | create, update | Comma-separated: what the key holds, in the permission catalogue’s names, e.g. records:read,records:write. Required on create. On update it replaces the key’s whole list. |
--baseline-grants <grants> | create, update | Comma-separated: what a publishable or a server key gives whoever comes through it, a visitor with nobody signed in and a signed-in user beneath their role. Nothing is filled in: without it a new key gives a visitor nothing. An admin key gives nobody anything. On update it replaces the key’s whole list, and an empty value leaves it giving nothing. |
--kind <kind> | create | What the key is for: publishable (it sits in a web page or an app), server (the server that renders your pages holds it) or admin (a machine’s own). Required: nothing is assumed. |
--workspace | create, list | The workspace’s own keys, bound to no project. Only an admin key is made there. |
--confine-to-org <id> | create | Confine the key to one organization, by id. Omit for a project-wide key. |
--allowed-models <keys> | create | Comma-separated model keys the key may touch. Omit for every model. |
--allowed-file-types <types> | create | Comma-separated file types the key may upload: a MIME type, a whole type such as image/*, or IMAGE, VIDEO, FILE. Omit for every type. |
--expires-in <days> | create, renew | An admin key only: how long it lives from now, e.g. 90d, which is what it is given when nothing is said, up to 365d. |
--expires-at <iso8601> | create, renew | An admin key only: the date it expires, e.g. 2027-01-31T00:00:00Z, within a year. |
--include-inactive | list | Also list revoked and switched-off keys. Without it only keys that are on are listed. |
--search <term> | list | Only keys whose name contains the term. |
--confined-to-org <id> | list | Only the keys confined to this organization, by id. |
--include-descendants | list | With --confined-to-org, also the keys confined to every organization beneath it. |
--first <n> | list | Most keys to list. Default: 50. |
--confirm | rotate, retire-previous, revoke, revoke-confined | Skip the confirmation prompt. |
A key confined to an organization reads that organization, everything nested under it and the project-shared tier, and writes only into that organization. Its organization is resolved before the key is minted, so a mistyped id is answered with the organizations that exist. It is named with a flag rather than --org because it is a property of the key being created, like its scopes, and not a target the command acts through.
list shows what each key holds and what it gives. create and update check
both lists before anything is sent, against the platform’s own list of what a
key of that kind may hold and give, and refuse a list sent in both
vocabularies.
create and update print both lists as the key was written, and what the
platform says about it: a publishable or a server key that gives a visitor
nothing says so, and
with --json the sentences are in notices beside the key. A key gives only
what --baseline-grants names, so a publishable key created with a read and no
second list is a key no visitor can read with. See
A key’s two lists.
list names each key’s reach in words: project wide, or confined to followed by the organization’s whole path and its id, so two organizations with the same name read differently.
revoke-confined takes the organization as an argument, like every command that acts on an organization. It first shows how many live keys it will revoke, which is the platform’s own count for the organization and everything beneath it, and asks you to confirm. Project-wide keys and the keys of other organizations are never touched. It is all or nothing: if the key you are signed in with holds apikeys:write and any key in the subtree is broader than it, nothing is revoked and the refusal says how many keys were beyond it.
Rotation is additive. It mints a new secret and leaves the current one working for 24 hours, so you can rotate first and deploy afterwards instead of racing the two. A key holds at most two secrets: rotating again inside the window retires the older one immediately. Revoking a key ends every secret it has at once.
An admin key expires. renew moves its expiry and keeps its secret, so nothing
that holds the key needs changing: with no option it is given another 90 days
from now. A publishable or a server key never expires, and renew refuses one.
See An admin key expires.
Once the new secret is deployed everywhere, retire the old one rather than waiting out the window. Both secrets belong to the same key, so scopes, model limits and organization confinement are identical under either. What changes is only how many secrets authenticate as that key.
Examples
# List all API keys
foir api-keys list
# Create an admin key for a machine of your own, for 90 days
foir api-keys create --name "CI Pipeline" --kind admin --grants records:read,records:write
# Keep it for another 90 days, with the same secret
foir api-keys renew clx123
# Create a publishable key a visitor can read with
foir api-keys create --name "Storefront" --kind publishable --grants records:read --baseline-grants records:read
# Create a server key for the server that renders your pages
foir api-keys create --name "Storefront server" --kind server --grants records:read,visitors:forward --baseline-grants records:read
# Create a key confined to one organization
foir api-keys create --name "Leeds storefront" --kind publishable --grants records:read --baseline-grants records:read --confine-to-org org_d72zr40bcbei7ddgwwc96zft
# Rotate an existing key (requires confirmation)
foir api-keys rotate clx123 --confirm
# Deploy the new secret, then retire the old one
foir api-keys retire-previous clx123 --confirm
# Revoke a key
foir api-keys revoke clx123 --confirm
# The keys confined to an organization and to every organization beneath it
foir api-keys list --confined-to-org org_d72zr40bcbei7ddgwwc96zft --include-descendants
# Revoke them all
foir api-keys revoke-confined org_d72zr40bcbei7ddgwwc96zftauth-providers
Manage user authentication providers (OAuth, SAML, etc.).
| Command | Description |
|---|---|
foir auth-providers list | List user auth providers |
foir auth-providers get <id> | Get an auth provider |
foir auth-providers create | Create an auth provider |
foir auth-providers update <id> | Update an auth provider |
foir auth-providers delete <id> | Delete an auth provider |
| Option | Applies to | Description |
|---|---|---|
--enabled-only | list | Show only enabled providers. |
--key <key> | create | Unique provider key. Required. |
--name <name> | create, update | Display name. Required for create. |
--type <type> | create | Provider type: OAUTH2, TOKEN_SSO, SAML, OIDC, or EXTERNAL. Required. |
-d, --data <json> | create, update | Provider config as a JSON string. |
--file <path> | create, update | Provider config from a JSON file. |
--enabled / --no-enabled | create, update | Enable / disable the provider (--no-enabled on update). |
--is-default | create, update | Set as the default provider. |
--priority <n> | create, update | Display priority (higher = first). |
--confirm | delete | Skip confirmation prompt. |
Examples
# List configured auth providers
foir auth-providers list
# Create a Google OAuth provider (key, name, and type are required)
foir auth-providers create \
--key google \
--name "Google" \
--type OAUTH2 \
--enabled \
--file google-auth.jsonauth-clients
The apps that sign people in with Foir. A project’s apps sign in its users; with --console, the workspace’s apps sign in your team.
| Command | Description |
|---|---|
foir auth-clients list | List the project’s auth clients, or the workspace’s with --console |
foir auth-clients delete <clientId> | Delete an auth client |
foir auth-clients rebind <clientId> | Bind an auth client to another place |
foir auth-clients secrets create <clientId> | Make a client secret for a confidential app, shown once |
foir auth-clients secrets list <clientId> | List an app’s client secrets by prefix |
foir auth-clients secrets revoke <clientId> <secretId> | Revoke one client secret |
| Option | Applies to | Description |
|---|---|---|
--console | all | An app of the workspace’s that signs in your team. |
--to-org <orgId> | rebind | The organization of the project a project’s app signs people in to. |
--to-project <projectId> | rebind | The project of the workspace a workspace’s app signs your team in to. |
--confirm | delete, rebind, secrets revoke | Skip confirmation prompt. |
Deleting or rebinding an app ends what it issued: its users’ consents to it, the sessions signed in through it and its refresh tokens. Each command says how many of each ended. A released app is deleted by the next release, and signs people in until then. rebind with neither --to-org nor --to-project binds the app to the whole project or workspace.
A confidential app (confidential: true in its config, or set in the console) is a server that keeps a client secret. secrets create shows the new secret once; Foir keeps only its hash, so copy it into the app then. An app can hold several secrets at once, so you rotate one with no gap: make the new one, put it in the app, then revoke the old one. Disabling an app or binding it to another place revokes all its secrets. With --json, secrets create answers the secret as secret for a script to store.
Examples
# Bind a project's app to one organization
foir auth-clients rebind storefront --to-org org_123
# Delete a workspace app that signs in your team
foir auth-clients delete team-tool --console
# Rotate a help desk's client secret
foir auth-clients secrets create help-desk
foir auth-clients secrets list help-desk
foir auth-clients secrets revoke help-desk acs_old123domains
Domains the project, or an organization, proves it controls, and what an address there gets. Each command acts where the CLI stands: the project, or the organization named with --org-id.
| Command | Description |
|---|---|
foir domains list | List the domains where the CLI stands |
foir domains add <domain> | Add a domain to verify, and print the TXT record to publish |
foir domains check <id> | Look for the TXT record now, and verify the domain when it is found |
foir domains remove <id> | Remove a domain. Addresses at it are no longer vouched for, and it joins nobody |
foir domains joining <id> <open|request|none> | What a verified address at an organization’s domain gets |
A verified domain vouches for the addresses at it. At an organization’s domain, joining also says what somebody with a verified address there gets when they sign in at the organization: open joins them with the organization’s joining role, request asks to join, and none gives nothing. A project’s own domain joins nobody.
Examples
# Add an organization's domain, then verify it once the TXT record is published
foir domains add acme.com --org-id org_123
foir domains check vd_456 --org-id org_123
# Let verified addresses at it ask to join
foir domains joining vd_456 request --org-id org_123notifications
Manage platform notifications.
| Command | Description |
|---|---|
foir notifications list | List notifications |
foir notifications read <id> | Mark a notification as read |
foir notifications read-all | Mark all notifications as read |
Examples
# List unread notifications
foir notifications list --unread
# Mark all as read
foir notifications read-allpush-credentials
Manage per-project push credentials (APNs for iOS, FCM for Android) used to deliver push notifications. Alias: push-creds.
| Command | Description |
|---|---|
foir push-credentials list | List push credentials for the current project |
foir push-credentials upload-ios | Upload an APNs .p8 credential for iOS |
foir push-credentials upload-android | Upload an FCM service-account JSON for Android |
foir push-credentials delete <id> | Delete a push credential by ID |
| Option | Applies to | Description |
|---|---|---|
--p8 <path> | upload-ios | Path to the APNs .p8 private key. Required. |
--bundle-id <id> | upload-ios | iOS app bundle identifier. Required. |
--team-id <id> | upload-ios | Apple Developer Team ID (10 chars). Required. |
--key-id <id> | upload-ios | APNs Key ID (10 chars). Required. |
--production | upload-ios | Use the production APNs endpoint (default: sandbox). |
--service-account <path> | upload-android | Path to the Firebase service-account JSON. Required. |
Examples
# List configured push credentials
foir push-credentials list
# Upload an APNs key for iOS (sandbox by default)
foir push-credentials upload-ios \
--p8 ./AuthKey_ABC123.p8 \
--bundle-id com.example.app \
--team-id A1B2C3D4E5 \
--key-id F6G7H8I9J0
# Upload the same key for production
foir push-creds upload-ios --p8 ./AuthKey_ABC123.p8 --bundle-id com.example.app \
--team-id A1B2C3D4E5 --key-id F6G7H8I9J0 --production
# Upload an FCM service-account for Android
foir push-credentials upload-android --service-account ./firebase-service-account.json
# Delete a credential
foir push-credentials delete cred_abc123notes
Manage notes attached to a subject.
| Command | Description |
|---|---|
foir notes list | List notes on a subject |
foir notes get <id> | Get a note by ID |
foir notes create | Create a note |
foir notes resolve <id> | Resolve a note |
foir notes delete <id> | Delete a note |
foir notes settings | Show the project’s notes settings, or turn one on or off |
A note’s subject is what it is about, and it takes two flags: the kind, and which one.
| Option | Applies to | Description |
|---|---|---|
--subject-type <type> | list, create | What the note is about: record, file, model, operation, schedule, user, project. Required. |
--subject-id <id> | list, create | Which one. The ID, except for model and operation, which take the key. Required. |
--model-key <key> | list, create | The record’s model key, such as article. Required for --subject-type record, refused for every other type. |
--include-resolved | list | Include resolved notes (default: unresolved only). |
--first <n> | list | Max results. Default: 20. |
--body <text> | create | Note body text. Required. |
--parent-note-id <id> | create | Reply to an existing note. |
--resolution <text> | resolve | Resolution message. |
--confirm | delete | Skip confirmation prompt. |
--anonymous, --no-anonymous | settings | Take notes from visitors who are not signed in, or refuse them. |
--screenshots, --no-screenshots | settings | Let a signed-in user’s note carry a screenshot, or not. |
--subject-type is never a model key. Model keys are yours to choose, so a
project with a model keyed file would otherwise make one value mean two
things. A record says record and names its model separately.
Examples
# List unresolved notes on a record
foir notes list --subject-type record --subject-id kx7p2m9q4wr8n3vt6ybc1zjd --model-key article
# List notes on a file -- no model key, because a file has no model
foir notes list --subject-type file --subject-id q3v8t1nc7k2rb9wz5yjd6xpm
# Create a note on a record
foir notes create --subject-type record --subject-id kx7p2m9q4wr8n3vt6ybc1zjd --model-key article --body "Needs review before publishing"
# Create a note on a model, which is addressed by its key
foir notes create --subject-type model --subject-id article --body "Adding a summary field next sprint"
# Resolve a note
foir notes resolve v4h8nq2zr6mkt9xw3jbc7pfd --resolution "Reviewed and approved"
# Delete a note
foir notes delete v4h8nq2zr6mkt9xw3jbc7pfd --confirm
# Show the project's notes settings, then take notes from visitors
foir notes settings
foir notes settings --anonymousfoir notes settings with no flag reads the project’s settings; a flag changes
that setting and leaves the other as it is. Changing them takes projects:write,
held by a person signed in: an API key is refused. They are the same settings as
project.settings.anonymousNotesEnabled and noteScreenshotsEnabled in
foir.config.ts.
--entity-type and --entity-id have been replaced by the subject flags.
--entity-type held a model key rather than a kind, so it could say “an
article” and could never say “a file”. Passing either now fails with the
replacement rather than being read as a record.
sites
Manage the project’s sites: its own websites, and which may host editing.
| Command | Description |
|---|---|
foir sites list | List the project’s sites |
foir sites save <origin> | Add a site, or change the one at that origin |
foir sites remove <origin> | Remove the site at an origin |
| Option | Applies to | Description |
|---|---|---|
--name <name> | save | What to call the site. Default: its host, for a new site; an existing one keeps its name. |
--allow-editing, --no-allow-editing | save | Let the site frame the console’s field editor, or stop it. Left out, a new site is not allowed and an existing one is unchanged. |
Examples
# Add the marketing site and let it host editing
foir sites save https://www.example.com --name Marketing --allow-editing
# Stop it hosting editing
foir sites save https://www.example.com --no-allow-editing
# Remove it
foir sites remove https://www.example.comsave and remove change one site, matched by its origin, and write every
other site back as it stood. Changing them takes projects:write, held by a
person signed in: an API key is refused. They are the same list as
project.settings.sites in foir.config.ts, and a change takes effect with the
project’s next release.
Apps
apps
Install and manage apps — pluggable units delivered by manifest URL.
| Command | Description |
|---|---|
foir apps list | List installed apps |
foir apps get <name> | Get an installed app by name |
foir apps install <manifestUrl> | Install an app from a manifest URL |
foir apps update <name> | Review an app update and apply it. An update that lets the app do more is applied only with --accept-gains |
foir apps enable <name> | Let a held app run again |
foir apps disable <name> | Hold an app quiet without uninstalling it |
foir apps uninstall <name> | Uninstall (runs __uninstall first if declared) |
foir apps trigger <appName> <operationKey> | Trigger an app-owned operation |
foir apps validate <manifestUrl> | Dry-run validation of a manifest URL |
foir apps dev | Open a public tunnel to a local app dev server so the Foir console can iframe it |
| Option | Applies to | Description |
|---|---|---|
--source-map <json> | install | Inline source mappings (ad-hoc, instead of foir.config.ts). |
--user-sign-in <key> | install, update | The user sign-in the app’s users come through, for an app that has users of its own. On update, it answers an update that starts to ask for one; left out, the install keeps the pairing it holds. |
--no-user-sign-in | update | Pair no user sign-in, removing one the install holds. |
--dry-run | update | Show the diff without applying. |
--reason <text> | enable, disable | Why. Recorded on the events spine, never on the app row: the row travels into the integration config the app’s own middleware reads, so a note about a misbehaving vendor would be readable by that vendor. |
--force | uninstall | Skip the middleware __uninstall call; remove platform state regardless. |
-d, --data <json> | trigger | Input data as a JSON string. |
-p, --port <port> | dev | Local port serving the app. Default: 8787 (wrangler default). |
--host <host> | dev | Local host to forward to. Default: localhost. |
-t, --tunnel <kind> | dev | Tunnel provider: cloudflared (default), ngrok, or none (use --url). |
--url <url> | dev | BYO tunnel URL; pairs with --tunnel none. |
--push | dev | Run foir push once after the tunnel comes up, with FOIR_APPS_HOST set. |
--watch | dev | Re-run foir push on foir.config.* changes (implies --push). |
Examples
# List installed apps
foir apps list
# Install with inline mappings (ad-hoc)
foir apps install https://apps.example.com/shopify/manifest.json \
--source-map '{"product":{"toModel":"product","naturalKey":"handle","fields":{"title":"title","handle":"handle"}}}'
# Install via foir.config.ts (golden path) — declare apps.<name> and run:
foir push
# Review an update without applying it
foir apps update redirector --dry-run
# Apply an update (a rejected change blocks it)
foir apps update redirector
# An update that lets the app do more prints what it gains and a code, and
# applies nothing. Apply it by sending the code back.
foir apps update redirector --accept-gains <code>
# An app whose manifest asks for credentials installs HELD: it has nothing to
# authenticate with yet, so nothing dispatches to it. Write the credentials,
# then release it. Any run_after_install operations fire at that point.
foir apps enable shopify
# Hold one quiet without uninstalling. Mappings, manifest and credentials stay.
foir apps disable shopify --reason "vendor incident, holding until it clears"
# Trigger a specific operation on an installed app
foir apps trigger redirector deploy-worker --data '{"force":true}'
# Force-uninstall (skip middleware __uninstall, remove platform state regardless)
foir apps uninstall redirector --force
# Validate a manifest before installing
foir apps validate https://my-app.example.com/manifest.json
# Tunnel a local app dev server (on :5173) and re-push on config changes
foir apps dev --port 5173 --watch
# Use a BYO tunnel URL instead of cloudflared
foir apps dev --tunnel none --url https://my-tunnel.example.com --pushApp-owned operations are stored as <appName>.<operationKey>. foir apps trigger takes the bare key and builds the stored form, and accepts the stored form too.
Scaffolding
create-config
Scaffold a new app or extension project — a Vite UI + Hono API monorepo wired up for Foir’s scoped-token verification.
npx @foir/cli create-config <name> [options]| Option | Description |
|---|---|
--type <type> | Project type: custom-editor, workflow, or widget |
Examples
# Custom editor placement (UI + middleware)
npx @foir/cli create-config my-editor --type custom-editor
# Pure backend operation (no UI)
npx @foir/cli create-config my-summarizer --type workflow
# Static iframe (no middleware)
npx @foir/cli create-config color-picker --type widgetSee Building an App and Building Operations for end-to-end walkthroughs.
init
Generate starter files for a project — a single model definition, or a tree of seed records for existing models. Run from inside a project that already has a foir.config.ts. To scaffold a brand-new project, use create-config.
| Command | Description |
|---|---|
foir init model <key> | Generate a starter model definition file |
foir init records | Generate seed files for one or more existing models (interactive picker) |
foir init skill | Put the Foir skill for coding agents in the project, and point AGENTS.md at it |
| Option | Applies to | Description |
|---|---|---|
-o, --output <dir> | model, records | Output directory. Default: models for model, seed for records. |
--ts | model, records | Emit TypeScript (.ts) instead of JSON. |
--dir <path> | skill | Project directory. Default: the current one. |
foir init skill writes the skill to .claude/skills/foir/, where Claude Code finds project skills, and adds a short section to AGENTS.md (creating it if needed) telling any coding agent to read it. The skill covers the config, the push and release loop, models, operations and hooks, the SDK and the CLI, and the mistakes the platform refuses with the fix for each. Its field types, permissions and command list are generated from the contract, so the copy a CLI release writes matches that release. Run it again after upgrading the CLI: it replaces the skill and its own AGENTS.md section, and leaves the rest of the file alone.
Examples
# Create a starter model file at ./models/blog-post.ts
foir init model blog-post --ts
# Generate seed records into ./seed/ for models you pick interactively
foir init records --ts
# Teach the coding agents working in this repository to build on Foir
foir init skillConfig Management
configs
Manage platform configs (apps, webhooks). For the config-as-code workflow built around foir.config.ts, use push / pull / remove instead.
| Command | Description |
|---|---|
foir configs list | List configs |
foir configs get <idOrKey> | Get a config by ID or key |
foir configs create | Create a new config |
| Option | Applies to | Description |
|---|---|---|
--type <type> | list | Filter by config type. |
--enabled | list | Only enabled configs. |
--first <n> | list | Max results. Default: 50. |
-d, --data <json> | create | Config data as a JSON string. |
-f, --file <path> | create | Read config data from a file. |
Examples
# List all configs
foir configs list
# Get a config by key
foir configs get my-blog-config
# Create a config
foir configs create --file config.jsonpull
Export the current platform state of a config back into a local foir.config.ts file. Inverse of push — useful when a manager edited models or operations in the dashboard and you want those changes back in source control.
foir pull [options]| Option | Description |
|---|---|
--key <configKey> | Config key to export (default: auto-discover from the current foir.config.ts) |
--out <path> | Output file (default: foir.config.ts next to the current one) |
--force | Overwrite an existing file without prompting |
Examples
# Pull the current project's config into ./foir.config.ts
foir pull
# Pull a named config and write to a different file
foir pull --key my-blog-config --out ./configs/blog.config.ts
# Overwrite without prompt (useful in CI / pre-commit hooks)
foir pull --forcepush
Push a local foir.config.ts file to the platform. This registers or updates a config and all its associated resources.
foir push [options]| Option | Description |
|---|---|
--config <path> | Path to config file (default: auto-discovers foir.config.ts) |
--force | Overwrite platform state on three-way-merge conflicts with console UI edits |
--publish | Release everything the config declares, breaking model changes included, in the push’s own transaction. Without it the push releases only new models and operations and model updates that only add optional fields; everything else waits for foir release publish. |
--rebuild | Accept lookup renames. A lookup with the same keyBy but a changed name rebuilds its projection rows (old rows dropped, new rows re-emitted). Without this flag the server rejects renames. Pure add/remove of lookups does not need it. |
--rotate-keys | Rotate existing API keys and rewrite their values in .env. Names every key it will rotate and asks first; with no TTY it proceeds without prompting. Afterwards it lists each rotated key with its previous secret’s prefix, when that secret expires, and the retire-previous command to end it sooner |
--dry-run | Print what the push would create / update / delete and exit without changing anything. |
--allow-delete | Skip the interactive confirmation when the push deletes resources (for CI). Without this flag, deletions prompt on a TTY and abort when there’s no TTY. |
--prune | Delete resources the config omits. Beside named projects, the way to delete what a project holds and the config does not declare. |
--no-prune | Leave resources the config omits in place. Refused beside named projects. |
--env <path> | Path to .env file (default: .env). Refused beside named projects, where each project declares its own envFile. |
Named projects
When foir.config.ts declares named projects,
a push:
- acts in the project
--project <name>orFOIR_PROJECTselects, and refuses with the declared names when neither is given, on a terminal and in CI alike; - sends to the project’s control plane, refusing
--api-url,FOIR_API_URLor a session minted anywhere else unless--allow-control-plane-mismatchis passed; - resolves the config for every declared project first and refuses, before anything is sent, when any two differ in a field that is not a destination, naming the field and both values;
- fails when the project holds a model, operation, hook, cron schedule or context
dimension that the config does not declare and no config or app owns, and
names it;
--prunedeletes it after the usual confirmation; - writes minted keys and signing secrets to the project’s
envFileonly; - records the hash of the manifest it applied, which
foir projects statusreads.
A change to what a key holds or gives is applied to the existing key in place and reported as live at once, not as a draft. The plan names each new public key that would give a visitor nothing, and the push prints what the platform says about every key it wrote.
Examples
# Push the config file in the current directory
foir push
# Push a specific config file
foir push --config ./configs/blog.config.ts
# Apply and release in one step, design tokens included
foir push --publish
# Overwrite console UI edits when the three-way merge reports conflicts
foir push --force
# Preview the create / update / delete plan without changing anything
foir push --dry-run
# In CI: allow deletions to proceed without an interactive prompt
foir push --allow-delete
# Named projects: say which one, every time
foir push --project staging
FOIR_PROJECT=production foir push --publish
# Delete what production holds and the config does not declare
foir push --project production --prunerelease
Release drafted configuration to production. Every edit to a model, operation, hook, schedule, auth provider, role, auth client, locale, variant catalog entry, email copy, notification category, design tokens or the project’s settings is a draft until a release carries it. A release carries the pending drafts you are shown and may release, or the ones you name as family:key, in one transaction, and says what it left waiting; it is recorded, and rolling it back republishes exactly what it replaced. See Schema Publishing.
| Command | Description |
|---|---|
foir release status | List the drafts a release at your level would carry, and the ones it would leave |
foir release publish [items...] | Release the pending drafts you may release, or the family:key items named |
foir release rollback <releaseId> | Republish exactly what a release replaced |
foir release cancel <releaseId> | Cancel a scheduled release before it comes due |
foir release list | List your level’s releases, scheduled ones included, newest first |
| Option | Applies to | Description |
|---|---|---|
--at <time> | publish, rollback | Schedule it for this ISO 8601 time instead of now |
--limit <n> | list | How many to list (default 20, at most 100) |
Examples
# What would a release carry?
foir release status
# Release everything pending
foir release publish
# Release two drafts on their own
foir release publish model:article operation:checkout
# Release everything pending tonight
foir release publish --at 2026-10-01T22:00:00Z
# Roll the last release back
foir release list --limit 1
foir release rollback rel_01J9X2remove
Remove a config and all its provisioned resources (models, operations, hooks, schedules), and revoke the API keys it created.
The keys are revoked, not deleted — the row survives with a revoked_at so the audit trail does too. A key still listed after a remove is the design, not a leftover.
foir remove <key> [options]| Option | Description |
|---|---|
--force | Skip the confirmation prompt |
Examples
# Remove a config (with confirmation prompt)
foir remove my-blog-config
# Remove without confirmation
foir remove my-blog-config --forceData Portability
export
Export the project as a restorable Postgres database — typed tables, real foreign keys, your media, and your access rules as row-level security. See the Export to Postgres guide for the full walkthrough, and Your Data Is Portable for what the commitment is.
Exporting is gated on the export:run permission, not on ownership. It is implied by tenant:manage, so a workspace owner has it by default and nothing needs granting — but it is a permission in its own right, so it can be delegated to someone who is not an owner, or withheld from someone who otherwise manages the workspace. The distinction matters where the person who should be able to take the data out is not the person who pays the bill.
| Command | Description |
|---|---|
foir export postgres | Export the project as a restorable Postgres bundle |
| Option | Description |
|---|---|
-o, --out <path> | Write the archive to this path (default: foir-export-<date>.tar.gz). |
--target <dsn> | Apply the bundle directly into this Postgres: the tables, the data, the foreign keys and the access rules (policies.sql), checked against what was exported, and the media fetched into a <archive>-media folder beside the archive. Requires psql, and curl for the media. The connection string never leaves your machine: the bundle is applied from here, so your database password is never sent to Foir. |
--postgis | Export location fields as PostGIS geography(Point,4326) rather than JSON. Your database needs the postgis extension. |
--include-raw | Also emit a full-fidelity mirror of every record, drafts and versions and variants included. The stored JSON, plus the typed publish, version and variant columns. |
--include-credentials | Also include your users’ password hashes (portable argon2id, so nobody resets). Prompts for your password to confirm, and records the export in your audit log. |
Examples
# Write an archive you can restore later
foir export postgres
# …somewhere specific
foir export postgres --out ./backups/myproject.tar.gz
# Restore straight into a database you own (never leaves your machine)
foir export postgres --target "postgresql://user:pass@localhost:5432/myproject"
# With PostGIS geometry and the full-fidelity mirror
foir export postgres --postgis --include-raw --target "$DATABASE_URL"
# From a machine, with the project's own admin key
FOIR_API_KEY="$PROJECT_ADMIN_KEY" foir export postgres --project-id "$PROJECT_ID" --out ./backups/project.tar.gz
# From a machine, with an admin key made for the workspace itself:
# the key is bound to no project, so name the one to export
FOIR_API_KEY="$WORKSPACE_ADMIN_KEY" foir export postgres --project-id "$PROJECT_ID" --out ./backups/project.tar.gzExporting needs export:run. A console user holds it where their role gives it. An admin key holds it where it was made with it: a project’s key exports its own project, and a key made for the workspace itself exports the project you name. A key exports the whole project or nothing, so a project’s key also needs records:read.all and files:read.all.
The command prints what it could not carry — a reference pointing at something already deleted, a value that wouldn’t fit its column — before it prints success. Nothing is dropped silently.
Embeddings and AI
embeddings
Manage vector embeddings for semantic search and similarity. Pairs with the AI & Search feature; the embedding pipeline runs on the platform but the CLI is how you trigger writes, deletes, and ad-hoc searches outside the console.
| Command | Description |
|---|---|
foir embeddings write | Write an embedding vector for a record |
foir embeddings delete <recordId> | Delete the embedding for a record |
foir embeddings search | Search by vector similarity |
foir embeddings list <recordId> | List embeddings stored for a record |
foir embeddings stats [modelKey] | Embedding statistics, optionally scoped to a model |
foir embeddings similar <recordId> | Find records similar to the given record |
| Option | Applies to | Description |
|---|---|---|
-d, --data <json> | write, search | Input payload as a JSON string. search requires --data. |
--file <path> | write | Input payload from a JSON file. |
--confirm | delete | Skip confirmation prompt. |
--model-key <key> | similar | Limit matches to a specific model. |
--first <n> | similar | Page size. |
The write payload is {"recordId":"…","vector":[…]} (with optional dimensions, provider, modelName). The search payload is {"queryVector":[…],"modelKey":"…","first":N} — queryVector is required.
Examples
# Write an embedding from a file
foir embeddings write --file embeddings.json
# Semantic search by vector similarity
foir embeddings search --data '{"queryVector":[0.12,0.04,-0.31],"modelKey":"article","first":10}'
# Find similar records, scoped to a model
foir embeddings similar clx123 --model-key article --first 5
# Embedding statistics for a single model
foir embeddings stats article --json
# Project-wide stats (no model key)
foir embeddings stats --json
# Delete the embedding attached to a record
foir embeddings delete clx123 --confirmWorking with your credential
explain
Print what the credential you are holding can actually reach in this project.
foir explain # everything this credential can see
foir explain page # just the `page` modelIt reads GET /v1/manifest, which is per credential — so it is not a description of the project, it is a description of your view of it. That is the point: when a model, a field or an operation is missing from the output, its absence is the answer to why you cannot see it. Scope shaping, model allow-lists and the schema channel all show up here rather than having to be inferred from a failing query.
| Option | Description |
|---|---|
--api-key <key> | Explain a different credential’s view instead of your own. |
--public-api-url <url> | Point at a different API. |
--channel <channel> | Read the draft schema rather than the published one. |
--from <file> | Explain a saved manifest instead of fetching one. |
Reach for it before reaching for introspection: it answers “what can this key do here” directly, in the CLI, without a GraphQL query.
types
Generate TypeScript types for your project’s models, from the same manifest.
It reads the manifest through your signed-in session, for the credential your app will use: the project’s whole surface by default, a key of the project with --api-key-id, or an operation’s dispatch surface with --operation. The session asks the platform for a short-lived token that describes that credential’s surface and reads nothing, so generating never needs the credential’s secret. Describing the project takes models:read; a key also takes apikeys:write, and an operation operations:write.
| Option | Description |
|---|---|
-o, --out <path> | Where to write the types. |
--stdout | Print to stdout instead of writing a file. |
--check | Exit non-zero if the generated types differ from what is on disk. For CI. |
--api-key-id <id> | Generate the surface this key of the project is served: its scopes, the models it is restricted to and the organization it is confined to. |
--api-key <key> | Read the surface with this key instead of your session (also FOIR_API_KEY). For CI with no session. |
--channel <channel> | Generate from the draft schema. |
--from <file> | Generate from a saved manifest. |
--save-manifest <file> | Save the manifest that was used. |
--operation <key> | Generate the types an operation’s dispatch token is served, for that operation’s endpoint. |
--check is the CI form: it makes a schema change that nobody regenerated for fail the build rather than surface later as a type error in an unrelated PR. --from plus --save-manifest is how you generate reproducibly, without a network call in the build.
--operation generates for an endpoint rather than a key: the module is the surface the operation’s token is served, it exports foirCredential naming the operation, and only a client built from that operation’s dispatch token takes it. Through your session it takes operations:write; with --api-key, the key must hold it. See types for the operation’s token.
The global --org-id (or FOIR_ORG_ID) generates an organization’s surface: its composition of the project’s models. It applies to the session and to --api-key alike, and it is recorded in the file’s Regenerate: line so --check reads the same surface again. A key confined to an organization is served that organization’s surface without it. Either way the header says Composed for organization <id>, and foir explain names the organization too. Without an organization the project’s own surface is generated, exactly as before.
Agents
mcp
Run a stdio MCP server that proxies to the hosted Foir MCP endpoint, so an MCP client can reach your project as you.
| Option | Description |
|---|---|
--url <url> | MCP endpoint. Defaults to FOIR_MCP_URL, then the hosted endpoint. |
--read-only | Mint a read-only working token, so the proxy offers only the read tools. Signed-in session only. |
The proxy is capped at your real permissions — --read-only narrows further, it never widens. Everything human-facing goes to stderr, because stdout is the MCP transport.
| Command | Description |
|---|---|
foir mcp configure | Print a connection config for your MCP client |
| Option | Applies to | Description |
|---|---|---|
--oauth | configure | Emit a native-OAuth HTTP config instead of the stdio proxy: the client runs the browser login and consent itself and mints its own scoped token, so there is no static key and no proxy process. |
--read-only | configure | For the stdio-proxy config, emit foir mcp --read-only. Does not apply with --oauth, where read-only is a choice on the consent screen. |
--url <url> | configure | The endpoint to write into the config. |
chat
Talk to Fóir in the terminal, with your own permissions.
| Option | Description |
|---|---|
-p, --prompt <text> | Send one message and exit, instead of opening an interactive session. |
--url <url> | Assistant endpoint. Defaults to FOIR_ASSISTANT_URL, then the hosted endpoint. |
--prompt is the scriptable form; without it you get an interactive session.