Templates

Add a field to the template

post/api/v1/templates/{id}/fields

Request

  • Base URL: https://api.korala.ai
  • URL: https://api.korala.ai/api/v1/templates/{id}/fields
  • Auth: one of:
    • API key in header X-API-Key
    • bearer (a scheme the document does not define)

Path parameters

idstring required

Request body

valueKeystring

Links repeated text fields for the same signer. Signer edits or clears one occurrence to update every field with this valueKey. Independent of the merge variable used for prefills.

signerRoleIdstring

Signer role ID (optional for non-signing fields)

fieldType'signature' | 'initials' | 'date' | 'text' | 'checkbox' | 'dropdown' | 'radio' required
placement'coordinate' | 'anchor' | 'bookmark'
pageNumbernumber

1-based page number (coordinate mode). Use -1 for the last page. Ignored for anchor placement.

xPositionnumber

Required for coordinate placement; ignored for anchor.

yPositionnumber

Required for coordinate placement; ignored for anchor.

widthnumber required

Field box width in points. Korala fits a signature image inside the box, preserving its aspect ratio, then centres it, so a wide box scales the signature by width and leaves vertical padding. The box bounds the ink; it does not size it.

heightnumber required

Field box height in points. Text, date and dropdown values render left-aligned with 4pt padding, centred against the box height, at min(12, height * 0.6) points.

requiredboolean
mergeFieldNamestring
defaultValuestring
editableboolean

Treat a value resolved from variables or defaultValue as a suggestion: the generated field stays unfilled and the signer can change the value before signing. Applies to text, date, and checkbox fields.

sharedFillboolean

One signer role owns the generated field, but until that signer signs any signer able to act may fill or correct it. Refused on signature and initials fields.

signingDateboolean

Date fields only. True fills the field with the date the signer signs: the signing page shows today and the signer does not type it. False makes it an ordinary date the signer enters. Refused on any other type. Copied onto every document made from the template.

labelstring

Human-readable label shown to the signer for this field

acroFieldNamestring

Fully-qualified name of an embedded AcroForm field in the base PDF (see GET /templates/{id}/form-fields). When set, generated document fields inherit the link and values are written through the PDF form field at completion — comb boxes, checkboxes, and length limits render natively — instead of being overlay-stamped.

acroOptionValuestring

For radio-group AcroForm fields: the option (export value) this field selects when checked.

optionsstring[]

Allowed values for dropdown fields. The signer picks one; fills with a value outside this list are rejected.

maxLengthnumber

Maximum characters accepted at fill time. Imported automatically from AcroForm comb fields by detection.

inputMaskstring nullable

Single-line signer input mask. Each # accepts one digit; Korala inserts every other character as a literal.

validationPatternstring

Regular expression the filled value must match (text and date fields). Rejected fills return validationMessage.

validationMessagestring

Signer-facing error when validationPattern does not match

dateFormatstring

Date fields only: format the auto-filled date is rendered in. Combines D/DD, M/MM, and YY/YYYY tokens with a consistent "-", "/", or "." separator. Copied onto generated document fields.

fontSizenumber

Point size the value is drawn at, copied onto generated document fields. Imported automatically from the base PDF's form fields; omit to fit the size to the box.

textColorstring

Color the value is drawn in, as #rrggbb

textAlign'left' | 'center' | 'right'

Horizontal alignment of the value inside the field box

fontFamilystring

Base font the value is drawn in, copied onto generated document fields. Imported from the base PDF's form fields; honored when the platform can render that face, otherwise the default font is used.

multilineboolean

Whether the value may contain line breaks. Imported from multiline PDF form fields and copied onto generated document fields.

groupKeystring

Semantic group key. Checkbox members sharing a groupKey are mutually exclusive (checking one clears the others) even with distinct PDF fill targets — e.g. a W-9 federal tax classification.

groupRequiredboolean

Require at least one member of this field's group to be selected before signing can complete.

requiredWhenFieldIdstring uuid

Make this field conditionally required: on generated documents it must be filled before signing only while the referenced template field (same template, same signer role) is checked/filled — e.g. a W-9 LLC tax-classification code required only when the LLC box is checked. Refused on choose-one group members.

requiredWhenValuestring

Narrow the condition to an exact value of the referenced field. Omit to trigger on any checked/filled state.

anchorTextstring

Literal string to locate in the rendered document for anchor placement. A field is placed at EVERY occurrence. Required when placement is "anchor". Must not contain {{ }} (reserved for merge fields). Hiding a marker (white text, or hideAnchor) leaves it in the PDF text layer, where it survives into the signed document. Anchor on text that already belongs in the document when the output must carry no implementation markers.

anchorPosition'replace' | 'left' | 'right' | 'above' | 'below'
anchorOffsetXnumber

Horizontal offset in points applied after anchor resolution. Positive moves the field right, negative left.

anchorOffsetYnumber

Vertical offset in points applied after anchor resolution. Coordinates are top-left origin, so positive moves the field DOWN the page and negative moves it UP.

