---
name: billingnow-cli
description: Use BillingNow CLI (bn) for invoicing, billing, payments, and financial management. Use this skill when users ask to create invoices, manage bills, record payments, handle clients/suppliers, generate reports, or work with estimates and credit notes via command line.
---

# BillingNow CLI

The BillingNow CLI (`bn`) provides command-line access to BillingNow's invoicing and billing platform. Use Bash to execute these commands.

## Authentication

If a command fails with an unauthorized error (401), authenticate with:

```bash
bn login   # Opens browser for OAuth authentication
```

## Command Reference

All commands support `-f json` for machine-readable output. Use `--help` on any command for details.

### Invoices

```bash
# List invoices
bn invoice list
bn invoice list --status sent
bn invoice list --relation <client-id>

# Get invoice by ID
bn invoice get <invoice-id>

# Find invoice by ID or invoice number
bn invoice find INV-001
bn invoice find <invoice-id>

# Create invoice (items format: JSON array)
bn invoice create --relation <id> --items '[{"name":"Service","quantity":1,"netPrice":100}]'
bn invoice create --relation <id> --items '<json>' --date 2025-01-15 --due-date 2025-02-15

# Update invoice
bn invoice update <id> --items '<json>'
bn invoice update <id> --due-date 2025-02-28

# Change status (draft, not-sent, sent, overdue, cancelled)
bn invoice status <id> sent

# Delete invoice
bn invoice delete <id>

# Generate invoice number
bn invoice generate-number <relation-id>
```

**Invoice statuses**: draft, not-sent, sent, overdue, partially-paid, paid, refunded, cancelled

**Important**: `paid` and `partially-paid` statuses can ONLY be set via the payment system, not manually.

### Bills (Expenses)

```bash
# List bills
bn bill list
bn bill list --status pending
bn bill list --relation <supplier-id>

# Get bill by ID
bn bill get <bill-id>

# Find bill by ID or bill number
bn bill find BILL-001
bn bill find <bill-id>

# Create bill
bn bill create --relation <id> --total 500
bn bill create --relation <id> --total 500 --subtotal 450 --tax-amount 50 --date 2025-01-15

# Update bill
bn bill update <id> --total 600 --note "Updated amount"

# Change status (draft, pending, overdue)
bn bill status <id> pending

# Bill analysis (for uploaded receipts)
bn bill analyze <id>      # Check analysis status
bn bill confirm <id>      # Confirm extracted data
bn bill retry <id>        # Retry failed analysis

# Delete bill
bn bill delete <id>
```

**Bill statuses**: draft, pending, overdue, partially-paid, paid

### Payments

```bash
# List payments
bn payment list
bn payment list --invoice <id>
bn payment list --bill <id>
bn payment list --transaction-type credit

# Get payments for an entity
bn payment get <invoice-or-bill-id>

# Create payment (required: --amount + one of --invoice/--bill/--credit-note)
bn payment create --invoice <id> --amount 500
bn payment create --bill <id> --amount 300 --method cash --date 2025-01-20
bn payment create --credit-note <id> --amount 100

# Update payment
bn payment update <id> --amount 550 --method bank_transfer

# Delete payment
bn payment delete <id>
```

**Payment methods**: bank_transfer, card, cash, check, other

### Relations (Clients/Suppliers)

```bash
# List relations
bn relation list
bn relation list --type client
bn relation list --type supplier

# Get relation by ID
bn relation get <id>

# Find relation by ID or name
bn relation find "Acme Inc"
bn relation find <relation-id>

# Create an organization (company) relation
bn relation create --org --org-name "Acme Inc" --currency USD
bn relation create --org --org-name "Supplier Co" --org-tax "CHE-123.456.789" --currency EUR --type supplier --email contact@supplier.com

# Create an individual (person) relation
bn relation create --first-name "John" --last-name "Doe" --email "john@example.com" --currency USD
bn relation create --prefix "Mr." --first-name "John" --last-name "Smith" --email "john@smith.com" --currency CHF --type client

# Create with full details
bn relation create --org --org-name "Company Inc" --currency USD \
  --address-line1 "123 Main St" --city "New York" --state "NY" --zipcode "10001" --country "USA" \
  --payment-term 45 --note "Key client"

# Update relation
bn relation update <id> --email new@email.com
bn relation update <id> --org-name "New Company Name" --org-tax "VAT123456"
bn relation update <id> --first-name "Jane" --last-name "Doe"
bn relation update <id> --address-line1 "456 Oak Ave" --city "Boston" --country "USA"
bn relation update <id> --payment-term 60 --note "Updated terms"

# Delete relation
bn relation delete <id>
```

