Skip to content
Navigation

Compose many documents from one template

Renders the same template once per item — a run of invoices, contracts or letters from one call.

Every item's data is validated first. If ANY item fails, nothing renders and the call answers 422 with an errors[] naming the failing item indexes and instance paths: a half-finished batch is worse than none.

{
  "template": "invoice",
  "items": [
    { "name": "acme-0042", "data": { "customer": "Acme", "total": 1240 } },
    { "name": "globex-0043", "data": { "customer": "Globex", "total": 990 } }
  ]
}

output decides what comes back:

  • files (the default) stores each PDF and returns the list. An item's name names its file (<name>.pdf); without one the files are numbered from the template slug.
  • zip stores ONE archive holding every PDF and returns that single file.

A name must be a bare file name — no /, no \, no .., no leading dot — and two items may not end up with the same file name.

Learn more: Compose

POST
https://api.cloudraker.com/v1/spaces/{spaceId}/compose/batch
Try it
Path parameters
Request body
Live API request

This request can change data or incur charges for the selected organization.

Authorization

  • bearerAuth
    HTTP
    required

Path parameters

  • spaceId
    string
    required

Request body JSON required

  • template
    string
    required
    minLength: 1
  • items
    array of
    object
    required
    • data
      map of
      unknown
      required
    • name
      optional
      string
      maxLength: 200 · minLength: 1
  • output
    optional
    files
    or
    zip

Returns

201

The composed files, or the single zip file.

JSON
  • object
    string
    required
  • data
    array of
    object
    required
    • object
      string
      required
    • id
      string
      required
    • name
      string
      required
    • mimeType
      string
      required
    • status
      uploading
      or
      processing
      or
      ready
      or
      failed
      required
    • createdAt
      string
      required
    • parentFileId
      optional
      string
    • metadata
      optional
      map of
      string
    • error
      optional
      string
    • uploadUrl
      optional
      string
    • uploadExpiresAt
      optional
      string
    • urls
      optional
      object
      • content
        optional
        string
      • markdown
        optional
        string
      • json
        optional
        string
    • composeTemplate
      optional
      string
    • templateHash
      optional
      string
    • composedAt
      optional
      string

400

The reference is not a compose template (capability_mismatch).

404

Unknown template.

413

The rendered documents exceed the per-call output limit (output_too_large) — split the batch.

422

At least one item fails the template schema (invalid_data, with errors[] carrying index), two items share a file name (duplicate_item_names), an item name is not a bare file name (invalid_item_name), or the template is incomplete or failed to compile.

429

Rate limited. The /v1 API allows at least 67 requests per minute per organization (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the Retry-After interval and retry — the error is retryable.
JSON
  • code
    rate_limited
    required
  • message
    string
    required
  • retryable
    true
    required
  • requestId
    string
    required
  • docUrl
    optional
    string

Type to search…

↑↓ navigate↵ selectEsc close