Skip to content
Industry · Agencies and professional services

E-signatures and clickwrap for agency apps

An agency app records the documents of a client relationship: an NDA before the pitch, a proposal the client accepts, then a statement of work and a master services agreement both sides sign. You build each screen. Esign Comply supplies the rules as one prompt and seals every signature, valid under ESIGN, UETA and New York's ESRA.

Read the prompt

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

Last updated

POST /v1/prompts/generate · this page's prompt
curl https://esigncomply.com/v1/prompts/generate \
  -H "Authorization: Bearer $ESIGNCOMPLY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "use_cases": [
    { "use_case": "contract", "documents": [
      { "name": "Proposal", "type": "contract" }
    ] },
    { "use_case": "nda", "documents": [
      { "name": "Mutual NDA", "type": "nda" }
    ] }
  ],
  "signers": "business",
  "jurisdictions": ["US-FED"],
  "on_unknown_region": "base_only",
  "stack": "nextjs_app",
  "tool": "cursor"
}'
6 records · each links to its use case

What do agency and professional services apps record with Esign Comply?

An agency signs the same chain of documents with every client, and each one has a signatory on the other side who is not your user. Each card is one link of that chain, and links to the page that builds it.

The prompt · 2 flows · from the generator

Which prompt builds proposal acceptance and NDA signing for an agency app?

This is what the Esign Comply prompt generator produces when you tick two flows for business signers: contract signing, for the proposal, and NDA signing. The stack is Next.js App Router with Supabase and Vercel, under the U.S. Federal rule pack. Paste it into Cursor, Claude Code, v0, Lovable, Bolt or Replit and your tool builds both signing pages.

Both flows are signatures, so both use a typed name. The contract flow is the one a statement of work, a master services agreement and a change order run on as well: each is another document on the same profile. IDs in angle brackets are placeholders, and {Company} is your agency's name.

Generate it for your own regions and stack
esigncomply-agency-prompt.md · 1,889 words
# Esign Comply integration: contract signing and NDA signing
Prompt esc_prompt_caacb378ca44 · blocks 2026.11 · guidance bundled · region US
Jurisdictions: US-FED · mode auto

You are adding legally significant signature flows to this Next.js App Router application (TypeScript, Supabase Auth and Postgres, deployed on Vercel). Esign Comply is the independent record keeper. You build every screen. The Esign Comply SDK observes the screens you build and seals the record.

Follow this prompt exactly. If something here 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.

This prompt has four kinds of instruction. Keep them apart:
- "Required for the record": build all of it. Esign Comply checks these.
- "Your obligations": duties the law places on {Company}. Esign Comply does not check them. Build what code can do and list the rest in your report.
- "Recommendations": suggestions. Ask the developer before applying any that changes the product.
- "What you can send us": optional reports {Company} may file with Esign Comply.

## Context
- Packages (the only ones that exist): `esigncomply` (server), `@esigncomply/browser` (client), `@esigncomply/react` (optional hooks).
- API host: https://esigncomply.com/v1
- Environment variables (server only, never NEXT_PUBLIC_): ESIGNCOMPLY_API_KEY, ESIGNCOMPLY_WEBHOOK_SECRET
- Profiles: contract = `<profile ID for contract>`, NDA = `<profile ID for NDA>`
- Documents: Proposal = `<document ID for Proposal>`, Mutual NDA = `<document ID for Mutual NDA>`
- An ID in angle brackets does not exist yet. Ask the developer for it. Do not invent IDs.
- Rule pack versions: 2026-11-22 (all selected packs).
- Server SDK calls return `{ data, error }` and do not throw. Check `error` every time.

## Required for the record
1. Create every session on the server with the secret key. Send only `client_token` to the browser.
2. Read `required_steps` and `advised_steps` from the session and satisfy every one. Do not hard-code steps.
3. Show the notice text directly above the action button, in the same container, visible without scrolling at 390 x 844 (CR-04).
4. Every notice names the action button by its label and every document by its title (CR-02, CR-03). Each flow's wording is in its build step.
5. Links to documents must be underlined and use a colour that differs from the surrounding text with a contrast ratio of at least 3:1, and at least 4.5:1 against the background. Notice text is at least 14px and never lighter than body text (CR-05, CR-06).
6. Every typed-name field starts empty (CR-01).
7. Only one primary button inside the assent container. Any other action sits outside it (CR-07).
8. Serve each document at a stable page on this domain that renders the registered version fetched from Esign Comply, unmodified (CR-08).
9. Treat the browser result as untrusted. Grant access only after the server has confirmed the record with the secret key (step 4 below).
10. Pass an `Idempotency-Key` on session creation.

