Add e-signatures with Cursor
You're building in Cursor and your app needs people to agree to something: terms at signup, an order at checkout, a contract. Paste one prompt and Cursor builds the flow in your own UI, while Esign Comply supplies the rules and keeps the independent record of every signature.
Free plan: 10 live signatures a month and a full test mode. No card required.
- 01Put a test key in your server environmentYou
- 02Paste one prompt into CursorYou
- 03Cursor wires your form and your serverYou
- 04Acceptance reported from the user's browserEsign Comply
- 05Sealed record, receipt and timestampEsign Comply
- 06Server confirms, then creates the accountYou
The prompt to paste into Cursor
Open your project in Cursor and paste this into the chat. It builds a signup clickwrap: your Terms of Service and Privacy Notice, accepted with your own checkbox and your own button.
- Read
setup.md,auth.mdandllms.txtbefore writing anything. - Create the session on your server with the secret key, and send only the client token to the browser.
- Attach the browser SDK to your own checkbox and button. No widget, no iframe.
- Confirm the record on your server before the account exists.
- Never invent an API method, and stop and ask when something conflicts.
Add a signup clickwrap to this repository with Esign Comply. A new user accepts our Terms of Service and Privacy Notice before the account is created. We render every screen. Esign Comply observes it and keeps the independent record. Read these first and follow them exactly: - https://esigncomply.com/setup.md - https://esigncomply.com/auth.md - https://esigncomply.com/llms.txt Build 1. Server: create the session with the secret key from ESIGNCOMPLY_API_KEY. Send only the client token to the browser, with the document version IDs it presents. 2. Browser: in our existing signup form, attach @esigncomply/browser with the client token to our own unchecked checkbox and our Create account button. Call complete() from the user's real click. 3. Server: before creating the account, confirm the record. Read it with the secret key and check its status, livemode, signer ID and version IDs against what the server saved. Never - Never invent API methods, packages or legal wording. - Never pre-check the box or click for the user. - Never put the secret key in client code, and never print it. If anything here conflicts with existing code, or the docs do not cover a step, stop and ask me. Save these rules as .cursor/rules/esigncomply.mdc. Run commands in the integrated terminal. Finish with npx esigncomply check --url http://localhost:3000/signup and fix every finding marked "block".
How to run it in Cursor
Cursor is an AI code editor. This is the whole run, from a new Esign Comply account to your first test record.
- 01Create a free account and a test keySign up, then choose Create test key in the dashboard. The key starts with
esc_test_and is shown once. The Free plan needs no card, and test keys work onlocalhostwith no domain. - 02Put the key in your server environmentAdd
ESIGNCOMPLY_API_KEY=esc_test_us_...to.env.localand check that the file is in.gitignore. The key stays out of the chat: the prompt tells Cursor to read it from the environment. - 03Paste the prompt into CursorCursor reads the three docs pages, then writes the session route, wires your signup form and adds the server confirmation. It saves the rules as
.cursor/rules, so later sessions in this repo build under them too./esigncomply.mdc - 04Run the app and tick the boxStart your dev server, open
/signup, tick the checkbox and click Create account. Test keys work onlocalhostwith no setup. - 05Read the conformance check
npx esigncomply check --url http:/runs your page at three window sizes and prints each finding with its rule ID, the measurement and the fix. Paste a finding back into Cursor and it repairs the page./localhost:3000 /signup
What you have 60 seconds after Cursor finishes
Run the app, tick the box, click Create account. A minute after Cursor finishes, this is what is in your repo and in your Esign Comply dashboard.
- 01
The server route that creates the session
e.g.app/api/ceremony /route.ts It holds the secret key, pins the current version of each document and hands the browser a short-lived client token.
- 02
Your signup form, with the SDK attached
e.g.app/signup/signup-form.tsx Your markup and your styles. The SDK renders nothing: it watches your links, your checkbox and your button, and reports what the user did.
- 03
The server confirmation
e.g.app/api/signup /confirm /route.ts The record ID came from the browser, so the server reads the record with the secret key before the account exists.
// app/api/ceremony/route.ts import { esc } from "@/lib/esigncomply"; export async function POST(request: Request) { const { signerId, email, attempt } = await request.json(); const { data: session, error } = await esc.sessions.create( { profile: "prof_signup_4f1a", signer: { external_id: signerId, email, class: "consumer", country: "US", }, documents: [ { document: "doc_8Hq2", version: "current" }, // Terms of Service { document: "doc_Pv71", version: "current" }, // Privacy Notice ], context: { url: "http://localhost:3000/signup", locale: "en-US", purpose: "account_signup", }, }, { idempotencyKey: `signup-${signerId}-${attempt}` }, ); if (error) return Response.json({ error: error.code }, { status: 502 }); // Save signerId and the pinned version IDs in server-owned state. return Response.json({ clientToken: session.client_token, documents: session.documents, }); }
// app/signup/signup-form.tsx import { EsignComply } from "@esigncomply/browser"; // After /api/ceremony returns clientToken and documents: const ceremony = await EsignComply.attach({ clientToken }); await ceremony.presentDocument({ versionId: documents[0].version_id, mode: "hyperlink", link: document.querySelector("#tos-link"), }); await ceremony.presentDocument({ versionId: documents[1].version_id, mode: "hyperlink", link: document.querySelector("#privacy-link"), }); await ceremony.observeAssent({ region: document.querySelector("#assent"), // notice, links, box, button checkbox: document.querySelector("#agree"), // yours, unchecked submit: document.querySelector("#create-account"), // your button }); // Called from the real submit handler, after the user ticked the box. async function finishSignup() { const result = await ceremony.complete(); // result: { recordId, receipt, verifyUrl, status } await fetch("/api/signup/confirm", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ recordId: result.recordId }), }); }
// app/api/signup/confirm/route.ts import { esc } from "@/lib/esigncomply"; export async function POST(request: Request) { const { recordId } = await request.json(); const expected = await loadCeremonyState(request); // server-owned state const { data: record, error } = await esc.records.get(recordId); if (error) return Response.json({ confirmed: false }, { status: 409 }); const versions = record.documents.map((d) => d.version_id).sort(); const confirmed = ["recorded", "timestamped", "anchored"].includes(record.status) && record.livemode === (process.env.VERCEL_ENV === "production") && record.signer.external_id === expected.signerId && versions.join() === [...expected.versionIds].sort().join(); if (!confirmed) return Response.json({ confirmed: false }, { status: 409 }); // Only now create the account. return Response.json({ confirmed: true }); }
The example is a Next.js repository. In another stack, Cursor writes the same three parts under that stack's file names.
One sealed test record, kept by Esign Comply
Your first test record opens in the dashboard with what was observed, what was asserted, and the conformance findings. It is sealed like a live record, on a separate test ledger, and its evidence report is watermarked TEST.
What Cursor gets right with the rules, and wrong without them
Cursor writes a signing page that looks finished from one sentence. The prompt gives it what the sentence left out: where the notice goes, what it has to say and what the checkbox starts as.
Affirmative assent control
The checkbox ships already ticked, or a handler ticks it for the user to save a click.
The box renders unchecked and only a real user event changes it. The SDK records its state at load, and the check reports a pre-checked box or a scripted click at block level.
Notice names the action control
"By continuing" or "by clicking below", next to a button that says something else.
The notice names the button by its exact label: "By checking the box and clicking Create account, you agree to the Terms of Service." The check flags vague phrases.
Notice and control in the same viewport
The agreement line sits in the footer or under a long form, below the fold on a phone.
The notice sits directly above the button in the same container. The SDK records both positions at the signing act, and the check runs your page at 390 by 844.
Notice font size and contrast
Fine print: 10 px, light gray, tucked under a bright button.
The notice is set at body size, never under 12 px, with contrast of at least 4.5 to 1 against its background. The SDK measures both.
Document links resolve to the registered version
A link to /terms that serves whatever is in the repo today, or the legal text pasted into a component.
Every link serves the registered version by its ID, and the record pins that version by SHA-256 hash. Document text is never copied into your code.
Each row is a real conformance rule with its ID and its default level. Esign Comply runs 28 of them over your test records, and every finding names the rule, the measurement and the fix.
Go further with Cursor
The signup clickwrap is the smallest flow. Cursor builds the larger ones from the same pattern: one session per signer, your own screens, a record you do not hold.
Build your own signing app
Upload a document, email each signer a link to your own application and collect the signatures there. There are 7 build guides, each with the steps and the code.
Build your own DocuSignStack guides
The same integration written out for your framework and your host, with working code for the server, the browser and the confirmation.
Browse the stack guidesUse cases
NDAs, contractor agreements, consent forms, order forms and terms updates. Each page has a live demo you can sign in test mode.
See the use casesThe exact rules for your regions
Pick your use case, regions, signer types and stack. You get one prompt to paste into Cursor, with your own document and profile IDs and the rule packs you selected.
Generate a promptQuestions about Cursor and e-signatures
Can Cursor build an e-signature flow?
Yes. Cursor writes the form, the server route and the confirmation in your own repository. Paste the prompt on this page and it reads the Esign Comply setup runbook first, then builds a signup clickwrap with your own checkbox and button. Esign Comply supplies the rules and keeps the independent record of every acceptance.
Where do I put the Esign Comply API key when I use Cursor?
In your server environment as ESIGNCOMPLY_API_KEY, for example in .env.local, which stays in .gitignore. Never paste the key into the chat and never give it a public prefix such as NEXT_PUBLIC_. The browser only ever receives a short-lived client token for one session.
Read the quickstartWhere does Cursor keep the Esign Comply rules?
In .cursor/rules/esigncomply.mdc. The prompt on this page tells Cursor to save the rules there, and a prompt generated in the Esign Comply dashboard downloads as that same file, so every later session in the repository builds under the same rules.
Generate a promptHow do I know the page Cursor built follows the rules?
Run npx esigncomply check --url http://localhost:3000/signup. The CLI opens your page at three window sizes, runs the ceremony with a test signer and prints each finding with its rule ID, the measurement and the fix. It returns an exit code, so the same command runs in CI.
Read the conformance rulesCan Cursor build more than a signup checkbox?
Yes. The same pattern builds NDA and contract signing with a typed name and an emailed one-time code, checkout terms, terms updates and a whole send-for-signature product with uploads and signer links. Pick the use case in the prompt generator, or start from a build guide.
Build your own DocuSignPaste the prompt into Cursor. Leave the record to us.
Free plan: 10 live signatures a month and a full test mode. No card required.
Cursor is a trademark of its owner. Esign Comply is not affiliated with it.