Accounting

Hydrate a business case from a template id, scoped to a single snippet.

This operation remains available until <b>2027-08-14</b> and is removed after that date. Use <code>GET /core/v1/accounting/business-cases/v2</code> instead.<br/><br/>Snippet-scoped variant of <code>GET /core/latest/accounting/business-cases</code>: hydrates only the template root plus the snippet identified by <code>snippet-id</code>, so the booking UI can stream the form one snippet at a time instead of loading the whole tree up-front. When <code>dateForFilteringFiscalYear</code> is supplied it drives the fiscal-year resolution; otherwise <code>dateForFilteringCompanyVat</code> is used; otherwise the downstream service resolves the fiscal year that covers today. When <code>group-insurance-by-insurer</code> is <code>true</code> (the default), social-insurance entries that share the same display + value pair are collapsed, keeping the entry with the smallest numeric id. Tenant and company are derived from the bearer-token session — they are never accepted from the URL. The endpoint is a pure read — idempotent, no side effects. The caller must hold the <code>ACCOUNTING</code> permission on the company in scope.

get/core/latest/accounting/business-cases/v2

Request

  • Base URL: https://api.klara.ch
  • URL: https://api.klara.ch/core/latest/accounting/business-cases/v2
  • Auth: one of:
    • API key in header X-API-KEY
    • HTTP bearer

Query parameters

businessCaseTemplateIdinteger required
Example:101

Numeric id of the business-case template to hydrate. Obtain it from <code>GET /core/latest/accounting/companies/current/business-case-templates</code>.

dateForFilteringCompanyVatstring date
Example:2024-06-15

ISO date (<code>yyyy-MM-dd</code>) used to resolve the company-VAT regime applicable to the business case. Used as the fallback for <code>dateForFilteringFiscalYear</code> when that is omitted.

dateForFilteringFiscalYearstring date
Example:2024-06-15

ISO date (<code>yyyy-MM-dd</code>) used to resolve the fiscal year that hydrates the business case. When omitted, falls back to <code>dateForFilteringCompanyVat</code>; when both are omitted the downstream service resolves the fiscal year that covers today.

group-insurance-by-insurerboolean
Example:true

When <code>true</code>, collapses social-insurance entries that share the same display + value pair, keeping the entry with the smallest numeric id. Defaults to <code>true</code>. Allowed values: <code>true</code>, <code>false</code>.

snippet-idinteger
Example:42

Numeric id of the snippet currently activated by the user; v2 hydrates only this snippet plus the template root. When omitted, only the template root is hydrated.

snippet-valuestring
Example:EMP-1001

Currently ignored on the downstream side; reserved for a future optimisation that would load external entries only for the activated value (for example, payment dates of a single employee). Safe to omit.

Headers

Accept-Languagestring
Example:de-CH

IETF language tag used to translate the snippet labels and field captions. Examples: <code>de-CH</code>, <code>fr-CH</code>, <code>it-CH</code>, <code>en</code>.

Response

Hydrated business-case aggregate for the requested template and snippet.

businessCaseIdinteger

Identifier of the business case instance when persisted; null on a freshly hydrated template.

businessCaseTemplateIdinteger

Identifier of the business-case template this aggregate was hydrated from.

documentIdstring

Identifier of the underlying document the business case is attached to; null when the booking is not yet linked to a document.

displaystring

Pre-translated display label of the business-case template for the request's Accept-Language.

bookingNumbersstring

Comma-separated list of booking numbers already generated for this business case; empty on a fresh template.

effectiveCompanyVatDatestring date

Date used to resolve the company-VAT regime applicable to this business case (ISO yyyy-MM-dd).

documentDatestring date

Document date associated with the business case (ISO yyyy-MM-dd).

effectiveFiscalYearDatestring date

Date used to resolve the fiscal year applicable to this business case (ISO yyyy-MM-dd).

fiscalYearHasCreatedAutoboolean

True when the downstream service had to auto-create the fiscal year covering the resolved date.

withOPboolean

True when this business case is tracked as an open item (OP). May be null when not applicable.

fieldsobject

Recursive snippet-and-field tree driving the booking form, keyed by snippet code. The shape of each entry follows the downstream BusinessCaseField model (see analysis report §8.2).

entriesDefinitionobject[]

Per-field entries definitions used by the booking form to resolve enum-like fields. Each entry mirrors the downstream FieldEntriesDefinition model (see analysis report §8.2).

Example response

{
  "businessCaseTemplateId": 101,
  "documentId": "null",
  "display": "Bürobedarf",
  "effectiveCompanyVatDate": "2024-06-15",
  "documentDate": "2024-06-15",
  "effectiveFiscalYearDate": "2024-06-15",
  "fields": {
    "PAYMENT": {
      "snippetId": 42,
      "nestedFields": {}
    }
  }
}

Changes

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