Accounting

Suggest ready-to-use VAT case / rate / account bundles for a booking line.

Turns a plain-language context — a purchase vs a sale — into ranked, copy-paste-ready VAT bundles. Each bundle carries the verbatim <code>vatCaseLink</code> and <code>vatRateLink</code> to drop into a booking line's <code>links</code>, plus a suggested <code>vatAccountCode</code>. Supply <code>amount</code> to also receive a net/VAT preview. The bundle marked <code>recommended</code> is the server's best guess.<br/><br/><strong>Rebuilding the Manual-booking VAT UI from this response (read this if you are generating a UI).</strong> This endpoint returns a <em>flat array</em>, but the Manual-booking screen renders it as <strong>three linked dropdowns plus two toggles and an auto-computed amount</strong>. Map each control as follows:<table border="1" cellpadding="4"><tr><th>GUI control</th><th>Driven by</th><th>How to build it</th></tr><tr><td><strong>VAT</strong> on/off toggle</td><td>client-side state (not in this response)</td><td>OFF → the line has no VAT: don't call this endpoint, add no VAT links/fields. ON → call this endpoint and show the dropdowns below.</td></tr><tr><td><strong>VAT case</strong> dropdown (e.g. "taxable supply")</td><td>distinct <code>vatCaseCode</code> (label it with <code>label</code>)</td><td>Group the array by <code>vatCaseCode</code>; one entry per distinct case.</td></tr><tr><td><strong>VAT rate</strong> dropdown (e.g. "8.1%")</td><td><code>vatRateDisplay</code></td><td>Cascades from the chosen case: the rows sharing the selected <code>vatCaseCode</code> are the rate options.</td></tr><tr><td><strong>VAT account</strong> dropdown (e.g. "1170 | Input tax VAT")</td><td><code>vatAccountCodes</code></td><td>List all <code>vatAccountCodes</code>; preselect <code>vatAccountCode</code>.</td></tr><tr><td><strong>including / excluding</strong> toggle</td><td>the <code>amountKind</code> query param</td><td><code>including</code> = <code>GROSS_INCLUSIVE</code>; <code>excluding</code> = <code>NET_EXCLUSIVE</code>. Flipping it means re-calling this endpoint to refresh the preview.</td></tr><tr><td>Debit / Credit amount preview</td><td><code>previewNet</code> / <code>previewVat</code></td><td>Null until you pass <code>amount</code>. Re-call with the new <code>amount</code>/<code>amountKind</code> to refresh.</td></tr></table><strong>End-to-end recipe (call → render → book):</strong><ol><li>User turns the VAT toggle ON. Call this endpoint with <code>direction</code> (PURCHASE/SALE), the line's <code>accountCode</code>, the user's <code>amount</code>, the <code>amountKind</code> from the including/excluding toggle, and the <code>date</code> you will book on.</li><li>Render the dropdowns per the table above; preselect the row where <code>recommended = true</code>.</li><li>When the user picks a row, send it to <code>POST /core/v1/bookings?autoCalculateVat=true</code>: on the VAT-bearing line set <code>links = "<vatCaseLink>,<vatRateLink>"</code> (both verbatim), <code>vatAccountCode = <vatAccountCode></code>, your <code>amount</code>, and <code>isExcludeVatAmount</code> matching the <code>amountKind</code> you queried — then omit the VAT counterpart line; the server generates it (matching <code>previewNet</code>/<code>previewVat</code>). Pass the same <code>date</code> you will book on.<br/><br/><strong>Coverage:</strong> the response mirrors the booking GUI's two dropdowns. The VAT-case list is direction-agnostic (every configured case is offered regardless of <code>direction</code>), and the rate list includes every configured version of each rate code the case references — current <em>and</em> historical — so a line dated before a rate change still finds its rate.

get/core/v1/accounting/vat-suggestions

Request

  • Base URL: https://api.klara.ch
  • URL: https://api.klara.ch/core/v1/accounting/vat-suggestions
  • Auth: one of:
    • API key in header X-API-KEY
    • HTTP bearer

