A CLI for the Fatture in Cloud API, with full API coverage, agent-oriented docs, and a practical XML import workflow for fattura elettronica files.
Website: 16bitsrl.github.io/fattureincloud-cli. See CHANGELOG.md for release notes starting from 1.0.1.
CLI is developed by 16bit and is not a Fatture in Cloud product.
curl -fsSL https://raw.githubusercontent.com/16bitsrl/fattureincloud-cli/main/install.sh | shThis downloads the single static binary for your platform from the latest GitHub release, verifies its checksum, and installs it to ~/.local/bin/fic. No PHP or Composer needed.
Set FIC_VERSION=1.2.0 to install a specific version, or FIC_INSTALL_DIR=/usr/local/bin to pick another directory.
irm https://raw.githubusercontent.com/16bitsrl/fattureincloud-cli/main/install.ps1 | iexDownload fic-<os>-<arch> from the latest release, make it executable, and put it on your PATH:
chmod +x ./fic-linux-x86_64
mv ./fic-linux-x86_64 ~/.local/bin/ficIf you already have PHP 8.2+:
composer global require 16bitsrl/fattureincloud-clific upgrade # latest version
fic upgrade --check # only tell whether a newer version is available
fic upgrade 1.2.0 # a specific versionThe download is verified against the release checksums before replacing the binary. Composer installs upgrade with composer global update 16bitsrl/fattureincloud-cli.
Once a day fic checks whether a newer version exists and, if so, says so on stderr after the command output (JSON on stdout is untouched). Set FIC_NO_UPDATE_CHECK=1 to turn this off; it is also off when CI is set.
# Sign in with your Fatture in Cloud account (opens the browser)
fic auth:login
# Set your default company
fic company:set
# Overview of commands and docs
fic
# Explore the generated API commands
fic api:list
# Search helpers
fic clients:search acme --company-id=12345
fic suppliers:search studio --company-id=12345
fic products:search consulting --company-id=12345fic auth:login shows a link and a short code: open the link, sign in to Fatture in Cloud, enter the code and approve. No secrets are stored in the binary, nothing runs on a local port, and it works over SSH too. Tokens are refreshed automatically.
The first sign-in grants read-only access. Write access is asked for only when it is needed:
fic api:create-client --company-id=12345 --input='{"data":{"name":"Acme"}}'
# Missing permission: this command needs entity.clients:a.
# Grant it with: fic auth:grant entity.clients:a
fic auth:grant entity.clients:a # approve in the browser, then run the command again
fic auth:grant --full # or full access to everything, without signing in again
fic auth:status # current permissionsIf you already know what you need, ask for it at sign-in with fic auth:login --grant=issued_documents.invoices:a,entity.clients:a, or use fic auth:login --full for full access to everything. Running fic auth:login again goes back to read-only.
Other ways to sign in:
fic auth:login --token=TOKENwith a manual token from secure.fattureincloud.it/apific auth:login --client-id=ID --client-secret=SECRETto use your own OAuth app (redirect URIhttp://localhost:8511/callback)fic auth:login --no-browserto print the link without opening a browser
Point your agent at this repository, or tell it:
Install the CLI for Fatture in Cloud with
curl -fsSL https://raw.githubusercontent.com/16bitsrl/fattureincloud-cli/main/install.sh | sh, then runficand follow its instructions.
Once installed, everything an agent needs is built into the binary:
ficprints a short overview: sign-in status, key commands, where to learn morefic skillprints the full usage guide (filters, pagination, workflows, errors, quotas)fic skill --listandfic skill TOPICprint the detailed reference topicsfic api:<command> --helpdocuments each API command
The first sign-in needs a human: the agent runs fic auth:login and shows you the link and code it prints, you approve in the browser.
The official API does not ingest raw XML, so the CLI recreates documents through JSON APIs.
For issued XML imports, the recreated document is treated as an electronic invoice by default.
# Preview a single XML
fic einvoice:import /absolute/path/to/fattura.xml --company-id=12345 --dry-run
# Preview a signed XML.p7m file
fic einvoice:import /absolute/path/to/fattura.xml.p7m --company-id=12345 --dry-run
# Import a folder of XML files (direction is auto-detected from XML content)
fic einvoice:import /absolute/path/to/xml-dir --company-id=12345 --yesThe import supports recap before creation, dry runs, .xml and .xml.p7m inputs, client/supplier matching, embedded attachment carry-over, automatic direction inference (issued/received/self-invoice), and structured mapping for supported e-invoice fields before falling back to ei_raw. If neither XML party matches the selected company, the import is rejected.
The usage guide is also packaged as an agent skill, so coding agents load it automatically when relevant.
fic install-skillSkill sources live in skills/fattureincloud/.
fic api:list-issued-documents --company-id=12345 --type=invoice --sort=-date --json
fic api:list-clients --company-id=12345 --q="vat_number = 'IT01234567890'" --json
fic api:send-e-invoice --company-id=12345 --document-id=99composer testUse the release script:
./bin/release.sh X.Y.ZIt will:
- build
builds/ficwith the requested version - verify that
builds/ficmatches the source version - commit
builds/fic - create tag
vX.Y.Z - push branch and tag
Then the GitHub release workflow will build the PHAR and static binaries for Linux, macOS, and Windows.
If you only want to verify that the committed PHAR is still aligned with the source version:
./bin/check-phar-sync.shCI also runs the same sync check on pushes and pull requests.
Users install with the install script (or composer global require 16bitsrl/fattureincloud-cli) and upgrade with fic upgrade.
./bin/update-spec.sh # latest from master
./bin/update-spec.sh v2.1.8 # specific tag
fic clear-cache # clear cached spec and temporary files- Built with Laravel Zero and Spatie Laravel OpenAPI CLI
- API by Fatture in Cloud
- Made by Mattia Trapani at 16bit S.r.l.
The MIT License (MIT). Please see LICENSE.md for more information.
