Bulk-import many statement files for a publisher in one call
POST /publisher/publishers//statements/bulk-import
Description
POST /publisher/publishers//statements/bulk-import Multipart upload of up to 50 files (field namefiles, 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 capability enabled.
Code Examples
Authorizations
JWT Authorization header using the Bearer scheme. Format: "Bearer {token}"
Path Parameters
Publisher ID that owns the imported statements.
Body
Statement files, field name files. Max 50 files, 25 MB each.
50Per-fileName ManualColumnMapping, or a single mapping
applied to every file. Object or JSON-encoded string.
Statement currency for shells created this run. Falls back to the publisher's default, then USD.
{ [alias]: CWRWriter.id }. Object or JSON-encoded string.
{ [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.