# Commands

## General

| Command | Description |
|---|---|
| `altoviz hello` | Test the API key and display connection info |
| `altoviz configure` | Save API key and endpoint to `~/.altoviz/cli.yaml` |
| `altoviz version [--check]` | Print current version; `--check` compares with the latest GitHub release |
| `altoviz completion <shell>` | Emit a completion script for `bash`, `zsh`, `fish`, or `pwsh` |
| `altoviz about` | Display version, website, and copyright |

## Customers

| Command | Description |
|---|---|
| `customer list` | List customers (supports `--query`, `--order-by`, `--all-pages`) |
| `customer get <id>` | Get a customer by ID |
| `customer find` | Find a customer by `--email`, `--number`, or `--internal-id` |
| `customer create` | Create a customer (flags or `--file <json/yaml>`) |
| `customer update <id>` | Update a customer (merges flag changes onto existing record) |
| `customer delete <id>` | Delete a customer (prompts for confirmation) |

## Suppliers

| Command | Description |
|---|---|
| `supplier list` | List suppliers |
| `supplier get <id>` | Get a supplier by ID |
| `supplier find` | Find a supplier by `--email` or `--internal-id` |
| `supplier create` | Create a supplier (`--name`, `--payment-method`, person fields, or `--file`) |
| `supplier update <id>` | Update a supplier |
| `supplier delete <id>` | Delete a supplier |

## Contacts

| Command | Description |
|---|---|
| `contact list` | List contacts |
| `contact get <id>` | Get a contact by ID |
| `contact find` | Find by `--email` or `--internal-id` |
| `contact create` | Create a contact (`--company-name`, `--function`, `--service`, person fields, or `--file`) |
| `contact update <id>` | Update a contact |
| `contact delete <id>` | Delete a contact |

## Colleagues

| Command | Description |
|---|---|
| `colleague list` | List colleagues |
| `colleague get <id>` | Get a colleague by ID |
| `colleague find` | Find by `--email`, `--number`, or `--internal-id` |
| `colleague create` | Create a colleague (`--name`, `--is-partner`, `--user-id`, person fields, or `--file`) |
| `colleague update <id>` | Update a colleague |
| `colleague delete <id>` | Delete a colleague |

## Products

| Command | Description |
|---|---|
| `product list [--family-id]` | List products, optionally filtered by family |
| `product get <id>` | Get a product by ID |
| `product find` | Find by `--reference` or `--internal-id` |
| `product create` | Create a product (`--name`, `--unit-price`, `--type`, …, or `--file`) |
| `product update <id>` | Update a product |
| `product delete <id>` | Delete a product |
| `product family list` | List product families |
| `product family get <id>` | Get a product family |
| `product family create` | Create a product family (`--file` required) |
| `product family delete <id>` | Delete a product family |

## Invoices

| Command | Description |
|---|---|
| `invoice list` | List invoices (`--from`, `--to`, `--customer-id`, `--status`) |
| `invoice get <id>` | Get an invoice by ID |
| `invoice find` | Find by `--number` or `--internal-id` |
| `invoice create` | Create an invoice (`--file` required) |
| `invoice update <id>` | Update a draft invoice |
| `invoice delete <id>` | Delete an invoice |
| `invoice finalize <id>` | Finalize (issue) an invoice |
| `invoice send <id>` | Send an invoice by email |
| `invoice mark-paid <id>` | Mark an invoice as paid |
| `invoice download <id>` | Download the invoice PDF (`--file <path>`) |

## Quotes

| Command | Description |
|---|---|
| `quote list` | List quotes |
| `quote get <id>` | Get a quote by ID |
| `quote find` | Find by `--number` or `--internal-id` |
| `quote create` | Create a quote (`--file` required) |
| `quote delete <id>` | Delete a quote |
| `quote send <id>` | Send a quote by email |
| `quote download <id>` | Download the quote PDF (`--file <path>`) |

## Credit Notes

| Command | Description |
|---|---|
| `credit list` | List credit notes |
| `credit get <id>` | Get a credit note by ID |
| `credit find` | Find by `--number` or `--internal-id` |
| `credit create` | Create a credit note (`--file` required) |
| `credit update <id>` | Update a draft credit note |
| `credit delete <id>` | Delete a credit note |
| `credit finalize <id>` | Finalize a credit note |
| `credit send <id>` | Send a credit note by email |
| `credit mark-refunded <id>` | Mark a credit note as refunded |
| `credit download <id>` | Download the credit note PDF (`--file <path>`) |

## Receipts

| Command | Description |
|---|---|
| `receipt list` | List receipts |
| `receipt get <id>` | Get a receipt by ID |
| `receipt find` | Find by `--internal-id` |
| `receipt create` | Create a receipt (`--file` required) |
| `receipt update <id>` | Update a receipt |
| `receipt delete <id>` | Delete a receipt |

## Webhooks

| Command | Description |
|---|---|
| `webhook list` | List webhooks |
| `webhook create` | Create a webhook (`--name`, `--url`, `--type`, optional `--secret-key`, or `--file`) |
| `webhook delete <id-or-url>` | Delete a webhook by numeric ID or URL |

## Exports

All export commands accept `--from` / `--to` (date range), `--format` (Excel, EuropeanCsv, AmericanCsv, Tsv, Json, Markdown), `--sheets` (Summary, Detail, Analysis, All), and `--out <file>` to save to disk.

| Command | Description |
|---|---|
| `export invoices` | Sales invoices |
| `export quotes` | Sales quotes |
| `export credits` | Credit notes |
| `export products` | Product catalog |
| `export customers` | Customer list |
| `export suppliers` | Supplier list |
| `export receipts-book` | Receipts journal |
| `export expenses-book` | Expenses journal |
| `export bank-transactions` | Bank transactions (requires `--id`) |
| `export expense-charges` | Expense charges |
| `export expense-reports` | Expense reports (`--colleague-id`) |
| `export settlements` | Settlements |
| `export commitments` | Commitments |

## Statistics

| Command | Description |
|---|---|
| `stats by-month [--year]` | Monthly breakdown for a given year (default: current year) |
| `stats turnover` | Sales turnover vs previous period |
| `stats evolution [--by] [--years]` | Turnover evolution by customer, supplier, product, or colleague |

## Reference data

| Command | Description |
|---|---|
| `ref vats` | List VAT rates |
| `ref units` | List units of measure |
| `ref classifications [--type]` | List classifications, optionally filtered by type |
| `ref settings` | Get account settings |