---
title: "Submit an operator fixed-width layout template"
method: POST
path: "/v1/imports/formats/templates"
tags: ["Ingestion"]
---

# Submit an operator fixed-width layout template

`POST /v1/imports/formats/templates`

## Request

- Base URL: `https://identity.sandbox.lerian.net`
- URL: `https://identity.sandbox.lerian.net/v1/imports/formats/templates`
- Auth: HTTP bearer
- TypeScript: <https://skmtc.dev/lerian/apis/identity-plugin/docs/v1/imports/formats/templates/post.ts> (a function with typed inputs; its response is checked against the schema)

Validates and stores a per-tenant fixed-width layout template (region/family/variant-namespaced). The layout is run through the well-formedness gate BEFORE storage: overrun, overlap, missing-required, zero-field, or a mis-marked money column (money MUST be kind=decimal) rejects with 422 and the template is never stored. An approved template is resolved by the parse path as an additive layout source. Tenant from the JWT; never the body.

## Request body

- CreateLayoutTemplateRequest
  - `discriminatorLength` integer, required: Discriminator width in bytes
  - `discriminatorStart` integer, required: Zero-based byte offset of the record-type discriminator
  - `family` string, required: Format family the template namespaces under
  - `records` LayoutTemplateRecordRequest[], nullable, required: Record types declared by the layout
    - `fields` LayoutTemplateFieldRequest[], nullable, required: Ordered positional fields of this record type
      - `kind` string, required: Value type: string (raw text), decimal (money/numeric verbatim token, parsed downstream), or date. A money column MUST be decimal
      - `length` integer, required: Field width in bytes (must be greater than 0)
      - `name` string, required: Canonical field name this byte slice feeds (e.g. external_id, amount, currency, date)
      - `startByte` integer, required: Zero-based byte offset where the field begins
    - `recordType` string, required: Record-type value the discriminator byte slice must match (e.g. "1")
    - `width` integer, required: Fixed width in bytes every record of this type must be
  - `region` string, required: ISO alpha-2 region (uppercased) or XX
  - `requiredFields` string[], nullable: Field names the variant must declare
  - `variant` string, required: Operator/brand variant axis

## Response `201`

Created

- LayoutTemplateResponse
  - `createdAt` string, date-time, required: Creation timestamp (RFC 3339, UTC)
  - `discriminator` LayoutTemplateDiscriminatorResponse, required
    - `length` integer, required: Discriminator width in bytes
    - `startByte` integer, required: Zero-based byte offset of the record-type discriminator
  - `formatKey` string, required: Canonical format descriptor key (region/family/variant) the template registers under
  - `id` string, uuid, required: Template identifier
  - `recordTypeCount` integer, required: Number of record types the layout declares
  - `recordWidths` object, required: Per-record-type fixed width in bytes, keyed by record type
  - `records` LayoutTemplateRecordResponse[], nullable, required: Record types the layout declares, each with its fixed width and ordered byte-range fields, sorted by record type
    - `fields` LayoutTemplateFieldResponse[], nullable, required: Ordered positional fields of this record type
      - `kind` string, required: Value type: string (raw text), decimal (money/numeric verbatim token, parsed downstream), or date
      - `length` integer, required: Field width in bytes
      - `name` string, required: Canonical field name this byte slice feeds (e.g. external_id, amount, currency, date)
      - `startByte` integer, required: Zero-based byte offset where the field begins
    - `recordType` string, required: Record-type value the discriminator byte slice matches (e.g. "1")
    - `width` integer, required: Fixed width in bytes every record of this type must be
  - `requiredFields` string[], nullable, required: Field names the variant must declare across its record types
  - `variantKey` string, required: In-file variant key the layout is keyed by

## Other responses

- `default`: Error

---

[API](https://skmtc.dev/lerian/apis/identity-plugin.md) - [All operations](https://skmtc.dev/lerian/apis/identity-plugin/llms.txt) - [OpenAPI document](https://skmtc.dev/lerian/apis/identity-plugin/revisions/25daba385532?raw)
