Add e-signatures and clickwrap to Node.js
To add e-signatures and clickwrap to Node.js, install the esigncomply package: the server SDK is written for Node.js. Your server creates a session with esc.sessions.create, the browser SDK attaches to your own checkbox and button, and esc.records.get confirms the result. Esign Comply seals each acceptance as an independent, tamper-evident record that anyone can verify.
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 esigncomplyFree plan: 10 live signatures a month and a full test mode. No card required.
Last updated
// Step 4: create the session with the secret key. The browser gets the client token only. if (req.method === "POST" && url.pathname === "/api/ceremony") { 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 page that runs the ceremony: the origin the browser reports, plus its path. context: { url: `${req.headers.origin ?? url.origin}/signup`, locale: "en-US", purpose: "account_signup" }, }, { idempotencyKey: `signup-${signer.external_id}-${randomUUID()}` }, ); if (error) return json(res, 502, { error: error.code }); pinned.set(signer.external_id, session.documents.map((d) => d.version_id)); return json(res, 200, { clientToken: session.client_token, apiUrl: session.api_url, documents: session.documents });
const agree = document.querySelector("#agree"); const submit = document.querySelector("#create-account"); const message = document.querySelector("#message"); // Your server creates the session and returns only the client token and the pinned documents. const response = await fetch("/api/ceremony", { method: "POST" }); const { clientToken, apiUrl, documents } = await response.json(); const ceremony = await EsignComply.attach({ clientToken, apiUrl }); ceremony.on("change", ({ remainingSteps }) => { submit.disabled = remainingSteps.some((step) => step !== "signature.applied"); }); // Point each link at the exact version this session pinned, then report it. const links = [document.querySelector("#tos-link"), document.querySelector("#privacy-link")]; for (const [i, link] of links.entries()) { link.search = "?v=" + documents[i].version_id; await ceremony.presentDocument({ versionId: documents[i].version_id, mode: "hyperlink", link }); } await ceremony.observeAssent({ region: document.querySelector("#assent"), // notice, links, checkbox, button checkbox: agree, submit, }); agree.disabled = false; // the SDK watches the box from here on. Only the user ticks it.
// Step 6: confirm the record with the secret key before the account exists. if (req.method === "POST" && url.pathname === "/api/signup/confirm") { const { recordId } = await body(req); const { data: record, error } = await esc.records.get(String(recordId)); const expected = [...(pinned.get(signer.external_id) ?? [])].sort(); const confirmed = !error && SEALED.includes(record.status) && record.livemode === LIVE && record.signer.external_id === signer.external_id && JSON.stringify(record.documents.map((d) => d.version_id).sort()) === JSON.stringify(expected); console.log(confirmed ? `confirmed ${record.id} (${record.status})` : "refused"); if (!confirmed) return json(res, 409, { confirmed: false }); // Only now create the account, and store record.id and record.receipt with it. return json(res, 200, { confirmed: true, recordId: record.id });
How do you integrate Esign Comply with Node.js?
Node.js is the one runtime with a server SDK, so the integration is two method calls. The package is an ES module for Node.js 20.19 or later, it reads ESIGNCOMPLY_API_KEY from the environment, and every call resolves to { data, error } and never throws. The quickstart is one file with node:http and no other dependency.
As an asynchronous event-driven JavaScript runtime, Node.js is designed to build scalable network applications.
Source: About Node.js, read on .- Serverserver.js
- Browserpublic/signup.html
- Confirmserver.js
Run on 2026-11-26 with Node.js 24.22.1, esigncomply 1.0.4, the browser SDK script build and the conformance check from esigncomply 1.0.4, against the API in test mode.
What prompt adds Esign Comply clickwrap to a Node.js 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 in Node.js, 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 toolAdd Esign Comply clickwrap to my Node.js app: 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/nodejs.md (the steps and the tested code for Node.js)
- https://esigncomply.com/setup.md (the order of API calls)
- https://esigncomply.com/auth.md (how to handle the keys)
Node.js facts
- Packages (the only ones that exist): esigncomply (server, Node.js 20.19 or later, an ES module) and @esigncomply/browser. Without a bundler, load the browser SDK from https://esigncomply.com/sdk/v1/esigncomply.js.
- The secret key is in ESIGNCOMPLY_API_KEY, in a .env file that Node.js loads with: node --env-file=.env server.js. Never print it.
- Server SDK calls return { data, error } and do not throw. Check error every time.
- 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. Server: POST /api/ceremony creates the session with esc.sessions.create and an Idempotency-Key, saves the signer ID and the pinned version IDs in server-owned state, and returns only clientToken, apiUrl and documents.
4. Server: GET /legal/terms and /legal/privacy 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. Server: POST /api/signup/confirm reads the record with esc.records.get and requires: 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:3000/signup --callback http://localhost:3000/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.mdWhat goes wrong when you add e-signatures in Node.js?
These are specific to Node.js. Each one was seen while the quickstart's code was run, or is in Node.js's own documentation.
- 01
Node.js does not read .env on its own
Start the server with
node --env-file=.env server.js. Without the flag the SDK finds no key, and it does not throw: in the test run/apianswered/ceremony 502withmissing_api_key. Checkerroron every call. - 02
The package is an ES module
esigncomplyhas no CommonJS build. Set"type": "module"inpackage.jsonand useimport, or load it from a CommonJS file withawait import("esigncomply"). - 03
State in memory belongs to one process
The quickstart keeps the pinned version IDs in a
Map. It is empty after a restart and split in two under a cluster or two instances, so a confirmation can reach the process that never saw the session. Use a table in your database.
Where are the Node.js quickstart and the API reference?
Start with the quickstart: it carries every file this page excerpts, in the order you write them.
- QuickstartNode.js quickstartStep by step, from install to your first sealed test record, with every file and the output of each step.Open
- ReferenceAPI referenceEvery endpoint, field and error code. Sessions, records and documents are the three this page uses.Open
- GuideServer confirmationThe one place access is granted: what to compare, and the webhook that backs the check up.Open
What does Esign Comply record for a signature in Node.js?
The same record on every stack and platform. Your Node.js 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, andGET /v1returns it again./records /{id} /receipt 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.
Questions about e-signatures in Node.js
Is there an Esign Comply SDK for Node.js?
Yes. esigncomply is the server SDK and it is written for Node.js 20.19 or later. It wraps the REST API for documents, sessions, records, supplements, certificates and webhooks, and the same package carries the command line tool.
Where do I create the session in Node.js?
In the request handler that serves your signing page's data, with esc.sessions.create and the secret key. The handler returns only the client token, the API URL and the pinned documents to the browser.
Does the Node.js SDK throw on errors?
No. Every method resolves to an object with data and error, and exactly one of them is null. Only the constructor throws, and only when it runs in a browser. A missing key resolves every call with missing_api_key.
Which Node.js versions are supported?
Node.js 20.19 or later, which is the engines field of the package. The quickstart was run on Node.js 24.22.1 and uses the --env-file flag and the built-in fetch, so it has one dependency.
Do I need a bundler for the browser SDK?
No. A script tag loads the build at https:/, which defines one global, EsignComply. @esigncomply/browser on npm is also one self-contained ES module that a static file server can serve as it is.
Build the signing flow on your own Node.js server. Leave the record to us.
Free plan: 10 live signatures a month and a full test mode. No card required.
Node.js is a trademark of its owner. Esign Comply is not affiliated with it. What this page says about Node.js is from Node.js's documentation or from a test run, as marked, on . /nodejs.md is this page as Markdown.