Skip to content
Platform · Netlify

Add e-signatures and clickwrap to an app on Netlify

To add e-signatures and clickwrap to an app on Netlify, store the secret key as a site environment variable, with the live key in the production context only. Netlify Functions create the session and confirm the record, and Netlify Blobs keeps what the session pinned. Esign Comply seals the record, and your database keeps the receipt.

Follow the quickstart and each signature is a valid electronic signature under the U.S. ESIGN Act, state UETA laws and New York's ESRA, and each clickwrap is built the way courts require: clear notice of the terms, an unmistakable act of assent, and a sealed record of both.

$npm install esigncomply @netlify/blobs && npm install --save-dev netlify-cli
Netlify quickstart

Free plan: 10 live signatures a month and a full test mode. No card required.

Last updated

Run locally for Netlify before publishing
netlify/functions/ceremony.mjs
// netlify/functions/ceremony.mjs
import { ceremonies, DOCUMENTS, esc, signer } from "../lib/esigncomply.mjs";

// Step 4: create the session with the secret key. The browser gets the client token only.
export default async (req) => {
  const { data: session, error } = await esc.sessions.create(
    {
      profile: process.env.ESIGNCOMPLY_PROFILE_ID,
      signer,
      documents: [
        { document: DOCUMENTS.terms, version: "current" },
        { document: DOCUMENTS.privacy, version: "current" },
      ],
      // The origin the browser reports: localhost, a Deploy Preview or your production domain.
      context: { url: `${req.headers.get("origin") ?? new URL(req.url).origin}/signup`, locale: "en-US", purpose: "account_signup" },
    },
    { idempotencyKey: `signup-${signer.external_id}-${crypto.randomUUID()}` },
  );
  if (error) return Response.json({ error: error.code }, { status: 502 });

  await ceremonies().setJSON(signer.external_id, session.documents.map((d) => d.version_id).sort());
  return Response.json({ clientToken: session.client_token, apiUrl: session.api_url, documents: session.documents });
};

export const config = { path: "/api/ceremony", method: "POST" };
Integrate with Netlify

How do you integrate Esign Comply with Netlify?

On Netlify the server half is three functions under netlify/functions, each with a path of its own. They read the key with process.env, and the confirm function reads its deploy context from context.deploy.context. Two functions share no memory, so the pinned versions go to Netlify Blobs, opened with strong consistency.

A function is a file in your project that contains server-side code for responding to an event.

Source: Netlify documentation, Functions overview, read on .
Where each part lives on Netlify
  • Session functionnetlify/functions/ceremony.mjs
  • Shared modulenetlify/lib/esigncomply.mjs
  • Confirm functionnetlify/functions/confirm.mjs

Run on 2026-11-26 with Netlify CLI 27.20.1 (netlify dev, offline), @netlify/blobs 11.1.10, esigncomply 1.0.4, the browser SDK script build and the conformance check from esigncomply 1.0.4 on Node.js 24.22.1, against the API in test mode. The Netlify settings are from Netlify's documentation as of 2026-11-23. The code has not yet been run on a Netlify deploy.

Three steps

How does Esign Comply fit with Netlify?

Each step uses a feature Netlify already has. The secret key stays on the server side of Netlify in all three.

  1. 01
    A site environment variable holds the keySet ESIGNCOMPLY_API_KEY in the Netlify UI or with netlify env:set, with a different value per deploy context: the live key for production, the test key for Deploy Previews, branch deploys and local development. Source: Netlify documentation, Environment variables overview, read on .
  2. 02
    A Netlify Function creates the sessionnetlify/functions/ceremony.mjs calls esc.sessions.create and answers at /api/ceremony, the path its config names. A second function serves the document pages, and the browser SDK records the ceremony from the signer's device.
  3. 03
    The confirm function checks the deploy contextnetlify/functions/confirm.mjs reads the pinned versions from Netlify Blobs and expects a live record only when context.deploy.context is production. Your database keeps the record ID and the receipt. Source: Netlify documentation, Functions API reference, read on .
Netlify setup

Where do the key, the preview hosts and the webhook go on Netlify?

Four settings carry an Esign Comply integration on Netlify. What is said here about Netlify was read from its own documentation, and the quickstart has each command.

Environment variables

