> ## 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 size ranges

> Build and maintain the size ranges that drive sample requests, size charts, and SKU generation across styles and items.

<Info>
  **When to use this.** A size range is the ordered list of sizes — for example S, M, L, XL — that
  every style and item in Delogue is measured and sampled against. You must create at least one
  size range before you can attach sizes to a style, make a sample request, or build a size chart.
  Use these endpoints to set up and maintain the organisation's size range library.
</Info>

## The workflow

Size ranges are admin-level records owned by the designer organisation. The typical path is to
create a size range with its sizes, mark one as the default, then reference it from styles and
items further along the product lifecycle.

<Steps>
  <Step title="Create the size range">
    `POST /api/size-ranges` with a name and the ordered list of sizes. Mark `isDefault: true` if
    this should be the organisation's default range. Only one default is allowed at a time.
  </Step>

  <Step title="Find size ranges">
    `GET /api/size-ranges` with filters (name, state, `userDefinedId`) to look up existing ranges
    — useful when checking before an ERP import or a bulk update.
  </Step>

  <Step title="Assign to styles">
    Styles reference a size range to drive sample requests and size charts. Once a style is in use,
    avoid changing its size range — active sample requests will be cancelled.
  </Step>

  <Step title="Retire or update">
    `PUT /api/size-ranges/{id}` to rename or change the state. `DELETE /api/size-ranges/{id}`
    soft-deletes a range that is no longer needed; it must not be in use on any style.
  </Step>
</Steps>

```mermaid theme={"dark"}
sequenceDiagram
  participant D as Designer
  participant API as Delogue API
  D->>API: POST /api/size-ranges  (with sizes)
  API-->>D: size range id + size ids
  D->>API: GET /api/size-ranges?State=active
  API-->>D: paginated list of size ranges
  D->>API: PUT /api/size-ranges/{id}  (rename / retire)
  API-->>D: updated size range
```

## Walkthrough

Create a size range for a women's EU collection. The body is an array — one or many size ranges
are created in a single all-or-nothing transaction.

<CodeGroup>
  ```bash cURL theme={"dark"}
  curl -X POST "https://service.my.delogue.com/api/size-ranges" \
    -H "Accept: application/json" \
    -H "X-Auth-Token: Bearer YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '[
    {
      "name": "Mens EU",
      "userDefinedId": "M-EU",
      "state": "active",
      "isDefault": false,
      "isAdvancedGrading": false,
      "allowHalfSample": false,
      "sizes": [
        {
          "name": "M",
          "sizeId": "M"
        },
        {
          "name": "L",
          "sizeId": "L"
        }
      ]
    }
  ]'
  ```

  ```js JavaScript theme={"dark"}
  const res = await fetch("https://service.my.delogue.com/api/size-ranges", {
    method: "POST",
    headers: {
      "Accept": "application/json",
      "X-Auth-Token": "Bearer YOUR_API_KEY",
      "Content-Type": "application/json",
    },
    body: JSON.stringify([
    {
      "name": "Mens EU",
      "userDefinedId": "M-EU",
      "state": "active",
      "isDefault": false,
      "isAdvancedGrading": false,
      "allowHalfSample": false,
      "sizes": [
        {
          "name": "M",
          "sizeId": "M"
        },
        {
          "name": "L",
          "sizeId": "L"
        }
      ]
    }
  ]),
  });
  const { data } = await res.json();
  ```
</CodeGroup>

```json theme={"dark"}
{
  "status": "success",
  "code": "size_ranges_created",
  "data": [
    {
      "id": 7,
      "name": "Mens EU",
      "state": "active",
      "userDefinedId": "M-EU",
      "defaultGradingSizeId": null,
      "defaultGradingSizeName": null,
      "sizes": [
        {
          "id": 70,
          "name": "M",
          "sizeId": "M",
          "relatedSizeRangeSizeId": null,
          "gradingGroupId": null
        },
        {
          "id": 71,
          "name": "L",
          "sizeId": "L",
          "relatedSizeRangeSizeId": null,
          "gradingGroupId": null
        }
      ],
      "properties": []
    }
  ]
}
```

The response wraps the created size ranges in the standard envelope. Hold onto each size `id` —
styles and grading configurations reference sizes by it.

## Field reference

The fields that matter most when creating or updating a size range:

| Field               | What it means at Delogue                                         |
| ------------------- | ---------------------------------------------------------------- |
| `allowHalfSample`   | Whether half-size samples are allowed for this range.            |
| `isAdvancedGrading` | Enables advanced grading. Requires the Pro module to be enabled. |
| `isDefault`         | Whether this becomes the organization's default size range.      |
| `name`              | Display name of the size range. Required.                        |
| `sizes`             | The sizes to create in the range. At least one is required.      |
| `state`             | Initial lifecycle state. Defaults to active.                     |
| `userDefinedId`     | Customer-defined identifier.                                     |

<Note>
  Size steps (individual sizes within a range) **cannot be added or removed** after creation via
  the API. Plan your size ranges to be as wide as possible; individual sizes can be deactivated
  at the style level. `PUT /api/size-ranges` is a full replace of the range's metadata — it does
  not modify the sizes array.
</Note>

## Roles & permissions

Managing size ranges requires the designer (brand) account role — typically `CompanyAdmin` or
`CompanyUser`. Supplier accounts collaborate on styles and sample requests but do not manage a
brand's size range library. Advanced grading (`isAdvancedGrading`) is a **Pro-tier** feature
and requires the module to be enabled for the organisation.

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

## What to call next

<CardGroup cols={2}>
  <Card title="Seasons" href="/guides/seasons">
    Seasons are the other prerequisite for styles — set them up alongside size ranges.
  </Card>

  <Card title="Style categories" href="/guides/style-categories">
    Organise styles by category once you have seasons and size ranges in place.
  </Card>

  <Card title="Size range bulk update" href="/api-reference/sizeranges/bulk-updates-size-ranges-full-replace-in-a-single-transaction">
    Update multiple size ranges in one call: `PUT /api/size-ranges` with an array of objects
    including `id`.
  </Card>

  <Card title="Authentication" href="/authentication">
    How to get and send your `X-Auth-Token` API key.
  </Card>
</CardGroup>
