---
title: "Attach Gl Journal Entry Document"
method: POST
path: "/companies/{company_id}/gl/journal-entries/{entry_id}/documents"
tags: ["gl-references"]
---

# Attach Gl Journal Entry Document

`POST /companies/{company_id}/gl/journal-entries/{entry_id}/documents`

## 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}/documents`
- Auth: none declared

Attach an accounting document to a journal entry — the evidence retrofit.

A journal entry booked by hand used to be **permanently** unsupported: nothing
attached a document to one, and only the ingest path stamps
`source_ref_type='item'`. This is the door back. Create the document first with
`POST …/gl/documents` (it can point at an already-uploaded `file_id`), then name it
here; the entry read returns it in `documents` afterwards, and the VAT close counts
the entry as documented.

**It works on a posted entry, and inside a closed period.** The link changes no
amount, account, date or VAT figure and does not bump `version_no` — it is an
append-only annotation, not a ledger edit, so the immutability guards do not apply
to it. Attaching is not re-opening.

Idempotent: re-attaching the same document in the same `role` returns the existing
link rather than a second one. 404 for an entry or a document that is not this
company's. Returns the entry's full document list.

**This is a retrofit, not a substitute for the pipeline.** Do not transcribe a
document into an entry and then attach the file — ingest it (`POST …/uploads/`) and
accept what the coder proposes, so the booking is derived from the document rather
than merely filed beside it.

## Path parameters

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

## Headers

- `authorization` string, nullable

## Cookies

- `access_token` string, nullable

## Request body

- GlJournalEntryDocumentCreate: ``POST …/gl/journal-entries/{entry_id}/documents`` body.
  - `document_id` string, required
  - `role` 'source' | 'attachment' | 'evidence' | 'generated_pdf'

## Response `201`

Successful Response

- GlDocumentsResponse
  - `documents` GlDocumentOut[], required
    - `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)