### Never
- Never pre-check a box, auto-submit, or call `.click()` on the user's behalf.
- Never treat sign-in, scrolling, or continued use as acceptance.
- Never use "By continuing" or "By clicking below" wording.
- Never put the secret key, or any call that uses it, in a client component.
- Never proxy `@esigncomply/browser` calls through this application's server.
- Never cache or copy document text into the repository. Always render the registered version.
- Never write to `esign_acceptances` from the browser.
- Never show "signed" or "accepted" in the interface before step 4 confirms it.
- Never write or change the text of the Proposal or Mutual NDA.

## Your obligations
These are {Company}'s duties under the rule packs selected. Esign Comply lists them and does not perform, monitor, or verify them. The list is not exhaustive.

US-FED · pack 2026-11-22
- Customer: where another law requires {Company} to keep a record, keep an accurate, accessible copy for that period, including after export (US-31); before offering a record in court, give the adverse party reasonable written notice and access to the record and declaration (US-38). Outside this codebase.

## Recommendations
Esign Comply recommends the following. Ask the developer which to apply.

- State in the contract notice that the signer agrees to sign electronically, give a way to decline, and show a review step before the final act (US-04, US-05). Already reflected in step 6.
- Before a material update to a document takes effect, notify signers in advance and ask for a fresh acceptance (US-18).
- Keep saving and printing open wherever a signed record is shown (US-29).
- Where minors may sign, consider an age attestation checkbox: `ceremony.ageAttested({ checkbox })` (US-42).

## What you can send us
Optional. Each report is sealed with Esign Comply's receipt time and marked as supplied by {Company}; Esign Comply does not verify it. Every field is optional and any text, JSON, or file is accepted.
Reports never affect recording, and a failed one never blocks the user's action. Suggested `data` per type: `esc.supplements.types()`.

- When the terms-update notice email is sent:
  `esc.supplements.create({ subject: { signer: signerId }, type: "notice.sent", rule_ids: ["US-18"], text, data: { channel: "email", template } })`
- Anything else worth keeping (support ticket, screenshot, policy in force): type `note`, or omit `type`.

Only wire these if the developer says yes.

## Build steps

### 1. Install and configure
`npm install esigncomply @esigncomply/browser`
Create `lib/esigncomply.ts`:
```ts
import "server-only";
import { EsignComply } from "esigncomply";
export const esc = new EsignComply(process.env.ESIGNCOMPLY_API_KEY!);
```
Keys go in `.env.local` and the Vercel project settings, never in chat.
Run commands in the integrated terminal. Rules file: `.cursor/rules/esigncomply.mdc`.

### 2. Database (Supabase migration)
```sql
create table public.esign_acceptances (
  id uuid primary key default gen_random_uuid(),
  user_id uuid references auth.users(id) on delete cascade,
  signer_id uuid not null,
  record_id text not null unique,
  document_id text not null,
  version_id text not null,
  purpose text not null,
  signed_at timestamptz not null,
  created_at timestamptz not null default now()
);
alter table public.esign_acceptances enable row level security;
create policy "read own" on public.esign_acceptances
  for select using (auth.uid() = user_id);
-- No insert, update, or delete policies. Only the service role writes.
```
Add `signer_id uuid unique` to the profile table.

### 3. Document pages
Create `app/legal/[slug]/page.tsx` for `proposal` and `nda`. Resolve `current` on session creation only. Fetch with `esc.documents.versions.getContent(documentId, versionId)`; render, print and download by the exact version ID returned on the session; the cache key includes that ID. Render inside `<article data-esc-document>` and reject stale versions before the final action. Give users a real opportunity to read the terms.

