> ## Documentation Index
> Fetch the complete documentation index at: https://apidocs.royalti.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Build a draft statement from an Add-files table

> **POST /publisher/statements/from-files**

> [!NOTE]
>
> This endpoint requires authentication. Include your Bearer token in the Authorization header.

## Description

**POST /publisher/statements/from-files**

Builds one draft statement from one processed table and writes its lines, matched to works where that can be done without guessing. It never posts to the ledger.

Body: `sourceId`, `tableName` (`<prefix>_YYYYMM`), `publisherId`, `payeeMode` (`publisher` or `writer_collected`; `writer_at_source` is refused with 422 `PAYEE_MODE_NOT_AVAILABLE_YET` until the paid-at-source display ships), `dryRun` (preview, nothing written) and `replace` (rebuild an existing draft in place).

The same society-month cannot be booked twice, nor alongside a statement entered through Reconcile. A rebuild is refused once the statement is posted or no longer a draft, and the payee mode cannot change after any posting. A BigQuery error writes nothing.

**Authorization:** `admin` role + `publisher` capability enabled.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.