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 | — |
VariableDto
| Field | Type | Required | Description |
|---|---|---|---|
| tenantId | string | No | — |
| name | string | No | — |
| type | `string` | `number` | `boolean` | `array` | `object` | No | — |
| value | any | No | — |
| scope | `global` | No | — |
| updatedAt | string | No | — |
BatchDocumentSpec
| Field | Type | Required | Description |
|---|---|---|---|
| templateId | string | Yes | — |
| alias | string | Yes | — |
| count | integer | Yes | — |
| relations | object | No | — |
| params | object | No | — |
BatchSpec
| Field | Type | Required | Description |
|---|---|---|---|
| seed | number | No | — |
| sequenceNamespace | string | No | — |
| variableNamespace | string | No | — |
| documents | array of BatchDocumentSpec | Yes | — |
BatchDto
| Field | Type | Required | Description |
|---|---|---|---|
| batchId | string | No | — |
| tenantId | string | No | — |
| seed | number | No | — |
| status | `queued` | `running` | `completed` | `failed` | No | — |
| spec | BatchSpec | No | — |
| error | object | No | — |
| createdAt | string | No | — |
BatchDocumentDto
| Field | Type | Required | Description |
|---|---|---|---|
| batchId | string | No | — |
| alias | string | No | — |
| seqNo | integer | No | — |
| templateId | string | No | — |
| status | `pending` | `completed` | `failed` | No | — |
| result | any | No | — |
| documentSeed | number | No | — |
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.