Get the data schema of a template
get_template_schemaFetch a template's JSON schema and sample data before rendering. Use it to build payloads that fit the template's expected shape.
Instructions
Returns the JSON Schema of the data object a template expects and the sample data it was designed with, from its published version, else its latest draft. Call it after list_templates and before render or validate_template, to build data that fits; ad-hoc html has no stored schema to read. When the template stores no schema, one is inferred from the sample data: treat that as a guide, not a contract. Read-only and free; an unknown slug returns an error.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| template | Yes | Slug (e.g. invoice) or tpl_ id, as list_templates returns them |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| schema | Yes | JSON Schema of data; inferred from sample_data when none is stored | |
| status | Yes | published, or draft when nothing is published yet | |
| version | Yes | The version the schema comes from | |
| template | Yes | ||
| sample_data | Yes |