Create a JsonFabrica template
jsonfabrica_create_templateCreate a persistent JSON template using function-call placeholders, optionally generating data immediately with provided parameters.
Instructions
Calls POST /v1/templates. Creates a persisted, reusable template that can be generated from repeatedly with jsonfabrica_generate_from_template — use this instead of jsonfabrica_generate_adhoc when you want the body saved and shareable rather than a one-off, unsaved evaluation. body uses JsonFabrica's function-call placeholder syntax, e.g. "Hello {{getRandomFullName()}}" or "<getRandomNumber(1,100)>" — see the data-generation-functions reference for the full catalog. The optional generate field is a convenience that also runs a generation in the same call (response includes generation or generationError alongside template) so you avoid a separate jsonfabrica_generate_from_template round-trip; that generation is metered/billed and can advance durable sequences/variables just like a normal generate call. If generate is omitted, the response is just the created template with no generation side effects.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| body | Yes | Template body containing at least one function-call placeholder. Required. | |
| name | Yes | Template name. Required; not required to be unique per tenant. | |
| tags | No | Labels for later filtering via jsonfabrica_list_templates' `tags` parameter (AND-match: a template must contain every requested tag). Optional; omitted or empty means no tags stored. | |
| generate | No | When present, immediately generates one document from the just-created template using these options; the response then includes `generation`/`generationError` alongside `template`. Optional — omit to only create the template record with no generation side effects. | |
| description | No | Free-text human-readable description of the template's purpose. Optional; omitted means none stored. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| body | No | Template body containing function-call placeholders. | |
| name | No | Template name. | |
| tags | No | Tags stored on the template. | |
| status | No | "active" unless soft-deleted via jsonfabrica_delete_template. | |
| astCache | No | Server-internal parsed-body cache; opaque to callers. | |
| template | No | Present when `generate` was passed; the created template record. | |
| tenantId | No | Owning tenant id. | |
| warnings | No | Non-fatal validation warnings, if any. | |
| createdAt | No | ISO-8601 creation timestamp. | |
| updatedAt | No | ISO-8601 last-update timestamp. | |
| validated | No | Whether the body passed static template validation. | |
| generation | No | Present when `generate` was passed and the immediate generation succeeded. | |
| templateId | No | Server-assigned template id. | |
| description | No | Free-text description, if any was stored. | |
| generationError | No | Present when `generate` was passed but the immediate generation failed at runtime (template was still created). |