Create a customer invoice

Create an invoice for a customer, as a draft by default.

POST https://cotlet.dev/api/v1/pennylane/customers/{customer_id}/invoice

write Confirm

Creates an invoice with one or more lines and returns its invoice_id and amounts. Draft defaults to true and keeps the invoice editable; with draft set to false Pennylane finalizes it at once and it can no longer be edited. Amounts are strings, and the call fails when the totals do not add up or the VAT rate is not one Pennylane accepts. Without a ledger account on a line, Pennylane applies the company's default mapping. Set external_reference so a repeated run finds the invoice instead of creating it twice. A draft reaches nobody; a final invoice is a legal document. By default you confirm each call; you can switch that off for this tool.

Parameters

Parameters: create_customer_invoice
NameTypeDescription
customer_id integer required integer Customer ID from list_customers or create_customer.
date date required date Invoice date.
deadline date required date Payment due date.
lines array required array Invoice lines. Each has label, quantity, unit, unit_price as a string and vat_rate in percent.
draft boolean boolean true keeps the invoice a draft, false finalizes it. Default: true.
external_reference string string Your own reference, e.g. 2026-10-atelier-lumen. Use it to avoid duplicates.

Request

cURL
curl -X POST https://cotlet.dev/api/v1/pennylane/customers/4034/invoice \
  -H "Authorization: Bearer $COTLET_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"date":"2026-10-31","deadline":"2026-11-30","draft":true,"external_reference":"2026-10-studio-marais","lines":[{"label":"Workshop day, October","quantity":8,"unit":"hour","unit_price":"120.00","vat_rate":20}]}'
Python
result = client.call("pennylane", "create_customer_invoice", {"customer_id":4034,"date":"2026-10-31","deadline":"2026-11-30","draft":True,"external_reference":"2026-10-studio-marais","lines":[{"label":"Workshop day, October","quantity":8,"unit":"hour","unit_price":"120.00","vat_rate":20}]})
Node.js
const result = await cotlet.call('pennylane', 'create_customer_invoice', {"customer_id":4034,"date":"2026-10-31","deadline":"2026-11-30","draft":true,"external_reference":"2026-10-studio-marais","lines":[{"label":"Workshop day, October","quantity":8,"unit":"hour","unit_price":"120.00","vat_rate":20}]});
CLI
cotlet call pennylane create_customer_invoice --data '{"customer_id":4034,"date":"2026-10-31","deadline":"2026-11-30","draft":true,"external_reference":"2026-10-studio-marais","lines":[{"label":"Workshop day, October","quantity":8,"unit":"hour","unit_price":"120.00","vat_rate":20}]}'

Example response

JSON

{
  "invoice_id": 118390,
  "customer": {
    "customer_id": 4021,
    "name": "Atelier Lumen SARL"
  },
  "status": "draft",
  "draft": true,
  "date": "2026-10-31",
  "deadline": "2026-11-30",
  "external_reference": "2026-10-atelier-lumen",
  "amount_before_tax": "1140.00",
  "tax": "228.00",
  "amount": "1368.00",
  "currency": "EUR"
}

Sign in once. Your agent does the rest.

Sign up and add the apps you need. Free 7-day trial with 2,000 credits, no card needed.