### 4. Server confirmation (the only place access is granted)
Server action `finishContract(recordId)`:
- `const { data: record, error } = await esc.records.get(recordId);`
- Require: no error; `record.status` is "recorded", "timestamped", or "anchored"; `record.signer.external_id` equals the signer ID this server put on the session; `record.livemode` equals `process.env.VERCEL_ENV === "production"`; the record lists the exact versions pinned in that session.
- Only then mark the document signed, and insert one `esign_acceptances` row per document using the service-role client.
- If checks are inconclusive, do not mark the document signed. Show: "We could not confirm whether your acceptance was recorded. Please wait while we check." Reconcile the existing session before requesting another act.

### 5. Webhook
`app/api/esigncomply/webhook/route.ts`, Node.js runtime. Read the raw body, then `esc.webhooks.verify(rawBody, request.headers, process.env.ESIGNCOMPLY_WEBHOOK_SECRET!)`.
Reject on failure with 400. Handle idempotently by `webhook-id`:
- `record.completed`: upsert `esign_acceptances` (covers a browser that closed early).
- `record.disputed`: flag the row and notify the admin email.
- Ignore event types you do not recognise and return 200.
Return 200 within 5 seconds.

### 6. Contract signing (`/contracts/[id]`)
- Server: create a session with `profile: "<profile ID for contract>"`, `documents: [{ document: "<document ID for Proposal>", version: "current" }]`, `context.purpose: "contract_signature"`, the signer's `external_id`, `name` and `email`, `class: "business"`.
- Obtain `country` and applicable jurisdiction from the form/customer configuration; do not guess from IP.
- Page layout, top to bottom:
  1. The full session-pinned Proposal rendered inline with download and print. Call `ceremony.presentDocument({ versionId, mode: "inline", container })`.
  2. Review line: "You are signing the Proposal between {Company} and {signer name} as {signer name}." Record it with `ceremony.reviewPresented({ container })` (CR-13).
  3. Assent container with: the notice "By typing your name and clicking Sign agreement, you agree to sign this agreement electronically and to be bound by it." (CR-12), and in the same notice the title "Proposal" (CR-02); an empty text field labelled "Type your full legal name" (CR-09); a primary button "Sign agreement"; a secondary text link "Decline" outside the container that calls `ceremony.cancel()`.
  4. `ceremony.observeAssent({ region, typedName: nameField, submit })`, then `ceremony.complete()` from the click.
- After completion, confirm on the server as in step 4, then show "Signed. A copy has been emailed to you by Esign Comply." with a link to `result.verifyUrl` and a "Download copy" link.
- Do not render a signature image or a cursive font as the signature.

### 7. NDA signing (`/nda/[id]`)
- Server: create a session with `profile: "<profile ID for NDA>"`, `documents: [{ document: "<document ID for Mutual NDA>", version: "current" }]`, `context.purpose: "nda"`, the signer's `external_id`, `name` and `email`, `class: "business"`, and `country` and `region` as in step 6.
- Page layout, top to bottom:
  1. The full session-pinned Mutual NDA rendered inline with download and print. Call `ceremony.presentDocument({ versionId, mode: "inline", container })`.
  2. Review line: "You are signing the Mutual NDA between {Company} and {signer name} as {signer name}." Record it with `ceremony.reviewPresented({ container })` (CR-13).
  3. Assent container with: the notice "By typing your name and clicking Sign NDA, you agree to sign this agreement electronically and to be bound by it." (CR-12), and in the same notice the title "Mutual NDA" (CR-02); an empty text field labelled "Type your full legal name" (CR-09); a primary button "Sign NDA"; a secondary text link "Decline" outside the container that calls `ceremony.cancel()`.
  4. `ceremony.observeAssent({ region, typedName: nameField, submit })`, then `ceremony.complete()` from the click.
- After completion, confirm on the server as in step 4, then show "Signed. A copy has been emailed to you by Esign Comply." with a link to `result.verifyUrl` and a "Download copy" link.
- Do not render a signature image or a cursive font as the signature.

### 8. Errors
- `ceremony.complete()` rejected with a rule ID: show the message, keep the form, do not retry automatically.
- Network failure or 5xx: show "We could not confirm whether your acceptance was recorded. Please wait while we check." Reconcile the same session and idempotency key before requesting another act. Never proceed without a record.
- `client_token_expired`: create a new session and re-attach.

