API Schema Reference
The canonical API route is POST /api/v1/render.
The request body is a single DocumentRequest JSON object.
Root: DocumentRequest
| Field | Type | Required |
|---|---|---|
settings | Settings | No |
pages | Page[] | Yes |
header | Section | No |
footer | Section | No |
Page Sizing
Each page must define its physical size in exactly one of these ways:
- Explicit millimeters:
width+height - Preset size:
size
Rules:
sizeandwidth/heightare mutually exclusivewidthandheightmust be provided together- Preset matching is case-insensitive
Supported preset values:
a4a6letterlegallabel_100_100label_100_150label_4_6_in
Section (header / footer)
header and footer share the same shape:
height: numberin mmelements: Element[]
Behavior:
headeris repeated on every pagefooteris repeated on every pageheaderelements render in absolute page coordinatesfooterelements render with a bottom offset ofpage.height - footer.heightfooter.heightreduces the available body height for paginationheaderdoes not automatically push body elements down- optional
settings.page_margin/pages[].margindefine a body content box - when page margins are configured, body
x/ybecome relative to the content box - body elements outside the content box fail validation
Settings
| Field | Type |
|---|---|
defaults | Defaults |
metadata | Metadata |
output | OutputSettings |
profile | string |
page_margin | PageMargin |
Defaults uses unified style objects:
text: TextStylestroke: StrokeStylefill: FillStyleshape: ShapeDefaults
OutputSettings
mode:binaryorfile(response presentation mode)file_name: optional custom file name used in bothbinaryandfilemodes- default behavior is
binary - both modes return PDF bytes
binaryusesContent-Disposition: inline; filename="..."fileusesContent-Disposition: attachment; filename="..."- missing
file_namefalls back togPdf-MMDDHHmmssSSS.pdf
Element Types
elements[] is a tagged union by type:
textbarcodelinerectcircleellipsepolygonlinkimagetablestack
Image payloads currently support:
- Raster:
jpg/jpeg/png/webp - Vector image payloads:
svg
Barcode format values are case-insensitive, and - / _ are treated as equivalent separators.
Supported barcode formats in the current build:
- 2D / matrix:
qrcode(qr),microqr(micro-qr),pdf417,micropdf417(micro-pdf417),datamatrix(data-matrix),gs1datamatrix(gs1-datamatrix,gs1_datamatrix),aztec,maxicode,gs1qrcode(gs1-qrcode,gs1_qr,gs1-qr) - 1D / linear:
code128(code-128),code128a(code-128a),code128b(code-128b),code128c(code-128c),gs1128(gs1-128),code39(code-39),code93(code-93),codabar,ean8(ean-8),ean13(ean-13),upca(upc-a),upce(upc-e),itf(interleaved2of5),itf14(itf-14),gtin8(gtin-8),gtin12(gtin-12),gtin13(gtin-13),gtin14(gtin-14),isbn(isbn-13),sscc(sscc-18) - Other business formats:
msi(msi-plessey),msi10(msi-10),msi11(msi-11),msi1010(msi-1010),msi1110(msi-1110),upus10(s10),uspsimb(usps-imb,intelligent-mail),upcacomposite(upca-composite),upcecomposite(upce-composite)
stack
- body-only flow element for
tablefollowed by one or moreblocks children[0]must betable- later children must be
block gapis the vertical distance between the table's final bottom and the next block's start
block
- follow-up content group used inside
stack - no own
x/y/width/height - child
xkeeps current body semantics - child
yis relative to the block start - cannot nest
table/stack/block
x_anchor
- supported by
text,barcode,rect,image, andlink - mutually exclusive with
x - supports
page_*andcontent_*references everywhere - supports
table_left/table_rightonly insidestack -> block textrequires width whenx_anchoris used:- plain text /
spansshorthand usestyle.width - block text uses
frame.width
- plain text /
Unified Vector Styling
Vector elements use the same schema:
stroke: StrokeStylefill: FillStyle
This is shared by line / rect / circle / ellipse / polygon. Table borders also use the same StrokeStyle model for grid.top/right/bottom/left/horizontal/vertical and cell.borders.
StrokeStyle includes optional compound for compound strokes. The currently supported kind is double.
Hyperlink Model
- Attached links:
text/barcode/line/rect/circle/ellipse/polygon/imagesupport optionallink: LinkSpec - Independent hotspots:
type: "link"supports area-based click targets without visible graphics LinkSpec.targetsupports:- URL:
{ "type": "url", "url": "https://..." } - Page destination:
{ "type": "page", "page": 2, "x": 10, "y": 20 }
- URL:
- URL schemes are restricted to
http,https,mailto,tel - Invalid link fields fail validation instead of being silently ignored
Text Typography
public
textaccepts three input forms:- plain text shorthand
- rich
spansshorthand - block text
all three forms are handled consistently during validation and rendering
block text is the most complete and recommended form
text.rotationaccepts arbitrary integer degree valuesimage.rotationaccepts arbitrary degree valuesbarcode.rotationand barcode-attached text currently support only0/90/180/270for
POST /api/v1/render, onlysystem.pageandsystem.total_pagesare publicly guaranteed built-in variablesif you need business-data substitution, use
POST /api/v1/template-rendercomputedis not currently exposed as a public capability_ifis template metadata and is not evaluated byPOST /api/v1/renderfont_familyomitted or empty:- the current style keeps inheriting the parent font intent
- if no explicit font exists in the chain, the engine uses automatic fallback mode
font_familypresent andfont_modeomitted:- effective mode is
strict
- effective mode is
font_mode = "strict":- explicit font must cover the current scope
font_mode = "prefer":- explicit font is preferred, but fallback is still allowed
font_weightsupportsnormal | medium | semibold | boldfont_stylesupportsnormal | italicin
strict, the requested weight/style must resolve to a real facein
preferand automatic mode, the engine prefers the requested weight/style, then may fall back to the nearest usable facefont_modecannot appear without a same-levelfont_familyPublic requests should only use
strictandpreferletter_spacingis a single numeric multiplieromitted
letter_spacingmeans no extra tracking0means no extra trackingvalues above
0apply uniform tracking based on a fixed0.2emstepexamples:
0.2=0.04em1=0.2em1.12=0.224em2=0.4em
automatic tracking is not supported
background,decoration, andlink_styleare object fields onTextStylebackground.paddinguses logical directions:inlineblock- optional start/end overrides
there is no separate background preset enum;
Square,Soft, andCapsuleare parameter combinationsrecommended defaults:
badgeusesSquarehighlightusesSoftCapsuleis optional, not the default
span.stylemay override typography fields, but not box layout fields such aswidth,height, or alignment
Table Schema
The only supported public table schema is centered on:
columnsrowscellheaderrow_headerbodygridpagination
Key rules:
- row headers are modeled as
columns[].role = "row_header" grid.top/right/bottom/left/horizontal/verticalacceptStrokeStylecolumns[].widthis always a width object:fixed,percent, orautopercentandautorequiretable.width- grouped headers live in
header.rows; leaf headers still usecolumns[].header - complex body cells use
content; grouped header cells andcolumns[].headershare the same text contract (string | number | boolean | null | BlockTextContent) TableCellStylesupportscontent_offset_x/content_offset_y- row objects may only contain keys declared in
columns[].key - legacy lightweight payloads such as
data/layout/theme/row_headers/corner/style_overridesare no longer part of the public API
Notes
- Deprecated payloads (
LabelRequest[],pdf_params,items,1d_params,2d_params) are not part of the current public schema. - Service defaults are applied automatically when the request omits a field.
- See JSON 数据结构 for complete field-level details.