Skip to content
Navigation

Compose a document from a template and data

Renders one of your saved compose templates with the data you pass, and gives you back a PDF.

template is the config id or slug from POST /v1/compose/configs. data is validated against that template's JSON Schema BEFORE anything renders, so a missing field costs you a 422 with the exact instance paths, not a broken document.

{ "template": "invoice", "data": { "customer": "Acme", "total": 1240 } }

output decides what comes back:

  • file (the default) stores the PDF in your corpus and returns the file object, with the templateHash of the exact bundle that produced it.
  • raw streams the PDF bytes straight back and stores nothing.

Learn more: Compose

POST
https://api.cloudraker.com/v1/spaces/{spaceId}/compose
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
  • data
    map of
    unknown
    required
  • output
    optional
    file
    or
    raw

Returns

200

The PDF bytes (output: "raw" only — nothing was stored).

201

The composed file (output: "file", the default).

JSON
  • 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.

422

The data does not satisfy the template schema (invalid_data, with errors[]), the template has no main/files (config_incomplete), or it failed to compile (template_render_failed).

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