**Relation types**: client, supplier, both

**Creating organizations** (companies): Use `--org --org-name <name>` with optional `--org-tax <tax-id>`

**Creating individuals** (persons): Use `--first-name <name> --last-name <name> --email <email>` (all required), optional `--prefix <prefix>`

**Common options**: `--currency <code>` (required), `--type <type>`, `--address-line1`, `--address-line2`, `--city`, `--state`, `--zipcode`, `--country`, `--payment-term <days>` (default: 30), `--note <text>`

### Estimates (Quotes)

```bash
# List estimates
bn estimate list
bn estimate list --status sent

# Get estimate by ID
bn estimate get <id>

# Find estimate by ID or estimate number
bn estimate find EST-001
bn estimate find <estimate-id>

# Create estimate
bn estimate create --relation <id> --items '[{"name":"Consulting","quantity":10,"netPrice":150}]'
bn estimate create --relation <id> --items '<json>' --valid-until 2025-02-28

# Update estimate
bn estimate update <id> --valid-until 2025-03-15

# Change status
bn estimate status <id> sent
bn estimate status <id> approved

# Delete estimate
bn estimate delete <id>
```

**Estimate statuses**: draft, sent, approved, rejected

### Credit Notes

```bash
# List credit notes
bn credit-note list
bn credit-note list --status sent

# Get credit note by ID
bn credit-note get <id>

# Find credit note by ID or credit note number
bn credit-note find CN-001
bn credit-note find <credit-note-id>

# Create credit note
bn credit-note create --relation <id> --items '[{"name":"Refund","quantity":1,"netPrice":50}]'
bn credit-note create --relation <id> --items '<json>' --invoices inv-id1,inv-id2

# Update credit note
bn credit-note update <id> --items '<json>'

# Change status
bn credit-note status <id> sent

# Delete credit note
bn credit-note delete <id>
```

**Credit note statuses**: draft, not-sent, sent, applied, cancelled

### Recurring Invoices

```bash
# List recurring templates
bn recurring-invoice list
bn recurring-invoice list --active

# Get template by ID
bn recurring-invoice get <id>

# Find template by ID or name
bn recurring-invoice find "Monthly Retainer"
bn recurring-invoice find <template-id>

# Create recurring template
bn recurring-invoice create --name "Monthly Retainer" --relation <id> --frequency monthly \
  --items '[{"name":"Monthly Service","quantity":1,"netPrice":1000}]'

# Update template
bn recurring-invoice update <id> --frequency weekly --next-issue-date 2025-02-01

# Toggle active/inactive
bn recurring-invoice toggle <id> --active
bn recurring-invoice toggle <id> --inactive

# Manually generate invoice from template
bn recurring-invoice generate <id>

# Delete template
bn recurring-invoice delete <id>
```

**Frequencies**: daily, weekly, monthly, yearly, custom
**End types**: never, after_occurrences, by_date

### Catalog Items

```bash
# List items
bn item list
bn item list --active

# Get item by ID
bn item get <id>

# Find item by ID, name, or SKU
bn item find "Web Development"
bn item find LOGO-001
bn item find <item-id>

# Create item
bn item create --name "Web Development" --net-price 150 --currency USD
bn item create --name "Logo Design" --net-price 500 --currency EUR --sku LOGO-001

# Update item
bn item update <id> --net-price 175 --active
bn item update <id> --inactive

# Delete item
bn item delete <id>
```

### Tax Rates