Query parameters

accountCodeinteger required

Main account being booked against (e.g. 1020); drives VAT-account resolution. Required.

amountnumber

Amount to preview the net/VAT split for (optional).

amountKindstring

GROSS_INCLUSIVE (default) or NET_EXCLUSIVE.

datestring

Date (ISO yyyy-MM-dd) to resolve the company VAT config for; defaults to today.

direction'PURCHASE' | 'SALE' required

PURCHASE (you are buying) or SALE (you are selling). Required. It does not restrict which VAT cases are returned (the full case list is always offered); it only selects the fallback VAT account — purchases vs sales — and the recommendation wording.

vatCase'TAXABLE_SUPPLY' | 'SUPPLY_WITH_OPTION_ART_22' | 'TAX_EXEMPT_SUPPLY' | 'EXPORT' | 'SUPPLY_ABROAD' | 'EXCLUDED_SUPPLY' | 'DECREASE_IN_PROFITS' | 'INTERNAL_CONSUMPTION' | 'SUBVENTION' | 'CONTRIBUTIONS_DIVIDEND_DAMAGE_COMPENSION' | 'DOMESTIC_PURCHASE' | 'IMPORT_WITH_CUSTOMS' | 'IMPORT_WITH_REVERSE_CHARGE' | 'PURCHASE_ABROAD' | 'TRANSFER_SUPPLY' | 'MISCELLANEOUS' | 'DE_TAXATION' | 'MIXED_USE' | 'REDUCTION' | 'TAX_CREDIT_1050' | 'TAX_CREDIT_1055_1056'

VAT case code to restrict suggestions to a single case; returns all its rate/account bundles (optional). Any valid case code is accepted regardless of direction — e.g. a sales case such as TAXABLE_SUPPLY can be requested with direction=PURCHASE.

Headers

Accept-Languagestring

Preferred language for the bundle labels.

Response

Ranked VAT suggestions.

labelstring

Human-meaningful label. Use it as the option text in the VAT-rate dropdown.

recommendedboolean

True on the server's recommended default bundle — preselect this row in the dropdowns.

reasonstring

Why this bundle is suggested.

vatCaseCodestring

VAT case code. Group rows by this value to build the VAT-case dropdown.

vatCaseLinkstring

Verbatim link to copy into a booking line's links (comma-joined with vatRateLink).

vatRateDisplaystring

Display string of the VAT rate — the VAT-rate dropdown option within the selected VAT case.

vatRateLinkstring

Verbatim link to copy into a booking line's links (comma-joined with vatCaseLink).

vatAccountCodeinteger

Suggested VAT account for the generated VAT line — preselect this in the VAT-account dropdown; the first of vatAccountCodes (confirm against your chart of accounts).

vatAccountCodesinteger[]

All VAT accounts the company's chart maps to this account + VAT case; the options for the GUI's VAT-account dropdown.

previewNetnumber

Net amount preview — the Debit/Credit preview shown in the GUI. Null until an amount is supplied; refreshes when amount/amountKind change.

previewVatnumber

VAT amount preview — the VAT portion shown in the GUI. Null until an amount is supplied; refreshes when amount/amountKind change.

Example response

[
  {
    "label": "Domestic purchase — 8.1%",
    "recommended": true,
    "reason": "Default VAT rate for DOMESTIC_PURCHASE.",
    "vatCaseCode": "DOMESTIC_PURCHASE",
    "vatCaseLink": "vat_case:/luz_accounting/api/vat-cases/1",
    "vatRateDisplay": "8.1%",
    "vatRateLink": "vat_rate:/luz_accounting/api/master-vats/59",
    "vatAccountCode": 1170,
    "vatAccountCodes": [
      1170,
      1171
    ],
    "previewNet": 925.93,
    "previewVat": 74.07
  }
]

Changes

No recorded changes to this operation across all 1 revision of this API.