Transaction Categorization API: Endpoints and Error Codes
Transaction categorization API reference: endpoints, request and response examples, mapping rules, webhooks and error codes for automated accounting.
The most repeated advice about a transaction categorization API is to classify every payment the instant it arrives and post it. That advice treats a category label as a finished ledger entry. It is not. A usable response is a ledger suggestion: a category, a calibrated confidence, reason codes, alternatives, and a record that stays readable after someone changes it. Posting before you have tested a review gate writes the wrong account, the wrong VAT treatment, or both, and the cleanup costs more than the time you saved.
Connectivity made the raw feed possible. The Open Banking Implementation Entity reports that UK open-banking API calls rose from 66.8 million in 2018 to almost 5.8 billion in 2020. That volume is structured dates, amounts, and descriptions. It is not a chart of accounts. PSD2 never defined a category taxonomy, so the interpretation layer is your job.
I would not turn auto-posting on until shadow mode shows precision on the classes that hit the books.
Endpoint Reference at a Glance
No vendor specification was supplied for this contract, so the paths below follow a common REST pattern. Adapt every path, status, and field name to the provider's published spec before you code against it.
| Method | Path | Purpose | Key inputs | Returns |
|---|---|---|---|---|
| POST | /v1/transactions/categorize | Classify one or many transactions | transactions array, taxonomy_version | 200 with categorization objects |
| GET | /v1/transactions/{id}/categorization | Read current and past classifications | transaction id | Category history with source and version |
| POST | /v1/transactions/{id}/corrections | Record a user correction | corrected_category, reviewer_id, reason | 201 with a correction event, original suggestion kept |
| GET | /v1/categories | List the taxonomy in force | taxonomy_version (optional) | Category codes, parents, deprecation flags |
| PUT | /v1/mappings/{category} | Link a category to a ledger account | account_code, tax_code | 200 with active mapping |
| POST | /v1/webhook-endpoints | Register a callback URL | url, subscribed events | 201 with endpoint id and signing secret |
| GET | /v1/events | List events for replay | since cursor, event type | Paged event list |
Authentication and scopes
Authenticate with a bearer token scoped to one tenant. A shared token across companies mixes charts of accounts and correction history, and you cannot unwind that cleanly. Split scopes so a read token cannot categorize, a categorize token cannot rewrite mappings, and a write token is the only one that records corrections or mappings.
Idempotency on every POST
Send an Idempotency-Key header on every POST. Retries are normal when a client times out after the server has already written the row. Reusing the same key with the same body returns the original result. Reusing it with a different body is a conflict, not a second posting. Store the key with the request hash for at least the provider's retention window, which is often 24 hours.
The table is the map. Each later part of this contract explains one surface: fields, examples, mapping order, confidence, webhooks, errors, and the measurement you run before anything posts itself.
Transaction and Category Fields Explained
A production response keeps the bank's original attributes and adds normalized classification fields. It does not return only a merchant label. The ISO 20022 Bank Transaction Code external code list is the interoperability layer for families such as issued credit transfers, internal book transfers, own-account transfers, and ACH. For CHF and EUR SME accounts, keep amount, currency, booking date, value date, direction, counterparty, account identifiers, payment rail, and raw remittance text, then add transaction_code, category, subcategory, tax_relevance, confidence, and categorization_source.
Source fields are immutable. The bank feed sets them, and a new model must not rewrite them. Classification fields are versioned. They change when the model or the taxonomy changes, so every result stores the version that produced it.
| Field | Type | Set by | Purpose |
|---|---|---|---|
| id | string | Provider | Stable key for the source transaction, never reused |
| amount | decimal string | Bank feed | Signed amount in account currency, avoids float rounding |
| currency | string (ISO 4217) | Bank feed | CHF or EUR for Swiss SME accounts, sets ledger currency |
| direction | debit or credit | Bank feed | Separates expenses from receipts and refunds |
| booking_date | date | Bank feed | Assigns the ledger period |
| value_date | date | Bank feed | Settlement timing for cash-flow views |
| counterparty | object | Bank feed | Name, IBAN or account identifier used by rules |
| payment_rail | enum | Bank feed | SEPA, SWIFT, card, internal or other |
| remittance_text | string | Bank feed | Raw free text, kept as evidence rather than a label |
| transaction_code | string | Provider | ISO 20022 Bank Transaction Code family |
| category | string | Classifier | Normalized category from the versioned taxonomy |
| subcategory | string | Classifier | Optional finer class such as software or subscription |
| tax_relevance | enum | Classifier | none, input_vat, output_vat or review |
| confidence | number, 0 to 1 | Classifier | Calibrated probability for the chosen category |
| categorization_source | enum | Classifier | rule, model, recurring or user |
| taxonomy_version | string | Provider | Version used, needed to replay old results |
| reason_codes | array | Classifier | merchant_match, recurring_pattern, counterparty_history or remittance_evidence |
Rules that follow from the types
Amounts travel as decimal strings. A float turns 412.50 into a value that fails a two-decimal ledger check. Currency is the account currency, CHF or EUR, not the currency you wish the supplier had billed in.
Structured purpose and category-purpose codes express payment intent and help reconciliation. Unstructured remittance text is evidence. It is never the category by itself. A correction is an event, not an overwrite, so the original suggestion, its source, and its taxonomy version stay in the audit trail. Bookkeeping, invoice matching, payroll, and analytics can then read the same transaction without guessing from merchant text.
Worked Request and Response Examples
Three exchanges cover the paths an accounting integration hits: a clean suggestion, a case that must wait, and a human correction that must not erase history.
A single categorization that can be reviewed
Request. POST /v1/transactions/categorize with header Idempotency-Key: 7c2a-mar-sub and body field taxonomy_version: 2026.01. The transactions array holds one debit: id txn_8f21, amount "-412.50", currency CHF, booking_date 2026-03-14, counterparty Example Software GmbH, payment_rail SEPA, remittance_text "INV 20931 SUB MAR".
Response 200. One object: category software, subcategory saas_subscription, tax_relevance input_vat, confidence 0.97, categorization_source recurring, reason_codes recurring_pattern and counterparty_history, one alternative at 0.02, taxonomy_version 2026.01.
Store the object as a suggestion. Do not post it until it clears the tenant's tested threshold for a tax-relevant class. A 0.97 on a recurring software debit is a candidate, not a posted line.
A low-confidence payment that stays out of the ledger
Request. Same endpoint. Remittance text is "PAYMENT 4471". No counterparty match, no invoice link.
Response 200. confidence 0.58, alternatives travel at 0.21 and supplies at 0.14, status pending_review, categorization_source model.
Queue it. No ledger posting. The integration's next step is to show the alternatives to a reviewer, not to pick the top label because something must be filled in.
A correction that keeps the original suggestion
Request. POST /v1/transactions/txn_8f21/corrections with corrected_category travel, reviewer_id usr_14, reason "Client site visit, not software".
Response 201. A correction event id, for example corr_19ab. The history still shows the original software suggestion, its confidence, and its taxonomy version.
Practical rule: Check four fields on every response before you touch the ledger: confidence, review status, taxonomy_version, and categorization_source.
If any of those four is missing, treat the call as incomplete and leave the transaction in suspense. A label without a version cannot be explained at year end.
Mapping Rules from Bank Data to Ledger Categories
Categorization runs as layered rules. The first layer that resolves the transaction wins, and later layers do not get a vote. Deterministic layers come before the model because a user-pinned IBAN or an ISO 20022 transfer code is more reliable than a probability.

