GET
/
expenses
/
export
# Download CSV export with filtering
curl -X GET "https://api.contazen.ro/v1/expenses/export?format=csv&start_date=2024-01-01&end_date=2024-01-31&status=paid" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  --output expenses_january_2024.csv

# Download all unpaid expenses
curl -X GET "https://api.contazen.ro/v1/expenses/export?format=csv&status=unpaid" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  --output unpaid_expenses.csv
Reference,Date,Due Date,Supplier,Category,Description,Amount,Currency,VAT %,Amount without VAT,VAT Amount,Status,Payment Date,Payment Type
INV-2024-001,2024-01-15,2024-02-15,Office Depot SRL,Office Expenses,Office supplies purchase,238.00,RON,19,200.00,38.00,Paid,2024-01-20,Bank transfer
INV-2024-002,2024-01-16,2024-02-16,Marketing Pro,Marketing & Advertising,Social media campaign,1190.00,RON,19,1000.00,190.00,Unpaid,,
EXP-2024-003,2024-01-17,2024-02-17,Travel Agency,Travel & Transportation,Business trip accommodation,595.00,RON,9,545.87,49.13,Paid,2024-01-25,Card

Overview

The Export Expenses endpoint allows you to download your expense data in structured formats for external analysis, reporting, or archival purposes. You can export all expenses or use the same filtering options available in the List Expenses endpoint.
This endpoint returns file data directly rather than JSON, so the response format differs from other API endpoints.

Query Parameters

format
string
default:"csv"
Export format:
  • csv - Comma-separated values file (Excel compatible)
  • pdf - Portable Document Format (currently not implemented)

Filtering Parameters

All filtering parameters from the List Expenses endpoint are supported:
supplier_id
string
Filter by supplier CzUid
category_id
integer
Filter by expense category ID
status
string
Filter by payment status (paid, unpaid, overdue, registered)
currency
string
Filter by currency code
payment_type
integer
Filter by payment type ID (1-7)
start_date
string
Start date for filtering expenses
end_date
string
End date for filtering expenses
sort
string
default:"created_at"
Sort field (created_at, date, due_date, amount)
order
string
default:"desc"
Sort order (asc, desc)

Response Formats

CSV Export (format=csv)

The CSV export includes the following columns:
ColumnDescription
ReferenceReference number or invoice number
DateExpense date
Due DatePayment due date
SupplierSupplier name
CategoryExpense category name
DescriptionExpense description
AmountTotal amount
CurrencyCurrency code
VAT %VAT percentage
Amount without VATAmount excluding VAT
VAT AmountVAT amount
StatusPayment status (Paid/Unpaid)
Payment DateDate when expense was paid (if applicable)
Payment TypePayment method name (if paid)
File characteristics:
  • UTF-8 encoding with BOM for Excel compatibility
  • Comma-separated values
  • Headers included in first row
  • Filename format: expenses_YYYY-MM-DD.csv

PDF Export (format=pdf)

PDF export is currently not implemented. The endpoint will return a JSON error message indicating this feature is not yet available.

Response Headers

CSV Export

Content-Type: text/csv; charset=utf-8
Content-Disposition: attachment; filename="expenses_2024-01-20.csv"

Error Responses

Content-Type: application/json

Pagination Behavior

Unlike the List Expenses endpoint, the export endpoint does not use pagination. It will export all expenses matching your filter criteria in a single file. Be mindful when exporting large datasets.

Use Cases

Accounting Integration

Export expenses for import into accounting software:
const exportUrl = 'https://api.contazen.ro/v1/expenses/export?format=csv&start_date=2024-01-01&end_date=2024-01-31';
// Download and import into accounting system

Monthly Reporting

Generate monthly expense reports:
const currentMonth = new Date().toISOString().slice(0, 7); // YYYY-MM
const exportUrl = `https://api.contazen.ro/v1/expenses/export?format=csv&start_date=${currentMonth}-01&end_date=${currentMonth}-31`;

Audit Preparation

Export all expenses for a specific period for auditing:
const auditExport = 'https://api.contazen.ro/v1/expenses/export?format=csv&start_date=2024-01-01&end_date=2024-12-31&sort=date&order=asc';

Category Analysis

Export expenses by category for detailed analysis:
const categoryExport = 'https://api.contazen.ro/v1/expenses/export?format=csv&category_id=1';
# Download CSV export with filtering
curl -X GET "https://api.contazen.ro/v1/expenses/export?format=csv&start_date=2024-01-01&end_date=2024-01-31&status=paid" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  --output expenses_january_2024.csv

# Download all unpaid expenses
curl -X GET "https://api.contazen.ro/v1/expenses/export?format=csv&status=unpaid" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  --output unpaid_expenses.csv
Reference,Date,Due Date,Supplier,Category,Description,Amount,Currency,VAT %,Amount without VAT,VAT Amount,Status,Payment Date,Payment Type
INV-2024-001,2024-01-15,2024-02-15,Office Depot SRL,Office Expenses,Office supplies purchase,238.00,RON,19,200.00,38.00,Paid,2024-01-20,Bank transfer
INV-2024-002,2024-01-16,2024-02-16,Marketing Pro,Marketing & Advertising,Social media campaign,1190.00,RON,19,1000.00,190.00,Unpaid,,
EXP-2024-003,2024-01-17,2024-02-17,Travel Agency,Travel & Transportation,Business trip accommodation,595.00,RON,9,545.87,49.13,Paid,2024-01-25,Card

Best Practices

File Management

  1. Naming conventions: Use descriptive filenames with dates
  2. Storage: Store exported files securely with appropriate access controls
  3. Cleanup: Regularly clean up old export files to save storage space

Data Integrity

  1. Filtering: Use appropriate filters to export only needed data
  2. Sorting: Sort by relevant fields for easier analysis
  3. Validation: Verify exported data matches your expectations

Performance Considerations

  1. Large exports: For very large datasets, consider using date ranges to split exports
  2. Scheduling: Schedule exports during off-peak hours for better performance
  3. Monitoring: Monitor export file sizes and processing times

Security

  1. Access control: Ensure only authorized users can export sensitive financial data
  2. Audit logging: Log export activities for security auditing
  3. Data handling: Follow your organization’s data protection policies for exported files

Integration Tips

  1. Automation: Automate regular exports for recurring reporting needs
  2. File processing: Build workflows to automatically process exported CSV files
  3. Error handling: Implement proper error handling for failed exports
  4. Notifications: Set up notifications for successful or failed export operations

Authorizations

Authorization
string
header
required

Use your API key (sk_live_xxx or sk_test_xxx)

Query Parameters

supplier_id
string

Filter by supplier CzUid

category_id
integer

Filter by category ID

start_date
string<date>

Start date (Y-m-d format)

end_date
string<date>

End date (Y-m-d format)

status
enum<string>

Filter by payment status

Available options:
paid,
unpaid,
overdue

Response

CSV export file

The response is of type file.