Add expense
Add a cost document by hand: goods purchase, business cost or phone and internet bill.
POST https://cotlet.dev/api/v1/ifirma/invoices/{invoice_number}/expenses
write Confirm
Adds one cost document with the amounts per VAT rate. KSeF marking is required: number (with ksef_number), offline, bfk or di. The seller is matched by contractor_id or NIP. The cost goes into your records. By default you confirm each call; you can switch that off for this tool.
Parameters
| Name | Type | Description |
|---|---|---|
| type string required | string | goods_purchase, business_cost_invoice or phone_internet. |
| invoice_number string required | string | Number printed on the supplier document. |
| expense_name string required | string | Name of the expense. |
| issue_date string required | string | YYYY-MM-DD. |
| ksef_marking string required | string | number, offline, bfk or di. |
| ksef_number string | string | Required when ksef_marking is number. |
| contractor_id string | string | Contractor ID from list_contractors. |
| net_23 number | number | Net amount at 23%. The same for net_8, net_5, net_0 and net_exempt. |
| vat_23 number | number | VAT amount at 23%. The same for vat_8 and vat_5. |
Request
curl -X POST https://cotlet.dev/api/v1/ifirma/invoices/invoice%20number/expenses \
-H "Authorization: Bearer $COTLET_API_KEY" \
-H "Content-Type: application/json" \
-d '{"type":"type","expense_name":"expense name","issue_date":"issue date","ksef_marking":"ksef marking"}' result = client.call("ifirma", "add_expense", {"type":"type","invoice_number":"invoice number","expense_name":"expense name","issue_date":"issue date","ksef_marking":"ksef marking"}) const result = await cotlet.call('ifirma', 'add_expense', {"type":"type","invoice_number":"invoice number","expense_name":"expense name","issue_date":"issue date","ksef_marking":"ksef marking"}); cotlet call ifirma add_expense --data '{"type":"type","invoice_number":"invoice number","expense_name":"expense name","issue_date":"issue date","ksef_marking":"ksef marking"}' Example response
{
"id": 3310027,
"type": "phone_internet",
"invoice_number": "2026/10/0042",
"net": 81.3,
"vat": 18.7,
"gross": 100
}