💰 FreshBooks CLI — 技能工具
v1.0.0FreshBooks CLI for managing invoices, clients, and billing. Use when the user mentions freshbooks, invoicing, billing, clients, or accounting.
详细分析 ▾
运行时依赖
版本
Initial release of freshbooks-cli. - Provides CLI commands for managing FreshBooks invoices, clients, and billing using the official API SDK. - Supports OAuth2 authentication via a manual (OOB) flow. - Includes commands to create, update, list, and retrieve clients and invoices. - Offers the ability to generate shareable invoice links and archive invoices. - Outputs all data as JSON for easy scripting and integration. - Provides setup, command reference, and sample workflows in documentation.
安装命令 点击复制
技能文档
CLI tool for managing FreshBooks invoices, clients, and billing. Uses the official @freshbooks/api SDK.
Install
npm install -g @haseebuchiha/freshbooks-cli
Requires .npmrc with @haseebuchiha:registry=https://npm.pkg.github.com for GitHub Package Registry.
Setup (once)
Authenticate with FreshBooks OAuth2. You must use the --manual flag (localhost redirect does not work with FreshBooks).
freshbooks auth login \
--client-id "" \
--client-secret "" \
--manual
This opens the browser. Authorize, then copy the code from the page and paste it into the CLI. Tokens are stored at ~/.config/freshbooks-cli/config.json (0600 permissions) and auto-refresh before expiry.
Verify: freshbooks auth status
Auth commands
freshbooks auth login --client-id-- authenticate via OAuth2 OOB flow--client-secret --manual freshbooks auth logout-- clear stored tokens and credentialsfreshbooks auth status-- show account ID, token expiry, and auth statefreshbooks auth refresh-- manually refresh the access token
Clients commands
freshbooks clients list [-p-- list clients, search by org name] [--per-page ] [-s ] freshbooks clients get-- get a single client by IDfreshbooks clients create [--fname-- create a client] [--lname ] [--email ] [--organization ] freshbooks clients create --data '-- create with full JSON payload' freshbooks clients update-- update a client--data ' '
Example: freshbooks clients create --fname "Taha" --organization "abcg.io"
Invoices commands
freshbooks invoices list [-p-- list invoices] [--per-page ] freshbooks invoices get-- get a single invoice by IDfreshbooks invoices create --client-id-- create an invoice with line items[--lines ' '] freshbooks invoices create --client-id-- create with full JSON payload--data ' ' freshbooks invoices update-- update an invoice--data ' ' freshbooks invoices archive-- archive an invoice (no permanent delete in FreshBooks)freshbooks invoices share-link-- get a shareable link for an invoice
Line items format
Lines are a JSON array. Each line has name, qty, and unitCost (money object):
[
{"name": "Web Services", "qty": 1, "unitCost": {"amount": "15000.00", "code": "USD"}},
{"name": "App Services", "qty": 1, "unitCost": {"amount": "15000.00", "code": "USD"}}
]
Example (full invoice create):
freshbooks invoices create --client-id 818183 \
--lines '[{"name":"Web Services","qty":1,"unitCost":{"amount":"15000.00","code":"USD"}},{"name":"App Services","qty":1,"unitCost":{"amount":"15000.00","code":"USD"}}]'
Workflows
Onboard a new client and invoice them
freshbooks clients create --fname "Name" --organization "Company"-- note the returnedidfreshbooks invoices create --client-id-- create the invoice--lines '[...]' freshbooks invoices share-link-- get shareable link
Look up billing for a client
freshbooks clients list -s "company name"-- find the client IDfreshbooks invoices list-- list all invoices (filter by client in output)freshbooks invoices get-- get full invoice details
Notes
- All output is JSON to stdout. Pipe to
jqfor filtering:freshbooks clients list | jq '.clients[].organization' - Money values are
{"amount": "string", "code": "USD"}. The amount is always a string like"30000.00", never a number. Do not use parseFloat on money. archivesets vis_state=1. FreshBooks does not support permanent deletion.- Tokens auto-refresh. If refresh fails, re-run
freshbooks auth login --client-id.--client-secret --manual - Client credentials can also be read from env vars
FRESHBOOKS_CLIENT_IDandFRESHBOOKS_CLIENT_SECRET(takes priority over stored config). - Always use
--manualfor auth login. The localhost callback redirect URI does not work with FreshBooks. - Confirm with the user before creating invoices or modifying billing data.
免费技能或插件可能存在安全风险,如需更匹配、更安全的方案,建议联系付费定制