> ## 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 style SKUs

> Create, replace, and look up the color/size SKUs of a style — the sellable variants that carry barcodes, prices, and resolved custom fields.

<Info>
  **When to use this.** A SKU is one unique colour/size combination of a style — the level at
  which you assign barcodes, negotiate prices, and read resolved custom-field values. Use these
  endpoints to create a style's SKUs, replace their state in bulk, and look them up again.
  SKUs require the **Barcodes** module and are a **designer-only** surface.
</Info>

## The workflow

SKUs hang off a style that already has its colourways and size range set up. The usual path is
to create the SKUs for the colour/size combinations you sell, adjust their state in bulk as the
range evolves, then read them back — each SKU comes back enriched with its nested colour and
size, the style's custom fields resolved to that coordinate, and the lowest applicable price
rows.

<Steps>
  <Step title="Create SKUs on a style">
    `POST /api/styles/{styleId}/skus` with an array of `{ number, colorId, sizeId, state }`
    objects — one colour/size combination each, created in a single all-or-nothing transaction
    (capped at 200 per request).
  </Step>

  <Step title="Replace SKU state in bulk">
    `PUT /api/styles/{styleId}/skus` with an array of `{ id, state }` objects to activate or
    deactivate SKUs together. `state: "deleted"` sets a SKU inactive — a SKU has no separate
    deleted state.
  </Step>

  <Step title="Look SKUs up">
    `GET /api/styles/{styleId}/skus` (filter by `state`, `colorId`, `sizeId`) for one style's
    SKUs, `GET /api/styles/{styleId}/skus/{skuId}` for a single one, or `GET /api/skus` to page
    across every style in the organisation.
  </Step>
</Steps>

```mermaid theme={"dark"}
sequenceDiagram
  participant D as Designer
  participant API as Delogue API
  D->>API: POST /api/styles/{styleId}/skus  (number, colorId, sizeId, state)
  API-->>D: created SKUs (enriched)
  D->>API: PUT /api/styles/{styleId}/skus  (id, state)
  API-->>D: updated SKUs
  D->>API: GET /api/styles/{styleId}/skus/{skuId}
  API-->>D: SKU with colour, size, custom fields, prices
```

## Walkthrough

Create a SKU for a colour/size combination on a style, then read it back. The body is an array —
one or many SKUs are created in a single all-or-nothing transaction.

<CodeGroup>
  ```bash cURL theme={"dark"}
  curl -X POST "https://service.my.delogue.com/api/styles/{styleId}/skus" \
    -H "Accept: application/json" \
    -H "X-Auth-Token: Bearer YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '[
    {
      "number": "SS26-1042-ECR-M",
      "colorId": 5568,
      "sizeId": 8901,
      "state": "active"
    }
  ]'
  ```

  ```js JavaScript theme={"dark"}
  const res = await fetch("https://service.my.delogue.com/api/styles/{styleId}/skus", {
    method: "POST",
    headers: {
      "Accept": "application/json",
      "X-Auth-Token": "Bearer YOUR_API_KEY",
      "Content-Type": "application/json",
    },
    body: JSON.stringify([
    {
      "number": "SS26-1042-ECR-M",
      "colorId": 5568,
      "sizeId": 8901,
      "state": "active"
    }
  ]),
  });
  const { data } = await res.json();
  ```
</CodeGroup>

```json theme={"dark"}
{
  "status": "success",
  "code": "style_skus_created",
  "data": [
    {
      "id": 90777,
      "number": "SS26-1042-ECR-M",
      "state": "active",
      "barcode": null,
      "barcodeId": null,
      "styleId": 4821,
      "color": {
        "id": 5568,
        "name": "Ecru",
        "customId1": "ECR",
        "customId2": null,
        "state": "active"
      },
      "size": {
        "id": 8901,
        "name": "Medium",
        "sizeId": "M",
        "state": "active"
      },
      "customFields": [],
      "prices": [],
      "properties": []
    }
  ]
}
```

The response wraps each SKU in the standard envelope. A read returns the SKU enriched: `color`
and `size` as nested objects, `customFields` resolved to that coordinate, `prices` at the lowest
applicable variant level, and `properties` flags such as `barcodeAssigned`.

## Field reference

The fields that matter most when creating, updating, or reading a SKU:

| Field     | What it means at Delogue                                                                       |
| --------- | ---------------------------------------------------------------------------------------------- |
| `colorId` | The color-library color id (StyleColorMaster id) for the SKU, or null for a size-only variant. |
| `number`  | The SKU number identifying the new color/size variant.                                         |
| `sizeId`  | The size-range size id (SizeRangeSize id) for the SKU, or null for a color-only variant.       |
| `state`   | Initial lifecycle state of the SKU: active or inactive.                                        |

## Roles & permissions

SKUs are a **designer-only** surface: supplier accounts receive **403**. The caller's
organisation must have the **Barcodes** module enabled, and the user needs the **`barcodes`**
permission — read level for the `GET`s, write level for `POST`/`PUT`. Without the module the
request is refused; without price access, `prices` comes back empty rather than failing.

## When things go wrong

Errors use the standard envelope (`status: "error"`, a `code`, and `error.details[]`). A style
that does not exist returns **404**; a style in another organisation returns **403**; an unknown
`skuId` under the style returns **404**. Bulk `POST`/`PUT` failures use the bulk error envelope
with per-item `[i].field` paths. See [Errors & responses](/concepts/errors) for the full list of
codes and how to resolve them.

## What to call next

<CardGroup cols={2}>
  <Card title="Styles" href="/guides/styles">
    Set up the style, its colourways, and size range before creating SKUs.
  </Card>

  <Card title="Size ranges" href="/guides/size-ranges">
    Manage the sizes a SKU's `sizeId` points at.
  </Card>

  <Card title="Colours" href="/guides/colors">
    Manage the colour library a SKU's `colorId` points at.
  </Card>

  <Card title="Style prices" href="/guides/style-prices">
    The full price rows a SKU's `prices` join back to: `GET /api/styles/{styleId}/prices`.
  </Card>
</CardGroup>
