---
title: "Upload an option swatch image"
method: POST
path: "/catalog/attributes/{attributeId}/options/{optionId}/swatch"
tags: ["Admin Catalog: Attributes"]
---

# Upload an option swatch image

`POST /catalog/attributes/{attributeId}/options/{optionId}/swatch`

## Request

- Base URL: `http://localhost:8000/api/admin`
- URL: `http://localhost:8000/api/admin/catalog/attributes/{attributeId}/options/{optionId}/swatch`
- Auth: HTTP bearer
- TypeScript: <https://skmtc.dev/bagisto/apis/bagisto-admin-api/docs/catalog/attributes/:attributeId/options/:optionId/swatch/post.ts> (a function with typed inputs; its response is checked against the schema)

Stores the image as the option's swatch value. Only for attributes whose swatch type is `image`. Send multipart/form-data with `swatch_value` (bmp, jpeg, jpg, png, webp). Optional `swatch_file_name` names the stored file and `swatch_alt` is saved for the `locale` sent (or the default locale). Returns the full attribute detail.

## Path parameters

- `attributeId` integer, required
- `optionId` integer, required

## Request body `multipart/form-data`

- object
  - `swatch_value` string, binary, required
  - `swatch_file_name` string
  - `swatch_alt` string
  - `locale` string

## Response `200`

Swatch stored. Returns the full attribute detail.

## Other responses

- `400`: Invalid input
- `403`: Missing catalog.attributes.edit permission.
- `404`: Attribute or option not found.
- `422`: Missing or invalid file, or the attribute does not use image swatches.

## Changes

- **2026-10-28** `3198f11be70f`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/bagisto/apis/bagisto-admin-api/changes/catalog/attributes/:attributeId/options/:optionId/swatch/post.md)

---

[API](https://skmtc.dev/bagisto/apis/bagisto-admin-api.md) - [All operations](https://skmtc.dev/bagisto/apis/bagisto-admin-api/llms.txt) - [OpenAPI document](https://skmtc.dev/bagisto/apis/bagisto-admin-api/revisions/3198f11be70f?raw)
