---
title: "Replace an operator fixed-width layout template"
method: PUT
path: "/v1/imports/formats/templates/{templateId}"
tags: ["Ingestion"]
---

# Replace an operator fixed-width layout template

`PUT /v1/imports/formats/templates/{templateId}`

Fully replaces a stored per-tenant fixed-width layout template (records/fields/discriminator/recordWidths/requiredFields) by its id — a PUT full replace, not a sparse patch, since the byte-range invariants are whole-layout properties. The replacement is run through the SAME well-formedness gate the submission path enforces BEFORE storage: overrun, overlap, missing-required, zero-field, or a mis-marked money column (money MUST be kind=decimal) rejects with 422 and the stored template is left unchanged. Returns 404 when no active template matches, 409 when the new format key collides with another active template. Tenant from the JWT; never the body.

## Path parameters

- `templateId` string, uuid, required — Layout template ID

## 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 `200`

OK

- 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.net/lerian/apis/identity-plugin.md) · [All operations](https://skmtc.net/lerian/apis/identity-plugin/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/lerian/identity-plugin/revisions/25daba385532/schema)
