> ## 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 materials

> Build and maintain the organisation's material library — the fibre names (cotton, polyester, spandex…) that define the composition of each care instruction layer on styles.

<Info>
  **When to use this.** A care instruction material names a fibre or fabric component — for
  example "spandex", "polyester", or "micro fleece polyester". Materials are created once in
  Admin, given a stable user-defined ID, and then selected on styles to define the percentage
  composition within each care instruction layer. Use these endpoints to build and maintain that
  material library. Multi-language translation of material text requires a Professional licence.
</Info>

## The workflow

Materials sit at the innermost level of the care instruction setup hierarchy: layers contain
compositions, and each composition entry picks a material from this library. The typical path
is to create the materials, keep them active so they appear in the style-level dropdown, and
retire or bulk-update them as your fibre vocabulary evolves.

<Steps>
  <Step title="Create materials">
    `POST /api/care-instruction-materials` with the default text and an optional user-defined ID.
    The body is an array — one or many materials 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 material via
    `PUT /api/care-instruction-materials/{id}` with a replacement `languages` list. Requires a
    Professional licence and at least one language configured under Admin > General Settings >
    Languages with "Use for Care Instructions" enabled.
  </Step>

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

  <Step title="Retire or bulk-manage">
    Use `PUT /api/care-instruction-materials/{id}` to deactivate a single material, or
    `PUT /api/care-instruction-materials` (bulk) to update positions, states, and translations —
    or hard-delete multiple materials — in one transaction by setting `state: "deleted"` on those
    items. A material can only be hard-deleted when it is not referenced by any style.
  </Step>
</Steps>

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

## Walkthrough

Create a "spandex" material with per-language translations in a single call. The body is an
array — all items in the array are committed atomically.

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

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

```json theme={"dark"}
{
  "status": "success",
  "code": "care_instruction_materials_created",
  "data": [
    {
      "id": 6100,
      "userDefinedId": "10120",
      "text": "spandex",
      "state": "active",
      "position": 0,
      "properties": [],
      "languages": [
        {
          "id": 51,
          "languageId": 78,
          "text": "Spandex"
        },
        {
          "id": 52,
          "languageId": 2,
          "text": "spandex"
        }
      ]
    }
  ]
}
```

The response wraps the created materials in the standard envelope. Hold onto each `id` — it is
the stable reference used when reordering, deactivating, or referencing the material on a
style's care instruction composition.

## Field reference

| Field           | What it means at Delogue                                                                                                                                                                                                                   |
| --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `isActive`      | Initial lifecycle state. Defaults to true (active). Set to false to create an inactive material that is not yet selectable on styles.                                                                                                      |
| `languages`     | Optional per-language translations to attach at creation time. Each entry references a language that must be active and enabled for care instructions in Admin > Languages. Null or omitted creates the material without any translations. |
| `text`          | Default display text of the material. Required.                                                                                                                                                                                            |
| `userDefinedId` | Optional customer-defined identifier for the new material. Must be unique within the organisation.                                                                                                                                         |

## Roles & permissions

Managing the care instruction material 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 material 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 material is still referenced by one or more styles.
  Deactivate it with `PUT /api/care-instruction-materials/{id}` (`state: "inactive"`) instead of
  deleting it, or remove it from all style compositions 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 instruction layers" href="/guides/care-instruction-layers">
    Create the layers (Main, Lining, Shell…) that materials are composed within on styles.
  </Card>

  <Card title="Care instructions" href="/guides/care-instructions">
    Create the washing and handling instructions that sit alongside compositions 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 data — are filed under.
  </Card>
</CardGroup>