Set them in the UI or with netlify env:set ESIGNCOMPLY_API_KEY <value> --context production --secret. Variables declared in netlify.toml are not available to functions, and a change needs a new build and deploy to take effect. Locally, netlify dev reads .env.

Source: Netlify documentation, Environment variables and functions, read on .

Deploy Previews and test mode

A test key refuses a host it does not know. Each pull request gets a host of the form deploy-preview-<number>--<site-name>.netlify.app: list the host of the preview you are testing under Domains in the Esign Comply dashboard as a test origin. Never list the shared suffix netlify.app.

Source: Netlify documentation, Deploy Previews, read on .

The registered domain

Register your custom domain and verify it with one DNS record. A production site on a netlify.app host verifies with a file instead: put the token in public/.well-known/esigncomply.txt.

The webhook endpoint

Add a function for the record.completed webhook and register its production URL under Webhooks in the Esign Comply dashboard. It backs the confirmation up when the browser closes before your function hears about the record.

Read on : Netlify documentation, Functions overview, Netlify documentation, Environment variables overview, Netlify documentation, Environment variables and functions, Netlify documentation, Functions API reference, Netlify documentation, Netlify Blobs, Netlify documentation, Deploy Previews.

Copy-paste prompt

What prompt adds Esign Comply clickwrap to a Netlify app?

Paste this into Cursor, Claude Code or the AI coding tool that is open on your project. It names the packages that exist, where the secret key goes on Netlify, what to build and what never to do, and it ends with the rules block for your project.

The rules block lives at /rules.md. Added to your project's instruction file, it makes every later session build signing and acceptance flows the same way. The prompt generator writes the long version, with your own document and profile IDs.

Pages for each AI tool
Prompt: Esign Comply clickwrap on Netlify
Add Esign Comply clickwrap to my site on Netlify: a signup form where the user accepts the Terms of Service and the Privacy Notice with a checkbox and a button.

Read these first and follow them exactly. If something conflicts with existing code, or you are unsure how to implement a step, stop and ask. Do not invent API methods, packages or legal wording.
- https://esigncomply.com/docs/quickstart/netlify.md (the steps and the tested code for Netlify)
- https://esigncomply.com/setup.md (the order of API calls)
- https://esigncomply.com/auth.md (how to handle the keys)

Netlify facts
- Packages (the only ones that exist): esigncomply (server) and @esigncomply/browser. Without a bundler, load the browser SDK from https://esigncomply.com/sdk/v1/esigncomply.js.
- Server calls live in Netlify Functions under netlify/functions, each with export const config = { path }. Functions read variables with process.env.
- The secret key is the site environment variable ESIGNCOMPLY_API_KEY, set in the Netlify UI or with netlify env:set. Variables declared in netlify.toml do not reach functions. Never print the key.
- Two functions share no memory. Keep the pinned version IDs in Netlify Blobs with strong consistency, or in the database.
- Expect live records only when context.deploy.context is "production".
- The page is on screen before the script has a session: render the checkbox disabled and enable it when observeAssent has resolved.

Build
1. Verify the key: GET /v1/usage with ESIGNCOMPLY_API_KEY. Stop if it fails.
2. Register the Terms of Service and the Privacy Notice as documents and publish one version of each from the documents in this project. If the project has none, register short sample documents and say so in your report. Never write or change the wording of the real documents. Create a profile: jurisdictions ["US-FED"], method "checkbox", assurance_level "L1".
3. Function ceremony (path /api/ceremony): create the session with esc.sessions.create and an Idempotency-Key, save the signer ID and the pinned version IDs in server-owned state, and return only clientToken, apiUrl and documents.
4. Function legal (path /legal/:slug): render the registered version from esc.documents.versions.getContent inside <article data-esc-document>, unmodified.
5. Browser: EsignComply.attach({ clientToken, apiUrl }), presentDocument for each link, observeAssent({ region, checkbox, submit }), then complete() from the user's real click.
6. Function confirm (path /api/signup/confirm): read the record with esc.records.get and require: status is "recorded", "timestamped" or "anchored"; livemode is as expected; the signer ID and version IDs equal the server-owned state. Only then create the account.

Never
- Never pre-check the box, auto-submit, or call .click() on the user's behalf.
- Never use "By continuing" or "By clicking below" wording. The notice names the button by its label and each document by its registered name.
- Never put the secret key, or any call that uses it, in code that reaches the browser.
- Never show "signed" or "accepted" before the server has confirmed the record.
- Never fall back to an acceptance with no record when a session is refused.

