Skip to content
Chat assistant · Grok

Build an e-signature flow with Grok

You use Grok to research engineering questions and to write code. Ask it this one: the prompt sends it to the Esign Comply docs, and it comes back with a signup clickwrap for your stack as three files you add to your project.

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

One prompt, from paste to record
  1. 01
    Paste the prompt into GrokYou
  2. 02
    Add the three files to your projectYou
  3. 03
    Put a test key in your server environmentYou
  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 Grok

Fill in the square brackets, then paste this into a new conversation with Grok. 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 Grok
  • 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 Grok
Help me build a signup clickwrap with Esign Comply. My app: [what it does]. My stack: [framework and host]. New users accept the Terms of Service and the Privacy Notice with a checkbox and a button that I render myself.

Read these three pages before you answer, and follow them exactly:
- https://esigncomply.com/setup.md
- https://esigncomply.com/auth.md
- https://esigncomply.com/llms.txt
If a page does not load, say so and stop.

Give me, in this order:
1. The server file that creates the session with the secret key from ESIGNCOMPLY_API_KEY and sends the browser only the client token and the document version IDs.
2. The signup form with @esigncomply/browser attached to my own unchecked checkbox and my own button, calling complete() from the user's real click.
3. The server file that confirms the record with the secret key before the account is created.
4. The order of API calls, in one short list, with the docs page for each.

Rules
- Never invent API methods, packages or legal wording. If the docs do not cover it, say so and ask me.
- Never pre-check the box.
- Never ask for my key in this chat.
- If something conflicts with my stack, stop and ask.

Write each file in full, with its path, so I can copy it into my project.
4 steps

How to run it in Grok

Grok is an AI assistant that can code, and people use it to research engineering questions. 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. No card on the Free plan, and no domain either: test keys work on localhost.
  2. 02
    Paste the prompt into GrokDescribe your app and your stack between the square brackets. Grok reads the three docs pages, then gives you three files and a short list of the API calls in order, each with its docs page. If a page does not load for it, paste the text of that page into the conversation.
  3. 03
    Add the files to your projectEach file comes with its path. Copy them in, install esigncomply and @esigncomply/browser, and set ESIGNCOMPLY_API_KEY in your server environment yourself.
  4. 04
    Run the app and tick the boxOpen your signup page on localhost, tick the checkbox and click Create account. Then run npx esigncomply check --url http://localhost:3000/signup and paste any finding back into the conversation.
Research prompt

A second prompt, for research with Grok

Researching before you build? This second prompt asks Grok the engineering question first, then for the Esign Comply integration step by step.

The comparison is yours to read and argue with. The integration part comes from the docs, so every call Grok shows is one you can look up.

See what you can build yourself
Research prompt for Grok
Research question: what is the best way to add e-signatures to an app I am building myself? My app: [what it does]. My stack: [framework and host].

Compare buying a hosted signing product, embedding one, self-hosting an open-source tool, and building the signing flow in my own UI with Esign Comply as the independent record keeper. Cover build effort, who controls the screen, who holds the record, and what I can give a third party as evidence.

Then show the Esign Comply integration step by step from https://esigncomply.com/setup.md and https://esigncomply.com/llms.txt: the order of API calls, what runs on the server and what runs in the browser. Link the docs page for each step. Do not invent API methods.
The 60-second result

What you have 60 seconds after Grok finishes

Copy the files in, start the app and sign up once. This is what Grok handed you, 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 for Next.js. Name your stack in the prompt and Grok writes the same three files for it.

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

A research answer about e-signatures reads well and skips the details a signing screen is judged on. The prompt sends Grok to the docs, where those details are written down as rules.

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-04block

Notice and control in the same viewport

Without the rules

The agreement line sits in the footer or under a long form, below the fold on a phone.

With the prompt

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.

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-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 Grok

Research done, first flow built. These pages cover the rest of what you can build, with code for each.

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 Grok, with your own document and profile IDs and the rule packs you selected.

Generate a prompt

Questions about Grok and e-signatures

Can Grok write the code for an e-signature flow?

Yes. Give Grok the prompt on this page with your app and stack filled in. It reads the Esign Comply docs, then writes the server file that creates the session, your signup form with the browser SDK attached, and the server file that confirms the record. You copy the files into your project.

Can I use Grok to research how to add e-signatures to my app?

Yes. The research prompt on this page asks Grok to compare a hosted signing product, an embedded one, a self-hosted open-source tool and your own UI with Esign Comply as the record keeper, then to walk through the Esign Comply integration with a link to the docs page for each step.

What you can build yourself

Where does my API key go when I work with Grok?

In your server environment as ESIGNCOMPLY_API_KEY, set by you. The prompt tells Grok never to ask for the key in the chat. The files it writes read the variable on the server, and the browser receives a short-lived client token for one session.

Read the quickstart

How do I check the code Grok wrote?

Run it. Tick the box on your signup page with a test key, then run npx esigncomply check --url http://localhost:3000/signup. The CLI runs your page at three window sizes and prints each finding with its rule ID, the measurement and the fix. Paste a finding back to Grok to repair the file.

Read the conformance rules

Is a signature collected in an app I built with an AI tool recognized?

Yes. Electronic signatures are recognized under the U.S. ESIGN Act and state UETA laws: a signature cannot be denied legal effect just because it is electronic. Esign Comply gives your AI tool the ceremony rules drawn from those laws and from leading U.S. online-assent decisions, and keeps each signature as an independent, tamper-evident record.

U.S. rules we draw on

Research it with Grok. Build it. Leave the record to us.

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

Grok 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/grok.md