| Order | Rule layer | Trigger | Outcome |
|---|---|---|---|
| 1 | Tenant override | Counterparty or IBAN pinned by a user | Pinned account and tax code, no model call |
| 2 | Transfer detection | ISO 20022 code marks an internal or own-account transfer | Transfer, excluded from expense and revenue |
| 3 | Recurring pattern | Same counterparty, similar amount, regular interval | Category of the prior series, source recurring |
| 4 | Merchant dictionary | Normalized counterparty name matches | Category and default tax code |
| 5 | Remittance keyword | Text contains payroll, tax or invoice markers in DE, FR, IT or EN | Category, flagged for review if ambiguous |
| 6 | Model fallback | No earlier layer applies | Suggested category with calibrated confidence |
| 7 | Suspense | No layer resolves or confidence is below threshold | Queued for review, no ledger posting |
Where simple mapping breaks
A transfer between two of the company's own accounts must not become income or expense. Booking both sides as revenue double-counts cash that never left the group. A refund has to match the original payment so the VAT is reversed on the same rate, not dropped into a generic income account.
One bank line that settles two invoices, or a salary plus a tax debit, needs a split. The parent stays as the bank movement. Child lines carry the categories and the tax codes. A EUR payment to a foreign supplier keeps the original EUR amount and the CHF ledger amount. Collapsing them loses the FX difference.
Language and business event
The same payroll entry can arrive as Lohn, salaire, or salario, and each bank shortens it differently. Keyword layers have to carry those forms or the model will invent a new class every month. A workshop paper on open-banking analytics notes that an inflow can be a sale or external credit even though both look like cash receipts. Text alone cannot tell a sale from a shareholder contribution or a loan. The mapping has to use invoice links, prior corrections, and tenant rules.
Each category maps once per company to that company's chart of accounts, and the tax code follows the mapping. That is the link between a bank category and the accounting ledger, not a universal merchant label.
Confidence Scores and the Review Queue
A single accuracy number does not tell you when to post. A confidence figure is useful only when it is calibrated: a 0.8 should be right about four times in five. Marketing copy that promises real-time automation skips that test.
Recent research on an SME-focused model reports only 73.49% standard accuracy, while accuracy rose to 90.36% on predictions whose confidence exceeded 0.8. The same work cut Expected Calibration Error from 0.1091 to 0.0048 through probability calibration, as summarized by AlphaXiv's overview of that study. Calibration can matter as much as the headline accuracy.

