> ## Documentation Index
> Fetch the complete documentation index at: https://integration.delogue.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Manage care instruction layers

> Build and maintain the organisation's layer library — the fabric-layer labels (Main, Lining, Shell…) that structure care instruction composition on styles.

<Info>
  **When to use this.** A care instruction layer names a physical layer of a garment — for
  example "Main", "Lining", or "Shell". Layers are created once in Admin, given a stable
  user-defined ID, and then selected on styles to organise the composition of each layer's
  materials and care icons. Use these endpoints to build and maintain that layer library.
  Multi-language translation of layer text requires a Professional licence.
</Info>

## The workflow

Layers sit one level above materials in the care instruction setup hierarchy: you create the
layers, optionally translate them into working languages, and then select them on styles when
defining each layer's fibre composition and washing icons.

<Steps>
  <Step title="Create layers">
    `POST /api/care-instruction-layers` with the default text and an optional user-defined ID.
    The body is an array — one or many layers are created in a single all-or-nothing transaction.
  </Step>

  <Step title="Add translations (optional)">
    Include a `languages` array in the create body, or update an existing layer via
    `PUT /api/care-instruction-layers/{id}` with a replacement `languages` list. Requires a
    Professional licence and at least one language configured under Admin > General Settings.
  </Step>

  <Step title="Find and list layers">
    `GET /api/care-instruction-layers` with filters (`text`, `userDefinedIds`, `state`) to look
    up layers for import verification or to drive a selection dropdown.
  </Step>

  <Step title="Retire or bulk-manage">
    Use `PUT /api/care-instruction-layers/{id}` to deactivate a single layer, or
    `PUT /api/care-instruction-layers` (bulk) to update positions, states, and translations — or
    hard-delete multiple layers — in one transaction by setting `state: "deleted"` on those items.
  </Step>
</Steps>

```mermaid theme={"dark"}
sequenceDiagram
  participant D as Designer
  participant API as Delogue API
  D->>API: POST /api/care-instruction-layers  (with optional languages)
  API-->>D: layer id(s)
  D->>API: GET /api/care-instruction-layers  (filter by state / text)
  API-->>D: paginated list
  D->>API: PUT /api/care-instruction-layers/{id}  (update text, state, or translations)
  API-->>D: updated layer
  D->>API: DELETE /api/care-instruction-layers/{id}  (hard-delete when not used on any style)
  API-->>D: deleted layer (state: inactive)
```

## Walkthrough

Create a "Lining" layer with a Norwegian translation in a single call.

<CodeGroup>
  ```bash cURL theme={"dark"}
  curl -X POST "https://service.my.delogue.com/api/care-instruction-layers" \
    -H "Accept: application/json" \
    -H "X-Auth-Token: Bearer YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '[
    {
      "userDefinedId": "LINING-01",
      "text": "Lining",
      "isActive": true,
      "languages": [
        {
          "languageId": 1,
          "text": "Foring"
        }
      ]
    }
  ]'
  ```

  ```js JavaScript theme={"dark"}
  const res = await fetch("https://service.my.delogue.com/api/care-instruction-layers", {
    method: "POST",
    headers: {
      "Accept": "application/json",
      "X-Auth-Token": "Bearer YOUR_API_KEY",
      "Content-Type": "application/json",
    },
    body: JSON.stringify([
    {
      "userDefinedId": "LINING-01",
      "text": "Lining",
      "isActive": true,
      "languages": [
        {
          "languageId": 1,
          "text": "Foring"
        }
      ]
    }
  ]),
  });
  const { data } = await res.json();
  ```
</CodeGroup>

```json theme={"dark"}
{
  "status": "success",
  "code": "care_instruction_layers_created",
  "data": [
    {
      "id": 42,
      "userDefinedId": "LINING-01",
      "text": "Lining",
      "state": "active",
      "position": 32,
      "properties": [],
      "languages": [
        {
          "id": 4001,
          "languageId": 1,
          "text": "Foring"
        }
      ]
    }
  ]
}
```

The response wraps the created layers in the standard envelope. Hold onto each `id` — it is
the stable reference used when reordering or deactivating the layer later.

## Field reference

| Field           | What it means at Delogue                                                                                                                                                                                                            |
| --------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `isActive`      | Initial active state of the layer. Defaults to true (active). Set to false to create the layer as inactive.                                                                                                                         |
| `languages`     | Per-language translations to attach at creation time. Null or omitted creates the layer with no translations. Each entry is matched by languageId and must reference a language enabled for care instructions in this organisation. |
| `text`          | Default display text for the layer. Required.                                                                                                                                                                                       |
| `userDefinedId` | Customer-defined identifier for the new layer. Must be unique within the organisation. Used as a stable key for imports and integrations.                                                                                           |

## Roles & permissions

Managing the care instruction layer library requires the **`company`** permission on a
**designer (brand)** account — typically `CompanyAdmin`. The user also needs the **Care
Instruction** role assigned in Admin > Company info > Roles. Supplier accounts collaborate on
styles but do not manage a brand's care instruction layer library.

<Note>
  Multi-language translations require a **Professional licence** subscription. The `languages`
  field is accepted on all tiers but translation values are only surfaced where the feature is
  enabled.
</Note>

## When things go wrong

Errors use the standard envelope (`status: "error"`, a `code`, and `error.details[]`). See
[Errors & responses](/concepts/errors) for the full list of codes and how to resolve them.

Common cases:

* **409 Conflict** on `DELETE` — the layer is still referenced by one or more styles.
  Deactivate it with `PUT /api/care-instruction-layers/{id}` (`state: "inactive"`) instead of
  deleting it, or remove it from all styles first.
* **400 validation\_error** — `text` is missing on create, or `state: "deleted"` was passed to
  the single-update endpoint.
* **404 resource\_error** — the `id` does not exist or does not belong to your organisation.

## What to call next

<CardGroup cols={2}>
  <Card title="Care instructions" href="/guides/care-instructions">
    Create the washing and handling instructions that sit within each layer on a style.
  </Card>

  <Card title="Colors" href="/guides/colors">
    Build the colour library used alongside care instruction layers on styles.
  </Card>

  <Card title="Seasons" href="/guides/seasons">
    Create the seasons that styles — and their care instruction layers — are filed under.
  </Card>

  <Card title="Style categories" href="/guides/style-categories">
    Organise styles by category before assigning layers and care labels.
  </Card>
</CardGroup>
