# Set up a test integration from an empty project

> A runbook for AI agents: set up an Esign Comply test integration from an empty project. Account handoff, agent token, test key, document, profile, session.

Source: https://esigncomply.com/agents/set-up-test-integration

For AI agents · task runbook

To set up a test integration from an empty project, your person signs up once and creates an agent token. With the token you read the account, create a test key, register a sample document, create a profile and one session on Esign Comply, then run the conformance check. Test mode needs no domain and no card.

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

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-set-up-test-integration.md · 251 words

```markdown
Set up an Esign Comply test integration in this project, from an empty project to one sealed test record.

Read these first and follow them exactly:
- https://esigncomply.com/agents/set-up-test-integration.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 create the account at https://esigncomply.com/signup?next=/dashboard/agent, accept the terms and type the 6-digit code from my inbox. Then I press "Create agent token" on the page "Agent access" and paste you the block it shows. Never tick the acceptance box or type the code for me.

What you do:
1. Keep the agent token in ESIGNCOMPLY_AGENT_TOKEN. Call GET /v1/agent and store api_url as ESIGNCOMPLY_API_URL.
2. Create a test key with POST /v1/agent/api-keys and store it as ESIGNCOMPLY_API_KEY in .env.local, listed in .gitignore. Never print a token or a key.
3. Check the key with GET /v1/usage.
4. Register one sample document with "Sample" in its name, publish one version, and create a profile with the checkbox method at L1.
5. Build one sign-up page: the server creates the session, the browser SDK records the ceremony, and the server confirms the record before it creates the account.
6. Run npx esigncomply check --url <page> and fix every finding marked "block".

Report to me: the files you changed, the IDs you created, the conformance summary, and where the key is stored (the variable name, never the value).

When the check passes, add the block at https://esigncomply.com/rules.md to this project's instruction file.
```

Before step 1

## What do you need before you set up a test integration?

- A person who can create the account. The Free plan needs no card.
- A project that runs on `localhost`. Test keys work on `localhost`, `127.0.0.1` and listed preview hosts before any domain is verified.
- Node.js 20.19 or later, for the CLI.
- A place for secrets on the server: `.env.local`, listed in `.gitignore`, for development.
- The two packages of the integration: `npm install esigncomply @esigncomply/browser`.

9 steps

## How do you set up a test integration with Esign Comply, step by step?

1. **Give your person the sign-up link**

   Your person creates the account. You never tick the acceptance box and you never type the code for them. They fill the field "Email", tick the one checkbox, press "Create account", then on the page "Check your email" they type the 6-digit code from their inbox into the field "Code" and press "Continue". The browser opens `https://esigncomply.com/dashboard/agent` with the heading "Agent access". No card is asked for.

   The link to give them

   ```
   https://esigncomply.com/signup?next=/dashboard/agent
   ```

2. **Get an agent token**

   On "Agent access" the field "Name" is filled with "My AI agent" and the field "Expires after" offers "1 day", "7 days", "30 days" (selected) and "90 days". Driving your person's logged-in browser, press "Create agent token" and read the token from the block headed "Agent token “My AI agent”". Otherwise your person presses the button and pastes you the block headed "Paste this to your AI agent". The token starts with `esc_agent_`, is 53 characters long and is shown once. Keep it in `ESIGNCOMPLY_AGENT_TOKEN`, never in client code, a URL, a log line or git.

3. **Read the account and store the API address**

   A `200` with `"object": "agent_account"` means the token works. Take `api_url` from the answer and store it on the server as `ESIGNCOMPLY_API_URL`: the Node SDK and the CLI read that variable. `next_step` names the open step, with its API call in `api` and its dashboard page in `browser`. On a new account it is `create_test_key`.

   ```bash
   curl -s https://esigncomply.com/v1/agent \
     -H "Authorization: Bearer $ESIGNCOMPLY_AGENT_TOKEN"
   ```

4. **Create a test key**

   In a browser: `https://esigncomply.com/dashboard`, on the page headed "Get started" press "Create test key", read the line `ESIGNCOMPLY_API_KEY=esc_test_…` and press "I have saved the key". Without a browser, make the call below. The answer is a `201` that carries the key once, in the field `key`, with the permission `full_access`. Store it on the server only, as `ESIGNCOMPLY_API_KEY` in `.env.local`, and check that `.env.local` is listed in `.gitignore`. Never give the variable a public prefix such as `NEXT_PUBLIC_` or `VITE_`.

   Without a browser

   ```bash
   curl -s -X POST https://esigncomply.com/v1/agent/api-keys \
     -H "Authorization: Bearer $ESIGNCOMPLY_AGENT_TOKEN" \
     -H "Content-Type: application/json" \
     -d '{ "mode": "test" }'
   ```

5. **Make the first API call**

   A `200` with `"object": "usage"` means the key works. `401 invalid_api_key`: the variable is empty or holds another value. `421 region_mismatch`: use the `host` named in the error. Check that `test_events.used_this_month` is below `test_events.quota_per_month`, which is 500 on the Free plan. Never echo the key: to say which key is in use, name its prefix only.

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

