Schemas appendix
Field tables for every named schema referenced across the endpoint group pages (linked from each endpoint's request/response section by name).
ErrorEnvelope
| Field | Type | Required | Description |
|---|---|---|---|
| error | object | Yes | — |
AuthContext
| Field | Type | Required | Description |
|---|---|---|---|
| tenantId | string | No | — |
| role | `admin` | `user` | No | — |
TemplateDto
| Field | Type | Required | Description |
|---|---|---|---|
| templateId | string | No | — |
| tenantId | string | No | — |
| name | string | No | — |
| description | string | No | — |
| body | string | No | — |
| astCache | array of any | No | — |
| tags | array of string | No | — |
| validated | boolean | No | — |
| warnings | array of string | No | — |
| status | `active` | `archived` | No | — |
| createdAt | string | No | — |
| updatedAt | string | No | — |
SequenceDto
| Field | Type | Required | Description |
|---|---|---|---|
| tenantId | string | No | — |
| name | string | No | — |
| type | `number` | `string` | `uuid` | No | — |
| currentValue | number | No | — |
| start | number | No | — |
| step | number | No | — |
| createdAt | string | No | — |
| updatedAt | string | No | — |
BatchDocumentSpec
| Field | Type | Required | Description |
|---|---|---|---|
| templateId | string | Yes | — |
| alias | string | Yes | — |
| count | integer | Yes | — |
| relations | object | No | — |
| params | object | No | Template params (read with getParam) for every document of this alias. Shallow-merged over the batch-level `params`; keys here win. Must be a JSON object, otherwise 400 VALIDATION_ERROR. |
| sequenceNamespace | string | No | Overrides the batch-level sequenceNamespace for this alias only. |
| variableNamespace | string | No | Overrides the batch-level variableNamespace for this alias only. |
BatchSpec
| Field | Type | Required | Description |
|---|---|---|---|
| seed | number | No | — |
| params | object | No | Default template params for every document in the batch. Each document's own `params` are shallow-merged over these (document keys win). Must be a JSON object, otherwise 400 VALIDATION_ERROR. |
| sequenceNamespace | string | No | Default sequence namespace for every document (a document may override it). |
| variableNamespace | string | No | Default variable namespace for every document (a document may override it). |
| documents | array of BatchDocumentSpec | Yes | — |
BatchResults
Generated documents keyed by document alias (the `alias` values from the request's `documents[]`). Each value is an array of `count` generated documents, in generation order — the documents themselves, exactly as the template renders them (plus any injected relation fields), with no per-document wrapper. A document is usually an object, but can be any JSON value the template produces (array, string, number, boolean or null), e.g. `[[7,3,3,0],[8,2,2,0]]` or `["plain 7","plain 8"]`. Only present when `status` is `completed`.
No documented fields.
BatchError
Why the batch failed. Only present when `status` is `failed`.
| Field | Type | Required | Description |
|---|---|---|---|
| code | string | Yes | — |
| message | string | Yes | — |
FunctionWeightDto
| Field | Type | Required | Description |
|---|---|---|---|
| functionName | string | No | — |
| weight | number | No | — |
| updatedAt | string | No | — |
| updatedBy | string | No | — |
TenantUsageDto
| Field | Type | Required | Description |
|---|---|---|---|
| tenantId | string | No | — |
| usageTotal | number | No | — |
| asOf | string | No | — |
GenerateRequestDto
| Field | Type | Required | Description |
|---|---|---|---|
| seed | number | No | — |
| params | object | No | — |
| context | object | No | — |
| sequenceNamespace | string | No | — |
| variableNamespace | string | No | — |
GenerateResponseDto
| Field | Type | Required | Description |
|---|---|---|---|
| data | any | No | — |
| meta | object | No | — |
AdhocGenerateRequestDto
Feature 1a (ad-hoc/debug generation) — same fields as `GenerateRequestDto` plus the required raw template `body`. Nothing is persisted; useful for quickly iterating on a template before committing it via `POST /v1/templates`.
| Field | Type | Required | Description |
|---|---|---|---|
| body | string | Yes | — |
| seed | number | No | — |
| params | object | No | — |
| context | object | No | — |
| sequenceNamespace | string | No | Recommended for ad-hoc calls to avoid colliding with real tenant sequences created by persisted templates. |
| variableNamespace | string | No | — |
AdhocGenerateResponseDto
Same shape as `GenerateResponseDto` but `meta` has no `templateId` — nothing was persisted.
| Field | Type | Required | Description |
|---|---|---|---|
| data | any | No | — |
| meta | object | No | — |
CreateTemplateRequestDto
| Field | Type | Required | Description |
|---|---|---|---|
| name | string | Yes | — |
| description | string | No | — |
| body | string | Yes | — |
| tags | array of string | No | — |
| generate | object | No | Feature 1b (one-shot create+generate, issue #5). When present, the template is created and, immediately after, a document is generated from it using these options (same fields as `GenerateRequestDto` minus `sequenceNamespace`/ `variableNamespace`, which follow the template's own tenant defaults). Omit this field for the original create-only behavior. |
GenerationErrorDto
Inline generation error embedded in a 201 create+generate response when the template was persisted successfully but the immediate generation attempt failed at runtime (e.g. a required param with no default). Distinct from the top-level `ErrorEnvelope` used for actual HTTP error responses — this always accompanies a 201 with a populated `template`.
| Field | Type | Required | Description |
|---|---|---|---|
| code | string | No | — |
| message | string | No | — |
CreateTemplateResponseDto
Three possible response shapes depending on the request (feature 1b): 1. `generate` absent — plain `TemplateDto` (unchanged, backward compatible). 2. `generate` present and generation succeeds — `{ template, generation }`. 3. `generate` present but generation fails at runtime — `{ template, generationError }` (the template was still persisted; only 201 create is not undone by a generate-time failure). `generation` and `generationError` are mutually exclusive.
This schema is a union of multiple shapes — see the description above for the exact variants.