Three bands you set on your own books
- Auto-post: only above a threshold you have measured on this tenant's reviewed postings.
- Review: the middle band, where a person picks among the returned alternatives.
- Suspense: below the floor, or whenever tax_relevance is review. Nothing posts.
Input VAT, output VAT, payroll, and tax debits need a stricter floor than ordinary expenses. A wrong expense label is a reclass. A wrong tax treatment is a filing problem.
Aggregate accuracy hides the rare classes: payroll adjustments, tax payments, transfers, refunds, owner contributions, and intercompany movements. A 2021 study in Intelligent Systems in Accounting, Finance and Management found a best within-company top-1 accuracy of 80.50% across 473 companies, and a model on 44 companies in 28 sectors exceeded 80% after account-structure standardization. Trained on 43 companies and tested on an unseen company, average performance fell to 64.62%. Published averages do not transfer. Set bands on the tenant's own reviewed postings.
Every override is feedback. The audit row holds the original suggestion, the confidence, the final category, the approver, and the timestamp. That trail is what financial insights can trust later, because the number on the dashboard came from a decision someone can still explain.
Webhook Events and Delivery Handling
Push the state changes. Polling the categorization endpoint on a timer misses corrections and double-fetches rows you already stored.
- transaction.created: a bank transaction has entered the system. Fetch the source fields and wait for a classification. Do not invent a category from the create payload.
- transaction.categorized: a classification was written. Read confidence and review status before any posting decision.
- transaction.review_required: confidence fell into the review band, or the item is tax-sensitive. Open a queue item.
- transaction.recategorized: a correction changed the category. Update the ledger only from the correction event, and keep the prior suggestion.
- taxonomy.updated: a new taxonomy_version was published. Refresh categories before the next categorize call.
- webhook.test: a setup check. Confirm the signature path works, then ignore the body.
Handling rules
- Verify the signature first. Compute the HMAC over the raw request body before you parse JSON. A parsed and re-serialized body will not match.
- Answer fast, work later. Return a 2xx quickly and process on a queue. Slow handlers look like failures and trigger retries.
- Store the event id. Providers retry. A duplicate id is a no-op, not a second ledger line.
- Order by event time, not arrival. Delivery is often out of order. A correction can land before the original categorize event.
- Backfill with a cursor. After an outage, call
GET /v1/eventswith asincecursor and replay what you missed. - Rotate secrets with an overlap. Accept the old and new signing secret for a short window, then drop the old one. A hard cut drops in-flight events.
Plan for retries with increasing delays, and for the provider to disable an endpoint after prolonged failure. Alert on failed deliveries the same day. A silent disabled endpoint looks like a quiet bank feed, and the books stop moving while nobody is paged.
Error Codes and Recovery Steps
These codes are typical for a categorization API, not one vendor's list. Replace them with the provider's documented codes, and keep a short map in your help center runbook so on-call does not guess.
| Status | Error code | Meaning | Recovery |
|---|---|---|---|
| 422 | taxonomy_version_unknown | Request pinned to a retired taxonomy version | Refresh GET /v1/categories and remap before posting |
| 500 | internal_error | Provider fault | Retry with exponential backoff and jitter, same key |
Client errors versus retries
4xx means fix the request. Do not retry an unchanged body. A 400 is a missing field. A 401 or 403 is a token or scope problem. A 404 is an unknown transaction id. Sending them again only fills the error log.
5xx and 429 can be retried. Honour Retry-After on 429 and spread the batch across that window. On 500 and 503, use exponential backoff with jitter, and send the original payload with the same Idempotency-Key so the retry is not a second write.
The two codes that fail quietly
A 409 idempotency conflict means the same key was reused with a different body. Retrying blindly can create duplicate postings if your client then invents a new key. Stop, compare the stored hash, and decide whether the first write or the new body is the one you meant.
A 422 taxonomy_version_unknown means you are pinned to a retired version. Refresh GET /v1/categories, remap deprecated codes, and only then categorize. Posting under the old codes puts new activity into accounts you have already closed.
A failed categorization leaves the transaction in suspense. Never post a guess because the call errored.
Run Shadow Mode Before Auto-Posting
A strong benchmark is not permission to post. A peer-reviewed study in Discover Artificial Intelligence reported 95.3% accuracy and 95.4% macro-F1 on a multilingual benchmark spanning five countries, five currencies, and 10 categories. The weakest classes were Financial Services and Other, the catch-alls where ambiguity lives.

