Skip to main content

CLI wrapper for Collmex accounting API - LLM-friendly interface

Project description

collmex-cli

LLM-friendly CLI wrapper for the Collmex accounting API (Buchhaltung Pro).

Installation

# From PyPI (recommended)
uv tool install collmex-cli

# From source (development)
uv pip install -e .

Configuration

Set environment variables (or use a .env file):

export COLLMEX_CUSTOMER_ID="your_customer_id"
export COLLMEX_COMPANY_ID="1"  # usually 1
export COLLMEX_USERNAME="your_username"
export COLLMEX_PASSWORD="your_password"

Seller master data (required for PDF invoice rendering)

export COLLMEX_SELLER_NAME="cognovis GmbH"
export COLLMEX_SELLER_STREET="Musterstraße 1"
export COLLMEX_SELLER_ZIP="12345"
export COLLMEX_SELLER_CITY="Berlin"
export COLLMEX_SELLER_VAT_ID="DE123456789"
export COLLMEX_SELLER_HRB="HRB 12345"
export COLLMEX_SELLER_IBAN="DE00 1234 5678 9012 3456 78"
export COLLMEX_SELLER_BIC="BELADEBEXXX"

# Optional
export COLLMEX_SELLER_AMTSGERICHT="Amtsgericht Berlin-Charlottenburg"
export COLLMEX_SELLER_GESCHAEFTSFUEHRUNG="Max Mustermann"
export COLLMEX_SELLER_PHONE="+49 30 123456"
export COLLMEX_SELLER_FAX="+49 30 123457"
export COLLMEX_SELLER_WEB="https://www.cognovis.de"
export COLLMEX_SELLER_EMAIL="info@cognovis.de"
export COLLMEX_SELLER_BANK_NAME="Deutsche Bank"

Usage

Test Connection

collmex test

Vendors (Lieferanten)

# List all vendors
collmex vendors

# Search vendors
collmex vendors --search "Amazon"

# Output as JSON (LLM-friendly)
collmex vendors --json

# Create a vendor
collmex vendor-create --company "New Supplier GmbH" --city "Berlin" --email "info@supplier.de"

Open Items (Offene Posten)

# List vendor open items (unpaid vendor invoices)
collmex open-items --vendor

# List customer open items
collmex open-items --customer

# Output as JSON
collmex open-items --vendor --json

Bookings (Buchungen)

# List all bookings
collmex bookings

# Filter by account
collmex bookings --account 1200

# Filter by date range
collmex bookings --from 2024-01-01 --to 2024-12-31

# Search in booking text
collmex bookings --search "Amazon"

Unmatched Bank Transactions

# Find bank transactions without matching invoices/receipts
collmex unmatched

# For a specific bank account
collmex unmatched --account 1200

# Output as JSON
collmex unmatched --json

Customer Invoices (Ausgangsrechnungen)

# Book a customer invoice in accounting (no invoicing module required)
collmex customer-invoice \
  --customer-id 10001 \
  --invoice "RE-2024-042" \
  --date 2024-01-15 \
  --net 1000.00 \
  --tax-rate 19 \
  --text "Consulting January 2024" \
  --account 8400

# Override the computed tax amount explicitly
collmex customer-invoice --customer-id 10001 --invoice "RE-2024-043" \
  --date 2024-01-15 --net 500.00 --tax 95.00

# Output as JSON
collmex customer-invoice --customer-id 10001 --invoice "RE-2024-044" \
  --date 2024-01-15 --net 200.00 --json

After booking, the invoice appears in open-items --customer until payment is received and in bookings with the debtor and revenue accounts.

Vendor Invoices (Lieferantenrechnungen)

# Create a vendor invoice
collmex vendor-invoice \
  --vendor-id 123 \
  --invoice "INV-2024-001" \
  --date 2024-01-15 \
  --net 100.00 \
  --text "Office supplies"

Invoice PDF Rendering

Generate a cognovis-layout PDF from structured invoice data:

from collmex_cli.invoice_renderer import render_invoice, InvoiceData, InvoiceLineItem

data = InvoiceData(
    company_name="Acme GmbH",
    company_contact_name="Jane Doe",
    address_line1="Hauptstraße 5",
    postal_code="10115",
    city="Berlin",
    country="DE",
    vat_number="DE987654321",
    invoice_nr="2026-0042",
    invoice_date="21.05.2026",
    delivery_date="21.05.2026",
    project_ref="Projekt XYZ",
    line_items=[
        InvoiceLineItem(name="Beratung", quantity="8 h", unit_price="150,00 €", amount="1.200,00 €"),
    ],
    subtotal="1.200,00 €",
    vat_rate="19%",
    vat_amount="228,00 €",
    total="1.428,00 €",
)

pdf_bytes = render_invoice(data)
with open("rechnung.pdf", "wb") as f:
    f.write(pdf_bytes)

Seller master data is read from CollmexConfig. Missing mandatory fields raise a ValueError listing the affected field names.

LLM Integration

All commands support --json output for easy parsing by LLMs:

collmex vendors --json | jq '.[] | select(.city == "Berlin")'

Workflow: Matching Bank Transactions

  1. Import bank statement (MT940) via Collmex Web UI
  2. Find unmatched transactions:
    collmex unmatched --json
    
  3. For each unmatched transaction, create vendor invoice:
    collmex vendor-invoice --vendor-id 123 --invoice "INV-001" --date 2024-01-15 --net 50.00
    

API Coverage

Currently supported Collmex record types:

  • VENDOR_GET / CMXLIF - Query and create vendors
  • CMXLRN - Create vendor invoices
  • CMXUMS - Create customer invoices (outgoing invoices in accounting)
  • OPEN_ITEMS_GET / OPEN_ITEM - Query open items
  • ACCDOC_GET / ACCDOC - Query accounting documents/bookings

Development

# Install with dev dependencies
uv sync --dev

# Run tests
uv run pytest

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

collmex_cli-2026.5.4.tar.gz (96.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

collmex_cli-2026.5.4-py3-none-any.whl (61.5 kB view details)

Uploaded Python 3

File details

Details for the file collmex_cli-2026.5.4.tar.gz.

File metadata

  • Download URL: collmex_cli-2026.5.4.tar.gz
  • Upload date:
  • Size: 96.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for collmex_cli-2026.5.4.tar.gz
Algorithm Hash digest
SHA256 10a37046c5ae49b93b864d484c94307a1b8e216274d73a4c32988cf00ec55883
MD5 3cbfcfdcffb26fac8c9120a7db75a4e2
BLAKE2b-256 34528ee7d423d07420fd36b402f735b406d45d8eb957fcf68413e17044b962fe

See more details on using hashes here.

Provenance

The following attestation bundles were made for collmex_cli-2026.5.4.tar.gz:

Publisher: release.yml on cognovis/collmex-cli

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file collmex_cli-2026.5.4-py3-none-any.whl.

File metadata

  • Download URL: collmex_cli-2026.5.4-py3-none-any.whl
  • Upload date:
  • Size: 61.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for collmex_cli-2026.5.4-py3-none-any.whl
Algorithm Hash digest
SHA256 845a4eaf96cf2e1d8f633c061552592f22045ea817b468ca89f07c0f65ed4d2b
MD5 61623d3ef1070d354961764d7e8f6fa5
BLAKE2b-256 1faf2f1af95aef5ef0877a4d3b36192d4192b07c6ef37d371077ad1a7957cdaf

See more details on using hashes here.

Provenance

The following attestation bundles were made for collmex_cli-2026.5.4-py3-none-any.whl:

Publisher: release.yml on cognovis/collmex-cli

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page