Skip to main content

Create Product Option (v1)

Method & Path

POST /api/v1/workspace/:workspaceId/storefront/product-options

Actual backend path: /v1/workspace/:workspaceId/storefront/product-options

Description

Create a new store-level product option. Options can later be linked to products in product option groups.

Authentication

Required: JWT token in Authorization header.

Required Permissions: store.products.manage

Headers

HeaderTypeRequiredDescription
AuthorizationstringYesBearer token: Bearer <token>
Content-TypestringYesapplication/json

Path Parameters

ParameterTypeRequiredDescription
workspaceIdstringYesWorkspace identifier

Request Body

FieldTypeRequiredDescription
namestringYesOption name (e.g. "كبير", "إضافي")
priceDeltanumberNoPrice adjustment (default 0). Can be negative.
imageUrlstring | nullNoURL of option image (optional)
isAvailablebooleanNoWhether option is available for selection in storefront (default true)
sortOrdernumberNoDisplay order (default 0)

Example

{
"name": "كبير",
"priceDelta": 2.5,
"isAvailable": true,
"sortOrder": 0
}

Response 201 Created

{
"option": {
"id": "507f1f77bcf86cd799439011",
"workspaceId": "507f1f77bcf86cd799439012",
"storeId": "507f1f77bcf86cd799439013",
"name": "كبير",
"priceDelta": 2.5,
"imageUrl": null,
"isAvailable": true,
"sortOrder": 0,
"createdAt": "2025-01-01T00:00:00.000Z",
"updatedAt": "2025-01-01T00:00:00.000Z"
}
}

Common Errors

  • 400 Bad Request: Invalid request body
  • 401 Unauthorized: Missing or invalid authentication token
  • 403 Forbidden: Insufficient permissions
  • 404 Not Found: Workspace or store not found
  • 422 Unprocessable Entity: Validation failed (e.g. name required)
  • 500 Internal Server Error: Server error