# Update Custom Entity Layout

Each Custom Entity type has its own layout identified by `customEntityDenominator`. The supplied
layout fully overwrites the currently stored layout for that Custom Entity; it is **not merged**.
A layout must already exist for the requested Custom Entity — this operation replaces it and does
not create one. If none exists the request returns `404 Not Found`.
## ⚠️ All attributes are required
The payload must contain **every attribute currently in the stored layout** — no more, no less.
Omitting an attribute removes it from the form. Adding an attribute that is not already in the
layout is also rejected. Use `GET /CustomEntities('{customEntityDenominator}')/layout` first to
obtain the current set of attributes.
This is different from `PATCH /v2/AttributeSets({id})`, where layouts may contain any subset of
the tenant's attributes.
## Layout Structure
The payload has the same shape as the `GET /CustomEntities('{customEntityDenominator}')/layout` response:

```json
{
  "sections": [
    {
      "title": "General",
      "rows": [
        {
          "fields": [
            { "attributeId": "ce_title", "size": "half" },
            { "attributeId": "ce_ref",   "size": "half" }
          ]
        },
        {
          "dividerType": "normal",
          "dividerTitle": "Details",
          "fields": [
            { "attributeId": "ce_description", "size": "row" }
          ]
        }
      ]
    }
  ]
}
```
**`size`** — one of: `quarter`, `half`, `threeQuarters`, `row`.
**`dividerType`** — optional; one of: `normal`, `wide`, `lineBreak`. `dividerTitle` is optional
and only meaningful when `dividerType` is set. Both are omitted from rows that have no divider.
## Validation Rules
If any rule is violated the request returns `400 Bad Request` describing each failure:
- The layout must contain every attribute currently in the stored layout — no more, no less.
- No `attributeId` may appear more than once.
- Each field `size` must be one of: `quarter`, `half`, `threeQuarters`, `row`.
- The sum of field sizes within any single row must not exceed a full row.
- Every row must contain at least one field.
- Section `title` values must be unique (case-insensitive).
- When a row sets `dividerType` it must be one of: `normal`, `wide`, `lineBreak`.

Endpoint: PUT /CustomEntities('{customEntityDenominator}')/layout
Version: 2.0.0

## Path parameters:

  - `customEntityDenominator` (string, required)
    Denominator of the Custom Entity type whose layout is replaced.

## Header parameters:

  - `X-API-KEY` (string)
    Tenant's API key

## Request fields (application/json):

  - `sections` (array)

  - `sections.title` (string)

  - `sections.rows` (array)

  - `sections.rows.fields` (array)

  - `sections.rows.fields.attributeId` (string)

  - `sections.rows.fields.size` (string)
    Enum: "quarter", "half", "threeQuarters", "row"

  - `sections.rows.dividerType` (string)
    Enum: "normal", "wide", "lineBreak"

  - `sections.rows.dividerTitle` (string)

## Response 401 fields (application/json):

  - `message` (string)

  - `request_id` (string)

## Response 403 fields (application/json):

  - `message` (string)

  - `request_id` (string)

## Response 500 fields (application/json):

  - `error` (string)

  - `details` (any)

