Generate a prompt
In the Esign Comply API, POST /v1/prompts/generate generates the integration prompt from wizard selections, creates or reuses the profiles it names and stores it under a permanent ID. Use it in continuous integration or from an AI coding tool to get the prompt the dashboard wizard produces.
POST /v1/prompts/generate · API version 2026-11-21
Authentication
Send a secret key in the Authorization header: Bearer $ESIGNCOMPLY_API_KEY. The key needs full_access permission. Test keys and live keys both work, and each reads and writes the objects of its own environment. Call it from your server: a secret key never goes to a browser. Keys and permissions are described under Authentication.
Request example
cURL
curl https://esigncomply.com/v1/prompts/generate \
-H "Authorization: Bearer $ESIGNCOMPLY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"jurisdictions": [
"US-FED",
"US-CA"
],
"jurisdiction_mode": "auto",
"on_unknown_region": "strictest"
}'
Node SDK
import { EsignComply } from "esigncomply";
const esc = new EsignComply(process.env.ESIGNCOMPLY_API_KEY);
const { data, error } = await esc.prompts.generate(
{
jurisdictions: ["US-FED", "US-CA"],
jurisdiction_mode: "auto",
on_unknown_region: "strictest",
},
);
This request ran against the API on November 26, 2026, and the response below is what came back. IDs are example values, and long values are shortened with ....
What it does
Generates the integration prompt that the dashboard wizard produces, so prompts can be created in continuous integration or by an AI coding tool. Prompts are assembled from reviewed, versioned blocks. No language model writes prompt text at generation time, and the same selections always produce the same prompt.
Generating a prompt creates the ceremony profiles for the selected use cases, or reuses a profile whose name and settings already match (an existing profile is never changed), and writes their IDs, the document IDs and the API host for the domain's region into the prompt. The prompt never contains a key. It names the environment variables ESIGNCOMPLY_API_KEY and ESIGNCOMPLY_WEBHOOK_SECRET.
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
company |
body | string | No | Company name written into the prompt, 120 characters at most. |
use_case |
body | string | No | Shorthand for one use case with its defaults, for example signup_terms. |
use_cases |
body | array | No | 1 to 12 entries: a use case ID, or { use_case, assurance_level, method, profile, documents }. |
profile |
body | string | No | Shorthand: the ID of an existing profile for the single use case. |
signers |
body | string: consumer, business, employee, mixed |
No | Who signs. |
jurisdictions |
body | array of strings | No | Pack codes, 64 at most. |
jurisdiction_mode |
body | string: auto, strictest, explicit |
No | Same meaning as on a profile. |
on_unknown_region |
body | string: strictest, base_only, reject |
No | Same meaning as on a profile. |
governing_law |
body | string | No | Pack code or ISO 3166 code. |
facts |
body | object | No | Asserted facts that pack rules read. |
consumer_econsent |
body | any | No | yes, no or not_sure, or a boolean: whether consumer notices are delivered electronically. |
failure_mode |
body | string: fail_closed, fail_open_deferred |
No | Same meaning as on a profile. |
stack |
body | any | No | A framework ID, or { framework, hosting, database, language }. |
tool |
body | string | No | The AI coding tool the prompt is written for, for example cursor. |
options |
body | object | No | { receipts, confirmation, mobile, languages, certificate_action, reports, guidance_updates }. |
Headers: Idempotency-Key (optional, up to 255 characters) and Esign-Comply-Version (optional, a dated API version). See API conventions.
Response
200 OK with a Prompt object.
{
"object": "prompt",
"id": "esc_prompt_i5Yi",
"livemode": false,
"title": "Esign Comply integration: signup acceptance",
"content_hash": "sha256:80170d02...",
"markdown": "# Esign Comply integration: signup acceptance\nPrompt esc_prompt_i5Yi · blocks 2026.11 · guidance 2026.11.2 · region US\nJurisdictions: US-FED, US-CA · mode auto · unknown U.S. state: strictest\n\nYou are...",
"word_count": 2163,
"guidance_release": "2026.11.2",
"jurisdictions": [
"US-FED",
"US-CA"
],
"pack_versions": {
"US-CA": "2026-11-21",
"US-FED": "2026-11-22"
},
"block_versions": {
"tool.other": "2026.11",
"us.routing": "2026.11",
"core.client": "2026.11",
"core.errors": "2026.11",
"core.gating": "2026.11",
"core.header": "2026.11",
"core.server": "2026.11",
"us.state.ca": "2026.11",
"core.reports": "2026.11",
"stack.vercel": "2026.11",
"verify.steps": "2026.11",
"core.documents": "2026.11",
"stack.supabase": "2026.11",
"core.obligations": "2026.11",
"stack.nextjs_app": "2026.11",
"core.assent_design": "2026.11",
"core.recommendations": "2026.11"
},
"profiles": [
{
"id": "prof_SVAG",
"name": "Signup acceptance",
"source": "created",
"use_case": "signup_terms"
}
],
"documents": [],
"env": [
"ESIGNCOMPLY_API_KEY",
"ESIGNCOMPLY_WEBHOOK_SECRET"
],
"files": [
"app/api/esigncomply/webhook/route.ts",
"app/signup/page.tsx",
"app/legal/[slug]/page.tsx",
"app/accept-updates/page.tsx",
"lib/esigncomply.ts",
"supabase/migrations/<timestamp>_esign_acceptances.sql"
],
"fact_keys": [],
"selections": {
"company": "Acme, Inc.",
"use_cases": [
{
"use_case": "signup_terms",
"assurance_level": "L1",
"method": "checkbox",
"documents": [
{
"name": "Terms of Service",
"type": "terms"
}
]
}
],
"signers": "mixed",
"jurisdictions": [
"US-FED",
"US-CA"
],
"jurisdiction_mode": "auto",
"on_unknown_region": "strictest",
"governing_law": null,
"consumer_econsent": "no",
"failure_mode": "fail_closed",
"stack": {
"hosting": "vercel",
"database": "supabase",
"language": "typescript",
"framework": "nextjs_app"
},
"tool": "other",
"options": {
"receipts": true,
"confirmation": "lookup",
"mobile": false,
"languages": [],
"certificate_action": false,
"reports": [],
"guidance_updates": "off"
}
},
"warnings": [
"use_cases_defaulted:signup_terms",
"document_id_missing:Terms of Service"
],
"status": {
"state": "current",
"behind": 0,
"blocks": [],
"packs": [],
"guidance_release": {
"built": "2026.11.2",
"current": "2026.11.2"
}
},
"regenerated_from": null,
"created_by": "key:key_Doqa",
"created_at": "2026-11-26T00:17:54.181Z"
}
Response fields
| Field | Type | Description |
|---|---|---|
object |
string | |
id |
string | esc_prompt_... |
content_hash |
string | |
markdown |
string | |
profiles |
array | |
guidance_release |
string |
Wizard selections
The body carries the selections of the dashboard wizard. Every field is optional: a default that was applied is reported in warnings. jurisdictions, jurisdiction_mode, on_unknown_region and governing_law have the same meaning as on a profile, and any state pack adds US-FED. The other fields mirror the wizard steps:
| Selection | Options |
|---|---|
| Use cases | Terms and privacy acceptance at signup, terms update re-acceptance, checkout, free trial, automatic renewal, NDA, contract or order form, consent to electronic records, marketing or data consent, policy acknowledgment, custom. |
| Signers | Consumers, businesses, employees and contractors, or mixed. |
| Per use case | Assurance level (L1 by default; L2 and L3 are optional and need Unlimited or Enterprise), signature method (click, checkbox, typed, drawn, passkey), documents. |
| Consumer notices delivered electronically | Yes, no or not sure. Yes or not sure adds the consumer e-consent steps. |
| Failure mode | fail_closed, or fail_open_deferred for terms acceptances at L1. |
| Stack | Framework (Next.js App Router, Next.js Pages Router, Remix, SvelteKit, Nuxt, Astro, Express, Hono, other), hosting, database and auth, language. |
| AI tool | Cursor, Claude Code, Codex, GitHub Copilot, Windsurf, v0, Lovable, Bolt, Replit, other. |
| Options | Receipt email, webhook confirmation or server lookup, languages, an admin action to request certificates, reporting through supplements, guidance updates. |
The response carries the prompt as Markdown with its prompt ID (esc_prompt_...), a content hash, the block versions and the guidance release it was built from. The profile stores the prompt ID, so every record traces back to the instructions the builder was given. Every prompt uses four fixed headings, in this order: "Required for the record", "Your obligations", "Recommendations" and "What you can send us", and ends with the conformance command to run before reporting success.
Every use case starts at assurance level L1, NDAs and contracts included, so a prompt generated without assurance_level has no code step. On Free and Starter, a use case set to L2 or L3 returns 403 plan_feature_unavailable with param: "use_cases.<n>.assurance_level", and no profile or document is created.
Prompt IDs resolve permanently, and code built from any issued prompt keeps working against the API version it was written for. Changes are offered as update prompts, never as a required rebuild. See guidance and the prompt generator.
Errors
| Code | HTTP | When |
|---|---|---|
invalid_request |
400 | The request is malformed: the body is not valid JSON, a known field has the wrong type, a required field is missing, a value is out of range, or a limit was passed (for example metadata over 50 keys, context.extra over 16 KB, event data over 256 KB, an Idempotency-Key over 255 characters, an unknown Esign-Comply-Version). |
jurisdiction_unknown |
400 | A pack code on a profile, a session, a dry run or a certificate wording is not in the catalogue. |
plan_feature_unavailable |
403 | The feature is not on the domain's plan: signer verification (assurance level L2 or L3) on Free or Starter, more webhook endpoints than the plan includes, a certificate request or quote for a live record on Free, a region the plan does not offer, or a custodian-signed certification on a plan or environment that does not have it. |
not_found |
404 | No object with that ID exists in this domain and environment. |
Like every call made with a secret key, it can also return missing_api_key, invalid_api_key, domain_not_verified, insufficient_permission, idempotency_conflict, region_mismatch, rate_limit_exceeded and internal_error.
Every error has the same body: error.type, error.code, error.message, error.doc_url and error.request_id. See Errors.
Questions about POST /v1/prompts/generate
Which credential does POST /v1/prompts/generate need?
A secret key with full_access permission. Send it as a Bearer token in the Authorization header, from your server only. A session client token is refused with insufficient_permission.
Does POST /v1/prompts/generate work with a test key?
Yes. It works with test keys and live keys. A test key reads and writes test objects only, and a live key works once the domain is verified.
Does POST /v1/prompts/generate count as a signature event?
No. A signature event is counted when a live record is written, by completing a session or by submitting a deferred acceptance. This call writes no record.
Is POST /v1/prompts/generate idempotent?
Yes, with an Idempotency-Key header of up to 255 characters. A repeat with the same key and the same bytes in the body returns the original response, with the header Idempotent-Replayed: true. The same key with a different body answers 409 idempotency_conflict.
What is the rate limit for POST /v1/prompts/generate?
The limit is counted for each key and depends on the plan: 2 requests per second on Free, 10 on Starter, 50 on Unlimited and 100 on Enterprise. Past the limit the API answers 429 rate_limit_exceeded with a Retry-After header.
Does the Node SDK have a method for POST /v1/prompts/generate?
Yes: esc.prompts.generate() in the esigncomply package. It resolves to { data, error } and does not throw.
Related
- Account: the overview of the resource and all of its operations.
- List prompts:
GET /v1/prompts - Retrieve a prompt:
GET /v1/prompts/{id} - Retrieve a prompt update:
GET /v1/prompts/{id}/update - Register a domain:
POST /v1/domains - Domains
- Test mode
- Errors: every error code, with what to do.
- API conventions: authentication, idempotency, rate limits and versioning.
Last updated · API version 2026-11-21