A small CLI for the FreeAgent API, built in Go.
- OAuth login (local callback or manual paste)
- Keychain-backed token storage with file fallback
- Create and send invoices
- Break-glass
rawcommand for any FreeAgent endpoint - JSON output mode for scripting / agents
go build ./cmd/freeagentCreate a FreeAgent API application and note the client ID + secret.
Save app credentials:
./freeagent auth configure \
--client-id YOUR_ID \
--client-secret YOUR_SECRET \
--redirect http://127.0.0.1:8797/callbackYou can also use env vars:
export FREEAGENT_CLIENT_ID=...
export FREEAGENT_CLIENT_SECRET=...
export FREEAGENT_REDIRECT_URI=http://127.0.0.1:8797/callbackLocal callback (default):
./freeagent auth loginManual flow:
./freeagent auth login --manualCreate a draft invoice:
./freeagent invoices create \
--contact CONTACT_ID \
--reference INV-001 \
--lines ./invoice-lines.jsonYou can also pass a contact name or email and the CLI will resolve it:
./freeagent invoices create \
--contact "Acme Ltd" \
--reference INV-002 \
--lines ./invoice-lines.jsonSend an invoice email:
./freeagent invoices send --id INVOICE_ID --email-to you@company.comMark as sent (no email):
./freeagent invoices send --id INVOICE_IDBreak-glass request:
./freeagent raw --method GET --path /v2/invoicesContacts:
./freeagent contacts list
./freeagent contacts search --query "Acme"
./freeagent contacts get --id CONTACT_ID
./freeagent contacts create --organisation "Acme Ltd" --email accounts@acme.testBank transactions (bulk approve):
./freeagent bank approve \
--bank-account BANK_ACCOUNT_ID \
--from 2025-01-01 \
--to 2025-01-31
./freeagent bank approve --ids ./transaction-ids.txt
./freeagent bank approve --ids ./explanation-ids.txt --ids-type explanation- Config:
~/.config/freeagent/config.json - Tokens (fallback):
~/.config/freeagent/tokens/PROFILE.json
- Default API base URL is production; use
--sandboxfor the sandbox API. - Use
--jsonto print raw JSON for automation or piping into other tools.
MIT. See LICENSE.