# create_from_template

> Start a document from a template in list_templates (any kind) and persist it, returning document_id.

Tool of the AppliFlo MCP server at `https://appliflo.com/api/mcp`. Kind: asks first: it changes something in your workspace, so clients ask you first.

Start a document from a template in list_templates (any kind) and persist it, returning document_id. Nothing is sent: review it with the user, then send it with send_envelope (or use send_template to create and send in one call). Call list_templates first; never guess ids or role keys. A `ready` template (a saved one, an AppliFlo contract or an official form AppliFlo set up): pass `people`, one {name, email} per roles[].key. The draft is a copy of the current version; the response's recipients[] (each role's person in signing order, then the template's fixed CCs) and fields[].recipient_index feed send_envelope directly, and fields are already placed (do NOT call detect_fields). Its fixed values (fixed_fields[]) are resolved like a send's: an empty Locked detail refuses the draft (422 missing_detail), an unanswered set-up box too (422 unanswered_ask: give it in fixed_overrides); send_envelope fills the fixed boxes without you passing `values` (the response's `values` lists them for review, a government ID number masked to its last 3 characters) and refuses a different value for a Locked box (422 locked_field). A `draft` saved template: `people` is ignored; you get a draft document whose fields[] carry their saved role label (`role`), and you add recipients and assignments at send_envelope. A `draft` official form (AppliFlo hasn't set it up): it is imported as a new document and its fields are read (like the app's Import), `people` is ignored; the response lists fields[] and groups[] like detect_fields: fill it with fill_document, then send_envelope with the recipients. The response says fields_read: false (with detection_skipped and a `notice` to relay) when only the PDF's built-in fillable fields could be read. A `contract` template (the workspace's own, older model): pass `values` (one per required_values[].key; a missing one is refused) and `recipients` in party order (recipients[0] = party_a, ...); fields[].recipient_index feeds send_envelope's assignments with the same recipients in the same order. An AppliFlo contract's draft carries `notice` ('Review before sending. This is not legal advice.'): a human MUST review it before it is sent; tell the user. An `own_risk` contract is refused (409 contract_risk_required) until the person accepts the own-risk terms: ask them, then call again with risk_accepted: true (a person who already accepted that contract version needs none). A fill-and-print-only government form (esign.mode block) drafts as usual (fill it, download it), but send_envelope refuses it (422 esign_not_allowed). Masked values (•••123) can't be sent back: ask the person for the full number.

## Inputs

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `template_id` | string | yes | templates[].template_id from list_templates |
| `people` | map of object | no | Ready templates (required there). One person per template role, keyed by the role's `key` from list_templates' saved_templates[].roles (e.g. {"r1": {"name": "Nguyen Thi Lan", "email": "lan@example.com"}}). Every role needs a person; two roles can't share an email |
| `document_name` | string | no | Defaults to the template name. Up to 255 characters |
| `fixed_overrides` | map of string \| boolean \| string[] | no | Ready templates only. The sender's values for the template's DEFAULT fixed boxes (get_template's fixed_fields[] with locked: false), keyed by fixed_fields[].index: text, true/false for a tick box, or option value(s) for a choice question. A LOCKED fixed box is set by the template and can't be overridden (refused with 422 locked_field). A Locked box whose workspace or My details value is empty refuses the send (422 missing_detail). A DEFAULT box the workspace answers once (an AppliFlo library form's "ask on copy" box) that nothing answered refuses the send (422 unanswered_ask): give it a value here |
| `local_day` | string | no | The sender's own calendar day (YYYY-MM-DD), the 'today' fixed date boxes count from. Defaults to the server's UTC day |
| `values` | map of string | no | kind contract only: map of required_values[].key -> string value |
| `recipients` | object[] | no | kind contract only (required there): the parties, in order: index 0 is party_a, index 1 is party_b, ... Up to 4 items |
| `recipients[].name` | string | yes | Up to 256 characters |
| `recipients[].email` | string | yes | Format: email. Up to 254 characters |
| `risk_accepted` | boolean | no | The person accepts AppliFlo's own-risk terms (Terms section 8A) for a library contract no lawyer has reviewed. Set it only after asking the person |
| `idempotency_key` | string | no | Same key = same call: a retry (e.g. after a timeout) returns the first result instead of doing it again. The same key with other arguments is refused (422 idempotency_key_reused). Up to 255 characters |
