---
title: "Retry Accounting Document"
method: POST
path: "/accounting-documents/{document_id}/retry"
tags: ["accounting-settings"]
---

# Retry Accounting Document

`POST /accounting-documents/{document_id}/retry`

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

Re-queue a ``failed`` accounting document for re-processing (recover by id).

Recovers from a processing failure (notably ``fiscal_year_undeterminable``) without
re-uploading bytes — the staged sha256 bytes persist. CompanyMember, scoped via the
loaded row (404 missing / 403 out of scope). The optional ``fiscal_year`` body field
(1900–2200; 422 otherwise) sets ``fiscal_year_hint`` before re-queueing; omitting it
preserves the existing hint for a plain retry. ``failed`` → ``pending`` (202);
``pending``/``processing`` → returned as-is (idempotent); ``done`` → 409.

Accountant/owner (ZCT-257): a retry re-runs extraction — a fresh billed analysis whose
result lands in the books. The row is loaded before the gate so it has a
``company_id``, keeping the same 404-missing / 403-out-of-scope split.

## Path parameters

- `document_id` string, required

## Headers

- `authorization` string, nullable

## Cookies

- `access_token` string, nullable

## Request body

- AccountingDocumentRetryIn: Body for ``POST /accounting-documents/{id}/retry``. ``fiscal_year`` recovers from ``fiscal_year_undeterminable``: when provided it sets the document's ``fiscal_year_hint`` before re-queueing; when omitted (None) the existing hint is preserved for a plain re-process.
  - `fiscal_year` integer, nullable

## Response `202`

Successful Response

- AccountingDocumentOut: An uploaded accounting document + its processing status.
  - `id` string, required
  - `company_id` string, required
  - `sha256` string, required
  - `filename` string, required
  - `content_type` string, nullable
  - `size` integer, nullable
  - `fiscal_year_hint` integer, nullable
  - `uploaded_by` string, nullable
  - `status` 'pending' | 'processing' | 'done' | 'failed', required
  - `error` string, nullable
  - `doc_types_found` string[], nullable
  - `result_summary` object, nullable
  - `created_at` string, date-time, required
  - `processed_at` string, date-time, nullable
  - `fault` IngestFaultOut: Why an ingest record failed or is parked, and what removes the cause.
    - `code` 'transient' | 'quota_held' | 'defect_fixed' | 'platform_defect' | 'bytes_gone' | 'too_large' | 'unreadable' | 'unexplained' | 'unsupported_type' | 'parse_error' | 'format_unknown' | 'not_a_statement' | 'no_account_id' | 'nothing_readable' | 'no_statement_found' | 'fiscal_year_undeterminable' | 'corrupt_archive' | 'empty_archive' | 'ambiguous_tabular' | 'analysis_failed' | 'statement_format_not_importable' | 'statement_beside_invoice' | 'statement_beside_card_bill' | 'accounting_document_not_importable' | 'statement_import_failed' | 'archive_incomplete' | 'encrypted' | 'corrupt' | 'limit_exceeded' | 'ratio' | 'depth_exceeded' | 'empty' | 'archive_no_connection' | 'archive_connection_disabled' | 'archive_reconnect_required' | 'archive_no_template' | 'archive_upload_failed' | 'triage_unrelated' | 'triage_needs_review' | 'triage_irrelevant', required: The closed vocabulary. The SPA has exactly one row per member (a test enforces it).
    - `retry` 'auto' | 'user' | 'none', required: Whether running the same operation again can change the outcome.
    - `actions` IngestFaultAction[], required
    - `params` object

## 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)
