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

# How to add and manage clothing items in Drssed

> Learn how to add, update, and delete clothing items via the Drssed API — from uploading an image to organizing your full wardrobe.

This guide walks you through the full lifecycle of a clothing item in the Drssed API. You will learn how to upload a clothing image and get AI-detected metadata back, create a clothing item using that image, list your wardrobe, update item details, and delete items you no longer need. Each step builds on the previous one, so you can follow along end-to-end or jump to the section you need.

<Note>
  The `image_id` used when creating a clothing item must come from a prior call to `POST /images/preview`. You cannot supply an arbitrary image URL or external identifier.
</Note>

<Steps>
  <Step title="Process the clothing image">
    Before creating a clothing item, upload a photo of it to `POST /images/preview`. Drssed removes the background, detects the dominant color, infers the category, and returns suggested seasons and style tags — all automatically.

    Send the image as `multipart/form-data` with the field name `file`.

    ```bash theme={null}
    curl -X POST https://api.drssed.com/images/preview \
      -H "Authorization: Bearer {token}" \
      -F "file=@/path/to/jacket.jpg"
    ```

    A successful response returns everything you need to create the clothing item:

    ```json theme={null}
    {
      "image_url": "https://cdn.drssed.com/images/abc123.png",
      "image_id": "img_abc123",
      "image_color": "Navy Blue",
      "image_category": "JACKET",
      "image_seasons": ["Autumn", "Winter"],
      "image_tags": ["Casual", "Vintage"]
    }
    ```

    <Tip>
      Use the AI-detected `image_category`, `image_seasons`, and `image_tags` as the default values when creating your clothing item. You can always override them, but the suggestions are accurate enough to use directly in most cases.
    </Tip>
  </Step>

  <Step title="Create the clothing item">
    Call `POST /users/me/clothing` with the `image_id` from the previous step along with any metadata you want to store.

    **Required fields:** `name`, `category`, `image_id`, `color`

    **Optional fields:** `seasons`, `tags`, `description`

    Valid `category` values: `JACKET`, `TOP`, `BOTTOM`, `FOOTWEAR`

    Valid `seasons` values: `Spring`, `Summer`, `Autumn`, `Winter`

    Valid `tags` values: `Casual`, `Formal`, `Sports`, `Vintage`

    ```bash theme={null}
    curl -X POST https://api.drssed.com/users/me/clothing \
      -H "Authorization: Bearer {token}" \
      -H "Content-Type: application/json" \
      -d '{
        "name": "Navy Denim Jacket",
        "category": "JACKET",
        "image_id": "img_abc123",
        "color": "Navy Blue",
        "seasons": ["Autumn", "Winter"],
        "tags": ["Casual", "Vintage"],
        "description": "Slightly oversized, great for layering"
      }'
    ```

    On success the API returns `201 Created` with the new clothing object:

    ```json theme={null}
    {
      "clothing": {
        "clothing_id": "clo_xyz789",
        "user_id": "usr_000111",
        "is_public": false,
        "name": "Navy Denim Jacket",
        "category": "JACKET",
        "color": "Navy Blue",
        "image_id": "img_abc123",
        "seasons": ["Autumn", "Winter"],
        "tags": ["Casual", "Vintage"],
        "description": "Slightly oversized, great for layering",
        "created_at": "2024-06-01T10:30:00+00:00"
      }
    }
    ```
  </Step>

  <Step title="List your clothing">
    Retrieve your wardrobe with `GET /users/me/clothing`. Use `limit` and `offset` for pagination, and the optional `category` parameter to filter by type.

    | Query parameter | Type    | Default | Description                                        |
    | --------------- | ------- | ------- | -------------------------------------------------- |
    | `limit`         | integer | `50`    | Number of items to return                          |
    | `offset`        | integer | `0`     | Number of items to skip                            |
    | `category`      | string  | —       | Filter by `JACKET`, `TOP`, `BOTTOM`, or `FOOTWEAR` |

    ```bash theme={null}
    curl https://api.drssed.com/users/me/clothing?limit=20&offset=0&category=JACKET \
      -H "Authorization: Bearer {token}"
    ```

    The response lists matching items alongside your pagination parameters:

    ```json theme={null}
    {
      "limit": 20,
      "offset": 0,
      "clothing": [
        {
          "clothing_id": "clo_xyz789",
          "name": "Navy Denim Jacket",
          "category": "JACKET",
          "color": "Navy Blue",
          "image_id": "img_abc123",
          "seasons": ["Autumn", "Winter"],
          "tags": ["Casual", "Vintage"],
          "description": "Slightly oversized, great for layering",
          "is_public": false,
          "user_id": "usr_000111",
          "created_at": "2024-06-01T10:30:00+00:00"
        }
      ]
    }
    ```
  </Step>

  <Step title="Update a clothing item">
    Use `PATCH /clothing/{clothing_id}` to update any subset of fields on an existing item. All fields are optional — only the fields you include are changed.

    **Updatable fields:** `name`, `category`, `color`, `seasons`, `tags`, `image_id`, `description`

    ```bash theme={null}
    curl -X PATCH https://api.drssed.com/clothing/clo_xyz789 \
      -H "Authorization: Bearer {token}" \
      -H "Content-Type: application/json" \
      -d '{
        "name": "Navy Denim Jacket (oversized)",
        "seasons": ["Spring", "Autumn", "Winter"]
      }'
    ```

    A successful update returns `200 OK` with the updated item:

    ```json theme={null}
    {
      "clothing": {
        "clothing_id": "clo_xyz789",
        "name": "Navy Denim Jacket (oversized)",
        "category": "JACKET",
        "color": "Navy Blue",
        "image_id": "img_abc123",
        "seasons": ["Spring", "Autumn", "Winter"],
        "tags": ["Casual", "Vintage"],
        "description": "Slightly oversized, great for layering",
        "is_public": false,
        "user_id": "usr_000111",
        "created_at": "2024-06-01T10:30:00+00:00"
      }
    }
    ```
  </Step>

  <Step title="Delete a clothing item">
    Remove an item from your wardrobe with `DELETE /clothing/{clothing_id}`. The API performs a soft delete — the item is hidden from your wardrobe immediately but is not permanently erased right away.

    ```bash theme={null}
    curl -X DELETE https://api.drssed.com/clothing/clo_xyz789 \
      -H "Authorization: Bearer {token}"
    ```

    A successful deletion returns `204 No Content` with an empty body.
  </Step>
</Steps>

## Rate limits

Most clothing endpoints are limited to **5 requests per minute**. If you exceed this limit the API returns `429 Too Many Requests`. Build a backoff strategy into your client if you expect bursts of requests.
