Renders a document from a template and the caller's own merge data, seals it in…
Renders a document from a template and the caller's own merge data, seals it in the org's store, and returns it with its rendered body.
POST /v1/legal/documents
| Address | https://api.hanzo.ai/v1/legal/documents |
| Method | POST |
| Operation | post_legal_documents |
| Auth | Authorization: Bearer $HANZO_API_KEY |
Renders a document from a template and the caller's own merge data, seals it in the org's store, and returns it with its rendered body.
The render is PURE and deterministic — no clock, no I/O — so the same template version and the same data always produce identical bytes, which is what makes a generated contract reproducible. It fails CLOSED on a missing merge field: there is no blank-filled contract, only a 400 naming the fields that were absent. When the template is counsel-review the rendered body opens with the counsel notice, which no caller can suppress.
The document is a DRAFT. Hanzo Legal manages documents; it does not give legal advice and does not determine that a document is valid or sufficient.
Request
3 fields, body application/json (required).
| Field | In | Type | Required | Description |
|---|---|---|---|---|
data | body | object | — | Data supplies every merge field the template declares, keyed by field key. |
data.* | body | string | — | |
templateId | body | string | — | TemplateID is the template to render. |
Response
| Status | Body | Meaning |
|---|---|---|
201 | documentReply | created |
201 body — 14 fields.
| Field | In | Type | Always | Description |
|---|---|---|---|---|
disclaimer | body | string | — | Disclaimer is the boundary made visible on the wire. |
document | body | documentView | — | |
document.body | body | string | — | Body is the rendered document. It is sealed at rest and returned only to the owning org. |
document.category | body | string | — | |
document.contentType | body | string | — | ContentType is the rendered body's media type — text/markdown. |
document.createdAt | body | integer | — | |
document.esignProvider | body | string | — | |
document.id | body | string | — | |
document.signedAt | body | integer | — | |
document.status | body | string | — | |
document.templateId | body | string | — | |
document.templateVersion | body | integer | — | |
document.title | body | string | — | |
document.updatedAt | body | integer | — |
Failure carries the platform error shape — see Errors.
Examples
hanzo legal documents createimport { Configuration, LegalApi } from 'hanzoai';
const api = new LegalApi(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data } = await api.postLegalDocuments({ data: {}, templateId: "<templateId>" });from hanzoai.cloud import ApiClient, Configuration
from hanzoai.cloud.api import LegalApi
client = ApiClient(Configuration(access_token=os.environ["HANZO_API_KEY"]))
result = LegalApi(client).post_legal_documents(data={}, template_id="<templateId>")cfg := cloud.NewConfiguration()
cfg.AddDefaultHeader("Authorization", "Bearer "+os.Getenv("HANZO_API_KEY"))
client := cloud.NewAPIClient(cfg)
resp, _, err := client.LegalAPI.PostLegalDocuments(context.Background()).Execute()
if err != nil {
return err
}use hanzo_cloud::apis::{configuration::Configuration, legal_api};
let mut cfg = Configuration::new();
cfg.bearer_access_token = std::env::var("HANZO_API_KEY").ok();
let result = legal_api::post_legal_documents(&cfg, Default::default()).await?;import ai.hanzo.cloud.ApiClient;
import ai.hanzo.cloud.api.LegalApi;
ApiClient client = new ApiClient();
client.setRequestInterceptor(b -> b.header("Authorization", "Bearer " + System.getenv("HANZO_API_KEY")));
var result = new LegalApi(client).postLegalDocuments();curl -X POST https://api.hanzo.ai/v1/legal/documents \
-H "Authorization: Bearer $HANZO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"data": {},
"templateId": "<templateId>"
}'The door reaches legal through the legal tool, which names its 11 operations with its own verbs — this one among them, under a name only the door declares. describe explains any of them:
curl -X POST https://api.hanzo.ai/v1/mcp \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "describe",
"arguments": {
"op": "list_legal_documents"
}
}
}'How is this guide?