HTML Fields
HTML fields enable you to create custom-styled document sections using HTML and CSS. These API-only fields provide advanced formatting control beyond the standard TEXT field, allowing precise control over document appearance.Overview
HTML fields allow you to add custom-styled content to documents with full control over HTML structure and CSS styling. Unlike the TEXT field (which uses the Tiptap editor format), HTML fields accept raw HTML and are perfect for:- Branded headers and footers - Add logos, colors, and custom layouts
- Custom-styled sections - Create professional document layouts with precise styling
- Image-rich content - Embed images from URLs or inline base64
- Complex layouts - Use tables, multi-column layouts, and advanced CSS
Key Features
- API-Only Access - Not visible in the UI editor, only via REST API
- Automatic Sanitization - HTML is sanitized server-side for security
- Safe Subset of HTML - Formatting tags and links allowed (no scripts; links restricted to http, https, mailto, tel)
- Inline CSS Styling - Full control over colors, fonts, spacing, borders
- Image Support - HTTP/HTTPS URLs and base64 data URIs
- PDF-Ready - Renders perfectly in generated PDF documents
When to Use HTML Fields
Use HTML fields when you need:- Precise visual control - Exact colors, spacing, and layout
- Brand consistency - Match your company’s visual identity
- Complex layouts - Multi-column sections or advanced tables
- Embedded images - Logos, signatures, or diagrams
- Simple rich text - Basic formatting with the Tiptap editor
- UI editing - Content editable in the dashboard
- Collaborative editing - Multiple users editing in the UI
Creating HTML Fields
Field Properties
When creating an HTML field, you can specify the following properties: type (string, required)- Must be
"HTML"
- Determines the order fields appear in the document (0-based index)
- If omitted, the field is appended to the end
- Use to control field ordering when creating multiple fields
- Unique key identifier for API access
- Must match pattern:
^[a-z0-9_-]*$(lowercase letters, numbers, underscores, hyphens) - Allows referencing the field via API using
key:prefix (e.g.,/api/v1/documents/{docId}/fields/key:header-section)
- type (string, required) - Must be
"HTML" - content (string, required) - The HTML content string
Basic Example
Create a document with an HTML field containing styled content:fieldId for each created field, which you can use to reference the field in subsequent API calls (e.g., updating or deleting the field).
Complete Example with All Properties
Multiple Fields with Position Control
When creating multiple HTML fields, useposition to control their order:
Document Style Settings
Documents support layout and appearance configuration through thedocumentStyle parameter. This controls document-level settings like orientation, padding, and background color.
Configuring Document Styles
When creating or updating a document, you can specify layout and style settings:Supported Properties
ThedocumentStyle object supports the following properties:
orientation (string)
PORTRAIT- Default orientation (816x1054px)LANDSCAPE- Landscape orientation (1054x816px)
true- Shows padding around document content (default)false- Content fills entire page edge-to-edge
- Background color in hex format (e.g.,
#ffffff,#f8f9fa) - Default:
#ffffff(white) - Must be a valid 6-character hex color
Combining with HTML Field Styles
ThedocumentStyle settings control the document canvas, while HTML field inline styles control content appearance. Use them together:
- documentStyle - Document orientation, page padding, page background
- HTML inline styles - Text colors, fonts, spacing, borders, content layout
Allowed HTML Tags
HTML fields support a safe subset of HTML tags for formatting and layout. All HTML content is automatically sanitized server-side.Text Formatting
<p>,<span>,<div>- Basic containers<b>,<strong>- Bold text<i>,<em>- Italic text<u>- Underlined text<s>- Strikethrough text<mark>- Highlighted text<small>,<sub>,<sup>- Size and position
Headings
<h1>,<h2>,<h3>,<h4>,<h5>,<h6>- All heading levels
Lists
<ul>- Unordered lists<ol>- Ordered lists<li>- List items
Tables
<table>,<thead>,<tbody>,<tfoot>- Table structure<tr>,<td>,<th>- Table rows and cells<caption>- Table caption
Images
<img>- Images withsrc,alt,width,height,titleattributes
Links
<a>- Links withhref,target,rel,title(allowed schemes: http, https, mailto, tel only; dangerous schemes like javascript:, data:, vbscript: are stripped; all links forced totarget="_blank"andrel="noopener noreferrer"for security)
Other
<br>,<hr>- Line breaks and horizontal rules<blockquote>- Quoted text<pre>,<code>- Code blocks
Allowed Attributes
All elements:style- Inline CSS stylesclass- CSS class names
<img>):
src- Image source (HTTP/HTTPS URLs or data URIs)alt- Alternative textwidth,height- Dimensionstitle- Image title
<table>:border,cellpadding,cellspacing,width<td>,<th>:colspan,rowspan,align,valign
<p>,<div>,<h1>through<h6>:align
<a>):
href- URL (http, https, mailto, tel only)target- Forced to_blankfor securityrel- Forced tonoopener noreferrerfor securitytitle- Link title
Not Allowed
The following tags are automatically removed for security:<script>- JavaScript (XSS protection)<iframe>- Embedded content<form>,<input>- Form elements<style>- Style tags (use inline styles instead)
Allowed CSS Properties
CSS can only be applied via inlinestyle attributes on elements. The following properties are supported:
Colors
color- Text color (hex, rgb, rgba)background-color- Background colorbackground- Background shorthand
Typography
font-size- Font size (px, em, rem, %, pt)font-weight- Font weight (normal, bold, 100-900)font-style- Font style (normal, italic)font-family- Font familyline-height- Line heightletter-spacing- Letter spacingtext-align- Text alignment (left, right, center, justify)text-decoration- Text decoration (underline, line-through)text-transform- Text transform (uppercase, lowercase, capitalize)
Spacing
margin,margin-top/right/bottom/left- Outer spacingpadding,padding-top/right/bottom/left- Inner spacing
Borders
border- Border shorthand (format:widthpx style #color, e.g.,2px solid #003366)border-top/right/bottom/left- Individual borders (same format as border shorthand)border-color- Border color (hex format)border-width- Border width (px values)border-style- Border style (solid, dashed, dotted, none)border-radius- Rounded corners (px, em, rem, %)
Layout
width,height- Element dimensionsmax-width,max-height- Maximum dimensionsmin-width,min-height- Minimum dimensionsdisplay- Display type (block, inline, inline-block, flex, grid, none)vertical-align- Vertical alignment (top, middle, bottom, baseline)box-sizing- Box model (border-box, content-box)
Flexbox
flex-direction- Direction of flex items (row, row-reverse, column, column-reverse)flex-wrap- Wrapping behavior (nowrap, wrap, wrap-reverse)align-items- Cross-axis alignment (flex-start, flex-end, center, baseline, stretch, start, end)align-content- Multi-line alignment (flex-start, flex-end, center, space-between, space-around, stretch, start, end)justify-content- Main-axis alignment (flex-start, flex-end, center, space-between, space-around, space-evenly, start, end)gap- Gap between flex items (px, em, rem, %)
Grid
grid-template-columns- Column track sizes (e.g.,1fr 1fr 1fr,repeat(3, 1fr),200px auto 1fr)grid-template-rows- Row track sizesgrid-column- Column placement for grid itemsgrid-row- Row placement for grid itemsgrid-area- Shorthand for grid placementgrid-gap- Gap between grid items (legacy, usegapinstead)row-gap- Gap between rowscolumn-gap- Gap between columnsgap- Gap between grid items (px, em, rem, %, fr)
Lists
list-style-type- List marker style (disc, circle, square, decimal, lower-alpha, upper-alpha, lower-roman, upper-roman, none)
Image Support
HTML fields support three types of image sources:1. HTTPS URLs
2. HTTP URLs
3. Base64 Data URIs
Perfect for embedding images directly in the HTML:Security Features
HTML fields are automatically sanitized server-side for security:Safe & Allowed
- Formatting tags (
<p>,<div>,<span>, headings) - Links (
<a>) with http, https, mailto, tel URLs (forcedtarget="_blank"andrel="noopener noreferrer") - Inline CSS styles (colors, fonts, spacing)
- Images from HTTP/HTTPS/data URIs
- Tables, lists, and basic structure
Blocked & Removed
<script>tags - JavaScript removed<iframe>tags - No embedded content<style>tags - No global stylesonclick,onerror- No event handlersjavascript:,data:,vbscript:- Dangerous URL schemes stripped from links
Example: Sanitization in Action
Input:javascript: link is stripped; the safe https link is preserved with target="_blank" and rel="noopener noreferrer" added.
Error Handling
Common Errors
Invalid HTML Contenttype and fieldMeta.type are set to 'HTML'.
Next Steps
Creating Documents
Learn how to create documents via the API
Send for Signing
Send HTML-styled documents for signatures
File Uploads
Upload PDF files to combine with HTML fields
Document Fields API
Complete API reference for document fields