## Verify before you report success
1. `npm run build` passes and no file under `app/**` marked "use client" imports `esigncomply` or reads ESIGNCOMPLY_API_KEY.
2. Run `npx esigncomply check --url http://localhost:3000/contracts/test` and `npx esigncomply check --url http://localhost:3000/nda/test`. Fix every finding marked "block", re-running until none is left. List every finding marked "warn" in your report.
3. Confirm by test that submitting with the name field empty does nothing, and that calling `finishContract` with a made-up record ID does not mark the document signed.
4. Report: files created or changed, anything in this prompt you did not implement and why, the conformance summary, each item under "Your obligations" with "built", "partly built", or "needs a process outside this codebase", and each recommendation with the developer's decision.

The flows in the prompt for agency apps: the profile the prompt generator derives for each, with its method, level, purpose and documents
Flow in the promptMethodLevelPurposeDocuments
Contract signingTyped nameL1contract_signatureProposal contract
NDA signingTyped nameL1ndaMutual NDA nda

Each row is a profile the generator derives for one flow: the method, the assurance level and the context.purpose its sessions send. Send the same flows to POST /v1/prompts/generate and the API returns this prompt with your own profile IDs in it. Every flow starts at L1, which is on every plan.

Worked flow · run before publishing

How does an agency app record a client's acceptance of a proposal with the Esign Comply API?

The proposal is where an engagement starts, and the document a fee dispute goes back to. Your server registers each proposal as its own version and creates one session for the client's signatory on that version, your proposal page runs the typed-name ceremony, and the project opens only after your server has read the sealed record back.

required_steps · 5 steps, in orderas the API returns them for this session
  1. 01client.attached

    The browser SDK attaches to your signing page with the client token.

  2. 02document.presented:<version_id>

    Your page shows the Proposal in full, rendered from the registered version, and the SDK reports a hash of the text on screen.

  3. 03notice.captured

    The SDK captures the signing statement and the Sign agreement button as the browser rendered them.

  4. 04intent.captured

    The signer types their full legal name into an empty field. Nothing is prefilled.

  5. 05signature.applied

    The signer clicks Sign agreement. The API seals the record and returns a signed receipt.

import { EsignComply } from "esigncomply";

const esc = new EsignComply(process.env.ESIGNCOMPLY_API_KEY!);

export async function startProposalSession(origin: string, signatory: { id: string; name: string; email: string }, proposal: { id: string; versionId: string; clientId: string }) {
  const { data: session, error } = await esc.sessions.create(
    {
      profile: process.env.ESC_PROPOSAL_PROFILE_ID!,
      signer: { external_id: signatory.id, name: signatory.name, email: signatory.email, class: "business", country: "US" },
      documents: [{ document: process.env.ESC_PROPOSAL_DOCUMENT_ID!, version: proposal.versionId }],
      context: { url: `${origin}/proposals/${proposal.id}`, locale: "en-US", purpose: "contract_signature" },
      metadata: { proposal_id: proposal.id, client_id: proposal.clientId },
    },
    { idempotencyKey: `proposal-${proposal.id}-${signatory.id}` },
  );
  if (error) throw new Error(`${error.code}: ${error.message}`);
  // Only the client token, the API base for it and the pinned versions go to the browser.
  return { clientToken: session.client_token, apiUrl: session.api_url, documents: session.documents };
}

What is agency about this call: the signer is a client's signatory, not a user of yours, so the session is created when they open the link you sent, and every client gets a proposal of its own, so the session names that proposal's version by ID. The client and the proposal travel in metadata and come back on the confirmed record.

Searching records

Every signatory of one client

GET /v1/records?query= takes a record ID, matched exactly, or part of a signer's external ID. Start each signatory's ID with the client's key, such as acme-, and one query lists every record that client's people have signed: the NDA, the proposal, each statement of work. The match is on the ID your server sent, which the record marks as asserted.

The screen and the browser code

Use case: Proposal or quote acceptance

This is the flow of the proposal acceptance page: the proposal in full, a review line, a typed name and one button. That page shows the screen at each step, the browser code that reports it and what the sealed record holds.

