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

# POST /images/preview — Process and analyze clothing photo

> Upload a clothing photo for AI processing. Returns a background-removed image with auto-detected category, color, seasons, and style tags.

Call `POST /images/preview` to upload a clothing photo and run it through the Drssed image pipeline. The API removes the background from the image and uses AI to detect the item's dominant color, category, relevant seasons, and style tags. The returned `image_id` links the processed image to a clothing item when you call `POST /users/me/clothing`.

## Endpoint

| Field         | Value                 |
| ------------- | --------------------- |
| Method        | `POST`                |
| Path          | `/images/preview`     |
| Auth required | Yes — Bearer token    |
| Rate limit    | 1 per minute          |
| Content-Type  | `multipart/form-data` |

## Request parameters

<ParamField body="file" type="file" required>
  The clothing image to process. Send as a `multipart/form-data` field.
</ParamField>

## Response fields

**Status: 201 Created**

<ResponseField name="image_url" type="string" required>
  URL of the processed image with the background removed.
</ResponseField>

<ResponseField name="image_id" type="string" required>
  Unique identifier for this processed image. Pass this as `image_id` when creating a clothing item via `POST /users/me/clothing`.
</ResponseField>

<ResponseField name="image_color" type="string" required>
  Detected dominant color of the clothing item.
</ResponseField>

<ResponseField name="image_category" type="string" required>
  Detected category of the clothing item. One of: `JACKET`, `TOP`, `BOTTOM`, `FOOTWEAR`.
</ResponseField>

<ResponseField name="image_seasons" type="array" required>
  Detected seasons the item is suited for. Possible values: `Spring`, `Summer`, `Autumn`, `Winter`.
</ResponseField>

<ResponseField name="image_tags" type="array" required>
  Detected style tags for the item. Possible values: `Casual`, `Formal`, `Sports`, `Vintage`.
</ResponseField>

## Error codes

| Status | Meaning                                               |
| ------ | ----------------------------------------------------- |
| `400`  | No file was included in the request.                  |
| `413`  | The uploaded file exceeds the maximum allowed size.   |
| `422`  | The image is unclear or not recognizable as clothing. |

## Example

```bash cURL theme={null}
curl --request POST \
  --url https://api.drssed.com/images/preview \
  --header "Authorization: Bearer <token>" \
  --form "file=@shirt.jpg"
```

```json Response theme={null}
{
  "image_url": "https://api.drssed.com/uploads/clothing_images/img_f1e2d3c4",
  "image_id": "img_f1e2d3c4",
  "image_color": "Navy Blue",
  "image_category": "TOP",
  "image_seasons": ["Spring", "Autumn"],
  "image_tags": ["Casual"]
}
```

<Warning>
  This endpoint is strictly rate limited to 1 request per minute. Queue image uploads appropriately to avoid hitting the limit.
</Warning>

<Tip>
  Use the returned `image_category`, `image_seasons`, and `image_tags` as default values when calling `POST /users/me/clothing` — this reduces the amount of input the user needs to provide.
</Tip>