SME feeds are imbalanced, and errors are not equal. A false positive on an expense or VAT class writes a wrong ledger or tax treatment. A low-confidence item can wait. Measure class-level precision, recall, and macro-F1, not accuracy alone. Precision matters more than coverage when the alternative is a bad posting.
Measurement before the first automatic post
- Run categorization in shadow mode for four to six weeks. Suggestions are stored. Nothing posts.
- Compare every suggestion with the category a person entered.
- Compute precision, recall, and macro-F1 by category, currency, payment rail, merchant novelty, and confidence band.
- Set the auto-post threshold where precision meets the target. Use a stricter target for tax-relevant categories.
- Post automatically only for categories that meet that target. Keep the rest in review.
- Repeat the measurement after every taxonomy or model change so drift does not reopen a gate you already closed.
Open Banking guidance treats data management as a defined area of good practice for third-party propositions, which fits a repeatable shadow run better than a one-off accuracy demo. The API already returns calibrated confidence, alternative categories, taxonomy version, and reason codes such as merchant match, recurring pattern, counterparty history, or remittance evidence. Use those fields as the columns of the comparison, not a separate spreadsheet of merchant names.
Helvo's Automated Accounting records and categorises every transaction automatically, and the books update as the business runs. Helvo also records every payment made with its payments and cards product and reflects it in the accounting automatically. The same shadow-mode metrics belong in front of that posting path: measure, set the gate, then let only the classes that clear it update the books, and watch drift after launch.
A transaction categorization API earns its place when accounting can defend every posted line. If you cannot name the confidence, the reason, and the person who could have stopped it, the line should still be in review.
Helvo brings the business account, payments, invoicing, and accounting into one place, so a categorized bank line can stay tied to the invoice, the card payment, and the ledger. If you want categorization that posts only after a review gate you have tested, start with Helvo and run the first weeks in shadow mode before anything posts itself.