Skip to main content

Embedding Overview

DocuTrust provides three approaches to embed document signing and template building directly into your application. Choose the one that best fits your architecture and level of control.

Approaches

1. Web Components

Drop-in HTML custom elements that work in any web page or framework.
  • <docuseal-form> renders a signing form for a specific submission.
  • <docuseal-builder> renders the template editor for building and configuring document templates.
No framework dependency required. Add the script tag, drop in the element, and configure via data-* attributes.

Signing Form

Embed a signing form with pre-fill, events, and redirect support.

Template Builder

Embed the template editor with field configuration and save hooks.

2. JavaScript SDK

A global window.DocuTrust API for programmatic control. Use the SDK when you need imperative mounting, event handling, or dynamic configuration that goes beyond static HTML attributes.

JavaScript SDK

Full SDK reference with mount, configure, and event APIs.

3. Direct iframe

For maximum control, build your own iframe pointing to the signing URL with the embed=true query parameter. This approach gives you full control over iframe sizing, sandboxing, and cross-origin communication.
With a direct iframe you are responsible for:
  • Resizing the iframe to match content height (listen for docutrust:resize messages)
  • Listening to postMessage events from the iframe for completion and field changes
  • Passing configuration via query parameters instead of data-* attributes
Supported query parameters:

Decision Matrix

Use this table to choose the right approach for your integration.
For most integrations, Web Components are the recommended approach. They provide the best balance of simplicity and flexibility with zero framework dependencies.

Authentication for Embedding

Both the signing form and the template builder support token-based authentication via JWT. Tokens are generated server-side through the /api/embed/token endpoint and scoped to a single submission or template.
  • Signing forms can use either a submitter slug (public link) or a JWT token for authenticated access.
  • Template builders always require a JWT token generated server-side.
Tokens use HS256 signing with configurable expiration (default 4 hours) and are scoped by audience (form or builder).

JWT Tokens

Server-side token generation, claim structure, and security best practices.