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"
}

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
Update the VAT percentage
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
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
supplier_id
string
category_id
integer | null
reference
string
description
string
amount
number
with_vat
enum<integer>
Available options:
0,
1
vat
enum<integer>
Available options:
0,
5,
9,
11,
19,
21
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

Response

Expense updated

success
boolean
data
object
meta
object