---
title: "Bulk-import expenses from a CSV/Excel spreadsheet or CAMT bank statement"
method: POST
path: "/expenses/import"
tags: ["Expenses"]
---

# Bulk-import expenses from a CSV/Excel spreadsheet or CAMT bank statement

`POST /expenses/import`

Imports many expenses at once from an uploaded spreadsheet (CSV or Excel) or ISO-20022 CAMT bank statement (camt.052/.053/.054 XML). For spreadsheets the pipeline auto-detects the file's structure (any language, any delimiter, any leading preamble) and drops rows missing the minimum fields (date, amount, description); for CAMT files only booked outgoing debits become expenses — incoming credits and reversals are reported in `skipped_credits`, and each transaction gets a stable fingerprint so re-importing the same statement never creates duplicates. All rows are deduplicated against the user's existing expenses (date + amount within a 1-day tolerance), enriched via Claude (category and payment method are matched against the user's existing entries — never invented), re-checked for duplicates after AI normalisation, and finally written in batches. Foreign-currency amounts are converted to CHF and the originals are preserved in `originalAmount`/`originalCurrency`.

## Response `201`

Spreadsheet processed; returns a summary of how rows were classified and how many were imported.

## Other responses

- `400` — Invalid multipart request, empty file, or unparseable spreadsheet
- `401` — Unauthorized
- `500` — Internal Server Error
- `502` — Firestore batch write failed

---

[API](https://skmtc.dev/vocal/apis/magic-heidi-invoicing-software-api.md) · [All operations](https://skmtc.dev/vocal/apis/magic-heidi-invoicing-software-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/vocal/magic-heidi-invoicing-software-api/revisions/591ae048f0a0/schema)
