Skip to main content
PUT
/
expenses
/
{id}
curl -X PUT "https://api.contazen.ro/v1/expenses/exp_abc123" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "description": "Updated: Office supplies and equipment",
    "amount": 285.00,
    "is_paid": true,
    "paid_date": "2024-01-20",
    "payment_type": 2
  }'
{
  "success": true,
  "expense": {
    "id": "exp_abc123",
    "reference": "INV-2024-001",
    "description": "Updated: Office supplies and equipment",
    "amount": {
      "total": "285.00",
      "without_vat": "239.50",
      "vat": "45.50",
      "currency": "RON"
    },
    "account_amount": {
      "total": "285.00",
      "without_vat": "239.50",
      "vat": "45.50",
      "currency": "RON"
    },
    "vat_percent": 19,
    "with_vat": true,
    "date": "2024-01-15",
    "due_date": "2024-02-15",
    "paid_date": "2024-01-20",
    "is_paid": true,
    "payment_type": {
      "id": 2,
      "name": "Bank transfer"
    },
    "status": "paid",
    "supplier_id": "sup_xyz789",
    "category_id": 1,
    "user_id": 1,
    "created_at": "2024-01-15 10:30:00",
    "updated_at": "2024-01-20 14:45:00"
  },
  "message": "Expense updated successfully"
}

Documentation Index

Fetch the complete documentation index at: https://docs.contazen.ro/llms.txt

Use this file to discover all available pages before exploring further.

Overview

The Update Expense endpoint allows you to modify an existing expense record. You can update any field including supplier, category, amounts, payment status, and other details. The system will automatically recalculate VAT and currency conversions based on your changes.
Some expenses may not be modifiable if they are locked due to accounting periods or other business rules. The system will return an error if the expense cannot be modified.

Path Parameters

id
string
required
The CzUid of the expense to update

Request Body

All fields are optional - only include the fields you want to update. Existing values will be preserved for any fields not included in the request.
supplier_id
string
Change the supplier for this expense (CzUid)
category_id
integer
Change the expense category
reference
string
Update the reference or invoice number
description
string
Update the expense description
amount
number
Update the expense amount (will trigger VAT recalculation)
with_vat
boolean
Change whether the amount includes VAT
vat
integer | string
Update the VAT percentage. Either a numeric value (0, 5, 9, 11, 19, 21) or the string "mix" for multi-rate receipts where the caller supplies total VAT manually via amount_vat_manual. See Mix VAT mode on Create for the full shape.
amount_vat_manual
number
Total VAT amount in receipt currency. Required (>= 0) when vat = "mix", ignored otherwise. The server stores amount_wvat = amount, amount_vat = amount_vat_manual, amount_total = amount + amount_vat_manual.
currency
string
Change the currency (will trigger currency conversion recalculation)
date
string
Update the expense date (YYYY-MM-DD)
due_date
string
Update the payment due date (YYYY-MM-DD)
is_paid
boolean
Change the payment status
paid_date
string
Update the payment date (only relevant if is_paid is true)
payment_type
integer
Update the payment type ID (1-7, only relevant if is_paid is true):
  • 1 - Cash
  • 2 - Bank transfer
  • 3 - Card
  • 4 - Check
  • 5 - Promissory note
  • 6 - Other
  • 7 - Compensation
with_currency_exchange
boolean
Enable or disable currency exchange
currency_to
string
Update the target currency for exchange
items
array
Replace the expense line rows. Sending items overwrites all existing lines for this expense — send the full desired set, not a diff. Lines you omit are deleted. When items is present the server derives amount, vat, and vat_breakdown from the lines; the corresponding header-level fields on the request body are ignored.Omit items entirely to leave the existing lines untouched and update only the header fields you pass. To convert an itemized expense back to flat, send an empty items: [] alongside new amount + vat.Per-item shape matches the Create Expense endpoint. See Expense Lines & VAT Breakdown for rounding rules.
vat_breakdown
array
Update the per-rate VAT breakdown for multi-VAT receipts on the flat or mix paths. Send an array of { rate, net, vat_amount, gross } entries (two or more). On the mix path, the breakdown is also used to synthesize one persisted line per rate group. Ignored when items is supplied.
currency_rate
number
Update the exchange rate

