Skip to content
DocsMenu

Fetch document version content

View as Markdown

Open this page inChatGPTClaudeCursor

In the Esign Comply API, GET /v1/documents/{id}/versions/{version_id}/content serves the registered content of one version for your page to render, as text with sanitized HTML or a base64 PDF. Call it from your server, or from the browser with the session's client token, and inject the returned HTML unmodified.

GET /v1/documents/{id}/versions/{version_id}/content · API version 2026-11-21

Authentication

Send the client token of the session (esc_ct_...) or a secret key with any permission, in the Authorization header: Bearer $CLIENT_TOKEN or Bearer $ESIGNCOMPLY_API_KEY. A client token works for its own session only, from a page inside the registered domain (live) or on the test allowlist (test). A secret key is used from your server only. Test and live credentials both work.

Request example

cURL

curl https://esigncomply.com/v1/documents/doc_8Hq2/versions/dv_3kT9/content \
  -H "Authorization: Bearer $ESIGNCOMPLY_API_KEY"

Node SDK

import { EsignComply } from "esigncomply";

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

const { data, error } = await esc.documents.versions.getContent("doc_8Hq2", "dv_3kT9");

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

Returns the registered content to render. Use the version ID your session pinned, not current, so that the page shows exactly what the record will name.

  • With a secret key, version_id may be an ID or current (with optional ?locale=).
  • With a client token, only the versions pinned on that token's own session can be read, by ID. Anything else returns not_found. The call must come from an allowed origin, as for every browser endpoint.

The response is cacheable privately for one hour (Cache-Control: private, max-age=3600, immutable). Versions never change, so you can cache by version ID for as long as you like.

Format Fields returned
markdown, html, text text (the stored source) and html (sanitized HTML to inject).
pdf data_base64 and content_type: "application/pdf". No text or html.
hash_only text: null, html: null and a note. Esign Comply holds the hash, not the document.

Parameters

Name In Type Required Description
id path string Yes ID of the document.
version_id path string Yes ID of the document version, or "current" for the version in effect now.
locale query string No With version_id "current" and a secret key: prefer the translation for this locale.

Headers: Esign-Comply-Version (optional, a dated API version). See API conventions.

Response

200 OK with a DocumentVersionContent object.

{
  "object": "document_version_content",
  "version_id": "dv_3kT9",
  "document_id": "doc_8Hq2",
  "format": "markdown",
  "language": "en",
  "content_hash": "sha256:4e712fcc...",
  "render_hash": "sha256:56dbea58...",
  "text": "# Terms of Service\n\nThese terms govern your use of the Acme service.\n\n1. You may use the service for lawful purposes.\n2. We may update these terms. We ask you to accept material changes.\n",
  "html": "<h1>Terms of Service</h1>\n<p>These terms govern your use of the Acme service.</p>\n<ol>\n<li>You may use the service for lawful purposes.</li>\n<li>We may update these terms. We ask you to accept material changes.</li>\n</ol>\n"
}

Response fields

Field Type Description
object string
version_id string
document_id string
format string
language string
content_hash string
render_hash string
text string
html string
data_base64 string
content_type string

Rendering in Next.js

// app/legal/[versionId]/page.tsx (server component)
import { esc } from "@/lib/esigncomply";
import { notFound } from "next/navigation";

export default async function LegalPage({ params }: { params: Promise<{ versionId: string }> }) {
  const { versionId } = await params;
  const { data, error } = await esc.documents.versions.getContent("doc_8Hq2", versionId);
  if (error || !data.html) notFound();
  // Inject the registered HTML unmodified so the page text matches render_hash.
  return <article data-esc-document dangerouslySetInnerHTML={{ __html: data.html }} />;
}

Errors

Code HTTP When
not_found 404 No object with that ID exists in this domain and environment.
internal_error 500 Something went wrong on Esign Comply's side.
domain_mismatch 403 For a client token used from an origin outside the registered domain or the test allowlist.

Like every call made with a client token or a secret key, it can also return missing_api_key, invalid_api_key, client_token_expired, domain_not_verified, insufficient_permission, region_mismatch and rate_limit_exceeded.

Every error has the same body: error.type, error.code, error.message, error.doc_url and error.request_id. See Errors.

Questions about GET /v1/documents/{id}/versions/{version_id}/content

Which credential does GET /v1/documents/{id}/versions/{version_id}/content need?

The client token of the session, or a secret key with any permission. Send either one as a Bearer token in the Authorization header. A client token works for its own session only.

Does GET /v1/documents/{id}/versions/{version_id}/content work with a test key?

Yes. It works in test mode and in live mode. A client token carries the mode of the key that created its session.

Does GET /v1/documents/{id}/versions/{version_id}/content 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 GET /v1/documents/{id}/versions/{version_id}/content idempotent?

It is a read, so it is safe to repeat. It takes no Idempotency-Key header.

What is the rate limit for GET /v1/documents/{id}/versions/{version_id}/content?

With a client token, 240 calls per minute for each session. With a secret key, the plan's limit for each key: 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 GET /v1/documents/{id}/versions/{version_id}/content?

Yes: esc.documents.versions.getContent() in the esigncomply package. It resolves to { data, error } and does not throw.

Last updated · API version 2026-11-21