Skip to main content
POST
This endpoint requires authentication. Include your Bearer token in the Authorization header.

Description

POST /cwr/export Description: Loads the publisher (with PublisherTerritory rows), the tenant’s CWRWork rows (optionally filtered to workIds) with their writer links, and generates a CWR file at the requested version. Works with no writer links, NULL relative shares, or bootstrap-seeded skeletons are excluded from the file and reported back in excludedWorks — never silently dropped. On success the rendered CWR text is persisted through the File + Cloud Storage pipeline and a CWRExportJob row is created with status: completed and resultFileId set. Poll GET /cwr/status/{publisherId} for the job list and download the bytes via GET /cwr/jobs/{jobId}/download. The legacy synchronous streaming path (?stream=true) has been removed; it never produced valid work registrations or trailer counts. A request with ?stream=true returns 400. Authorization:
  • Required role: admin or higher
Method: POST

Code Examples

Authorizations

Authorization
string
header
required

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

Body

application/json
publisherId
string<uuid>
required

Publisher owning the works to export. Must belong to the caller's tenant.

version
enum<string>
required

CWR file-format version to render. Only the 2.x family is emittable — CWR 3.0/3.1 are a different specification (different transaction structure and record layouts) and are rejected with 400.

Available options:
2.1,
2.2
workIds
string<uuid>[]

Optional subset of work ids to export. Omit to export all exportable works for the publisher's tenant.

_options
object

Reserved for future export options. Currently unused by the export path.

Response

Export job created and completed synchronously (the async job flow renders and persists the file before responding)

job
object

CWRExportJob row. Filters, configId, and templateId are provisioned automatically on first use for a tenant.

excludedWorks
object[]

Works excluded from the export (no writer links, NULL relative shares, bootstrap-seeded skeletons). Never silently dropped — always reported.

excludedCount
integer