---
title: "Replace Gl Journal Entry"
method: PUT
path: "/companies/{company_id}/gl/journal-entries/{entry_id}"
tags: ["gl"]
---

# Replace Gl Journal Entry

`PUT /companies/{company_id}/gl/journal-entries/{entry_id}`

## Request

- Base URL: `https://app.zeno-works.ch` (the document declares no server; this is the origin it was published from)
- URL: `https://app.zeno-works.ch/companies/{company_id}/gl/journal-entries/{entry_id}`
- Auth: none declared

Correct a **draft** entry in place — full-object replace (ZET-127).

Validation runs at post, so a rejected posting leaves a draft behind. Until now the
router exposed no way to fix it (or to discard it), so the only recourse was to
create a fresh entry and abandon the old one. 409 for anything but a draft, or a
closed period.

Full-object semantics apply to ``auto_reverse_date`` too (ZCT-527): pass it to arm
the draft, omit it (or send ``null``) to disarm one.

## Path parameters

- `company_id` string, required
- `entry_id` string, required

## Headers

- `authorization` string, nullable

## Cookies

- `access_token` string, nullable

## Request body

- GlJournalEntryCreate
  - `period_id` string, required
  - `posting_date` string, date, required
  - `currency` string, nullable
  - `entry_type` 'manual' | 'invoice' | 'payment' | 'bank' | 'vat' | 'payroll' | 'accrual' | 'deferral' | 'depreciation' | 'inventory' | 'closing' | 'adjustment' | 'reversal'
  - `description` string, nullable
  - `lines` GlJournalLineIn[], required
    - `account_id` string, required
    - `amount_base` union
      - number
      - string
    - `amount_currency` union
      - number
      - string
    - `line_role` 'bank' | 'ar' | 'ap' | 'revenue' | 'expense' | 'vat' | 'payroll_liability' | 'salary_expense' | 'fixed_asset' | 'depreciation' | 'inventory' | 'cogs' | 'clearing' | 'rounding' | 'fx_gain_loss' | 'suspense', required
    - `currency` string, nullable
    - `counterparty_id` string, nullable
    - `open_item_id` string, nullable
    - `description` string, nullable
    - `vat` GlLineVatIn: VAT tag for a manual journal line (Gap B — manual-booking metadata completeness). Tag **both** legs of a taxable movement with the same ``code`` (a company ``gl_vat_code``): the taxable **base** line *and* its paired **VAT-control** line — posting groups the entry's lines by this tag to pair base with VAT line, and the composition guard refuses (409) any VAT-control line left untagged (ZET-158: a base-line-only tag has no working path). One tagged control line per code. ``amount`` (the tax, a magnitude) is read from the **base** line's tag and falls back to the paired VAT line's amount — when several base lines share one VAT line, give each base line its own ``amount``, or every pair books the full VAT-line amount. Exception: a catalog-linked **zero-rated output** code (0 % rate) books no VAT-control line at all — tag only the base line(s); each line tagged with such a code declares its turnover once. On post the entry gains ``gl_vat_posting`` rows so the lines reach the MWST-Abrechnung (``doc/pipeline.md §"VAT"``).
      - `code` string, required
      - `amount` union
        - number
        - string
    - `open_item` GlLineOpenItemIn: Open a new AR/AP subledger item from a manual control line (Gap B). Set ``create=true`` on the line posting to the AR/AP control account; ``due_date`` seeds aging. Direction is derived from the account's ``control_type``. To settle/adjust an *existing* item instead, pass ``open_item_id`` on the line (its balance is rebuilt on post).
      - `create` boolean
      - `due_date` string, date, nullable
  - `auto_reverse_date` string, date, nullable

## Response `200`

Successful Response

- GlJournalEntryDetailOut
  - `id` string, required
  - `company_id` string, required
  - `entry_no` integer, nullable
  - `period_id` string, required
  - `posting_date` string, date, required
  - `status` string, required
  - `entry_type` string, required
  - `origin` string, required
  - `description` string, nullable
  - `debit_total_base` string, required
  - `credit_total_base` string, required
  - `line_count` integer, required
  - `version_no` integer, required
  - `reversal_of_entry_id` string, nullable
  - `reversed_by_entry_id` string, nullable
  - `auto_reverse_date` string, date, nullable
  - `coding_guessed` boolean
  - `untagged_subledger_control` boolean
  - `source_ref_type` string, nullable
  - `source_ref_id` string, nullable
  - `source_action` string, nullable
  - `created_at` string, date-time, required
  - `posted_by` string, nullable
  - `created_by` string, nullable
  - `posted_at` string, date-time, nullable
  - `lines` GlJournalLineOut[]
    - `id` string, required
    - `line_no` integer, required
    - `account_id` string, required
    - `amount_base` string, required
    - `currency` string, required
    - `amount_currency` string, required
    - `line_role` string, required
    - `counterparty_id` string, nullable
    - `open_item_id` string, nullable
    - `description` string, nullable
    - `vat_code` string, nullable
    - `vat_amount` string, nullable
    - `open_item` GlLineOpenItemIn: Open a new AR/AP subledger item from a manual control line (Gap B). Set ``create=true`` on the line posting to the AR/AP control account; ``due_date`` seeds aging. Direction is derived from the account's ``control_type``. To settle/adjust an *existing* item instead, pass ``open_item_id`` on the line (its balance is rebuilt on post).
      - `create` boolean
      - `due_date` string, date, nullable
  - `vat_postings` GlVatPostingOut[]
    - `id` string, required
    - `journal_entry_id` string, required
    - `base_line_id` string, required
    - `vat_line_id` string, required
    - `vat_code_id` string, required
    - `vat_code` string, nullable
    - `vat_period_id` string, nullable
    - `base_amount` string, required
    - `vat_amount` string, required
    - `gross_amount` string, required
    - `deductibility_percent` string, required
    - `non_deductible_amount` string, required
    - `return_box_code` string, nullable
  - `vat_zero_postings` GlVatZeroPostingOut[]
    - `id` string, required
    - `journal_entry_id` string, required
    - `base_line_id` string, required
    - `vat_code_id` string, required
    - `vat_code` string, nullable
    - `vat_period_id` string, nullable
    - `base_amount` string, required
    - `return_box_code` string, nullable
  - `open_items` GlOpenItemOut[]
    - `id` string, required
    - `company_id` string, required
    - `direction` string, required
    - `counterparty_id` string, nullable
    - `control_account_id` string, required
    - `original_amount_base` string, required
    - `open_amount_base` string, required
    - `currency` string, required
    - `original_amount_currency` string, nullable
    - `open_amount_currency` string, nullable
    - `base_currency` string, nullable
    - `due_date` string, date, nullable
    - `status` string, required
    - `created_at` string, date-time, required
  - `documents` GlDocumentOut[]
    - `id` string, required
    - `company_id` string, required
    - `document_type` string, required
    - `file_id` string, nullable
    - `filename` string, nullable
    - `issue_date` string, date, nullable
    - `created_at` string, date-time, required

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/zeno-works/apis/zeno-api.md) · [All operations](https://skmtc.dev/zeno-works/apis/zeno-api/llms.txt) · [OpenAPI document](https://skmtc.dev/zeno-works/apis/zeno-api/revisions/1eb93dde146c?raw)
