Validate CSV uploads before they reach your database
Send a CSV and the columns you expect. Get every problem by column and row, the detected encoding, delimiter and header, and a normalized preview with locale-aware numbers and dates.
$0.03/call · 10 free calls a day, no signup · REST and MCP
curl https://api.kanagu.dev/v1/csv/check \
-H "Content-Type: application/json" \
-d '{"text":"invoice_id;issued_on;amount;status\r\nINV-00812;21.11.2026;1.242,50;paid\r\nINV-00813;31.11.2026;200,00;open\r\nINV-00814;23.11.2026;12,1,5;unknown","columns":[{"name":"invoice_id","type":"string","required":true,"regex":"^INV-[0-9]{5}$"},{"name":"issued_on","type":"date","locale":"de-DE","required":true},{"name":"amount","type":"number","locale":"de-DE","required":true},{"name":"status","type":"string","enum":["open","paid"]}]}'const res = await fetch("https://api.kanagu.dev/v1/csv/check", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.KANAGU_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
"text": "invoice_id;issued_on;amount;status\r\nINV-00812;21.11.2026;1.242,50;paid\r\nINV-00813;31.11.2026;200,00;open\r\nINV-00814;23.11.2026;12,1,5;unknown",
"columns": [
{
"name": "invoice_id",
"type": "string",
"required": true,
"regex": "^INV-[0-9]{5}$"
},
{
"name": "issued_on",
"type": "date",
"locale": "de-DE",
"required": true
},
{
"name": "amount",
"type": "number",
"locale": "de-DE",
"required": true
},
{
"name": "status",
"type": "string",
"enum": [
"open",
"paid"
]
}
]
}),
});
if (!res.ok) throw new Error((await res.json()).error.message);
const result = await res.json();{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "csv.check",
"arguments": {
"text": "invoice_id;issued_on;amount;status\r\nINV-00812;21.11.2026;1.242,50;paid\r\nINV-00813;31.11.2026;200,00;open\r\nINV-00814;23.11.2026;12,1,5;unknown",
"columns": [
{
"name": "invoice_id",
"type": "string",
"required": true,
"regex": "^INV-[0-9]{5}$"
},
{
"name": "issued_on",
"type": "date",
"locale": "de-DE",
"required": true
},
{
"name": "amount",
"type": "number",
"locale": "de-DE",
"required": true
},
{
"name": "status",
"type": "string",
"enum": [
"open",
"paid"
]
}
]
}
}
}Why
What it solves
CSV files from customers come in every encoding, delimiter and number format. Bad rows usually surface halfway through an import, or not at all. Kanagu checks the whole file against your schema first and tells the user exactly which cells to fix.
Built for
- SaaS products with a customer CSV import
- Data and operations teams that receive files from partners
- AI agents that prepare or check spreadsheets before upload
Example
What goes in, what comes out
In: CSV text or file bytes, plus the target columns and rules. Out: valid, detected format, diagnostics with row numbers, and a typed preview.
{
"text": "invoice_id;issued_on;amount;status\r\nINV-00812;21.11.2026;1.242,50;paid\r\nINV-00813;31.11.2026;200,00;open\r\nINV-00814;23.11.2026;12,1,5;unknown",
"columns": [
{
"name": "invoice_id",
"type": "string",
"required": true,
"regex": "^INV-[0-9]{5}$"
},
{
"name": "issued_on",
"type": "date",
"locale": "de-DE",
"required": true
},
{
"name": "amount",
"type": "number",
"locale": "de-DE",
"required": true
},
{
"name": "status",
"type": "string",
"enum": [
"open",
"paid"
]
}
]
}{
"valid": false,
"encoding": "utf-8",
"delimiter": ";",
"header": true,
"rows": 3,
"diagnostics": [
{
"code": "invalid_type",
"column": "issued_on",
"rows": [
3
]
},
{
"code": "invalid_type",
"column": "amount",
"rows": [
4
]
},
{
"code": "not_in_enum",
"column": "status",
"rows": [
4
]
}
],
"preview": [
{
"row": 2,
"values": {
"invoice_id": "INV-00812",
"issued_on": "2026-11-21",
"amount": 1242.5,
"status": "paid"
}
},
"… 2 more"
]
}31.11.2026 is not a date, 12,1,5 is not a German number, and unknown is not an allowed status.
Try it
Run it on the live API
The sample request is ready to run. No key needed for 10 calls a day.
Reference
Operations
| Operation | Price |
|---|---|
| csv.check Check a CSV against a target schema and return diagnostics and a normalized preview. | $0.03/call |
curl https://api.kanagu.dev/v1/csv/check \
-H "Authorization: Bearer $KANAGU_KEY" \
-H "Content-Type: application/json" \
-d '{"text":"invoice_id;issued_on;amount;status\r\nINV-00812;21.11.2026;1.242,50;paid\r\nINV-00813;31.11.2026;200,00;open\r\nINV-00814;23.11.2026;12,1,5;unknown","columns":[{"name":"invoice_id","type":"string","required":true,"regex":"^INV-[0-9]{5}$"},{"name":"issued_on","type":"date","locale":"de-DE","required":true},{"name":"amount","type":"number","locale":"de-DE","required":true},{"name":"status","type":"string","enum":["open","paid"]}]}'const res = await fetch("https://api.kanagu.dev/v1/csv/check", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.KANAGU_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
"text": "invoice_id;issued_on;amount;status\r\nINV-00812;21.11.2026;1.242,50;paid\r\nINV-00813;31.11.2026;200,00;open\r\nINV-00814;23.11.2026;12,1,5;unknown",
"columns": [
{
"name": "invoice_id",
"type": "string",
"required": true,
"regex": "^INV-[0-9]{5}$"
},
{
"name": "issued_on",
"type": "date",
"locale": "de-DE",
"required": true
},
{
"name": "amount",
"type": "number",
"locale": "de-DE",
"required": true
},
{
"name": "status",
"type": "string",
"enum": [
"open",
"paid"
]
}
]
}),
});
if (!res.ok) throw new Error((await res.json()).error.message);
const result = await res.json();claude mcp add --transport http kanagu https://api.kanagu.dev/mcp \
--header "Authorization: Bearer $KANAGU_KEY"{
"mcpServers": {
"kanagu": {
"url": "https://api.kanagu.dev/mcp",
"headers": {
"Authorization": "Bearer ${env:KANAGU_KEY}"
}
}
}
}{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "csv.check",
"arguments": {
"text": "invoice_id;issued_on;amount;status\r\nINV-00812;21.11.2026;1.242,50;paid\r\nINV-00813;31.11.2026;200,00;open\r\nINV-00814;23.11.2026;12,1,5;unknown",
"columns": [
{
"name": "invoice_id",
"type": "string",
"required": true,
"regex": "^INV-[0-9]{5}$"
},
{
"name": "issued_on",
"type": "date",
"locale": "de-DE",
"required": true
},
{
"name": "amount",
"type": "number",
"locale": "de-DE",
"required": true
},
{
"name": "status",
"type": "string",
"enum": [
"open",
"paid"
]
}
]
}
}
}Every field, error and schema is in the csv.check reference.
Coverage
Limits and coverage
- Size
- Up to 5 MiB of CSV, as text or Base64
- Diagnostics
- required, not_in_enum, regex_mismatch, invalid_type, missing_column, duplicate_column, unexpected_column, extra_cells, empty_csv, plus parse errors with line numbers
- Headerless files
- Columns are matched in source order
- Data
- Inputs are processed in memory. For keyed calls the JSON result is kept for 30 days so a retry with the same Idempotency-Key returns it, then deleted. Trial calls store only a daily counter.
Compare
Compared with the usual approaches
Ways teams usually check imports:
| Approach | What you take on |
|---|---|
| Parse and validate in your import job | Handle encodings, delimiters and locale formats yourself, and report errors after part of the data is already written. |
| Spreadsheet templates | Rely on users to follow the template and still get files saved with a different locale. |
| Kanagu | One call before import returns every problem with its row number, in a shape you can show to the user. |
Pricing
$0.03/call, billed only on success
- csv.check$0.03 / call
$1 of usage free every month after sign-in. Then pay as you go with no monthly fee, or the $9/month Bundle with $9 of usage included, shared across every Kanagu product. Compare plans
Sign in, create a key and use $1 of calls free each month, no card needed. Subscribe from your dashboard when you need more. Polar is the merchant of record and handles payment, tax and invoices.
FAQ
CSV validation questions
- Do you change my data?
- No. The response contains diagnostics and a typed preview of the first ten rows. Your import still reads the original file.
- How are European numbers handled?
- Set locale per column, e.g. de-DE, and 1.242,50 is read as 1242.5. Dates follow the locale unless you set dateOrder.
- How large can a file be?
- 5 MiB, as UTF-8 text or as Base64 bytes for other encodings.
- What does a check cost?
- $0.03 per file, whatever the number of rows.
More APIs with the same key
- E-invoicingGenerate, validate and parse XRechnung and ZUGFeRD invoices.
- France e-reportingDGFiP Flux 10 e-reporting XML for B2C sales, cross-border B2B and service receipts, checked against v3.2.
- Bank statementsTurn Chase, Wells Fargo and Barclays PDF statements into reconciled transactions.
- OTA payoutsMatch Airbnb, Booking.com and Vrbo payouts to the deposits on your bank statement.
- Rent rollsReconcile a multifamily rent roll against its T12: occupancy, loss to lease, vacancy and rent collected.
- Pay applicationsCheck AIA G702 and G703 pay applications line by line, against the last certified one and approved change orders.
- VAT validationCheck EU and UK VAT numbers against VIES and HMRC, with audit evidence.
- Packaging EPRPackaging weights by US state EPR category and Germany LUCID reports, traced to each SKU.
- CPSC eFilingCheck CPC and GCC certificates against each CBP entry line and get the PGA fields to file.
- PFAS reportingDecide Minnesota and Maine PFAS-in-products reporting and get the PRISM rows, MDA statements and deadlines.
- Demurrage auditAudit FMC demurrage and detention invoices against 46 CFR 541, recalculate each day and draft the dispute.
- UK CARFHMRC cryptoasset reports as OECD CARF XML, checked against HMRC's file rules and TIN check digits.
- EU PPWREU packaging regulation checks for heavy metals, PFAS, recycled content and empty space, with a draft declaration.
- SEC fundamentalsPoint-in-time SEC XBRL financials with every restatement, for backtests without look-ahead.
- Business daysBusiness-day math and SLA deadlines with public holidays in 207 countries.
- Email parsingParse raw .eml messages into headers, bodies, attachments and thread IDs.
- Screenshot diffCapture two web pages and get the changed pixels and regions.