Accounting

Create a new manual booking for the authenticated company.

This operation remains available until <b>2027-08-14</b> and is removed after that date. Use <code>POST /core/v1/bookings</code> instead.<br/><br/>Records a manual journal entry against the authenticated caller's company and returns the persisted booking with its server-assigned identifiers. The booking must contain at least two debit/credit lines whose totals balance — the downstream service rejects unbalanced postings. By default the <code>bookingDate</code> must fall inside an open fiscal year; set <code>confirmDontMindClosingFiscalYear</code> to <code>true</code> to accept a booking that targets a closing fiscal year. Set <code>ignore-unsubscripted-dates</code> to <code>true</code> to bypass the subscription-period guard that normally rejects bookings outside the active Klara Accounting subscription window. Tenant and company are derived from the bearer token — the request body's <code>id</code> and <code>companyId</code> are ignored. The caller must hold the <code>ACCOUNTING</code> permission on the targeted company.

post/core/latest/bookings

Request

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

Query parameters

autoCalculateVatboolean

When <code>true</code>, the server recalculates VAT like the Manual booking GUI: each VAT-bearing line sends a single gross/net <code>amount</code> + a <code>vat_rate</code> link + <code>vatAccountCode</code> + <code>isExcludeVatAmount</code> and <strong>omits</strong> its VAT counterpart line; the server derives the net/VAT split and generates the VAT line so the entry balances. When <code>false</code> (default), the caller must pre-split and pre-compute every line (current behaviour). Obtain valid VAT values from <code>GET /core/latest/vat-cases</code> and <code>GET /core/latest/accounting/master-vats</code>.

confirmDontMindClosingFiscalYearboolean

When <code>true</code>, accept the booking even if its <code>bookingDate</code> falls in a closing fiscal year. Defaults to <code>false</code>.

ignore-unsubscripted-datesboolean

When <code>true</code>, accept the booking even if its date falls outside the active Klara Accounting subscription period. Defaults to <code>false</code>.

Headers

Accept-Languagestring
Example:de-CH

Preferred language for any localized error messages produced downstream. Examples: de-CH, fr-CH, it-CH, en. Defaults to the tenant's configured language when omitted.

Request body

idinteger

Internal id of the booking. Assigned by the server on creation; omit when sending a new booking.

companyIdinteger

Internal id of the company this booking belongs to. Filled by the server from the caller's session; ignored on input.

documentDatestring date-time required

Date printed on the underlying document, e.g. supplier invoice date (yyyy-MM-ddT00:00:00Z).

bookingDatestring date-time required

Effective accounting date of the booking; must fall inside an open fiscal year unless confirmDontMindClosingFiscalYear is set (yyyy-MM-ddT00:00:00Z).

documentIdsstring[]

Ids of supporting documents (uploaded files / e-mails) attached to this booking.

businessCasestring

Free-text business case label shown on the journal.

snippetsstring[]

Snippet identifiers applied to this booking, copied from the booking template.

bookingStatusstring

Status of the booking. Allowed values: DRAFT, BOOKED, CANCELLED.

internalCommentstring

Internal comment, visible only to accounting users.

businessCaseIdstring

Id of the Klara business case that produced this booking. Set by the server and ignored on input: a booking created through this API never belongs to a business case, so leave it empty. This is not the business case template code (use businessCase for a label). A non-numeric value is rejected with 400 booking.business_case_id_invalid.

relatedBookingHeaderLinksstring[]

URIs of bookings that are related to this one (e.g. payment ↔ invoice, original ↔ delimitation).

invoiceNumberstring

Invoice number printed on the document.

orderManagementInvoiceLinkstring

Klara order-management invoice URI when the booking was generated from a Klara invoice.

bookingTemplateIdinteger

Id of the booking template the user picked when creating this entry.

bookingTitlestring

Short title of the booking shown in lists.

totalAmountnumber

Sum of the absolute amounts of the booking lines, in the company main currency.

bookingTypeCodestring

Business meaning of the booking. Allowed values include GENERAL_LEDGER, AR_INVOICE, AP_INVOICE, AR_PAYMENT, AP_PAYMENT, AR_CREDIT_NOTE, AP_CREDIT_NOTE.

Example request