hideAnchorboolean

Draw a white rectangle over each visible anchor marker after resolving it (use when the anchor text is not already invisible). This hides the marker without removing it: the anchor string stays in the PDF text layer, where pdftotext, copy-paste, search and indexing still surface it in the signed document.

anchorMatchWholeWordboolean

Match anchorText only at word boundaries. Off by default, because matching has always been a plain substring search and tightening it would silently drop fields that resolve today. Turn it on for short anchors: "By:" otherwise also matches inside "Standby:".

bookmarkNamestring

Word bookmark whose position locates this field. Required when placement is "bookmark", and DOCX templates only. A bookmark carries a position without carrying text, so unlike an anchor it leaves nothing in the PDF text layer, and Word keeps names unique so it always resolves to exactly one position. Use letters, digits and hyphens: the converter rewrites every other character to a hex code, so "Sig_Seller" is stored as "Sig5FSeller" and could collide with a bookmark of that literal name.

Example request

{
  "pageNumber": 1,
  "xPosition": 100,
  "yPosition": 200,
  "width": 200,
  "height": 50,
  "required": true,
  "mergeFieldName": "client_name",
  "defaultValue": "Default value",
  "signingDate": true,
  "label": "Your full name",
  "acroFieldName": "topmostSubform[0].Page1[0].f1_01[0]",
  "acroOptionValue": "married",
  "options": [
    "CA",
    "NY"
  ],
  "maxLength": 11,
  "inputMask": "###-##-####",
  "validationPattern": "^\\d{3}-\\d{2}-\\d{4}$",
  "validationMessage": "Enter your SSN as XXX-XX-XXXX",
  "dateFormat": "MM-DD-YYYY",
  "fontSize": 9,
  "textColor": "#000080",
  "fontFamily": "Helvetica-Bold",
  "groupKey": "fed_tax_class",
  "groupRequired": true,
  "requiredWhenValue": "Other",
  "anchorText": "Fund Lead Signature:",
  "bookmarkName": "SigSeller"
}

Response

valueKeystring nullable

Repeated text value key, scoped to the owning signer.

idstring required
templateIdstring required
signerRoleIdstring nullable
fieldType'signature' | 'initials' | 'date' | 'text' | 'checkbox' | 'dropdown' | 'radio' required
placement'coordinate' | 'anchor' | 'bookmark' required
pageNumbernumber required

1-based page number, or -1 for last page.

xPositionnumber nullable
yPositionnumber nullable
widthnumber required
heightnumber required
requiredboolean required
mergeFieldNamestring nullable
defaultValuestring nullable
editableboolean required

When true, a prefilled value is a suggestion the signer can change before signing.

sharedFillboolean required

One signer role owns the generated field, but until that signer signs any signer able to act may fill or correct it. Never true on signature or initials fields.

signingDateboolean nullable

Date fields only. True fills the field with the date the signer signs: the signing page shows today and the signer does not type it. False makes it an ordinary date the signer enters. Refused on any other type. Null on a date made before the flag existed: a date on the signer’s own signature line is then the date of signing.

labelstring nullable

Human-readable label shown to the signer for this field

acroFieldNamestring nullable

Embedded AcroForm field this field is linked to; generated document fields inherit the link.

acroOptionValuestring nullable

For radio-group AcroForm fields: the option this field selects.

optionsstring[] nullable

Allowed values for dropdown fields

maxLengthnumber nullable

Maximum characters accepted at fill time

inputMaskstring nullable

Input mask where # represents one digit

validationPatternstring nullable

Regex the filled value must match

validationMessagestring nullable

Signer-facing error when validationPattern does not match

dateFormatstring nullable

Date fields only: format the auto-filled date is rendered in, e.g. 'MM-DD-YYYY'

fontSizenumber nullable

Point size the value is drawn at, copied onto generated document fields. Null fits the size to the box.

textColorstring nullable

Color the value is drawn in, as #rrggbb

textAlign'left' | 'center' | 'right'

Horizontal alignment of the value inside the field box

fontFamilystring nullable

Base font the value is drawn in, copied onto generated document fields

multilineboolean required

Whether the value may contain line breaks (a multiline form field)

groupKeystring nullable
groupRequiredboolean required

Whether at least one member of this group must be selected

requiredWhenFieldIdstring uuid nullable

Id of the template field whose checked/filled state makes this field required on generated documents; null when unconditional

requiredWhenValuestring nullable

Exact controller value the condition triggers on; null means any checked/filled state

anchorTextstring nullable
anchorPosition'replace' | 'left' | 'right' | 'above' | 'below' required
anchorOffsetXnumber required
anchorOffsetYnumber required
hideAnchorboolean required
anchorMatchWholeWordboolean required
bookmarkNamestring nullable
createdAtstring date-time required
updatedAtstring date-time required

Example response

{
  "inputMask": "###-##-####",
  "fontSize": 9,
  "textColor": "#000080",
  "fontFamily": "Helvetica-Bold"
}

Changes

No recorded changes to this operation across all 1 revision of this API.