# Convert an existing acceptance checkbox to Esign Comply

> A runbook for AI agents: convert an existing terms checkbox to Esign Comply. Register the terms, create the session, attach the SDK, confirm on the server.

Source: https://esigncomply.com/agents/convert-acceptance-checkbox

For AI agents · task runbook

To convert an existing acceptance checkbox, register the terms the project shows today, create a session on your server, and attach the browser SDK to the box and the button the form already has. Esign Comply seals a record of each acceptance, and your server confirms it before the app creates the account. The old column stays.

[Get an API key](https://esigncomply.com/signup) · [Read the docs](https://esigncomply.com/docs/sdk/browser)

Paste the prompt into your AI agent, or follow the steps yourself. The whole flow is in the [guide for AI agents](https://esigncomply.com/agents).

Last updated November 23, 2026

esigncomply-convert-acceptance-checkbox.md · 261 words

```markdown
Convert the terms checkbox this project already has to Esign Comply. Keep the form, the box and the button. Change what happens behind them.

Read these first and follow them exactly:
- https://esigncomply.com/agents/convert-acceptance-checkbox.md (this task, step by step)
- https://esigncomply.com/agents.md (every dashboard label and every account call)
- https://esigncomply.com/setup.md (the whole setup runbook)

What stays with me: I confirm which text of the terms to register, and I choose the jurisdictions. Ask me before you register anything.

What you do:
1. Find the checkbox, the terms it links to and the column that stores the acceptance. Tell me what you found before you change it.
2. Register the terms the project shows today as a document, and publish one version from that text, unchanged.
3. Create the session on the server (POST /v1/sessions) with ESIGNCOMPLY_API_KEY. Send only client_token and documents to the browser.
4. Attach @esigncomply/browser to the existing box and button. The box starts unchecked. Never pre-check it and never submit for the user.
5. Confirm the record on the server (GET /v1/records/{id}) before the app creates the account.
6. Leave the old acceptance column and its data in place. Store the record ID and the receipt beside it.
7. Run npx esigncomply check --url <page> and fix every finding marked "block".

If a session is refused, the flow stops and tells the person. Never fall back to an acceptance with no record.

Last, add the block at https://esigncomply.com/rules.md to this project's instruction file and list this flow at its end: the path, what is accepted and the profile ID.
```

Before step 1

## What do you need before you convert an acceptance checkbox?

- A test key in `ESIGNCOMPLY_API_KEY` and the API address in `ESIGNCOMPLY_API_URL`, both on the server. Without them, start at `https://esigncomply.com/agents/set-up-test-integration`.
- The text of the terms the project shows today. You publish it unchanged, so confirm with your person that it is the text to register.
- A profile with the checkbox method at L1. Without one, create it: `https://esigncomply.com/dashboard/profiles`, link "New profile", or `POST /v1/profiles`.
- A form on `localhost` whose checkbox starts unchecked.

8 steps

## How do you convert an acceptance checkbox with Esign Comply, step by step?

1. **Find the checkbox and what it stores**

   Search the project for every place where a person accepts something: sign-up forms with a terms checkbox, checkout terms, "I agree" buttons, consent prompts that gate an action, and columns such as `accepted_terms_at`, `tos_version` or `signature`. Convert one flow at a time. For this one, note the page, the checkbox, the button, the link to the terms and the column the acceptance is written to.

   In the project

   ```bash
   git grep -n -i -E "accepted_terms_at|tos_version|i agree|type=\"checkbox\""
   ```

2. **Register the terms the project shows today**

   List what exists first, so that you do not create duplicates. Then create the document and publish one version from the text the project shows today, unchanged. In a browser: `https://esigncomply.com/dashboard/documents`, link "New document", button "Create document", then under "Publish a version" paste the text into "Content" and press "Publish version". A status line reads "Published version 2026-11-23 (en). Content hash sha256:…" with your label, language and hash. The page that shows the terms then renders the registered version, fetched from `GET /v1/documents/{id}/versions/{version_id}/content` and injected unmodified into an element marked `data-esc-document`.

   Without a browser

   ```bash
   curl -s "$ESIGNCOMPLY_API_URL/documents?limit=100" \
     -H "Authorization: Bearer $ESIGNCOMPLY_API_KEY"

   curl -s "$ESIGNCOMPLY_API_URL/documents" \
     -H "Authorization: Bearer $ESIGNCOMPLY_API_KEY" -H "Content-Type: application/json" \
     -d '{ "name": "Terms of Service", "type": "terms" }'

   curl -s "$ESIGNCOMPLY_API_URL/documents/doc_8Hq2/versions" \
     -H "Authorization: Bearer $ESIGNCOMPLY_API_KEY" -H "Content-Type: application/json" \
     -d '{ "version_label": "2026-11-23", "language": "en", "content": { "format": "markdown", "text": "# Terms of Service\n..." } }'
   ```

3. **Create the session on the server**

   The route that renders or submits the form creates one session for the signer. Send `signer.external_id` (your user ID, or a UUID your server generates for a sign-up with no account yet), `signer.region` from the form or account data and never from the IP address, the document with `"version": "current"`, and `context.url`. Send only `client_token` and `documents` to the browser. Save the signer ID and each pinned `version_id` in state the server owns.

   On the server

   ```bash
   curl -s "$ESIGNCOMPLY_API_URL/sessions" \
     -H "Authorization: Bearer $ESIGNCOMPLY_API_KEY" -H "Content-Type: application/json" \
     -H "Idempotency-Key: signup-user_7c1d-1" \
     -d '{
       "profile": "prof_signup_4f1a",
       "signer": { "external_id": "user_7c1d", "email": "dana@example.org", "class": "consumer", "country": "US", "region": "US-CA" },
       "documents": [{ "document": "doc_8Hq2", "version": "current" }],
       "context": { "url": "http://localhost:3000/signup", "purpose": "account_signup" }
     }'
   ```

4. **Attach the browser SDK to the existing box and button**

   The SDK renders nothing. It observes the elements the form already has and reports the ceremony from the signer's browser. The assent region holds, in this order: an unchecked checkbox whose label states agreement to the named documents, the notice text with a link to each document, and one primary button. The notice reads "By checking the box and clicking {button label}, you agree to the \[document titles\]." Keep the button disabled until only `signature.applied` is left, and call `complete()` from the form's real submit handler.

   In the browser

   ```
   import { EsignComply } from "@esigncomply/browser";

   // The elements the form already has. The selectors are your project's own.
   const form = document.querySelector<HTMLFormElement>("#signup")!;
   const region = document.querySelector<HTMLElement>("#assent")!; // notice text, link, checkbox, button
   const checkbox = document.querySelector<HTMLInputElement>("#agree")!;
   const submit = document.querySelector<HTMLButtonElement>("#create-account")!;

   // Your own route. It creates the session with the secret key and returns
   // { clientToken, apiUrl, documents } to the browser. Nothing else.
   const res = await fetch("/api/ceremony", { method: "POST" });
   if (!res.ok) throw new Error("Unable to create ceremony");
   const { clientToken, apiUrl, documents } = await res.json();

   const ceremony = await EsignComply.attach({ clientToken, apiUrl });
   await ceremony.presentDocument({ versionId: documents[0].version_id, mode: "hyperlink", link: document.querySelector("#tos-link") });
   ceremony.observeAssent({ region, checkbox, submit });

   const sync = () => {
     submit.disabled = ceremony.remainingSteps().some((step) => step !== "signature.applied");
   };
   ceremony.on("change", sync);
   sync();

   form.addEventListener("submit", async (event) => {
     event.preventDefault();
     const result = await ceremony.complete(); // { recordId, receipt, verifyUrl, status }
     // Send result.recordId to your server. It confirms the record before it creates the account.
   });
   ```

5. **Confirm the record on the server**

   Treat the record ID from the browser as a claim to check. Before the app creates the account, read the record with the key and require: no error, a `status` of `recorded`, `timestamped` or `anchored`, the `livemode` this deployment expects, a `signer.external_id` equal to the one the server saved, and exactly the `version_id` values the session pinned. A made-up ID answers `404 not_found`. Handle the `record.completed` webhook as the backstop for a browser that closed early.

   On the server

   ```bash
   curl -s "$ESIGNCOMPLY_API_URL/records/rec_Z4m8" \
     -H "Authorization: Bearer $ESIGNCOMPLY_API_KEY"
   ```

6. **Keep the old column**

   Leave the acceptance data the project already holds in place: it is the project's history. New acceptances get records. Keep writing the old column if other code reads it, and store `record.id` and `record.receipt` next to it. The receipt is a signed token that names the record hash.

7. **Run the conformance check**

   Run the check on the converted page and fix every finding marked `block`. With `--callback` the checker also posts a forged success to your confirmation route and expects a refusal. A box ticked by script fails rule `CR-01` with the finding "The assent control was changed by a programmatic event, not by the user." Confirm by test that submitting with the box unchecked does nothing.

   In the project

   ```bash
   npx esigncomply check --url http://localhost:3000/signup --callback http://localhost:3000/api/signup/finish
   ```

8. **Add the rules block and list the flow**

   Add the block from `https://esigncomply.com/rules.md` to the file the project's AI tools read for standing instructions: `AGENTS.md`, or `CLAUDE.md`, `.cursor/rules`, `.github/copilot-instructions.md` if the project already has one. The block ends with a list of the flows that use it. Add this one: its path, what is accepted, and its profile ID.

   The line to add to the list

   ```
   - /signup: Terms of Service accepted at sign-up, profile prof_signup_4f1a
   ```

### It worked when

ticking the box and pressing the button on the converted form seals a test record, your server reads it with `GET /v1/records/{id}` before it creates the account, the confirmation route refuses a made-up record ID, and the check exits with `0`.

## What must a person do, and what must the agent never do?

The account belongs to a person. These limits hold in this task, as they do in every task an agent runs on Esign Comply.

### The person does

- Your person confirms which text of the terms to register. You publish it as they give it to you.
- Your person chooses which jurisdictions apply. The choice of packs is theirs.

### The agent never does

- Never pre-check an assent control or submit on the user's behalf.
- Never store a signature or an acceptance only in the app's database, and never build one without a session.
- Never fall back to an acceptance with no record when a session is refused. Stop the flow and say so.
- Never trust the browser's completion result. Confirm every record on the server with a secret key or a verified `record.completed` webhook before granting access.
- Never copy document text into the repository, and never write or change it.
- Never infer `signer.region` from an IP address. Pass it from form or account data.
- Never put `ESIGNCOMPLY_API_KEY` in client code. The browser holds the session's client token and nothing else.

[Browser SDK](https://esigncomply.com/docs/sdk/browser) · [Server confirmation](https://esigncomply.com/docs/guides/server-confirmation) · [Sessions API](https://esigncomply.com/docs/api/sessions) · [Documents API](https://esigncomply.com/docs/api/documents) · [Conformance rules](https://esigncomply.com/docs/conformance)

## Questions about this task: convert an acceptance checkbox

### Do I have to rebuild the sign-up form to convert the checkbox?

No. The browser SDK is headless and renders nothing: it observes the checkbox, the notice and the button the form already has. You pass it those elements and it reports the ceremony from the signer's browser.

### What happens to the acceptances already stored in my database?

They stay where they are. The old column is the project's history, and new acceptances get sealed records. Importing historical acceptances is planned and not available yet.

### Can the checkbox stay pre-checked after the conversion?

No. The checkbox starts unchecked and the person ticks it themselves. A box that is checked when the page loads, or ticked by script, is reported as it was found and fails rule CR-01.

### Where does the text of the terms come from after the conversion?

From the registered version, fetched from Esign Comply and rendered unmodified on a page of your own domain. The browser SDK hashes the text on that page and compares it with the registered version, so do not copy the text into the repository or render the Markdown with your own library.

### What if creating the session fails during sign-up?

The flow stops and tells the person. The app never falls back to an acceptance with no record, and it never stores the acceptance in its own database alone.

### Which value does the app trust after the box is ticked?

Only the record your server reads with the secret key. The record ID the browser sends is a claim to check: the server requires a sealed status, the expected signer and exactly the versions the session pinned.

### Does converting one checkbox cover the other acceptance flows in the project?

No. Convert one flow at a time: checkout terms, NDA pages and consent prompts each go onto a session of their own. Add each converted flow to the list at the end of the rules block, with its path and its profile ID.

### Other tasks for an AI agent

- [Set up a test integration](https://esigncomply.com/agents/set-up-test-integration)
- [Publish a version and require re-acceptance](https://esigncomply.com/agents/publish-version-reacceptance)
- [Verify a domain and go live](https://esigncomply.com/agents/verify-domain-go-live)
- [Export evidence for one record](https://esigncomply.com/agents/export-evidence)
- [Check usage against the plan limit](https://esigncomply.com/agents/check-usage)
- [The whole guide for AI agents](https://esigncomply.com/agents)

## Your person signs up once. You do the rest.

[Get an API key](https://esigncomply.com/signup) · [Read the docs](https://esigncomply.com/docs/sdk/browser)

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

---

Every page on esigncomply.com has a Markdown version at the same URL plus `.md` (the home page is `https://esigncomply.com/index.md`). https://esigncomply.com/llms.txt lists them.

---

Esign Comply is the e-signature API and clickwrap API for developers who build their own signing flow in their own UI: it supplies the ceremony rules as a generated prompt for AI coding tools, records events in direct browser ceremonies, and seals independent, verifiable evidence.
