Documentation Index
Fetch the complete documentation index at: https://docs.spitshake.io/llms.txt
Use this file to discover all available pages before exploring further.
Template Builder Web Component
The<docuseal-builder> web component renders the full template editor inside your application. Users can upload documents, drag and drop fields, configure submitter roles, and save templates — all without leaving your page.
Quick start
Generate a JWT token server-side, then embed the builder:The builder always requires authentication. Use a JWT token from
POST /api/embed/token (recommended for embedded use) or pass data-template-id when the user is already authenticated via a session cookie.Attributes
The<docuseal-builder> component accepts 33 data-* attributes to control behavior, authentication, and UI.
| Attribute | Type | Default | Description |
|---|---|---|---|
data-token | string | — | JWT token generated via POST /api/embed/token with audience: "builder". This is the recommended authentication method for embedded builders. The token encodes the template ID, account scope, and UI options. |
data-host | string | current origin | The base URL of your DocuTrust instance. Only needed when the embed script is served from a different domain than the DocuTrust API. Example: "https://docs.your-app.com". |
data-template-id | string | — | Template ID to load in the builder. Only works when the user has an active session cookie (i.e., they are logged into DocuTrust in the same browser). For third-party embedding, use data-token instead. |
data-language | string | — | UI language code. Supported values: "en", "es", "fr", "de", "pt", "it", "nl", "ja", "zh", "ko", "ar", "he". |
data-autosave | "false" | "true" | Set to "false" to disable automatic saving. When disabled, the template is only saved when the user clicks Save or you call builder.save() programmatically. |
data-preview | "false" | "true" | Set to "false" to hide the document preview panel on the right side of the builder. |
data-with-title | "false" | "true" | Set to "false" to hide the editable template title field at the top of the builder. |
data-with-send-button | "false" | "true" | Set to "false" to hide the “Send” button. Useful when you want to handle submission creation through your own UI or API calls. |
data-with-recipients | "false" | "true" | Set to "false" to hide the recipients/submitter roles section. Useful when roles are pre-configured and should not be changed by the user. |
data-only-defined-fields | "true" | — | When set, the field palette only shows the field types listed in data-fields. All other field types are hidden. |
data-fields | JSON string | — | Pre-define the available fields as a JSON array. Each entry specifies a field name, type, and optional role assignment. See the Fields configuration section below. |
data-roles | JSON string | — | Pre-define submitter roles as a JSON array of role name strings. When provided, the user cannot add or remove roles. Example: '["Sender", "Recipient", "Witness"]'. |
data-submitters | JSON string | — | Pre-define default submitters as a JSON array of objects with name and email properties. Example: '[{"name": "Recipient", "email": "jane@example.com"}]'. |
data-required-fields | JSON string | — | A JSON array of field names that must be placed on the document before saving. The builder shows a warning if any required field is missing. Example: '["Signature", "Date"]'. |
data-field-types | string | — | Comma-separated list of allowed field types in the field palette. Only the specified types are available for placement. Example: "text,signature,date,checkbox". |
data-draw-field-type | string | — | Default field type when the user draws a new field on the document by clicking and dragging. Example: "text", "signature". |
data-custom-button-title | string | — | Custom text for the primary action button in the builder toolbar. Replaces the default “Send” label. Example: "Publish Template". |
data-custom-button-url | string | — | URL to navigate to when the custom button is clicked. When set, clicking the button navigates instead of triggering the send event. |
data-with-upload-button | "false" | "true" | Set to "false" to hide the document upload button. Useful when documents are pre-loaded via the API. |
data-with-add-page-button | "true" | — | Set to "true" to show an “Add blank page” button, allowing users to append empty pages to the document. |
data-with-sign-yourself-button | "false" | "true" | Set to "false" to hide the “Sign yourself” button in the builder toolbar. |
data-with-documents-list | "false" | "true" | Set to "false" to hide the documents sidebar listing all uploaded documents. |
data-with-fields-list | "false" | "true" | Set to "false" to hide the fields sidebar listing all placed fields. |
data-with-fields-detection | "true" | — | Set to "true" to show the AI-powered field detection button that automatically identifies and places fields on the document. |
data-with-title-input | "true" | — | Set to "true" to show the editable template title input at the top of the builder. Equivalent to data-with-title. |
data-with-send-myself-email | "true" | — | Set to "true" to show an option for the user to send themselves a copy of the template via email. |
data-email-subject | string | — | Custom email subject line for emails sent from the builder. Supports template tokens like {{template.name}}. |
data-email-body | string | — | Custom email body for emails sent from the builder. Supports template tokens like {{template.name}} and {{submitter.link}}. |
data-background-color | string | — | Background color for the builder as a HEX code (e.g., "#f9fafb"). Overrides the default background. |
data-custom-css | string | — | Custom CSS rules injected into the builder iframe. Allows overriding default styles for advanced branding. Example: "body { font-family: 'Inter', sans-serif; }". |
data-input-mode | "true" | — | When set to "true", enables data prefill mode. The builder shows a form for entering field values instead of the full drag-and-drop editor. Useful for creating pre-filled templates programmatically. |
data-with-signature-id | "true" | — | When set to "true", displays a unique signature identifier alongside each signature field. Useful for audit and compliance tracking. |
data-extract-fields | "false" | "true" | Set to "false" to disable automatic extraction of form fields from uploaded PDF documents. By default, DocuTrust auto-detects and places fields found in interactive PDF forms. |
Full HTML example
Events
The<docuseal-builder> component emits DOM custom events. Listen with addEventListener on the element.
init
Fired when the web component is initialized and the iframe begins loading.null
load
Fired when the iframe has loaded and the builder is ready to render.null
loaded
Fired when the builder UI has fully rendered and is interactive.template-saved
Fired when the template is saved (either by auto-save or the user clicking Save).template-data
Fired when the builder emits template data in response to agetTemplate() call or internal state change.
template-saved.
send
Fired when the user clicks the “Send” button inside the builder.upload
Fired when a document is uploaded to the builder.change
Fired when any change occurs in the builder — field added, moved, resized, deleted, or properties updated. Useful for tracking unsaved changes or implementing custom auto-save logic.Public methods
The<docuseal-builder> element exposes two public methods for programmatic interaction.
getTemplate()
Returns a Promise that resolves with the current template state. The method communicates with the builder iframe viapostMessage and has a 5-second timeout.
save()
Triggers a save operation viapostMessage to the builder iframe. This is equivalent to the user clicking the Save button. The save is asynchronous — listen for the template-saved event to confirm completion.
Fields configuration
Thedata-fields attribute accepts a JSON array of field definitions. Each field object supports the following properties:
| Property | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Display name of the field |
type | string | Yes | Field type (see table below) |
role | string | No | Submitter role this field is assigned to |
required | boolean | No | Whether the field must be filled before submission |
options | string[] | No | Available options for select and radio field types |
| Type | Description |
|---|---|
text | Single-line text input |
signature | Signature pad (draw, type, or upload) |
initials | Initials pad |
date | Date picker |
checkbox | Checkbox toggle |
select | Dropdown select |
radio | Radio button group |
number | Numeric input |
file | File upload |
image | Image upload |
stamp | Stamp/seal placement |
cells | Character-per-cell input (for codes, SSNs, etc.) |
phone | Phone number input |
payment | Payment collection field |
phone_verification | Phone + SMS OTP verification |
data-only-defined-fields:
When you set data-only-defined-fields="true", only the field types specified in data-fields appear in the field palette. This is useful when you want to restrict what fields a user can place on the document.