Appearance
CLI
Table of Contents
The Factorial command-line interface, fctl, lets people and software agents read and modify Factorial records from a terminal. It also creates, uploads, and tests plugins.
Install FCTL
Open Plugins → Install FCTL in your Factorial environment, or visit /install/fctl on that environment's hostname. The page is public; no sign-in is required. It shows commands for macOS & Linux or Windows, selects the one that matches your browser, and fills in the download links for that environment's release.
macOS and Linux
Paste the command from the install page into Terminal. It has this form:
sh
os=$(uname -s | tr A-Z a-z); arch=$(uname -m | sed 's/x86_64/amd64/;s/aarch64/arm64/')
curl -fsSL -o fctl "https://downloads.factorialhq.com/fctl/<version>/$os/$arch/fctl"
sudo mkdir -p /usr/local/bin
sudo install -m 755 fctl /usr/local/bin/fctl && rm fctlThe command detects the operating system and processor, downloads the matching binary, and installs it in /usr/local/bin. sudo asks for your password.
Windows
Paste the command from the install page into PowerShell. It downloads the binary for your processor to %LOCALAPPDATA%\Factorial and adds that folder to your user Path. The current PowerShell window can run fctl immediately; other terminals pick up the new Path when reopened.
Manual Downloads
Under Download a binary instead, the install page lists every build: Apple silicon or x64 for macOS, and x64 or ARM64 for Linux and Windows. x64 covers Intel and AMD processors. The page also links to SHA-256 checksums. Each checksum entry identifies its operating system, architecture, and binary filename.
FCTL binaries are unsigned. macOS blocks unsigned binaries downloaded through a browser until you remove the quarantine flag:
sh
chmod +x fctl
sudo install -m 755 fctl /usr/local/bin/fctl
xattr -d com.apple.quarantine /usr/local/bin/fctlBinaries downloaded with curl, as in the install command, do not receive the quarantine flag.
Connect to Factorial
FCTL reads FCTL_DOMAIN and FCTL_API_KEY from a .fctl file in your home directory, or from environment variables of the same names. Environment variables override the file. Use your Factorial hostname without https://.
Create a key on the API keys page of your Factorial environment. The Connect step of the install page shows a command that writes .fctl with that environment's hostname already filled in; replace <your-api-key> with the key. See Authenticate for the file format and API keys and service accounts for permissions.
Updates
Download FCTL from the environment you connect to so its version matches that server. Different environments can run different releases.
When a released CLI runs a command that connects to Factorial, it checks the server's version with a short timeout. A mismatch prints a warning and a download link to standard error. The warning does not change command output or exit status. If the check cannot complete, the command continues. Help and local commands do not check for updates; development builds skip the check.
To update, run the install command again. It replaces the installed binary with the release that matches the environment. Updates are manual.
Output
Commands print data from Factorial, such as task and project Markdown, query results, file names, and server error messages. Titles, descriptions, and blocks may be written by any user. On a terminal, FCTL prints control characters in that text, other than newline and tab, as escapes such as \u001b. A task title therefore cannot recolor the screen, add hidden links, or set the clipboard. JSON output stays valid, because \u001b is also a JSON escape. Output piped to another program or redirected to a file is unchanged, byte for byte.
FCTL colors short status words, such as Error:, on a terminal. Set NO_COLOR to turn color off.
Discovering Commands
Run fctl --help to list commands, or use --help with an individual command. Run fctl --version to see the installed revision. Some API endpoints do not have a corresponding CLI command.
Queue Tasks
fctl tasks queue puts tasks in a queue or takes them out of their queue. It works on project and work order tasks.
sh
fctl tasks queue --ids <task-id>,<task-id> --queue "Papercuts"
fctl tasks queue --ids <task-id> --clear--ids takes task ids, the id returned by fctl query --json '{"root":"TASKS","search":"Acme"}', not effective_step_id. --queue takes a queue's id or its exact name; the command fails if the name matches no queue or more than one. Add --dry-run to validate the change without saving it.
Analytics
fctl analytics runs read-only SQL over the Analytics views from a terminal. It uses the same API as the Analytics page, with the same limits. The API key's user needs the Analytics permission.
fctl analytics schema lists each view with its description, followed by its columns, their PostgreSQL types, and their descriptions. Column descriptions include units, status values, and join hints. Add --json for the API response.
sh
fctl analytics schemafctl analytics query runs a single SELECT, VALUES, or read-only WITH query. The SQL may be passed as one quoted argument, read from a file with -f, or piped on standard input:
sh
fctl analytics query "select status, count(*) as work_orders from analytics.work_orders group by status order by status"
fctl analytics query -f weekly.sql
cat weekly.sql | fctl analytics queryBy default, results print as aligned columns, followed by a row count. SQL null appears as NULL, newlines and tabs within values appear as \n and \t, and other control characters appear as escapes such as \u001b, so data can't send escape sequences to your terminal. --format csv and --format json print the API's CSV and JSON results unchanged when piped or redirected, and with the same control character escapes on a terminal:
sh
fctl analytics query --format csv -f weekly.sql > weekly.csvEach query has a 10-second deadline and returns at most 10,000 rows and 8 MiB of cell data. When a result reaches the row or size limit, the output says it was truncated: aggregate or filter in SQL to retrieve less data. An SQL error, such as an unknown column, prints the server's message and exits with a non-zero status.
AI Agents
Agents can inspect commands through --help and invoke the same CLI used by people. API key permissions apply to every request.
A coding agent such as Claude Code or Codex can use fctl to answer questions about your factory data. Asked a question like "Which parts have the most scrapped inventory this quarter?", the agent runs fctl analytics schema to learn the views, writes a SQL query, and runs it with fctl analytics query. If the query fails, the agent reads the error and revises it. fctl analytics --help describes this workflow and its limits, so the agent needs no further instructions.
The agent runs on your computer with the AI provider it already uses. Factorial needs no AI provider keys for this and does not contact an AI provider: fctl uses a regular Factorial API key. The agent receives the results of the queries it runs, and its provider handles them under your agreement with that provider. The key's roles apply to every request, and queries require the Analytics permission. Analytics queries are read-only; other fctl commands can change data when the key's roles allow it.
For agents, create the key for a service-account user with only the roles the agent needs, such as a role that grants only the Analytics permission. The agent's access then stays separate from any person's and can be changed or revoked on its own. See API Keys and Service Accounts.