Skip to main content
POST
Bulk-import many statement files for a publisher in one call
This endpoint requires authentication. Include your Bearer token in the Authorization header.

Description

POST /publisher/publishers//statements/bulk-import Multipart upload of up to 50 files (field name files, 25 MB each, any mimetype) — one PublisherStatement shell + its PublisherStatementLine rows created per file. Per file, the service infers the statement period from (in priority order) an explicit periodOverrides entry, a filename token (Q4 2025, 2026-01, YYYY-MM-DD..YYYY-MM-DD), or content (a usable sale-date column) — a file with none of the three fails with periodSource: "none". Contributor/writer matching runs per file via alias map or filename, reported as writer.via. mapping (per-fileName column mapping, or a single mapping applied to every file), aliasConfirmations (alias -> CWRWriter.id, persisted onto the publisher’s settings.ingestDefaults.aliasMap for future runs), and periodOverrides ({ [fileName]: token }) are optional JSON values — since multipart fields arrive as strings, each may be sent either as a pre-parsed JSON body value or as a JSON-encoded string. Partial failure is normal: the response is 201 whenever at least one file imported, and 422 only when every file in the batch failed. Check summary.failed/each result’s status rather than relying on the HTTP status alone. Authorization: admin role + publisher addon.

Code Examples

Authorizations

Authorization
string
header
required

JWT Authorization header using the Bearer scheme. Format: "Bearer {token}"

Path Parameters

id
string<uuid>
required

Publisher ID that owns the imported statements.

Body

multipart/form-data
files
file[]
required

Statement files, field name files. Max 50 files, 25 MB each.

Maximum array length: 50
mapping

Per-fileName ManualColumnMapping, or a single mapping applied to every file. Object or JSON-encoded string.

currency
string

Statement currency for shells created this run. Falls back to the publisher's default, then USD.

aliasConfirmations

{ [alias]: CWRWriter.id }. Object or JSON-encoded string.

periodOverrides

{ [fileName]: periodToken } — token forms 'Q4 2025', '2026-01', or 'YYYY-MM-DD..YYYY-MM-DD'. Object or JSON-encoded string. Wins over filename and content inference.

Response

At least one file imported (some may still have failed — check summary).

Standard server envelope used by the statement, reconciliation, sub-publishing, and analytics endpoints.

status
enum<string>
Available options:
success,
error
message
string
data
object