Create one document of a DocType, from that DocType's own fields.
The body is the DOCUMENT'S field data: a flat JSON object whose properties are the fieldnames the DocType declares, not a fixed envelope.
POST /v1/framework/{doctype}
| Address | https://api.hanzo.ai/v1/framework/{doctype} |
| Method | POST |
| Operation | post_framework_by_doctype |
| Auth | Authorization: Bearer $HANZO_API_KEY |
The body is the DOCUMENT'S field data: a flat JSON object whose properties are the fieldnames the DocType declares, not a fixed envelope. That is why this operation publishes no request schema — the shape is metadata the DocType defines at run time, and no Go struct both accepts it verbatim and describes it, so nothing is asserted rather than something false.
The engine validates and coerces every field against the DocType, runs the before_insert and before_save hooks (either may reject the write), stores the document, then runs the after hooks. It answers 201 with the stored document: the field data plus the managed envelope — name, doctype, docstatus, createdAt, updatedAt. A Password field comes back as a fixed redaction marker and is dropped when empty; its stored value is never returned by this or any other read on this surface.
name in the body is the REQUESTED DOCUMENT NAME, not a data field. A DocType with an autoname rule names the document itself and ignores it; a prompt-named DocType takes it. This collision is also why the two path segments cannot be folded into the body, and so why the route stays untyped.
Scoped to the org of the validated principal, and the engine's own permission calculus decides the rest: the caller needs create rights on this DocType through a role it holds, or a platform admin bit. A caller with no validated principal reaches the engine as the zero Caller and is refused before any store is opened — a forged org header alone buys nothing.
A DocType declared Single has exactly ONE document per org, so this writes that one instance instead of adding a row. The body is size-bounded by the engine, the same bound on every host.
Request
1 field.
| Field | In | Type | Required | Description |
|---|---|---|---|---|
doctype | path | string | yes |
Response
The document declares no response body for this operation. It answers 200 on success and the platform error shape on failure — see Errors.
Examples
hanzo framework add <doctype>import { Configuration, FrameworkApi } from 'hanzoai';
const api = new FrameworkApi(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data } = await api.postFrameworkByDoctype({ doctype: 'doctype' });from hanzoai.cloud import ApiClient, Configuration
from hanzoai.cloud.api import FrameworkApi
client = ApiClient(Configuration(access_token=os.environ["HANZO_API_KEY"]))
result = FrameworkApi(client).post_framework_by_doctype(doctype='doctype')cfg := cloud.NewConfiguration()
cfg.AddDefaultHeader("Authorization", "Bearer "+os.Getenv("HANZO_API_KEY"))
client := cloud.NewAPIClient(cfg)
resp, _, err := client.FrameworkAPI.PostFrameworkByDoctype(context.Background()).Execute()
if err != nil {
return err
}use hanzo_cloud::apis::{configuration::Configuration, framework_api};
let mut cfg = Configuration::new();
cfg.bearer_access_token = std::env::var("HANZO_API_KEY").ok();
let result = framework_api::post_framework_by_doctype(&cfg, Default::default()).await?;import ai.hanzo.cloud.ApiClient;
import ai.hanzo.cloud.api.FrameworkApi;
ApiClient client = new ApiClient();
client.setRequestInterceptor(b -> b.header("Authorization", "Bearer " + System.getenv("HANZO_API_KEY")));
var result = new FrameworkApi(client).postFrameworkByDoctype();curl -X POST https://api.hanzo.ai/v1/framework/<doctype> \
-H "Authorization: Bearer $HANZO_API_KEY"The door reaches framework through the framework tool, which names its 17 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": "get_framework_by_doctype"
}
}
}'How is this guide?