{
  "id": 12345,
  "companyId": 1,
  "documentDate": "2024-06-15T00:00:00Z",
  "bookingDate": "2024-06-15T00:00:00Z",
  "businessCase": "Office supplies",
  "bookingStatus": "BOOKED",
  "bookingDetails": [
    {
      "id": 1001,
      "accountCode": 1020,
      "crdrType": "DR",
      "description": "Office supplies — invoice 2024-019",
      "amount": 150,
      "tags": "project-alpha,q2",
      "links": "bank_account:/luzfin_finance/api/388c822c-7860-41ae-94ac-330684bb63e0/companies/1/bank-accounts/85,vat_case:/luz_accounting/api/vat-cases/1",
      "vatAccountCode": 1170,
      "vatTypeDescription": "INCLUSIVE",
      "vatAmount": 11.4,
      "vatRate": 7.7,
      "vatRateDisplay": "7.7%",
      "bookingTypeCode": "GENERAL_LEDGER",
      "openPositionStatus": "OPEN",
      "foreignCurrencyUnit": "EUR",
      "paidDate": "2024-06-15T00:00:00Z",
      "dueDate": "2024-06-30T00:00:00Z",
      "paymentDate": "2024-06-28T00:00:00Z",
      "servicePeriodFrom": "2024-06-01T00:00:00Z",
      "servicePeriodTo": "2024-06-30T00:00:00Z"
    }
  ],
  "invoiceNumber": "2024-019",
  "bookingTemplateId": 501,
  "bookingTitle": "Office supplies — June 2024",
  "totalAmount": 150,
  "bookingTypeCode": "GENERAL_LEDGER"
}

Response

Booking created.

idinteger

Internal id of the booking. Assigned by the server on creation; omit when sending a new booking.

companyIdinteger

Internal id of the company this booking belongs to. Filled by the server from the caller's session; ignored on input.

documentDatestring date-time required

Date printed on the underlying document, e.g. supplier invoice date (yyyy-MM-ddT00:00:00Z).

bookingDatestring date-time required

Effective accounting date of the booking; must fall inside an open fiscal year unless confirmDontMindClosingFiscalYear is set (yyyy-MM-ddT00:00:00Z).

documentIdsstring[]

Ids of supporting documents (uploaded files / e-mails) attached to this booking.

businessCasestring

Free-text business case label shown on the journal.

snippetsstring[]

Snippet identifiers applied to this booking, copied from the booking template.

bookingStatusstring

Status of the booking. Allowed values: DRAFT, BOOKED, CANCELLED.

internalCommentstring

Internal comment, visible only to accounting users.

businessCaseIdstring

Id of the Klara business case that produced this booking. Set by the server and ignored on input: a booking created through this API never belongs to a business case, so leave it empty. This is not the business case template code (use businessCase for a label). A non-numeric value is rejected with 400 booking.business_case_id_invalid.

relatedBookingHeaderLinksstring[]

URIs of bookings that are related to this one (e.g. payment ↔ invoice, original ↔ delimitation).

invoiceNumberstring

Invoice number printed on the document.

orderManagementInvoiceLinkstring

Klara order-management invoice URI when the booking was generated from a Klara invoice.

bookingTemplateIdinteger

Id of the booking template the user picked when creating this entry.

bookingTitlestring

Short title of the booking shown in lists.

totalAmountnumber

Sum of the absolute amounts of the booking lines, in the company main currency.

bookingTypeCodestring

Business meaning of the booking. Allowed values include GENERAL_LEDGER, AR_INVOICE, AP_INVOICE, AR_PAYMENT, AP_PAYMENT, AR_CREDIT_NOTE, AP_CREDIT_NOTE.

Example response

{
  "id": 12345,
  "companyId": 1,
  "documentDate": "2024-06-15T00:00:00Z",
  "bookingDate": "2024-06-15T00:00:00Z",
  "businessCase": "Office supplies",
  "bookingStatus": "BOOKED",
  "bookingDetails": [
    {
      "id": 1001,
      "accountCode": 1020,
      "crdrType": "DR",
      "description": "Office supplies — invoice 2024-019",
      "amount": 150,
      "tags": "project-alpha,q2",
      "links": "bank_account:/luzfin_finance/api/388c822c-7860-41ae-94ac-330684bb63e0/companies/1/bank-accounts/85,vat_case:/luz_accounting/api/vat-cases/1",
      "vatAccountCode": 1170,
      "vatTypeDescription": "INCLUSIVE",
      "vatAmount": 11.4,
      "vatRate": 7.7,
      "vatRateDisplay": "7.7%",
      "bookingTypeCode": "GENERAL_LEDGER",
      "openPositionStatus": "OPEN",
      "foreignCurrencyUnit": "EUR",
      "paidDate": "2024-06-15T00:00:00Z",
      "dueDate": "2024-06-30T00:00:00Z",
      "paymentDate": "2024-06-28T00:00:00Z",
      "servicePeriodFrom": "2024-06-01T00:00:00Z",
      "servicePeriodTo": "2024-06-30T00:00:00Z"
    }
  ],
  "invoiceNumber": "2024-019",
  "bookingTemplateId": 501,
  "bookingTitle": "Office supplies — June 2024",
  "totalAmount": 150,
  "bookingTypeCode": "GENERAL_LEDGER"
}

Changes

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