Skip to content

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
Format detection
Encoding (BOM, UTF-8, UTF-16, Windows-1252, Shift_JIS, ISO-2022-JP), delimiter (comma, semicolon, tab, pipe) and header row, or set them yourself.
Column rules
Types string, integer, number, boolean and date; required, enum and RE2 regex; BCP 47 locale for numbers and dates; date order override.
Actionable diagnostics
Each problem has a code, the column and the row numbers, so you can show users exactly what to fix. The preview shows the first ten rows as typed values.

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.

Request · POST /v1/csv/check
{
  "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"
      ]
    }
  ]
}
Response · 200
{
  "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.

csv.check

$0.03/call

No key needed · 10 free calls per IP per day

Response

Run the request to see the live response here.

Reference

Operations

OperationPrice
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:

ApproachWhat you take on
Parse and validate in your import jobHandle encodings, delimiters and locale formats yourself, and report errors after part of the data is already written.
Spreadsheet templatesRely on users to follow the template and still get files saved with a different locale.
KanaguOne 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

$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.

10 free calls a day
Start without a key
Try every call above for free. When it works, sign in for a key with $1 of usage free every month.

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