Check before you report success
- Run: npx esigncomply check --url http://localhost:8888/signup --callback http://localhost:8888/api/signup/confirm
  Fix every finding marked "block". List every finding marked "warn".
- Report the files you created or changed, anything you did not implement and why, and the conformance summary.

Then add the rules block to this project's instruction file: https://esigncomply.com/rules.md
3 things to watch

What goes wrong when you add e-signatures on Netlify?

These are specific to Netlify. Each one was seen while the quickstart's code was run, or is in Netlify's own documentation.

  • 01

    Variables in netlify.toml do not reach functions

    Netlify's documentation says so, and the local run showed it: a variable declared under [build.environment] was not set inside a function, while the ones from .env were. Set the key in the UI or with netlify env:set.

    Source: Netlify documentation, Environment variables and functions, read on .
  • 02

    Netlify Blobs is eventually consistent by default

    Updates can take up to 60 seconds to reach every edge location, and the confirmation reads what another function wrote a moment earlier. Open the store with consistency: "strong", as the quickstart does.

    Source: Netlify documentation, Netlify Blobs, read on .
  • 03

    The deploy context is not production under netlify dev

    In the local run context.deploy.context was dev, so the confirm function expected test records. It is production on the production deploy only, which is the one context that holds the live key.

Verifiable

What does Esign Comply record for a signature on Netlify?

The same record on every stack and platform. Your Netlify code creates the session and confirms the record, and the browser SDK reports what happened on the page. Esign Comply seals the result where your code cannot change it. The record itself is described on Evidence and verification.

  • Observed and asserted fields

    Every field is tagged. Observed is what the browser SDK and the API saw: the box unchecked at load, the tick from a trusted user event, the notice text, the terms version by hash, the server time. Asserted is what your app said, such as the user's email.

  • A signed receipt

    complete() returns a receipt signed with ES256, using keys you do not hold. Your server stores it next to the user, and GET /v1/records/{id}/receipt returns it again.

  • An external timestamp

    An outside authority timestamps the hash of every live record (RFC 3161), so the time on the record does not rest on your clock or on ours.

  • An offline verifier

    Each record has an evidence report (PDF) and an evidence package (ZIP). Anyone you send the package to checks the acceptance with the open-source esigncomply-verify, without an account.

Recordrec_Z4m8
simple · L1
RecordedWritten durably, receipt signed with ES256
TimestampedExternal RFC 3161 token over the record hash
AnchoredPublic anchor pending
Checkbox changed by a trusted user eventobserved
Terms of Service, version dv_3kT9observed
Server time 2026-11-21T15:03:20.291Zobserved
Signer email dana@example.orgasserted
record_hash sha256:5be7…example record

Questions about e-signatures on Netlify

How does test mode work on Netlify Deploy Previews?

A test key works on a Deploy Preview once the preview's host is listed as a test origin of your domain. Give the preview contexts the test key and add the exact netlify.app host under Domains. Without the entry the session is refused with domain_mismatch.

Where should the receipt be stored on Netlify?

In your own database, beside the user, with the record ID. The quickstart keeps only the pinned version IDs in Netlify Blobs, which is state for one ceremony. The confirm function is the place to write the receipt.

Can the key live in netlify.toml?

No. Netlify's documentation says variables declared in netlify.toml are not available to functions, and a key in that file would be committed. Set it in the Netlify UI or with netlify env:set, and mark it as secret.

Can I try it without a Netlify account?

Yes. netlify dev --offline ran the three functions, the static page and a local Blobs store with no account in the test, on Netlify CLI 27.20.1. You need a site on Netlify to set variables per deploy context and to deploy.

Was this code run on a Netlify deploy?

Not yet. It was run with netlify dev --offline, and the Netlify settings come from Netlify's documentation as of November 23, 2026. Variables per deploy context, Blobs on the hosted platform and file verification on a netlify.app host are proven only by a deploy.

Put the key in a Netlify Function. Leave the record to us.

Free plan: 10 live signatures a month and a full test mode. No card required.

Netlify is a trademark of its owner. Esign Comply is not affiliated with it. What this page says about Netlify is from Netlify's documentation or from a test run, as marked, on . /netlify.md is this page as Markdown.

Working with an AI tool? This page is also available as Markdown: /netlify.md