Lightweight Go CLI for Procountor API operations.
The CLI is a thin wrapper around:
internal/apispec/procountor-api.yaml- generated ogen client in
procountorapi/
External consumers can import the generated client directly:
import "github.com/myyra/procountor/procountorapi"All API operations are exposed as explicit Kong commands, grouped by OpenAPI tag.
go build ./...Run:
go run ./cmd/procountor --helpThis CLI uses persisted login state by default.
Run once:
procountor auth loginauth login uses --username/--password (or PROCOUNTOR_USERNAME/PROCOUNTOR_PASSWORD) and prompts when needed, performs the /login/companies -> /login flow, and stores tokens in:
$XDG_STATE_HOME/procountor/auth.json, or~/.local/state/procountor/auth.jsonwhenXDG_STATE_HOMEis not set.
The stored access token is automatically refreshed via /token when expired.
Useful auth commands:
procountor auth companiesprocountor auth loginprocountor auth refreshprocountor auth statusprocountor auth logout
--base-urlorPROCOUNTOR_BASE_URL: API base URL.- Default:
https://nemo.procountor.com/api
- Default:
--auth-fileorPROCOUNTOR_AUTH_FILE: override persisted auth state path.--timeout: HTTP timeout (default30s).--verbose/-v: print raw HTTP requests and responses to stderr.- Verbose output is dimmed when stderr is a terminal.
--output: output format (human,json, orplain, defaulthuman).
Login credential env vars:
PROCOUNTOR_USERNAME: username forauth companiesandauth login.PROCOUNTOR_PASSWORD: password forauth companiesandauth login.
Commands with request bodies use one of two primary models:
- small or patch-shaped bodies use explicit flags
- document-shaped create/replace bodies use command-specific whole-object import flags such as
--invoice,--ledger-receipt,--business-partner, and--cost-receipt
For flag-shaped commands:
- top-level scalar and enum fields use normal flags
- nested object fields use embedded sub-flags such as
--payment-info.bank-accountand--options.receipt-name
Complex object arrays are not assembled through repeatable JSON flags. If you need to author or replace a nested list of objects, use the command's whole-document import flag instead.
Whole-object import always uses an explicit command-specific flag. Bare stdin is never treated as an implicit whole request body.
Use per-command help for the exact flag contract:
procountor <group> <command> --help
Natural single-resource IDs are positional. Examples:
procountor invoices get 12345procountor ledger-receipts transactions update 12345 67890 --account 3000procountor attachments content 555 --out attachment.pdf
Binary endpoints support --out:
attachments contentinvoices image
If --out is omitted, binary bytes are written to stdout.
Paginated search/list commands use --paginate and return only the result array (no meta/nemoMeta envelope).
--paginate formats:
<limit>(same as0:<limit>)<from>:<limit>all<from>:all
Default: --paginate 0:200
authattachmentsbusiness-partnerschart-of-accountscompanycost-centerscost-receiptsdimensionsfiscal-yearsinvoicesledger-receiptspersonsproductsreportsvats
Use per-command help for exact flags:
procountor <group> <command> --helpUse schema with a command path to print that command's JSON request-body schema.
Commands that do not send an application/json request body print nothing.
procountor schema invoices save
procountor schema reports accounting# One-time login (prompts for credentials)
procountor auth login
# Non-interactive login
PROCOUNTOR_USERNAME=my-user PROCOUNTOR_PASSWORD=my-pass procountor auth login
# Search invoices using stored auth
procountor invoices search --status SENT --paginate 50
# Machine-readable JSON output
procountor invoices search --status SENT --paginate 50 --output json
# Get one invoice
procountor invoices get 12345
# Save invoice from command-specific import flag
procountor invoices save --invoice @./invoice.json
# Update one ledger receipt transaction without roundtripping JSON manually
procountor ledger-receipts transactions update 12345 67890 --account 3000
# Download invoice image
procountor invoices image 12345 --format PNG --out ./invoice.png
# Inspect company VAT defaults and a country VAT table
procountor vats settings
procountor vats country --country-code DK
# Show auth status / clear local auth state
procountor auth status
procountor auth logout