Upload Product Option Image (v1)
Method & Path
POST /api/v1/workspace/:workspaceId/storefront/product-options/:optionId/image
Actual backend path: /v1/workspace/:workspaceId/storefront/product-options/:optionId/image
Description
Upload an image for a store-level product option. Accepts PNG, JPEG, or WebP (max 5 MB). Image is processed and stored as WebP.
Authentication
Required: JWT token in Authorization header.
Required Permissions: store.products.manage
Headers
| Header | Type | Required | Description |
|---|---|---|---|
Authorization | string | Yes | Bearer token: Bearer <token> |
Content-Type | string | Yes | multipart/form-data |
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
workspaceId | string | Yes | Workspace identifier |
optionId | string | Yes | Product option identifier |
Request Body
Multipart form with a single file field:
| Field | Type | Required | Description |
|---|---|---|---|
file | file | Yes | Image file (PNG, JPEG, or WebP; max 5 MB) |
Response 201 Created
{
"optionId": "507f1f77bcf86cd799439011",
"imageUrl": "https://storage.googleapis.com/bucket/path/image.webp"
}
Common Errors
- 400 Bad Request: Missing file or invalid optionId
- 401 Unauthorized: Missing or invalid authentication token
- 403 Forbidden: Insufficient permissions or storage quota exceeded
- 404 Not Found: Workspace, store, or product option not found
- 422 Unprocessable Entity: Image too large or unsupported type
- 500 Internal Server Error: Server error