latestOpenAPI 3.0.02026-08-102413.0 KB

ce258d1167ca

PDF

Fill a PDF template

Fills a PDF template (Cast) with the provided data and returns the resulting PDF.

Templates are created and managed in the Anvil dashboard or via the GraphQL createCast mutation. Each template defines named fields (text, date, checkbox, signature, etc.) that can be populated via this endpoint. The field data can be supplied as a flat object keyed by field ID or alias, or as an array of objects for multi-page repeating templates.

Supports both JSON and multipart/form-data request bodies. When using multipart/form-data, string values for fontSize and page are automatically parsed.

Requires API key (Basic auth) or OAuth authentication. Development API keys produce watermarked PDFs; production keys produce clean PDFs and count toward your plan's usage.

post/api/v1/fill/{castEid}.pdf

Path parameters

castEidstring required

The EID (external identifier) of the PDF template (Cast) to fill.

Query parameters

versionNumberinteger

The version number of the template to use. If omitted, the latest published version is used. Use this to pin fills to a specific template revision.

Request body

titlestring

Custom title for the generated PDF. Overrides the template's default title.

textColorstring

Default text color for all fields, as a CSS hex color (e.g. #FF0000).

fontSizeinteger

Default font size in points for all fields.

fontFamilystring

Default font family name for all fields.

borderColorstring

Default border color for field bounding boxes, as a CSS hex color.

verticalAlignment'top' | 'middle' | 'bottom'

Default vertical alignment for text within fields.

defaultCheckboxCharacterstring

The character used to represent a checked checkbox.

defaultMakeCheckboxSquareboolean

When true, checkbox fields are rendered as squares instead of the default shape.

useInteractiveFieldsboolean

When true, the filled PDF will contain interactive AcroForm fields that can be edited by the recipient in a PDF viewer. Requires a paid plan.

drawDebugBoxesboolean

When true, draws visible bounding boxes around each field for debugging layout issues.

stripAnnotationsboolean

When true, removes all PDF annotations from the output.

defaultReadOnlyboolean

Controls whether interactive AcroForm fields default to read-only. Only applicable when useInteractiveFields is true. Defaults to false when useInteractiveFields is enabled.

outputFormat'pdf' | 'url'

Controls the response format. When set to url, the filled PDF is uploaded to cloud storage and a JSON response with a short-lived signed URL is returned instead of the binary PDF. The signed URL expires 5 minutes after generation. Defaults to pdf (binary PDF response).

Response

The filled PDF document.