```bash
# List taxes
bn tax list

# Get tax by ID
bn tax get <id>

# Find tax by ID or designation
bn tax find "VAT 20%"
bn tax find <tax-id>

# Create tax
bn tax create --designation "VAT 20%" --rate 20
bn tax create --designation "Sales Tax" --rate 8.5 --default

# Update tax
bn tax update <id> --rate 21 --default

# Delete tax
bn tax delete <id>
```

### Categories

```bash
# List categories
bn category list

# Get category by ID
bn category get <id>

# Find category by ID or name
bn category find "Consulting"
bn category find <category-id>

# Create category
bn category create --name "Consulting" --color "#3B82F6"

# Update category
bn category update <id> --name "Consulting Services"

# Delete category
bn category delete <id>
```

### Reporting

```bash
# Activity report (all document types)
bn reporting activity --period this-month
bn reporting activity --relation <id> --invoice-status paid,sent

# Sales reports
bn reporting sales --period last-month
bn reporting sales-per-date --years 2024,2025 --display-by monthly
bn reporting sales-per-client --period this-year
bn reporting sales-per-items --period this-month

# Payment reports
bn reporting payments --period this-month --transaction-type credit
bn reporting payments-per-date --years 2024,2025
bn reporting payments-per-relation --period this-year
bn reporting payments-per-type --period this-month

# Expense reports
bn reporting expenses --period this-month
bn reporting expenses-per-date --years 2024,2025
bn reporting expenses-per-relation --period this-year

# Tax reports
bn reporting tax --years 2024,2025 --display-by quarterly
bn reporting tax-per-designation --period this-year

# Get available years for reporting
bn reporting years
```

**Periods**: this-month, last-month, this-year, last-year, custom (requires --start-date and --end-date)
**Display groupings**: monthly, quarterly, yearly

### Organization

```bash
# List organizations
bn org list

# Get active organization
bn org active

# Get specific organization
bn org get <id>

# Switch organization
bn org switch <org-id>

# Update organization
bn org update --name "My Company" --email contact@company.com
bn org update --timezone "America/New_York" --country "USA"

# Get invoice template settings
bn org template

# Update template settings
bn org template-update --invoice-prefix "INV-" --payment-terms "Net 30"
```

### Authentication & API Keys

```bash
# Login (opens browser)
bn login
bn login --key <api-key>  # Direct API key login

# Logout
bn logout

# Show current user
bn whoami

# Manage API keys
bn keys list
bn keys create --name "CI/CD Key"
bn keys create --name "Temp Key" --expires 2025-06-01
bn keys revoke <key-id>
```

### Configuration

```bash
# View config
bn config list
bn config get baseUrl
bn config path

# Set config
bn config set baseUrl https://api.billingnow.com
```

## Line Item Format

Items for invoices, estimates, credit notes, and recurring invoices use JSON format:

```json
[
  {
    "name": "Service Name",
    "quantity": 1,
    "netPrice": 100,
    "description": "Optional description",
    "taxId": "optional-tax-id"
  }
]
```

Example with multiple items:
```bash
bn invoice create --relation <id> --items '[
  {"name":"Consulting","quantity":5,"netPrice":150},
  {"name":"Development","quantity":20,"netPrice":100}
]'
```

## Common Workflows

### Create and Send Invoice
```bash
# Get client ID
bn relation list --type client -f json

# Create invoice
bn invoice create --relation <client-id> --items '[{"name":"Service","quantity":1,"netPrice":500}]'

# Mark as sent
bn invoice status <invoice-id> sent
```

### Record Payment for Invoice
```bash
# Get invoice details to see amount
bn invoice get <invoice-id>

# Create payment
bn payment create --invoice <invoice-id> --amount 500 --method bank_transfer
```

### Generate Sales Report
```bash
bn reporting sales --period this-month -f json
bn reporting sales-per-client --period this-year
```

## Tips

- Use `-f json` for programmatic output parsing
- Due dates default to invoice date + client's payment term (default 30 days)
- Currency defaults to organization's currency
- Invoice/bill numbers are auto-generated if not specified
- All IDs are UUIDs