6. **Register a sample document and publish one version**

   Use the documents the project has. An empty project has none, so register a short sample document, put "Sample" in its name, and say so in your report. In a browser: `https://esigncomply.com/dashboard/documents`, link "New document", field "Name", group "Type", button "Create document", then under "Publish a version" the fields "Version label", "Language", "Format" and "Content" and the button "Publish version". Without a browser, make the two calls below and put the `id` of the first answer in place of `doc_8Hq2`. Both answer `201`. A published version cannot be edited: for new text, publish a new version label.

   Without a browser

   ```bash
   curl -s "$ESIGNCOMPLY_API_URL/documents" \
     -H "Authorization: Bearer $ESIGNCOMPLY_API_KEY" -H "Content-Type: application/json" \
     -d '{ "name": "Sample 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": "# Sample Terms of Service\n\nSample text for a test integration." } }'
   ```

7. **Create a profile**

   A profile says how one kind of signing works: the method, the assurance level and the rule packs. Ask your person which jurisdictions apply. In a browser: `https://esigncomply.com/dashboard/profiles`, link "New profile", field "Name", field "Signature method" set to "Checkbox plus button (checkbox)", field "Assurance level" set to "L1 Recorded", group "Enabled packs" with "US-FED United States, Federal" ticked, button "Create profile". The profile ID (`prof_…`) is in the address of the page that opens, and in the field `id` of the API answer.

   Without a browser

   ```bash
   curl -s "$ESIGNCOMPLY_API_URL/profiles" \
     -H "Authorization: Bearer $ESIGNCOMPLY_API_KEY" -H "Content-Type: application/json" \
     -d '{ "name": "Signup", "jurisdictions": ["US-FED"], "method": "checkbox", "assurance_level": "L1" }'
   ```

8. **Create one session and run the ceremony**

   Your server creates the session with the key and sends only `client_token` and `documents` to the browser. The answer lists `required_steps`. For the profile of step 7 they are `client.attached`, one `document.presented:<version_id>` for each version, `notice.captured`, `intent.captured` and `signature.applied`. Read them from the session and never hard-code them. In the page, `EsignComply.attach({ clientToken })` from `@esigncomply/browser` starts the ceremony, `presentDocument` reports each version, `observeAssent({ region, checkbox, submit })` watches the box and the button, and `complete()` runs from the user's real click. Before the app creates the account, the server reads the record with `GET /v1/records/{id}` and requires a `status` of `recorded`, `timestamped` or `anchored`.

   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" }
     }'
   ```

9. **Run the conformance check**

   The check opens your page at three window sizes, 390 by 844, 768 by 1024 and 1440 by 900, and reads the test ceremony it records at each. Fix every finding marked `block` and list every finding marked `warn` in your report. Each finding names its rule (`CR-01` to `CR-28`), the measurement and a fix. The command takes a test key only. It exits with `0` when no finding blocks, and with `1` when one does, when a violation it tried was not refused or when a ceremony did not complete. The findings are also at `https://esigncomply.com/dashboard/conformance`, where the button "Copy for AI" copies them as Markdown.

   In the project

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

### It worked when

`GET /v1/agent` reports `onboarding.key_created` and `onboarding.first_test_record` as `true`, the record is in the table at `https://esigncomply.com/dashboard/records`, 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 creates the account: the email, the acceptance of the terms, and the 6-digit code from their inbox.
- Your person creates the agent token on the page "Agent access". You can revoke your own.
- Your person chooses which jurisdictions apply. The choice of packs is theirs.
- Your person supplies the text of their own legal documents. Until they do, the project runs on the sample document.

### The agent never does

- Never tick the acceptance box or type the emailed code for your person.
- Never put the agent token or a key in client code, a URL, a log or git.
- Never write or change the text of a legal document. A sample document says "Sample" in its name.
- Never pre-check an assent control, auto-submit, or call `.click()` on the user's behalf.
- Never use a live key in development. Development and previews use test keys.

[Quickstart](https://esigncomply.com/docs/quickstart) · [Agent account API](https://esigncomply.com/docs/api/agent) · [Test mode](https://esigncomply.com/docs/guides/test-mode) · [Sessions API](https://esigncomply.com/docs/api/sessions) · [CLI](https://esigncomply.com/docs/sdk/cli)

## Questions about this task: set up a test integration

### Does a test integration need a verified domain?

No. Test keys work on localhost, 127.0.0.1 and listed preview hosts before any domain is verified. A verified domain is needed for a live key only.

### Does the agent need a browser to set up a test integration?

No. With the agent token, GET /v1/agent reads the account and POST /v1/agent/api-keys issues the test key, and the normal API does the rest with that key. The same steps exist in the dashboard, which the agent opens at /agent-login with the same token.

### What can the test key the agent creates do?

Everything in test mode. It has the full_access permission, like the key the dashboard creates on Get started, so it covers documents, profiles, sessions, records and the conformance check. It starts with esc_test_us\_ or esc_test_eu\_ and is shown once.

### How long do test records stay?

Test records are deleted 30 days after they are created. They are sealed on a separate test ledger, watermarked TEST, and never count against the plan's live signatures.

### What if the project has no terms to register yet?

Register a short sample document and put Sample in its name. Say so in your report, so that your person replaces it with their own text before going live. The agent never writes legal text.

### Which packages does a test integration install?

Two: esigncomply for the server and the CLI, and @esigncomply/browser for the page. A React project can add @esigncomply/react. The fourth package, esigncomply-verify, checks evidence offline and is not part of the integration.

### What does the agent report when the test integration is done?

The files it created or changed, the IDs of the document, the version and the profile, and the conformance summary. It names the variables that hold the token and the key, never their values. It also says what is left for the person.

### Other tasks for an AI agent

- [Convert an acceptance checkbox](https://esigncomply.com/agents/convert-acceptance-checkbox)
- [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/quickstart)

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.