Response

Returns the updated expense object with all recalculated fields.
expense
object
The updated expense object with all details
message
string
Success message confirming the update

Automatic Recalculations

When you update certain fields, the system automatically recalculates related values:

VAT Recalculation

  • Amount changes: VAT amounts are recalculated based on the new amount and VAT percentage
  • VAT percentage changes: All VAT-related amounts are recalculated
  • with_vat changes: The relationship between total and VAT-exclusive amounts is recalculated

Currency Conversion

  • Currency changes: Account amounts are recalculated using current exchange rates
  • Exchange rate changes: Account amounts are recalculated with the new rate

Status Updates

  • Payment status: The overall expense status is updated based on payment and due date information

Validation Rules

  • Modifiability: The expense must not be locked by accounting rules
  • Supplier: If changed, must exist and be owned by your firm
  • Category: If changed, must be a valid expense category
  • Amount: If changed, must be a positive number
  • Dates: Must be in YYYY-MM-DD format
  • Payment consistency: If marking as paid, payment_type is required
curl -X PUT "https://api.contazen.ro/v1/expenses/exp_abc123" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "description": "Updated: Office supplies and equipment",
    "amount": 285.00,
    "is_paid": true,
    "paid_date": "2024-01-20",
    "payment_type": 2
  }'
{
  "success": true,
  "expense": {
    "id": "exp_abc123",
    "reference": "INV-2024-001",
    "description": "Updated: Office supplies and equipment",
    "amount": {
      "total": "285.00",
      "without_vat": "239.50",
      "vat": "45.50",
      "currency": "RON"
    },
    "account_amount": {
      "total": "285.00",
      "without_vat": "239.50",
      "vat": "45.50",
      "currency": "RON"
    },
    "vat_percent": 19,
    "with_vat": true,
    "date": "2024-01-15",
    "due_date": "2024-02-15",
    "paid_date": "2024-01-20",
    "is_paid": true,
    "payment_type": {
      "id": 2,
      "name": "Bank transfer"
    },
    "status": "paid",
    "supplier_id": "sup_xyz789",
    "category_id": 1,
    "user_id": 1,
    "created_at": "2024-01-15 10:30:00",
    "updated_at": "2024-01-20 14:45:00"
  },
  "message": "Expense updated successfully"
}

Authorizations

Authorization
string
header
required

Use your API key (sk_live_xxx or sk_test_xxx)

Path Parameters

id
string
required

Expense CzUid

Body

application/json

All fields optional. Sending items REPLACES all existing lines — send the full desired set, not a diff. Omit items to leave lines untouched. To convert an itemized expense back to flat, send items: [] alongside new amount + vat.

supplier_id
string
category_id
integer | null
reference
string
description
string
amount
number
with_vat
enum<integer>
Available options:
0,
1
vat

VAT percentage. Either a numeric value or the string "mix" for multi-rate receipts. When set to "mix" the request must include amount_vat_manual.

Available options:
0,
5,
9,
11,
19,
21
amount_vat_manual
number

Total VAT amount when vat = "mix". Server stores amount_wvat = amount, amount_vat = amount_vat_manual, amount_total = amount + amount_vat_manual.

Required range: x >= 0
currency
string
date
string<date>
due_date
string<date>
is_paid
enum<integer>
Available options:
0,
1
paid_date
string<date>
payment_type
integer
Required range: 1 <= x <= 7
with_currency_exchange
enum<integer>
Available options:
0,
1
currency_to
string
currency_rate
number
items
object[]

Replace all line rows. When present, the server re-derives amount / vat / vat_breakdown from the lines and ignores the corresponding header fields on the body. Empty array ([]) clears the lines.

vat_breakdown
object[]

Update the per-rate breakdown for flat-path multi-VAT receipts. Ignored when items is sent.

Response

Expense updated

success
boolean
data
object
meta
object