Skip to content
Coding agent · Windsurf

Add e-signatures with Windsurf

You're in Windsurf and the next thing on the list is the "I agree" checkbox. One prompt builds the clickwrap in your own form, and Esign Comply gives Windsurf the rules and keeps the record you do not hold.

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

One prompt, from paste to record
  1. 01
    Put a test key in your server environmentYou
  2. 02
    Paste one prompt into WindsurfYou
  3. 03
    Windsurf wires your form and your serverYou
  4. 04
    Acceptance reported from the user's browserEsign Comply
  5. 05
    Sealed record, receipt and timestampEsign Comply
  6. 06
    Server confirms, then creates the accountYou
Copy-paste prompt

The prompt to paste into Windsurf

Open your project in Windsurf 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.

What the prompt tells Windsurf
  • Read setup.md, auth.md and llms.txt before 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.
Generate the prompt for your regions
Prompt for Windsurf
Build a signup clickwrap in this project with Esign Comply: an unchecked "I agree" checkbox and our Create account button, with links to the Terms of Service and the Privacy Notice. We build the screen. Esign Comply records the acceptance and keeps the record.

First read these three pages and follow them exactly:
- https://esigncomply.com/setup.md
- https://esigncomply.com/auth.md
- https://esigncomply.com/llms.txt

Steps
1. On the server, create the session with the secret key in ESIGNCOMPLY_API_KEY. Only the client token and the document version IDs go to the browser.
2. In the signup form we already have, attach @esigncomply/browser with the client token. Point it at our own checkbox, our own button and the two document links, and call complete() inside the real submit handler.
3. On the server, confirm the record with the secret key before the account is created. Check status, livemode, signer ID and version IDs.

Do not
- Do not invent API methods, packages or legal wording.
- Do not pre-check the box, auto-submit or call .click() for the user.
- Do not expose the secret key to client code.

If something conflicts with the existing code, or you are unsure about a step, stop and ask. Save these rules in .windsurf/rules/esigncomply.md, run commands in the integrated terminal, and finish with npx esigncomply check --url http://localhost:3000/signup.
4 steps

How to run it in Windsurf

Windsurf is an AI code editor. This is the whole run, from a new Esign Comply account to your first test record.

  1. 01
    Create 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.
  2. 02
    Add the key to .env.localOne line: ESIGNCOMPLY_API_KEY=esc_test_us_.... Keep the file in .gitignore and keep the key out of the chat. Never give the variable a public prefix such as NEXT_PUBLIC_ or VITE_.
  3. 03
    Paste the prompt into WindsurfWindsurf reads the docs, creates the session on your server, attaches the SDK to the form you already have and adds the confirmation. The rules land in .windsurf/rules/esigncomply.md.
  4. 04
    Run the app, tick the box, run the checkOpen /signup on localhost, tick the checkbox and click Create account. Then read the output of npx esigncomply check --url http://localhost:3000/signup and paste any finding back into Windsurf.
The 60-second result

What you have 60 seconds after Windsurf finishes

Four steps and one signup on localhost. This is what Windsurf leaves in your project, and what Esign Comply holds a minute later.

  1. 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.

  2. 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.

  3. 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,
  });
}

The example is a Next.js repository. In another stack, Windsurf writes the same three parts under that stack's file names.

The record that appears

One sealed test record, kept by Esign Comply

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

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 Windsurf gets right with the rules, and wrong without them

Left to its own taste, an AI editor optimizes a signup form for looks: quiet links, small print, one tidy line of legal text. The prompt tells Windsurf which of those choices the rules measure.

CR-01block

Affirmative assent control

Without the rules

The checkbox ships already ticked, or a handler ticks it for the user to save a click.

With the prompt

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.

CR-03warn

Notice names the action control

Without the rules

"By continuing" or "by clicking below", next to a button that says something else.

With the prompt

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.

CR-05warn

Document link contrast

Without the rules

Links to the terms styled to match the sentence around them, because it looked cleaner.

With the prompt

Document links are underlined and differ in colour from the surrounding text by at least 3 to 1. The check prints the ratio it measured.

CR-06warn

Notice font size and contrast

Without the rules

Fine print: 10 px, light gray, tucked under a bright button.

With the prompt

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.

CR-08block

Document links resolve to the registered version

Without the rules

A link to /terms that serves whatever is in the repo today, or the legal text pasted into a component.

With the prompt

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 Windsurf

The rules file stays in the project, so Windsurf builds the next signing screen under the same rules.

A whole product

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 DocuSign
Your stack

Stack 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 guides
Live demos

Use 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 cases
Prompt generator

The exact rules for your regions

Pick your use case, regions, signer types and stack. You get one prompt to paste into Windsurf, with your own document and profile IDs and the rule packs you selected.

Generate a prompt

Questions about Windsurf and e-signatures

Can Windsurf build a clickwrap or a signing page?

Yes. Windsurf builds the page in your own project and your own design. The prompt on this page has it read the Esign Comply docs first, then create the session on the server, attach the browser SDK to your checkbox and button, and confirm the record on the server before the account is created.

Where do I store the API key in a Windsurf project?

In your server environment as ESIGNCOMPLY_API_KEY, for example in .env.local, listed in .gitignore. Only server code reads it. Never use a public prefix such as NEXT_PUBLIC_ or VITE_, because a variable with such a prefix is compiled into the browser bundle.

Read the quickstart

Where does Windsurf keep the Esign Comply rules?

In .windsurf/rules/esigncomply.md. The prompt tells Windsurf to save them there, so the rules apply to later sessions in the same project and not only to the chat you pasted the prompt into.

Is there a generated prompt for Windsurf?

Yes. Windsurf is one of the tools in the prompt generator. Pick your use case, your regions, your signer types and your stack, choose Windsurf, and paste the result. The generated prompt carries your own document and profile IDs and the rules for the packs you selected.

See the prompt generator

How do I check the page Windsurf built?

Run npx esigncomply check --url http://localhost:3000/signup. The CLI opens the page at 390 by 844, 768 by 1024 and 1440 by 900, runs the ceremony with a test signer and prints each finding with its rule ID, what was measured and the fix.

Read the conformance rules

Build the screen in Windsurf. Leave the record to us.

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

Windsurf is a trademark of its owner. Esign Comply is not affiliated with it.

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