POST
/
expenses
curl -X POST "https://api.contazen.ro/v1/expenses" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "supplier_id": "sup_xyz789",
    "amount": 100.00,
    "vat": 21,
    "date": "2024-01-15"
  }'
{
  "success": true,
  "expense": {
    "id": "exp_abc123",
    "reference": null,
    "description": null,
    "amount": {
      "total": "121.00",
      "without_vat": "100.00",
      "vat": "21.00",
      "currency": "RON"
    },
    "account_amount": {
      "total": "121.00",
      "without_vat": "100.00",
      "vat": "21.00",
      "currency": "RON"
    },
    "vat_percent": 21,
    "with_vat": false,
    "date": "2024-01-15",
    "due_date": "2024-02-14",
    "paid_date": null,
    "is_paid": false,
    "payment_type": null,
    "status": "unpaid",
    "supplier_id": "sup_xyz789",
    "category_id": 0,
    "user_id": 1,
    "created_at": "2024-01-15 10:30:00",
    "updated_at": "2024-01-15 10:30:00"
  },
  "message": "Expense created successfully"
}

Overview

The Create Expense endpoint allows you to add a new expense to your firm’s records with just 4 required fields. The API provides smart defaults for all optional fields, making expense creation quick and simple.

Request Body

Required Fields (Only 4)

supplier_id
string
required
The CzUid of the supplier for this expense
amount
number
required
The expense amount (positive number)
vat
integer
required
VAT percentage (accepted values: 0, 5, 9, 11, 19, 21)
  • 21% is the standard rate in Romania
date
string
required
Expense date in YYYY-MM-DD format

Optional Fields with Defaults

currency
string
default:"RON"
Currency code (e.g., RON, EUR, USD)
  • Defaults to RON if not provided
due_date
string
default:"30 days from today"
Payment due date in YYYY-MM-DD format
  • Defaults to 30 days from today if not provided
category_id
integer
default:"0"
The ID of the expense category
  • Optional, defaults to 0 (uncategorized)
reference
string
Reference or invoice number for the expense
description
string
Detailed description of the expense
with_vat
boolean
default:"false"
Whether the amount includes VAT (true) or excludes VAT (false)
  • Defaults to false if not provided
is_paid
boolean
default:"false"
Whether the expense is already paid
  • Defaults to false if not provided
paid_date
string
default:"today"
Payment date
  • Defaults to today if is_paid is true and paid_date not provided
  • Optional even when is_paid is true
payment_type
integer
default:"1"
Payment type ID:
  • Defaults to 1 (Cash) if is_paid is true and payment_type not provided
  • Optional even when is_paid is true
  • 1 - Cash
  • 2 - Bank transfer
  • 3 - Card
  • 4 - Check
  • 5 - Promissory note
  • 6 - Other
  • 7 - Compensation
with_currency_exchange
boolean
default:"false"
Whether this expense involves currency exchange
currency_to
string
Target currency for exchange (required if with_currency_exchange is true)
currency_rate
number
Exchange rate (required if with_currency_exchange is true)

Response

Returns the created expense object with all computed fields including VAT calculations and currency conversions.
expense
object
The created expense object with all details
message
string
Success message confirming the expense creation

Validation Rules

  • Supplier: Must exist and be owned by your firm (required)
  • Amount: Must be a positive number (required)
  • VAT: Must be one of: 0, 5, 9, 11, 19, or 21 (required)
  • Date: Must be in YYYY-MM-DD format (required)
  • Category: If provided, must be a valid expense category for your firm
  • Currency: If provided, must be a valid 3-letter ISO code
  • Dates: All dates must be in YYYY-MM-DD format
  • Payment Info: paid_date and payment_type are optional with smart defaults

VAT Calculation

The system automatically calculates VAT amounts based on your input:
  • If with_vat is true: The amount includes VAT, and VAT is extracted from the total
  • If with_vat is false: The amount excludes VAT, and VAT is added to get the total

Currency Exchange

If with_currency_exchange is enabled:
  • Original amounts are kept in the expense currency
  • Account amounts are calculated using the provided exchange rate
  • Exchange details are stored for audit purposes
curl -X POST "https://api.contazen.ro/v1/expenses" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "supplier_id": "sup_xyz789",
    "amount": 100.00,
    "vat": 21,
    "date": "2024-01-15"
  }'
{
  "success": true,
  "expense": {
    "id": "exp_abc123",
    "reference": null,
    "description": null,
    "amount": {
      "total": "121.00",
      "without_vat": "100.00",
      "vat": "21.00",
      "currency": "RON"
    },
    "account_amount": {
      "total": "121.00",
      "without_vat": "100.00",
      "vat": "21.00",
      "currency": "RON"
    },
    "vat_percent": 21,
    "with_vat": false,
    "date": "2024-01-15",
    "due_date": "2024-02-14",
    "paid_date": null,
    "is_paid": false,
    "payment_type": null,
    "status": "unpaid",
    "supplier_id": "sup_xyz789",
    "category_id": 0,
    "user_id": 1,
    "created_at": "2024-01-15 10:30:00",
    "updated_at": "2024-01-15 10:30:00"
  },
  "message": "Expense created successfully"
}

Authorizations

Authorization
string
header
required

Use your API key (sk_live_xxx or sk_test_xxx)

Body

application/json
supplier_id
string
required

Supplier CzUid (required)

amount
number
required

Amount (required, positive number)

Required range: x >= 0.01
vat
enum<integer>
required

VAT percentage (required - accepts: 0, 5, 9, 11, 19, 21)

Available options:
0,
5,
9,
11,
19,
21
date
string<date>
required

Expense date (required, Y-m-d format)

currency
string
default:RON

Currency code (optional, defaults to RON)

due_date
string<date>

Due date (optional, defaults to 30 days from today)

paid_date
string<date>

Payment date (optional, defaults to today if is_paid=true)

payment_type
integer

Payment type ID 1-7 (optional, defaults to 1 if is_paid=true): 1 = Cash 2 = Bank transfer 3 = Card 4 = Check 5 = Promissory note 6 = Other 7 = Compensation

Required range: 1 <= x <= 7
category_id
integer | null

Category ID (optional, defaults to 0)

reference
string

Reference number (optional)

description
string

Description (optional)

with_vat
boolean
default:false

Whether amount includes VAT (optional, defaults to false)

is_paid
boolean
default:false

Whether expense is paid (optional, defaults to false)

with_currency_exchange
boolean
default:false

Whether to apply currency exchange (optional)

currency_to
string

Target currency (if with_currency_exchange)

currency_rate
number

Exchange rate (if with_currency_exchange)

Response

Expense created successfully

success
boolean
data
object
meta
object