Upload documents
Send invoices and receipts from your own software, one file per call (PDF, JPEG or PNG). AI reads them exactly like documents dropped off in Capture.
Coming soon to the United States. Sign-up is not open there yet; this page is provided for information.
A REST API over HTTPS, in JSON, for your integrations: upload documents, follow them through review and publication, read bank transactions and receive events as they happen. Every request follows the same rules as the Capture interface: permissions, isolation by organization and audit log.
Version 1 is stable: it only ever changes in compatible ways.
The v1 surface is deliberately small and stable. Each operation requires an explicit scope.
Send invoices and receipts from your own software, one file per call (PDF, JPEG or PNG). AI reads them exactly like documents dropped off in Capture.
List documents, read their extracted fields and checks, then approve, reject or publish them to the connected accounting software, with optimistic concurrency control.
Read bank, card and loan accounts and their transactions, with their matching status. Account numbers are never returned: only their last 4 digits.
Import OFX, QFX or CSV statements into an existing account. Matching with your documents follows automatically.
Request a ZIP archive of the documents received during a period (original files and CSV data), then download it once it is ready.
Receive signed events when a document is received, approved, published or rejected, instead of polling the API.
The examples use curl and Node.js 20 or later (built-in fetch). The keys and identifiers shown are fictitious.
In Capture, open Settings › API & integrations and create a key with only the scopes your integration needs (see Scopes). The key is shown once: store it right away in your secret manager. Creating and revoking keys is reserved for members allowed to manage the API (administrators, by default).
A key starts with ktx_live_ in production and with ktx_test_ everywhere else. A test key never works in production, and vice versa.
GET /api/v1/organisation only requires a valid key. It confirms that authentication works and returns your organization's name, language, currency and access status (never a price or an amount), along with its deposit policy: maximum file size, accepted types and upload rate.
# Your test key, kept out of your code (secret manager or environment variable)
export AXETRACT_API_KEY='ktx_test_…'
curl -s https://app.kataxe.com/api/v1/organisation \
-H "Authorization: Bearer $AXETRACT_API_KEY"
// Node.js 20 or later: fetch, FormData and Blob are built in
const BASE = "https://app.kataxe.com/api/v1";
const headers = { Authorization: `Bearer ${process.env.AXETRACT_API_KEY}` };
const res = await fetch(`${BASE}/organisation`, { headers });
if (!res.ok) {
const problem = await res.json(); // RFC 9457
throw new Error(`${problem.status} ${problem.code}`);
}
console.log(await res.json());
{
"id": "tnt_…",
"name": "Example Company Ltd.",
"locale": "en-US",
"currency": "USD",
"plan": {
"status": "ACTIF",
"trialEndsAt": null,
"access": { "read": true, "write": true, "reason": "ACTIF", "readOnlyUntil": null }
},
"deposit": {
"maxBytes": 10420224,
"acceptedContentTypes": ["application/pdf", "image/jpeg", "image/png"],
"acceptedExtensions": ["pdf", "jpg", "jpeg", "png"],
"rate": { "perHour": 60, "perDay": 400 }
},
"…": "…"
}
Send one file per call as multipart/form-data, in the file field, with the pieces:write scope. Every POST requires an Idempotency-Key header: generate one per operation and reuse it when you retry, so a network retry never creates a duplicate. Read the maximum size and the accepted types from deposit in GET /api/v1/organisation: never hard-code them.
# One key per operation: reuse the same value if you retry
IDEMPOTENCY_KEY=$(uuidgen)
curl -si https://app.kataxe.com/api/v1/pieces \
-H "Authorization: Bearer $AXETRACT_API_KEY" \
-H "Idempotency-Key: $IDEMPOTENCY_KEY" \
-F "file=@invoice-1042.pdf"
# HTTP/1.1 201 Created
# Location: /api/v1/pieces/cm9x1k2j30000abcd1234efgh
# {"id":"cm9x1k2j30000abcd1234efgh","version":1,"status":"RECUE","channel":"API",…}
import { readFile } from "node:fs/promises";
import { randomUUID } from "node:crypto";
// BASE and headers as defined in step 2
// One key per operation: reuse the same value if you retry
const idempotencyKey = randomUUID();
const form = new FormData();
const pdf = new Blob([await readFile("invoice-1042.pdf")], { type: "application/pdf" });
form.append("file", pdf, "invoice-1042.pdf");
const res = await fetch(`${BASE}/pieces`, {
method: "POST",
headers: { ...headers, "Idempotency-Key": idempotencyKey },
body: form,
});
const piece = await res.json(); // 201 Created → { id, version, status: "RECUE", … }
Each versioned resource returns a strong ETag. Send it back in If-None-Match: if nothing has changed, the API answers 304 Not Modified with no body. Requires pieces:read.
curl -si https://app.kataxe.com/api/v1/pieces/cm9x1k2j30000abcd1234efgh \
-H "Authorization: Bearer $AXETRACT_API_KEY"
# HTTP/1.1 200 OK
# ETag: "3-pN0mQ8dV2r4xY7aB"
curl -si https://app.kataxe.com/api/v1/pieces/cm9x1k2j30000abcd1234efgh \
-H "Authorization: Bearer $AXETRACT_API_KEY" \
-H 'If-None-Match: "3-pN0mQ8dV2r4xY7aB"'
# HTTP/1.1 304 Not Modified
// BASE and headers as defined in step 2
const cache = new Map(); // id → { etag, piece }
async function getPiece(id) {
const known = cache.get(id);
const res = await fetch(`${BASE}/pieces/${id}`, {
headers: known ? { ...headers, "If-None-Match": known.etag } : headers,
});
if (res.status === 304) return known.piece; // unchanged since the last read
if (!res.ok) throw new Error(`${res.status} ${(await res.json()).code}`);
const piece = await res.json();
cache.set(id, { etag: res.headers.get("ETag"), piece });
return piece;
}
Create an endpoint (scopes webhooks:manage and pieces:read) and keep the whsec_… secret it returns. On your side, verify the Kataxe-Signature header against the raw request body before trusting anything else (details under Webhooks).
IDEMPOTENCY_KEY=$(uuidgen)
curl -s -X POST https://app.kataxe.com/api/v1/webhook-endpoints \
-H "Authorization: Bearer $AXETRACT_API_KEY" \
-H "Idempotency-Key: $IDEMPOTENCY_KEY" \
-H "Content-Type: application/json" \
-d '{"url":"https://erp.example.com/axetract/webhooks","events":["piece.validee","piece.publiee"]}'
# 201 Created
# {"endpoint":{"id":"cm…","status":"ACTIF","version":1,…},"secret":"whsec_…"}
# The secret is shown only once: store it in your secret manager
import { createHmac, timingSafeEqual } from "node:crypto";
import { createServer } from "node:http";
// Verify the signature on the raw bytes, in constant time, within 5 minutes
function verifySignature(secret, header, rawBody, toleranceSeconds = 300) {
const parts = String(header ?? "").split(",").map((p) => p.trim());
const t = Number(parts.find((p) => p.startsWith("t="))?.slice(2));
if (!Number.isInteger(t) || Math.abs(Date.now() / 1000 - t) > toleranceSeconds) return false;
const expected = createHmac("sha256", secret).update(`${t}.`).update(rawBody).digest();
return parts
.filter((p) => p.startsWith("v1="))
.some((p) => {
const received = Buffer.from(p.slice(3), "hex");
return received.length === expected.length && timingSafeEqual(received, expected);
});
}
createServer((req, res) => {
const chunks = [];
req.on("data", (chunk) => chunks.push(chunk));
req.on("end", () => {
const rawBody = Buffer.concat(chunks); // raw bytes, never re-serialized JSON
const secret = process.env.AXETRACT_WEBHOOK_SECRET; // whsec_…
if (!verifySignature(secret, req.headers["kataxe-signature"], rawBody)) {
res.writeHead(400).end();
return;
}
res.writeHead(204).end(); // reply within 10 seconds, process afterwards
const event = JSON.parse(rawBody.toString("utf8"));
// At-least-once delivery: deduplicate on the Kataxe-Event-Id header
console.log(req.headers["kataxe-event-id"], event.type, event.data);
});
}).listen(8080);
Each request carries its key in the Authorization header. Nothing else is accepted.
Authorization: Bearer ktx_<env>_<id>_<secret>. The public prefix ktx_<env>_<id> identifies the key in your list of keys. Capture never stores the secret (only its fingerprint) and cannot show it again: if it is lost, revoke the key and create a new one.
A malformed, unknown, revoked or expired key, a wrong secret or a key from another environment all receive the same 401 invalid_api_key response, which reveals nothing about the cause.
A key belongs to the organization, not to the person who created it: it keeps working after that person leaves, never takes up a seat and never receives email. Its scopes can never exceed the permissions its creator held at the time.
The API is built for servers and native apps. It offers no CORS support and refuses browser sessions (401 session_not_accepted): never put a key in a web page.
ktx_ prefix makes a leaked key easy to detect automatically.Mobile app: coming soon
The Capture mobile app will use this same API, with sign-in through your Microsoft account instead of a key.
The same rules apply to every resource in v1.
/api/v1, over HTTPS only.{ "amountCents": 11498, "currency": "USD" }, in whole cents with an explicit ISO 4217 currency. Never a floating-point number.YYYY-MM-DD; timestamps in ISO 8601, in UTC (2026-10-26T14:03:00.000Z).RECUE, VALIDEE or ACTIF are stable identifiers. Compare them as codes and display your own labels.Lists return items and nextCursor. Pass that value back as cursor (with limit, from 1 to 100, 50 by default) until nextCursor is null. There are no offsets: a cursor neither skips nor repeats an item when data changes during the walk.
// Read every document, 100 at a time, by following nextCursor
let cursor = null;
do {
const url = new URL(`${BASE}/pieces`);
url.searchParams.set("limit", "100");
if (cursor) url.searchParams.set("cursor", cursor);
const page = await (await fetch(url, { headers })).json();
for (const piece of page.items) console.log(piece.id, piece.status);
cursor = page.nextCursor;
} while (cursor);
Every POST requires Idempotency-Key (1 to 255 printable ASCII characters; a UUID works well). Within 24 hours, the same key with the same request replays the recorded response (Idempotent-Replayed: true); the same key with a different request returns 422 idempotency_key_reused. A server error is never recorded, so retrying is always safe.
Every change to a document (validate, reject, publish) requires If-Match with the full ETag you last read. Missing: 428 precondition_required. Out of date: 412 precondition_failed; read the resource again before deciding. The response carries the new ETag.
By default, each key gets 600 reads and 60 writes per minute, over a sliding window. Every authenticated response tells you where you stand; beyond the limit, the API answers 429 rate_limited with Retry-After (in seconds). Wait that long rather than retrying in a loop: refused requests count too.
RateLimit-Limit: 600
RateLimit-Remaining: 597
RateLimit-Reset: 41
HTTP/1.1 429 Too Many Requests
Retry-After: 12
Uploads are also subject to your plan's hourly and daily upload limits, shared by every channel (web, email, API): 429 deposit_rate_limited. Their values are in deposit.rate of GET /api/v1/organisation.
You choose the scopes when you create the key. An operation outside them is refused with 403 insufficient_scope, and the WWW-Authenticate header names the missing scope.
| Scope | Allows |
|---|---|
pieces:read | List and read documents, their extracted fields, original files and suppliers. |
pieces:write | Upload documents, one file per call. They count toward your plan's volume, like any other document. |
pieces:review | Approve or reject documents. On its own, only the documents uploaded with this key; together with pieces:read, all of the organization's documents. |
pieces:publish | Publish approved documents to the connected accounting software. On its own, only the documents uploaded with this key; together with pieces:read, all of them. |
bank:read | Read bank, card and loan accounts and their transactions. |
bank:write | Import an OFX, QFX or CSV statement into an existing account. |
exports:read | Track export requests and download archives once they are ready. |
exports:write | Request an export of the documents received during a period. |
webhooks:manage | Create and manage webhook endpoints and read their delivery log. Subscribing to document events also requires pieces:read. |
GET /api/v1/organisation requires no scope (a valid key is enough), and the OpenAPI contract is public.
No scope ever lets a key create or revoke keys, or manage members, roles or the accountants invited into your organization. Your subscription rules apply exactly as they do in the interface (for example, read-only access while the organization is suspended).
Every error is a problem document in the RFC 9457 format (application/problem+json).
HTTP/1.1 404 Not Found
Content-Type: application/problem+json
{
"type": "urn:kataxe:problem:not_found",
"title": "Resource not found",
"status": 404,
"detail": "The requested resource was not found.",
"code": "not_found",
"instance": "/api/v1/pieces/cm9x1k2j30000abcd1234efgh",
"errors": []
}
code is stable and listed below: your code should test it, never the text.title and detail follow your Accept-Language header (English, French or Spanish; English by default).errors[] gives coded details, such as { "code": "too_big", "field": "limit" } for a rejected parameter. An unexpected error returns 500 internal_error, never a technical message.code | HTTP status | Meaning |
|---|---|---|
authentication_required | 401 | No Authorization header. |
session_not_accepted | 401 | Browser session without a key: refused. |
invalid_api_key | 401 | Malformed, unknown, revoked or expired key, wrong secret or key from another environment (same response in every case). |
insufficient_scope | 403 | The key lacks the scope this operation requires. |
forbidden | 403 | Action not allowed. |
no_access, read_only, suspended | 403 | The organization's subscription does not allow this action (no access, read-only, suspended). |
not_found | 404 | Does not exist, belongs to another organization or is outside what the key can see: always the same response. |
invalid_request | 400 | Invalid parameter or body (see errors[]). |
idempotency_key_invalid | 400 | Idempotency-Key missing on a POST, or malformed. |
idempotency_in_progress | 409 | The same idempotency key is still being processed: try again shortly. |
conflict | 409 | Conflicts with the resource's current state (document that cannot be changed or published, statement already imported, export already in progress). |
file_scan_pending, file_blocked, file_unavailable | 409 | Original file not yet scanned, blocked as malicious, or temporarily unavailable. |
precondition_failed | 412 | If-Match is out of date: read the resource again. |
payload_too_large | 413 | Body or file over the limit: the applied limit, in bytes, is in errors[0].limit. |
unsupported_media_type | 415 | Wrong Content-Type for the operation, or file type not accepted. |
idempotency_key_reused | 422 | Same idempotency key, different request. |
request_refused | 422 | Refused by a business rule (translated message). |
precondition_required | 428 | If-Match missing (or *) on a change. |
rate_limited | 429 | Rate limit exceeded: wait for Retry-After. |
deposit_rate_limited | 429 | Your plan's upload limit has been reached (separate from the key's rate limit). |
internal_error | 500 | Unexpected error. |
service_unavailable | 503 | Service temporarily unavailable; nothing was recorded (Retry-After). |
Capture sends a signed HTTPS request to your endpoint whenever a document's state changes, so you don't have to poll.
Manage your endpoints through the API (/api/v1/webhook-endpoints: create, update, pause, rotate the secret, test with ping, read the delivery log) or from Settings › API & integrations in Capture. An endpoint URL must use https and a public DNS name (never an IP address or a private network), with up to 10 endpoints per organization.
| Type | Sent when |
|---|---|
piece.recue | A document is received, whatever the channel (data.channel). |
piece.validee | A document is approved. |
piece.publiee | A document is published to the accounting software. |
piece.rejetee | A document is rejected (coded reason, never its text). |
ping | You test the endpoint (never retried). |
The payload holds only identifiers and codes (id, type, occurredAt, organisationId, data): no amount, file name or extracted text. Treat it as a signal and read the document through the API to get its current state. Ignore unknown types: new ones may be added within v1.
Each delivery carries Kataxe-Signature: t=<seconds>,v1=<hex>, where v1 is the HMAC-SHA256, keyed with your full whsec_… secret, of t, a dot and the raw body. Compare in constant time and reject a timestamp more than 5 minutes away from your clock (replay protection). The header may hold several v1 values: accept the request if any one of them matches.
Other headers: Kataxe-Event-Id (stable across retries), Kataxe-Event-Type and Kataxe-Delivery-Attempt. The Node.js example in step 5 implements the full check.
ping, then reactivate it; events from the interruption are not resent (catch up with GET /api/v1/pieces?receivedAfter=…).Kataxe-Event-Id and keep processed identifiers for at least 3 days.Several photos of one document become one document, assembled by the server. Resource /api/v1/deposit-sessions, scope pieces:write.
POST /api/v1/deposit-sessions with clientDepositId (a UUID v4 you generate once per document and keep until the end) and pageCount. The same clientDepositId always returns the same session and, once closed, the same document: a replay, even days later, never creates a duplicate.PUT /api/v1/deposit-sessions/{id}/pages/{rank}, one file per call in the file field (JPEG or PNG; a PDF only for a single-page session). Sending the same content again at the same rank has no effect.POST /api/v1/deposit-sessions/{id}/close creates the document (201 and Location): a single page is uploaded as is, several pages become a PDF in rank order, then the document follows the same path as POST /api/v1/pieces.Resume: GET /api/v1/deposit-sessions/{id} lists the pages received and missingRanks. DELETE abandons the session; an open session expires on its own (7 days by default). Pending pages are erased on close, abandonment and expiry.
Read the maximum number of pages in deposit.maxPages and the maximum document size in deposit.maxBytes of GET /api/v1/organisation: never hard-code them. Each refusal carries a code in errors[].code (for example pages_manquantes, page_differente, session_differente).
# One session per document: keep clientDepositId until closing
CLIENT_DEPOSIT_ID=$(uuidgen | tr 'A-Z' 'a-z')
SESSION=$(curl -s https://app.kataxe.com/api/v1/deposit-sessions \
-H "Authorization: Bearer $AXETRACT_API_KEY" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d "{\"clientDepositId\":\"$CLIENT_DEPOSIT_ID\",\"pageCount\":2}" | jq -r .id)
# One page per call, ranks 1 to pageCount
for RANK in 1 2; do
curl -s -X PUT https://app.kataxe.com/api/v1/deposit-sessions/$SESSION/pages/$RANK \
-H "Authorization: Bearer $AXETRACT_API_KEY" \
-H "Idempotency-Key: $(uuidgen)" \
-F "file=@receipt-page-$RANK.jpg;type=image/jpeg" > /dev/null
done
# Close: a single document, even if the call is replayed
curl -si -X POST https://app.kataxe.com/api/v1/deposit-sessions/$SESSION/close \
-H "Authorization: Bearer $AXETRACT_API_KEY" \
-H "Idempotency-Key: $(uuidgen)"
# HTTP/1.1 201 Created
# Location: /api/v1/pieces/cm9x1k2j30000abcd1234efgh
GET /api/v1/legal is public (no authentication): it lists the legal texts in force (kind, version, publishedOn, language, url) in the language requested by Accept-Language. A text not yet published has publishedOn and url set to null; accept any new kind value.
# Public route: no key required
curl -s https://app.kataxe.com/api/v1/legal \
-H "Accept-Language: fr-CA"
# {"documents":[{"kind":"conditions","version":"1.0","publishedOn":"…","language":"fr","url":"https://…"},…]}
The version is part of the path: /api/v1. Our commitments:
/api/v2), alongside v1.The complete, always up-to-date reference is the OpenAPI 3.1 contract, generated from the code itself.
Public address: https://app.kataxe.com/api/v1/openapi.json
Each operation declares its required scope (x-required-scope), its parameters, its responses and its error codes; the webhooks section describes every event. Import it into your API client or code generator.
A question about the API? Email us at support@kataxe.com.