session.ts reads the profile from ESC_PROPOSAL_PROFILE_ID and the document from ESC_PROPOSAL_DOCUMENT_ID: the IDs register.ts returned. Each sample is run as printed against the API in test mode, and the session is then completed in a real browser.

Proposal or quote acceptance
Rule packs

Which rules apply to e-signatures and clickwrap in an agency app?

Client contracts between businesses run on the U.S. Federal pack's rules for signature profiles: the explicit act, the statement that the signer agrees to sign electronically, a review step before the final act, a copy the signer can download, and chain of custody. A client in the EU, the UK or Switzerland brings that pack with it.

Rule packs, their versions, how many of their rules apply to the flows of agency apps, and the rules to know
Rule packPack versionRules that applyRules to know for these flows
United States, FederalUS-FED2026-11-2235US-01 Explicit intent action and exact notice textUS-04 Agreement to transact electronicallyUS-05 Review step before the final actUS-29 Downloadable, printable executed copiesUS-35 Chain of custody for signature profiles
CaliforniaUS-CA2026-11-211The pack's general rules
New YorkUS-NY2026-11-211The pack's general rules
FloridaUS-FL2026-11-212The pack's general rules
TexasUS-TX2026-11-214The pack's general rules
DelawareUS-DE2026-11-210No rule of this pack applies
VirginiaUS-VA2026-11-210No rule of this pack applies
MassachusettsUS-MA2026-11-211The pack's general rules
European Union and EEAEU2026-11-2117EU-03 Signature level classificationEU-14 EU minimal capture by default
United KingdomUK2026-11-2116The pack's general rules
SwitzerlandCH2026-11-219The pack's general rules

The counts are the rules the prompt generator resolves for this page's flows when a pack is selected. The prompt on this page is generated for United States, Federal (US-FED). Enable more packs on the profile, send the signer's country and state on the session, and the API applies the packs that cover that signer and returns the rules that fired. United States, Europe, jurisdictions guide.

POST /v1/sessions

Both sides sign, one session each

A statement of work signed by the client and by you is two sessions on the same document version. Each signer gets a ceremony and a sealed record of their own, and your app treats the document as complete when it has confirmed both.

Several signers and signing order
content.format: pdf

The document your client negotiated

Register the final text as Markdown, HTML, plain text or the PDF that came back from the client's counsel. Every version is stored unchanged and pinned to the record by its SHA-256 hash.

Documents API
record.completed

The project opens on your server

The browser receives a receipt when the signatory finishes. Your server still reads the record with its secret key, or handles the signed webhook, before it marks the proposal accepted.

Server confirmation guide
Limits

What does Esign Comply not cover in agencies and professional services?

Proposals, statements of work, master services agreements and NDAs are supported document types, and nothing an agency signs with a client every week is blocked. These are the edges a services firm reaches.

  • Blocked

    Anything that needs a notary, a witness or a public deed

    Documents that require notarization or a public deed are refused with document_type_excluded. The API has no notary step, and remote online notarization is not supported.

  • Blocked

    Deeds in England and Wales, and Swiss written form

    With the UK pack applied, an agreement executed as a deed is refused: a deed signed by an individual needs witnessing, attestation and delivery. With the Swiss pack, a contract with a statutory written-form requirement is refused.

  • Not supported

    Qualified and advanced signatures in Europe

    A typed name is a simple electronic signature under eIDAS. A client whose procurement rules ask for an advanced or a qualified signature needs a provider of those: Esign Comply does not offer them.

  • Not supported

    Tax forms from freelancers

    IRS e-signature rules are not supported, so the tax form you collect from a freelancer stays outside the flow. Their contractor agreement is supported.

  • By design

    No pricing, no invoicing, no clause review

    Esign Comply records the signature on the document you registered. It does not check the totals of a proposal, raise an invoice or read a clause: the record pins the text by hash and says what the signer did.

  • By design

    One signer per session

    A session is one person. A document several people sign is one session per signer on the same version, and your app tracks who has signed and in which order.

  • By design

    No hosted signing page

    Esign Comply has no signing or acceptance page of its own. Every screen the person sees is one you build, on your domain.

  • Plan

    Signer verification is optional and on two plans

    Every flow on this page records at L1 on every plan: your app says who the signer is. A one-time code that Esign Comply emails to the signer (L2) and passkeys (L3) are on Unlimited and Enterprise. Esign Comply sends no text messages.

