---
title: "Regenerate Invoice Pdf"
method: POST
path: "/api/v1/admin/payments/{payment_id}/regenerate-invoice-pdf"
tags: ["admin-payments"]
---

# Regenerate Invoice Pdf

`POST /api/v1/admin/payments/{payment_id}/regenerate-invoice-pdf`

Regenerate the invoice PDF synchronously and return the fresh invoice.

Applies any requested tax-mode / post-tax line-item adjustments (gated to
PO + unpaid invoices), then re-renders the invoice PDF **inline** and
overwrites the existing object at the same R2 key. Because the render
completes before this returns, the response carries the up-to-date invoice
(with a freshly-signed PDF URL) and the next download is guaranteed current
— no client-side polling for ``pdf_generated_at`` to advance. Useful after
template changes (e.g. adding the Remit To block) or after corrections to
quote line items on an already-issued invoice.

``exclude_tax`` (optional) flips the invoice's tax mode before
re-rendering — ``true`` removes tax, ``false`` restores it from the
Payment. ``additional_line_items_post_tax`` (optional body) replaces the
invoice's post-tax extras (``[]`` clears, omitted = unchanged). Both are
gated to PO + unpaid invoices. Omit both to re-render unchanged.

Requires ``payments:edit`` permission.

## Path parameters

- `payment_id` string, uuid, required

## Query parameters

- `exclude_tax` boolean, nullable

## Request body

- InvoiceLineItemsBody — Optional request body for issue / regenerate-invoice endpoints carrying admin-entered post-tax line items (shipping, expedite, …). ``additional_line_items_post_tax`` semantics on **regenerate**: ``None`` (field omitted) leaves the invoice's stored items unchanged; ``[]`` clears them; a non-empty list replaces them. On **issue**, ``None``/omitted = no extras.
  - `additional_line_items_post_tax` AdditionalLineItemInput[], nullable
    - `label` string, required
    - `quantity` integer, nullable — Optional display quantity for admin-entered misc line items. When set, the PDF shows the quantity alongside the label. The amount remains the line amount, not a unit price.
    - `amount` union, required
      - number
      - string

## Response `200`

Successful Response

- InvoiceResponse — Invoice summary returned in payment detail views. ``invoice_number`` is the sequential accounting identifier (``INV-YYYY-NNNNN``) and stays stable in the DB for accounting reconciliation. ``display_number`` is the project-derived short form (``INV-{project_id_first8}``) shown in the UI and on PDFs so quote + invoice + project share a visually-consistent identifier. Backend resolves ``display_number`` at response build time — frontends should prefer it for display and only surface ``invoice_number`` if accounting context is needed.
  - `id` string, uuid, required
  - `payment_id` string, uuid, required
  - `project_id` string, uuid, required
  - `invoice_number` string, required
  - `display_number` string, nullable
  - `status` string, required
  - `amount` string, required
  - `subtotal` string, nullable
  - `tax_amount` string, nullable
  - `tax_rate` string, nullable
  - `tax_excluded` boolean
  - `additional_line_items_post_tax` AdditionalLineItemOutput[], nullable
    - `label` string, required
    - `quantity` integer, nullable — Optional display quantity for admin-entered misc line items. When set, the PDF shows the quantity alongside the label. The amount remains the line amount, not a unit price.
    - `amount` string, required
  - `currency` string, required
  - `issued_at` string, date-time, nullable
  - `paid_at` string, date-time, nullable
  - `invoice_pdf_url` string, nullable
  - `pdf_generated_at` string, date-time, nullable
  - `notes` string, nullable
  - `created_at` string, date-time, required
  - `updated_at` string, date-time, required

## Other responses

- `422` — Validation Error

---

[API](https://skmtc.dev/prototyping/apis/prototyping-io-api.md) · [All operations](https://skmtc.dev/prototyping/apis/prototyping-io-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/prototyping/prototyping-io-api/revisions/f4a0079fbb57/schema)