Evidence

What evidence does an agency app hold for a dispute or an audit?

When a client disputes an invoice and says the scope was never agreed, you hand over the record of the proposal and of each statement of work: sealed at signing, and kept outside the project tool your team can edit.

  • Signed receiptStore it on your own rowcomplete() returns the receipt in the browser, and your server reads the record again with GET /v1/records/{id}. Save the record ID and the receipt beside your own data.
  • PDF, per recordEvidence reportGET /v1/records/{id}/report returns a readable account of one record, with each field labeled as observed by Esign Comply or asserted by your app. It is included for every record on every plan.
  • ZIP, verifies offlineEvidence packageThe record, the receipt, the timestamp token, the ledger proof and the exact document bytes. Anyone you hand it to runs the open-source esigncomply-verify with no account and no network.
  • On requestCertificateA signed statement about one record or a set of records, issued when a dispute or an audit calls for it. For live records it costs $20 on Starter, 25 a year are included on Unlimited and all of them on Enterprise. In test mode it is free and watermarked.
Export the evidence · cURL
# Every record whose signer ID carries one client's key, newest first
curl "https://esigncomply.com/v1/records?query=$CLIENT_KEY&limit=100" \
  -H "Authorization: Bearer $ESIGNCOMPLY_API_KEY"

# The evidence report of one record, as a PDF
curl https://esigncomply.com/v1/records/$RECORD_ID/report \
  -H "Authorization: Bearer $ESIGNCOMPLY_API_KEY" -o evidence-report.pdf

# The evidence package of the same record, as a ZIP, then the offline check
curl "https://esigncomply.com/v1/records/$RECORD_ID/evidence?inline=true" \
  -H "Authorization: Bearer $ESIGNCOMPLY_API_KEY" -o evidence.zip
npx esigncomply-verify evidence.zip

Each record shows the exact proposal by hash, the review line the signatory saw, the name they typed and Esign Comply's server time. Your proposal and client IDs are on it, marked as supplied by you.

Listing records and downloading reports and packages need a key with full_access or read_only permission. Keep that key in your admin tooling, apart from the key your application server records with.

E-signatures in agency apps: questions developers ask

How do I let a client accept a proposal inside my agency app?

Register the proposal as its own document version, email the client's signatory a link to your own proposal page, and create a session when they open it. They review the proposal, type their name and click the button. Mark the proposal accepted only after your server has confirmed the sealed record.

Proposal or quote acceptance

Is Esign Comply compliant with the ESIGN Act and UETA for client contracts?

Yes. Follow the setup and each typed name on a proposal, a statement of work or a master services agreement is a valid electronic signature under the U.S. ESIGN Act, state UETA laws and New York's ESRA. The record ties that name to the exact document and the notice the signatory saw.

What ESIGN, UETA and ESRA require

How do the client and the agency both sign a statement of work?

Create one session per signer on the same document version. The client's signatory and yours each get a ceremony and a sealed record of their own, and your app holds the order. The statement of work is complete when your server has confirmed both records.

Statement of work signing

Can I send a client a link instead of asking them to log in?

Yes. The link carries a token of your own and opens your signing page, and your server creates the session when the page loads. Esign Comply sends no invitation: the email, the reminders and the link are yours.

Emailed signing link

What happens when the scope changes after signing?

Sign a change order. It is a document of its own with its own record, and the earlier record stays sealed exactly as it was signed. Your server can mark the earlier record as superseded, which adds an annotation and changes nothing in it.

Change order signing

Can I move my agency's contracts off a send-a-PDF tool?

Yes. The migration guides map envelopes, templates and webhooks to sessions and records, operation by operation, and say when the tool you have is the better choice. You keep your documents and build the signing page in your own portal.

Migrate from PandaDoc

Build your client portal yourself. Leave the record to us.

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

PandaDoc, Docusign and the other product names on this page are trademarks of their owners. Esign Comply is not affiliated with them.

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