Skip to main content

Product Management

Author: Josh S. Sakweli, Backend Lead Team
Last Updated: 2025-09-232026-05-19
Version: v1.v2.0

Short Description: The Product Management API provides comprehensive functionality for managing products within shops on the NextGate platform. It supports advanced features including group buying, installment payments,payment plans, color variations, specifications, comprehensivedigital searchproduct file delivery, and filteringcomprehensive search/filter capabilities with role-based access control.

Hints:


Endpoints

1. Create Product

Purpose: Creates a new product in a shopshop, with support for all advanced features includingsupporting group buying, installments, color variations, specifications, and specificationsdigital product rules.

Endpoint: POST /api/v1/e-commerce/shops/{shopId}/products

Access Level: ๐Ÿ”’ Protected (Requires shop owner or system admin role)

Authentication: Bearer Token

Request Headers:

Header Type Required Description
Authorization string Yes Bearer token for authentication
Content-Type string Yes application/json

Path Parameters:

Parameter Type Required Description Validation
shopId UUID Yes ID of the shop to create product inValid UUID format, shop must exist and be active

Query Parameters:

Parameter Type Required DescriptionDefault ValidationDefaultDescription
action ReqAction Yes Action to perform on productโ€” SAVE_DRAFT,SAVE_DRAFT or SAVE_PUBLISHNone

Request JSON Sample:

{
  "productName": "iPhone 15 Pro Max 256GB",
  "productDescription": "The most advanced iPhone ever, featuring the groundbreaking A17 Pro chip, titanium design, and the most versatile Pro camera system. With a 6.7-inch Super Retina XDR display, Action Button, and up to 29 hours of video playback battery life.",
  "shortDescription": "Premium 6.7-inch iPhone with A17 Pro chip and titanium design",
  "price": 1199.00,
  "comparePrice": 1299.00,
  "stockQuantity": 25,
  "lowStockThreshold": 5,
  "categoryId": "123e4567-e89b-12d3-a456-426614174000",
  "brand": "Apple",
  "condition": "NEW",
  "productImages": [
    "https://example.com/images/iphone15-pro-max-main.jpg",
    "https://example.com/images/iphone15-pro-max-side.jpg",
    "https://example.com/images/iphone15-pro-max-back.jpg",
    "https://example.com/images/iphone15-pro-max-camera.jpg"
  ],
  "tags": ["smartphone", "apple", "premium", "5g", "titanium", "pro-camera"],
  "specifications": {
    "Display": "6.7-inch Super Retina XDR OLED",
    "Chip": "A17 Pro with 6-core GPU",
    "Storage": "256GB",
    "RAM": "8GB",
    "Rear Camera": "48MP Main, 12MP Ultra Wide, 12MP Telephoto",
    "Front Camera": "12MP TrueDepth",
    "Battery Life": "Up to 29 hours video playback",
    "Operating System": "iOS 17",
    "Connectivity": "5G, Wi-Fi 6E, Bluetooth 5.3",
    "Materials": "Titanium frame, Ceramic Shield front",
    "Water Resistance": "IP68 (6 meters for up to 30 minutes)",
    "Dimensions": "159.9 x 76.7 x 8.25 mm",
    "Weight": "221 grams"
  },
  "colors": [
    {
      "name": "Natural Titanium",
      "hex": "#F5F5DC",
      "images": [
        "https://example.com/colors/iphone-natural-titanium-1.jpg",
        "https://example.com/colors/iphone-natural-titanium-2.jpg"
      ],
      "priceAdjustment": 0.00
    },
    {
      "name": "Blue Titanium",
      "hex": "#4A90E2",
      "images": [
        "https://example.com/colors/iphone-blue-titanium-1.jpg",
        "https://example.com/colors/iphone-blue-titanium-2.jpg"
      ],
      "priceAdjustment": 0.00
    },
    {
      "name": "White Titanium",
      "hex": "#FFFFFF",
      "images": [
        "https://example.com/colors/iphone-white-titanium-1.jpg",
        "https://example.com/colors/iphone-white-titanium-2.jpg"
      ],
      "priceAdjustment": 0.00
    },
    {
      "name": "Black Titanium",
      "hex": "#1C1C1E",
      "images": [
        "https://example.com/colors/iphone-black-titanium-1.jpg",
        "https://example.com/colors/iphone-black-titanium-2.jpg"
      ],
      "priceAdjustment": 50.00
    }
  ],
  "minOrderQuantity": 1,
  "maxOrderQuantity": 3,
  "maxPerCustomer": 2,
  "requiresApproval": false,
  "groupBuyingEnabled": true,
  "groupMinSize": 10,
  "groupMaxSize": 50,
  "groupPrice": 1099.00,
  "groupTimeLimitHours": 72,
  "groupRequiresMinimum": true,
  "installmentEnabled": true,
  "installmentPlans": [
    {
      "duration": 6,
      "interval": "MONTHS",
      "interestRate": 0.00,
      "description": "6 months interest-free installment"
    },
    {
      "duration": 12,
      "interval": "MONTHS",
      "interestRate": 2.90,
      "description": "12 months with low interest rate"
    },
    {
      "duration": 24,
      "interval": "MONTHS",
      "interestRate": 5.90,
      "description": "24 months extended payment plan"
    }
  ],
  "downPaymentRequired": true,
  "minDownPaymentPercentage": 20.00,
  "trackInventory": true,
  "isFeatured": true,
  "isDigital": false,
  "requiresShipping": true,
  "metaTitle": "iPhone 15 Pro Max 256GB - Premium Titanium Smartphone | TechStore Pro",
  "metaDescription": "Buy the latest iPhone 15 Pro Max with 256GB storage, A17 Pro chip, and titanium design. Available with group buying discounts and flexible installment plans."
}

Request Body Parameters:

per(DIGITAL cap(DIGITAL
Parameter Type Required Description Validation
productTypeProductTypeYesPHYSICAL or DIGITALRequired
productName string Yes Unique name of the product within shop Min: 2, Max: 100 characterschars
productDescription string Yes Detailed product description Min: 10, Max: 1000 characterschars
price decimal Yes Product sellingSelling price Min: 0.01, Max:max 8 digits with+ 2 decimal places
stockQuantity integer Yes Available stock quantity Min: 0
categoryId UUID Yes Product category identifier Must exist and be active
shortDescriptionstringNoBrief product summaryMax: 200 characters
comparePrice decimal No Original price for discount display Must be greater than> price if provided
lowStockThreshold integer No Low stock alert threshold Min: 1, Max: 1000, Default: 5
brandstringNoProduct brand nameMax: 100 characters
skustringNoCustom Stock Keeping UnitMax: 50 characters, auto-generated if not provided
condition ProductCondition No Product condition NEW,NEW, USED_LIKE_NEW,USED_LIKE_NEW, USED_GOOD,USED_GOOD, USED_FAIR,USED_FAIR, REFURBISHED,REFURBISHED, FOR_PARTS
status ProductStatus No Initial productstatus status(overridden by action) DRAFT,Default: ACTIVE, INACTIVE, OUT_OF_STOCK, ARCHIVEDACTIVE
productImages array Yes Product image URLs Valid URLs, cannot be empty, at least 1 required
tagsarrayNoProduct tags for categorizationMax 50 characters per tag
specifications object No TechnicalKey-value product specificationsspecs Key:Key max 100 chars, Value:Value max 500 chars
colors array No Available colorColor variations See Color objectsobject with name, hex, images, priceAdjustmentbelow
minOrderQuantity integer No Minimum order quantityqty Min: 1, Default: 1
maxOrderQuantity integer No Maximum order quantityqty per order Min: 1, must be >=โ‰ฅ minOrderQuantity
maxPerCustomerintegerNoMaximum quantity per customerMin: 1
requiresApprovalbooleanNoRequires manual approval for ordersDefault: false
groupBuyingEnabled boolean No Enable group buying feature Default: false
groupMinSizeintegerNoMinimum group participantsMin: 2, required if groupBuyingEnabled=true
groupMaxSize integer No Maximum group participants Min: 2, mustrequired beif >= groupMinSizegroupBuyingEnabled
groupPrice decimal No Discounted group price Must be less than regular< price
groupTimeLimitHours integer No Group formation time limit Min: 1, Max: 8760 (1 year)
groupRequiresMinimumdownloadExpiryDays booleaninteger No GroupDownload mustlink reachexpiry minimum(DIGITAL sizeonly) Min: 1, Default: true7
installmentEnabledmaxDownloadsPerBuyer booleaninteger No EnableDownload installmentattempts payments Default:buyer false
installmentPlansarrayNoAvailable payment plansRequired if installmentEnabled=true
installmentPlans[].durationintegerYesPayment plan durationonly) Min: 1
installmentPlans[].intervalmaxQuantityForDigital stringYesPayment intervalDAYS, WEEKS, MONTHS
installmentPlans[].interestRatedecimalYesInterest rate percentageMin: 0, Max: 100, 2 decimal places
installmentPlans[].descriptionstringinteger No PlanPurchase description Max:per 200buyer characters
downPaymentRequiredbooleanNoRequire down paymentDefault: false
minDownPaymentPercentagedecimalNoMinimum down payment percentageonly) Min: 0, Max: 100, 2 decimal places
trackInventorybooleanNoTrack inventory changesDefault: true
isFeaturedbooleanNoMark as featured productDefault: false
isDigitalbooleanNoDigital product (no shipping)Default: false
requiresShippingbooleanNoPhysical shipping requiredDefault: true
metaTitlestringNoSEO meta titleMax: 100 characters
metaDescriptionstringNoSEO meta descriptionMax: 200 characters1

Color Object:

FieldTypeRequiredValidation
namestringYesMax: 50 chars
hexstringYesValid #RRGGBB format
imagesarrayNoValid URLs
priceAdjustmentdecimalNoMin: 0.0, Default: 0

Request ObjectJSON StructureSample (PHYSICAL):

{
  "productType": "PHYSICAL",
  "productName": "iPhone 15 Pro Max 256GB",
  "productDescription": "The most advanced iPhone featuring the A17 Pro chip and titanium design.",
  "price": 1199.00,
  "comparePrice": 1299.00,
  "stockQuantity": 25,
  "lowStockThreshold": 5,
  "categoryId": "123e4567-e89b-12d3-a456-426614174000",
  "condition": "NEW",
  "productImages": [
    "https://example.com/images/iphone15-main.jpg"
  ],
  "specifications": {
    "Display": "6.7-inch Super Retina XDR OLED",
    "Chip": "A17 Pro"
  },
  "colors": [
    {
      "name": "ColorNatural Name"Titanium",
      "hex": "#HEXCODE"#F5F5DC",
      "images": ["url1", "url2"https://example.com/colors/natural-titanium.jpg"],
      "priceAdjustment": 0.00
    }
  ],
  "minOrderQuantity": 1,
  "maxOrderQuantity": 3,
  "groupBuyingEnabled": true,
  "groupMaxSize": 50,
  "groupPrice": 1099.00,
  "groupTimeLimitHours": 72
}

Installment Plan Request ObjectJSON StructureSample (DIGITAL):

{
  "duration": 12,
  "interval"productType": "MONTHS"DIGITAL",
  "interestRate": 2.90,
  "description"productName": "12UI monthsDesign lowKit interest"Pro",
  "productDescription": "A comprehensive Figma component library with 500+ components.",
  "price": 49.00,
  "stockQuantity": 1000,
  "categoryId": "123e4567-e89b-12d3-a456-426614174000",
  "productImages": ["https://example.com/images/design-kit-preview.jpg"],
  "downloadExpiryDays": 30,
  "maxDownloadsPerBuyer": 5,
  "maxQuantityForDigital": 1
}

Response JSON Sample:

{
  "success": true,
  "message": "Product created successfully",
  "data": null
}

Response Fields:

FieldDescription
successBoolean indicating operation success
messageHuman-readable success message
dataAdditional response data (null for create operation)

Business Rules:

  • Product name must be unique within the shop
  • If comparePrice is provided, it must be greater than price
  • Group buying requires groupMinSize โ‰ค groupMaxSize
  • Group pricegroupPrice must be less than regular price
  • InstallmentAll plansgroup buying settings (groupMaxSize, groupPrice, groupTimeLimitHours) required when installmentEnabled=groupBuyingEnabled=true
  • At least one installment planmaxOrderQuantity must be providedโ‰ฅ minOrderQuantity
  • ColorDigital hexdownload codesfields must(downloadExpiryDays, bemaxDownloadsPerBuyer, validmaxQuantityForDigital) 6-digitonly hexapply formatto DIGITAL products
  • AllAfter imagecreation, URLsadd mustinstallment beplans validvia Installment Plan Config and accessible
  • digital
  • Categoryfiles mustvia existDigital andFile be active
  • Shop must exist and be active
  • User must be shop owner or system admin

Validation Rules:

Error Responses:

  • 400 Bad Request: InvalidValidation request data, validation errors,errors or business rule violations
  • 401 Unauthorized: Authentication required or invalid token
  • 403 Forbidden: Insufficient permissions (shop owner or system admin required)
  • 404 Not Found: Shop not found or category not found/inactivefound
  • 409 Conflict: Product with same name, brand, price, and specificationsname already exists in shop
  • 422 Unprocessable Entity: ValidationField-level validation errors with detailed field-level messages
  • 500 Internal Server Error: Server error during product creation

2. Update Product

Purpose: Updates an existing productproduct. withOnly supportprovided forfields allare advanced features and partial updatesupdated.

Endpoint: PUT /api/v1/e-commerce/shops/{shopId}/products/{productId}

Access Level: ๐Ÿ”’ Protected (Requires shop owner or system admin role)

Authentication: Bearer Token

Request Headers:

HeaderTypeRequiredDescription
AuthorizationstringYesBearer token for authentication
Content-TypestringYesapplication/json

Path Parameters:

Parameter Type Required DescriptionValidation
shopId UUID Yes ID of the shop Valid UUID format, shop must exist
productId UUID Yes ID of the product to updateValid UUID format, product must exist in shop

Query Parameters:

Parameter Type Required DescriptionDefault ValidationDefaultDescription
action ReqAction Yes Action to perform after updateโ€” SAVE_DRAFT,SAVE_DRAFT or SAVE_PUBLISHNone

Request JSON Sample:

{
  "productName": "iPhone 15 Pro Max 512GB - Updated",
  "price": 1399.00,
  "comparePrice": 1499.00,
  "stockQuantity": 15,
  "groupPrice": 1299.00,
  "specifications": {
    "Display": "6.7-inch Super Retina XDR OLED",
    "Storage": "512GB",
    "RAM": "8GB",
    "New Feature": "Enhanced Night Mode"
  },
  "installmentPlans": [
    {
      "duration": 6,
      "interval": "MONTHS",
      "interestRate": 0.00,
      "description": "6 months interest-free"
    },
    {
      "duration": 18,
      "interval": "MONTHS",
      "interestRate": 4.50,
      "description": "18 months flexible payment"
    }
  ],
  "tags": ["smartphone", "apple", "premium", "5g", "512gb", "pro-max"]
}

Request Body Parameters (all optional): All parameters are optional for updates. Only provided fields will be updated.

OUT_OF_STOCK,ARCHIVED URLs,replaces
Parameter TypeRequired Description Validation
productName string NoUpdated product name Min: 2, Max: 100 characters, unique in shopchars
productDescription stringNo Updated description Min: 10, Max: 1000 characters
shortDescriptionstringNoUpdated short descriptionMax: 200 characterschars
price decimal NoUpdated selling price Min: 0.01, Max: 8 digits with 2 decimal places01
comparePrice decimal NoUpdated originalcompare price Must be greater than> price if provided
stockQuantity integer NoUpdated stock quantity Min: 0
lowStockThreshold integerNo Updated low stock threshold Min: 1, Max: 1000
brandstringNoUpdated brand nameMax: 100 characters
skustringNoUpdated SKUMax: 50 characters, unique if changed
condition ProductConditionNo Updated condition NEW,See USED_LIKE_NEW,enum USED_GOOD, USED_FAIR, REFURBISHED, FOR_PARTSvalues
status ProductStatus NoUpdated status DRAFT,Overridden ACTIVE,by INACTIVE,action
urgencyTagUrgencyTagUrgency badge on productNONE, NEW_ARRIVAL, LIMITED_EDITION, LIMITED_OFFER, FEW_REMAINS
categoryId UUIDNo Updated category Must exist and be active
productImages array NoUpdated image URLs Valid URLs
tagsarrayNoUpdated tagsMax 50 characters per tagexisting
specifications object NoUpdated specifications Completely replaces existing specifications
colors arrayNo Updated color variations Completely replaces existing colors
minOrderQuantity integer NoUpdated minimummin order qty Min: 1
maxOrderQuantity integer NoUpdated maximummax order qty Min: 1, must be >=โ‰ฅ minOrderQuantity
requiresApprovalbooleanNoUpdated approval requirementtrue/falsemin
groupBuyingEnabled boolean NoEnable/disable group buying true/false
groupMinSizeintegerNoUpdated group minimumMin: 2, required if enabling group buyingโ€”
groupMaxSize integer NoUpdated group maximummax Min: 2, must be >= groupMinSize2
groupPrice decimal NoUpdated group price Must be less than regular< price
groupTimeLimitHours integerNo Updated group time limit Min: 1, Max: 8760
groupRequiresMinimumbooleanNoUpdated group requirementtrue/false
installmentEnabled boolean NoEnable/disable installment feature toggle Enable/disable installmentstrue/falseโ€”
installmentPlansmaxQuantityForInstallment arrayinteger NoMax qty a buyer can purchase on installment UpdatedMin: installment plansReplaces existing plans, required if enabling1
downPaymentRequiredshowStockAvailableToPublic boolean NoShow available stock count publicly Updated down payment requirementtrue/falseโ€”
minDownPaymentPercentagedecimalNoUpdated down payment percentageMin: 0, Max: 100
isFeaturedshowSoldCountToPublic boolean NoShow sold count publicly Updated featured statustrue/false
isDigitalbooleanNoUpdated digital product flagtrue/false
requiresShippingbooleanNoUpdated shipping requirementtrue/false
metaTitlestringNoUpdated SEO titleMax: 100 characters
metaDescriptionstringNoUpdated SEO descriptionMax: 200 charactersโ€”

Response JSON Sample:

{
  "success": true,
  "message": "Product updated successfully and published",
  "data": {
    "productId": "456e7890-e89b-12d3-a456-426614174001",
    "productName": "iPhone 15 Pro Max 512GB - Updated"512GB",
    "productSlug": "iphone-15-pro-max-512gb-updated"512gb",
    "price": 1399.00,
    "comparePrice": 1499.00,
    "status": "ACTIVE",
    "stockQuantity": 15,
    "updatedAt": "2025-09-23T14:2026-05-19T14:30:00Z",
    "sku": "SHP12345678-ELE-APP-512-0001"
  }
}

Business Rules for Updates:

  • Product name uniqueness checked only if name is being changed
  • SKU uniqueness validated only if SKU is being changed
  • Group buying settings must be complete when enabling feature
  • Installment plans required when enabling installment feature
  • Category must exist and be active if being changed
  • Action parameter determines final status regardless of status field

Error Responses:

  • 400 Bad Request: Invalid update data or validation errors
  • 401 Unauthorized: Authentication required
  • 403 Forbidden: Insufficient permissions
  • 404 Not Found: Shop or product not found
  • 409 Conflict: Updated product name or SKU already exists
  • 422 Unprocessable Entity: Validation errors

3. Publish Product

Purpose: Publishes a draft product making it active and publicly availableavailable.

Endpoint: PATCH /api/v1/e-commerce/shops/{shopId}/products/{productId}/publish

Access Level: ๐Ÿ”’ Protected (Requires shop owner or system admin role)

Authentication: Bearer Token

Request Headers:

HeaderTypeRequiredDescription
AuthorizationstringYesBearer token for authentication

Path Parameters:

Parameter Type Required DescriptionValidation
shopId UUID Yes ID of the shop Valid UUID format, shop must exist
productId UUID Yes ID of the product to publishValid UUID format,draft product must exist and be draft

Response JSON Sample:

{
  "success": true,
  "message": "Product 'iPhone 15 Pro Max 512GB'Max' published successfully",
  "data": {
    "productId": "456e7890-e89b-12d3-a456-426614174001",
    "productName": "iPhone 15 Pro Max 512GB",
    "productSlug": "iphone-15-pro-max-512gb"Max",
    "status": "ACTIVE",
    "publishedAt": "2025-09-23T14:2026-05-19T14:45:00Z",
    "shopId": "123e4567-e89b-12d3-a456-426614174000",
    "shopName": "TechStore Pro"
  }
}

Publishing Validation Requirements:

  • Product namename, mustdescription, notprice, bestock empty
  • quantity,
  • Productcategory, descriptionand mustat notleast beone empty
  • Priceimage must be greater than 0
  • Stock quantity must be >= 0
  • Category must be assigned and active
  • At least one product image requiredpresent
  • Group buying settings complete if enabled
  • Installment plans present if installmentsinstallment is enabled

Error Responses:

  • 400 Bad Request: Product already published or missing required publish fields for publishing
  • 401 Unauthorized: Authentication required
  • 403 Forbidden: Insufficient permissions
  • 404 Not Found: Shop or product not found

4. Delete Product

Purpose: Deletes a productproduct. usingDraft differentproducts strategiesare basedhard-deleted; onpublished productproducts statusare soft-deleted.

Endpoint: DELETE /api/v1/e-commerce/shops/{shopId}/products/{productId}

Access Level: ๐Ÿ”’ Protected (Requires shop owner or system admin role)

Authentication: Bearer Token

Request Headers:

HeaderTypeRequiredDescription
AuthorizationstringYesBearer token for authentication

Path Parameters:

Parameter Type Required DescriptionValidation
shopId UUID Yes ID of the shop Valid UUID format, shop must exist
productId UUID Yes ID of the product to deleteValid UUID format, product must exist

Response JSON Sample (Soft Delete):

{
  "success": true,
  "message": "Product 'iPhone 15 Pro Max 512GB'Max' has been deleted and will be permanently removed after 30 days",
  "data": {
    "message": "Product 'iPhone 15 Pro Max 512GB' has been deleted and will be permanently removed after 30 days",
    "productName": "iPhone 15 Pro Max 512GB"Max",
    "productId": "456e7890-e89b-12d3-a456-426614174001",
    "previousStatus": "ACTIVE",
    "deletedAt": "2025-09-23T15:2026-05-19T15:00:00Z",
    "deletionType": "SOFT_DELETE",
    "note": "Product will be permanently deleted after 30 days"
  }
}

Response JSON Sample (Hard Delete):

{
  "success": true,
  "message": "Draft product 'iPhone 15 Pro Max 512GB'Max' has been permanently deleted",
  "data": null
}

Deletion Logic:

  • Draft Productsproducts: Hard delete (permanently removed from database)removed)
  • Published Productsproducts: Soft delete (marked as deleted, status changedโ†’ toARCHIVED, ARCHIVED)
  • 30-day
  • Softrecovery Deleted Products: Marked with deletion timestamp and deleted by user ID
  • Recovery Period: 30 days for soft-deleted products before permanent removalwindow)

Error Responses:

  • 401 Unauthorized: Authentication required
  • 403 Forbidden: Insufficient permissions
  • 404 Not Found: Shop or product not found

5. Restore Product

Purpose: Restores a soft-deleted product back to draft statusstatus.

Endpoint: PATCH /api/v1/e-commerce/shops/{shopId}/products/{productId}/restore

Access Level: ๐Ÿ”’ Protected (Requires shop owner or system admin role)

Authentication: Bearer Token

Request Headers:

HeaderTypeRequiredDescription
AuthorizationstringYesBearer token for authentication

Path Parameters:

Parameter Type Required DescriptionValidation
shopId UUID Yes ID of the shop Valid UUID format, shop must exist
productId UUID Yes ID of the product to restoreValid UUID format,soft-deleted product must be soft-deleted

Response JSON Sample:

{
  "success": true,
  "message": "Product 'iPhone 15 Pro Max 512GB'Max' has been restored successfully",
  "data": {
    "productId": "456e7890-e89b-12d3-a456-426614174001",
    "productName": "iPhone 15 Pro Max 512GB",
    "productSlug": "iphone-15-pro-max-512gb"Max",
    "status": "DRAFT",
    "restoredAt": "2025-09-23T15:2026-05-19T15:30:00Z",
    "isDeleted": false,
    "shopId": "123e4567-e89b-12d3-a456-426614174000",
    "note": "Product restored as draft. Publish to make it active again."
  }
}

Restoration Process:

  • Sets isDeleted flag to false
  • Clears deletedAt and deletedBy fields
  • Sets status to DRAFT for safety (requires manual publishing)
  • Updates editedBy and updatedAt timestamps

Error Responses:

  • 400 Bad Request: Product is not deleted and cannot be restored
  • 401 Unauthorized: Authentication required
  • 403 Forbidden: Insufficient permissions
  • 404 Not Found: Shop or product not found

6. Get Product Detailed (Owner/Admin View)

Purpose: Retrieves comprehensive product details withincluding all features and management informationinformation.

Endpoint: GET /api/v1/e-commerce/shops/{shopId}/products/{productId}/detailed

Access Level: ๐Ÿ”’ Protected (Requires shop owner or system admin role)

Authentication: Bearer Token

Request Headers:

HeaderTypeRequiredDescription
AuthorizationstringYesBearer token for authentication

Path Parameters:

Parameter Type Required DescriptionValidation
shopId UUID Yes ID of the shop Valid UUID format, shop must exist
productId UUID Yes ID of the productValid UUID format, product must exist in shop

Response JSON Sample:

{
  "success": true,
  "message": "Product details retrieved successfully",
  "data": {
    "productId": "456e7890-e89b-12d3-a456-426614174001",
    "productName": "iPhone 15 Pro Max 512GB",
    "productSlug": "iphone-15-pro-max-512gb",
    "productType": "PHYSICAL",
    "productDescription": "The most advanced iPhone ever, featuring the groundbreaking A17 Pro chip.ever...",
    "shortDescription": "Premium 6.7-inch iPhone with A17 Pro chip and titanium design",
    "productImages": [
      "https://example.com/images/iphone15-pro-max-main.jpg",
      "https://example.com/images/iphone15-pro-max-side.jpg"
    ],
    "price": 1199.00,
    "comparePrice": 1299.00,
    "discountAmount": 100.00,
    "discountPercentage": 7.69,
    "isOnSale": true,
    "stockQuantity": 25,
    "lowStockThreshold": 5,
    "isInStock": true,
    "isLowStock": false,
    "trackInventory": true,
    "brand": "Apple",
    "sku": "SHP12345678-ELE-APP-512-0001",
    "condition": "NEW",
    "status": "ACTIVE",
    "tags": ["smartphone", "apple", "premium", "5g", "titanium"],
    "metaTitle"urgencyTag": "iPhone 15 Pro Max 512GB - Premium Titanium Smartphone",
    "metaDescription": "Buy the latest iPhone 15 Pro Max with 512GB storage..."NONE",
    "shopId": "123e4567-e89b-12d3-a456-426614174000",
    "shopName": "TechStore Pro",
    "shopSlug": "techstore-pro",
    "categoryId": "789e0123-e89b-12d3-a456-426614174002",
    "categoryName": "Smartphones",
    "isFeatured": true,
    "isDigital": false,
    "requiresShipping": true,
    "createdAt": "2025-09-23T10:30:00Z",
    "updatedAt": "2025-09-23T14:30:00Z",
    "createdBy": "111e2222-e89b-12d3-a456-426614174003",
    "editedBy": "111e2222-e89b-12d3-a456-426614174003",
    "specifications": {
      "Display": "6.7-inch Super Retina XDR OLED",
      "Chip": "A17 Pro with 6-core GPU",
      "Storage": "512GB",
      "RAM": "8GB",
      "Battery Life": "Up to 29 hours video playback",
      "Water Resistance": "IP68"Pro"
    },
    "hasSpecifications": true,
    "specificationCount": 6,
    "colors": [
      {
        "name": "Natural Titanium",
        "hex": "#F5F5DC",
        "images": ["https://example.com/colors/natural-titanium.jpg"],
        "priceAdjustment": 0.00,
        "finalPrice": 1199.00,
        "hasExtraFee": false,
        "extraFeeReason": null
      },
      {
        "name": "Black Titanium",
        "hex": "#1C1C1E",
        "images": ["https://example.com/colors/black-titanium.jpg"],
        "priceAdjustment": 50.00,
        "finalPrice": 1249.00,
        "hasExtraFee": true,
        "extraFeeReason": "Premium color finish"00
      }
    ],
    "hasMultipleColors": true,
    "colorCount": 2,
    "priceRange": {
      "minPrice": 1199.00,
      "maxPrice": 1249.00,
      "priceStartsFrom": 1199.00,
      "hasPriceVariations": true
    },
    "orderingLimits": {
      "minOrderQuantity": 1,
      "maxOrderQuantity": 3,
      "requiresApproval": false,
      "canOrderQuantity": 3,
      "maxAllowedQuantity": 3,
      "hasOrderingLimits": true
    },
    "groupBuying": {
      "isEnabled": true,
      "isAvailable": true,
      "minGroupSize": 10,
      "maxGroupSize"groupMaxSize": 50,
      "currentGroupSize": 7,
      "remainingSlots": 43,
      "progressPercentage": 70.0,
      "groupPrice": 1099.00,
      "groupDiscount": 100.00,
      "groupDiscountPercentage": 8.34,
      "timeLimitHours": 72,
      "timeRemainingHours": 48,
      "expiresAt": "2025-09-25T10:30:00Z",
      "requiresMinimum": true,
      "status": "PENDING",
      "canJoinGroup": true72
    },
    "installmentOptions": {
      "isEnabled": true,
      "isAvailable": true,
      "downPaymentRequired": true,
      "minDownPaymentPercentage": 20.00,
      "eligibilityStatus": "ELIGIBLE",
      "creditCheckRequired": false,
      "plans": [
        {
          "planId": "plan-6m",
          "duration": 6,
          "interval": "MONTHS",
          "interestRate": 0.00,
          "description": "6 months interest-free installment",
          "isPopular": true,
          "calculations": {
            "downPayment": 239.80,
            "remainingAmount": 959.20,
            "totalInterest": 0.00,
            "paymentAmount": 159.87,
            "totalAmount": 1199.00
          },
          "paymentSchedule": [
            {
              "paymentNumber": 1,
              "amount": 159.87,
              "dueDate": "2025-10-23T00:00:00Z",
              "description": "Month 1 payment"
            },
            {
              "paymentNumber": 2,
              "amount": 159.87,
              "dueDate": "2025-11-23T00:00:00Z",
              "description": "Month 2 payment"
            }
          ]
        }
      ]
    },
    "purchaseOptions": {
      "canBuyNow": true,
      "canJoinGroup": true,
      "canPayInstallment": true,
      "recommendedOption"createdAt": "GROUP_BUYING"2026-05-19T10:30:00Z",
    "bestDeal": {
        "option"updatedAt": "GROUP_BUYING",
        "savings": 100.00,
        "finalPrice": 1099.00
      }
    }2026-05-19T14:30:00Z"
  }
}

Response Fields:

FieldDescription
Basic product informationproductId, productName, productSlug, descriptions, images
Pricing detailsprice, comparePrice, discount calculations, sale status
Inventory informationstock quantities, availability status, tracking settings
Product detailsbrand, SKU, condition, status, category information
Shop informationshopId, shopName, shopSlug
Advanced featuresspecifications, colors, group buying, installments
Management datacreation/update timestamps, user IDs, featured status
Purchase optionsavailable buying methods and recommendations

Error Responses:

  • 401 Unauthorized: Authentication required
  • 403 Forbidden: Insufficient permissions (shop owner or admin required)
  • 404 Not Found: Shop or product not found

7. Get Shop Products (Management View)

Purpose: Retrieves all products for a shop management with summary statisticsstatistics.

Endpoint: GET /api/v1/e-commerce/shops/{shopId}/products/all

Access Level: ๐Ÿ”’ Protected (Requires shop owner or system admin role)

Authentication: Bearer Token

Request Headers:

HeaderTypeRequiredDescription
AuthorizationstringYesBearer token for authentication

Path Parameters:

Parameter Type Required DescriptionValidation
shopId UUID Yes ID of the shopValid UUID format, shop must exist

Response JSON Sample:

{
  "success": true,
  "message": "Retrieved 47 products from shop: TechStore Pro",
  "data": {
    "shop": {
      "shopId": "123e4567-e89b-12d3-a456-426614174000",
      "shopName": "TechStore Pro",
      "shopSlug": "techstore-pro",
      "logoUrl": "https://example.com/logos/techstore-pro.png",
      "isVerified": true,
      "isApproved": true,
      "isMyShop": true
    },
    "summary": {
      "totalProducts": 47,
      "activeProducts": 35,
      "draftProducts": 8,
      "outOfStockProducts": 4,
      "featuredProducts": 12,
      "lowStockProducts": 6,
      "averagePrice": 649.75,
      "totalInventoryValue": 89543.25,
      "productsWithGroupBuying": 18,
      "productsWithInstallments": 25,
      "productsWithMultipleColors": 14
    },
    "products": [
      {
        "productId": "456e7890-e89b-12d3-a456-426614174001",
        "productName": "iPhone 15 Pro Max 512GB",
        "productSlug": "iphone-15-pro-max-512gb",
        "shortDescription": "Premium 6.7-inch iPhone with A17 Pro chip",
        "primaryImage": "https://example.com/images/iphone15-pro-max-main.jpg",
        "price": 1199.00,
        "comparePrice": 1299.00,
        "finalPrice": 1199.00,
        "isOnSale": true,
        "discountPercentage": 7.69,
        "stockQuantity": 25,
        "isInStock": true,
        "isLowStock": false,
        "brand": "Apple",
        "sku": "SHP12345678-ELE-APP-512-0001",
        "condition": "NEW",
        "status": "ACTIVE",
        "isFeatured": true,
        "isDigital": false,
        "hasGroupBuying": true,
        "hasInstallments": true,
        "hasMultipleColors": true,
        "groupPrice": 1099.00,
        "startingFromPrice": 1199.00,
        "createdAt": "2025-09-23T10:30:00Z"
      }
    ],
    "totalProducts": 47
  }
}

Summary Statistics Fields:

FieldDescription
totalProductsTotal number of products in shop
activeProductsProducts with ACTIVE status
draftProductsProducts with DRAFT status
outOfStockProductsProducts with zero stock
featuredProductsProducts marked as featured
lowStockProductsProducts below low stock threshold
averagePriceAverage price of all products
totalInventoryValueTotal value of inventory (price ร— stock)
productsWithGroupBuyingProducts with group buying enabled
productsWithInstallmentsProducts with installment options
productsWithMultipleColorsProducts with color variations

Error Responses:

  • 401 Unauthorized: Authentication required
  • 403 Forbidden: Insufficient permissions
  • 404 Not Found: Shop not found or deleted

8. Get Shop Products Paginated (Management View)

Purpose: Retrieves shop products with pagination for management dashboard

Endpoint: GET /api/v1/shops/{shopId}/products/all-paged

Access Level: ๐Ÿ”’ Protected (Requires shop owner or system admin role)

Authentication: Bearer Token

Request Headers:

HeaderTypeRequiredDescription
AuthorizationstringYesBearer token for authentication

Path Parameters:

ParameterTypeRequiredDescriptionValidation
shopIdUUIDYesID of the shopValid UUID format, shop must exist

Query Parameters:

ParameterTypeRequiredDescriptionValidationDefault
pageintegerNoPage number (1-indexed)Min: 11
sizeintegerNoItems per pageMin: 1, Max: 10010

Response JSON Sample:

{
  "success": true,
  "message": "Retrieved 10 products from shop: TechStore Pro (Page 1 of 5)",
  "data": {
    "contents": {
      "shop": {
        "shopId": "123e4567-e89b-12d3-a456-426614174000",
        "shopName": "TechStore Pro",
        "shopSlug": "techstore-pro",
        "logoUrl": "https://example.com/logos/techstore-pro.png",
        "isVerified": true,
        "isApproved": true,
        "isMyShop": true
      },
      "summary": {
        "totalProducts": 47,
        "activeProducts": 35,
        "draftProducts": 8,
        "averagePrice": 649.75,
        "totalInventoryValue": 89543.25
    },
    "products": [
      {
        "productId": "456e7890-e89b-12d3-a456-426614174001",
        "productName": "iPhone 15 Pro Max 512GB",
        "price": 1199.00,
        "stockQuantity": 25,
        "status": "ACTIVE",
        "isInStock": true,
        "hasGroupBuying": true,
        "hasInstallments": true,
        "createdAt": "2025-09-23T10:2026-05-19T10:30:00Z"
      }
    ],
    "totalProducts": 47
  }
}

Error Responses:

  • 401: Authentication required
  • 403: Insufficient permissions
  • 404: Shop not found

8. Get Shop Products Paginated (Management View)

Purpose: Retrieves shop products with pagination for management dashboard.

Endpoint: GET api/v1/e-commerce/shops/{shopId}/products/all-paged

Access Level: ๐Ÿ”’ Protected (Requires shop owner or system admin role)

Authentication: Bearer Token

Path Parameters:

ParameterTypeRequiredDescription
shopIdUUIDYesID of the shop

Query Parameters:

ParameterTypeRequiredDefaultDescription
pageintegerNo1Page number (1-indexed)
sizeintegerNo10Items per page (max: 100)

Response JSON Sample:

{
  "success": true,
  "message": "Retrieved 10 products from shop: TechStore Pro (Page 1 of 5)",
  "data": {
    "contents": { "...same structure as /all..." },
    "currentPage": 1,
    "pageSize": 10,
    "totalElements": 47,
    "totalPages": 5,
    "hasNext": true,
    "hasPrevious": false
  }
}

Pagination Fields:

FieldDescription
currentPageCurrent page number (1-indexed)
pageSizeNumber of items per page
totalElementsTotal number of products
totalPagesTotal number of pages
hasNextWhether there is a next page
hasPreviousWhether there is a previous page

Error Responses:

  • 401 Unauthorized: Authentication required
  • 403 Forbidden: Insufficient permissions
  • 404 Not Found: Shop not found

9. Get Public Product by ID

Purpose: Retrieves a single active product for public viewing with customer-focused informationviewing.

Endpoint: GET /api/v1/e-commerce/shops/{shopId}/products/{productId}

Access Level: ๐ŸŒ Public (No authentication required)

Authentication: None

Path Parameters:

Parameter Type Required Description Validation
shopId UUID Yes ID of the shopValid UUID format, shopShop must be active and approved
productId UUID Yes ID of the productValid UUID format, productProduct must be active

Response JSON Sample:

{
  "success": true,
  "message": "Product retrieved successfully",
  "data": {
    "productId": "456e7890-e89b-12d3-a456-426614174001",
    "productName": "iPhone 15 Pro Max 512GB",
    "productSlug": "iphone-15-pro-max-512gb",
    "productType": "PHYSICAL",
    "productDescription": "The most advanced iPhone ever, featuring the groundbreaking A17 Pro chip.ever...",
    "shortDescription": "Premium 6.7-inch iPhone with A17 Pro chip and titanium design",
    "productImages": [
      "https://example.com/images/iphone15-pro-max-main.jpg",
      "https://example.com/images/iphone15-pro-max-side.jpg"
    ],
    "price": 1199.00,
    "comparePrice": 1299.00,
    "discountAmount": 100.00,
    "discountPercentage": 7.69,
    "isOnSale": true,
    "isInStock": true,
    "isLowStock": false,
    "stockQuantity": 25,
    "brand": "Apple",
    "condition": "NEW",
    "tags": ["smartphone", "apple", "premium", "5g", "titanium"],
    "shopId": "123e4567-e89b-12d3-a456-426614174000",
    "shopName": "TechStore Pro",
    "shopSlug": "techstore-pro",
    "shopLogoUrl": "https://example.com/logos/techstore-pro.png",
    "categoryId": "789e0123-e89b-12d3-a456-426614174002",
    "categoryName": "Smartphones",
    "isDigital": false,
    "requiresShipping": true,
    "specifications": { "Display": "6.7-inch Super Retina XDR OLED",
      "Storage": "512GB",
      "Chip": "A17 Pro with 6-core GPU",
      "Battery Life": "Up to 29 hours video playback" },
    "hasSpecifications": true,
    "colors": [
      {
        "name": "Natural Titanium",
        "hex": "#F5F5DC",
        "images": ["https://example.com/colors/natural-titanium.jpg"],
        "priceAdjustment": 0.00,
        "finalPrice": 1199.00
      },
      {
        "name": "Black Titanium",
        "hex": "#1C1C1E",
        "images": ["https://example.com/colors/black-titanium.jpg"],
        "priceAdjustment": 50.00,
        "finalPrice": 1249.00
      }
    ],
    "hasMultipleColors": true,
    "priceRange": {
      "minPrice": 1199.00,
      "maxPrice": 1249.00,
      "hasPriceVariations": true
    },
    "groupBuying": {
      "isAvailable": true,
      "minGroupSize": 10,
      "maxGroupSize"groupMaxSize": 50,
      "groupPrice": 1099.00,
      "groupDiscount": 100.00,
      "groupDiscountPercentage": 8.34,
      "timeLimitHours": 72
    },
    "installmentOptions": {
      "isAvailable": true,
      "downPaymentRequired": true,
      "minDownPaymentPercentage": 20.00,
      "plans": [
        {
          "duration"planId": "...",
          "planName": "6-Month Interest-Free",
          "paymentFrequency": "MONTHLY",
          "numberOfPayments": 6,
          "interval": "MONTHS",
          "interestRate"apr": 0.00,
          "description"minDownPaymentPercent": "6 months interest-free installment"
        },
        {
          "duration": 12,
          "interval": "MONTHS",
          "interestRate": 2.90,
          "description": "12 months with low interest rate"20
        }
      ]
    },
    "createdAt": "2025-09-23T10:2026-05-19T10:30:00Z"
  }
}

Public Response Features:

  • Only shows active products from approved shops
  • Hides internal management data (SKU, creation user IDs, etc.)
  • Shows stock quantity only if product is in stock
  • Includes customer-focused information (shipping, features, pricing)
  • Full specifications and color variations for customer decision making

Error Responses:

  • 404 Not Found: Shop not found, found/not approved, or product not found/not active

10. Get Public Shop Products

Purpose: Retrieves all active products from a shop for public browsingbrowsing.

Endpoint: GET /api/v1/e-commerce/shops/{shopId}/products/public-view/all

Access Level: ๐ŸŒ Public (No authentication required)

Authentication: None

Path Parameters:

Parameter Type Required Description Validation
shopId UUID Yes ID of the shopValid UUID format, shopShop must be active and approved

Response JSON Sample:

{
  "success": true,
  "message": "Retrieved 23 products from TechStore Pro",
  "data": {
    "shop": {
      "shopId": "123e4567-e89b-12d3-a456-426614174000",
      "shopName": "TechStore Pro",
      "shopSlug": "techstore-pro",
      "logoUrl": "https://example.com/logos/techstore-pro.png",
      "isVerified": true,
      "isApproved": true,
      "isMyShop": falsetrue
    },
    "products": [
      {
        "productId": "456e7890-e89b-12d3-a456-426614174001",
        "productName": "iPhone 15 Pro Max 512GB",
        "productSlug": "iphone-15-pro-max-512gb",
        "shortDescription": "Premium 6.7-inch iPhone with A17 Pro chip",
        "primaryImage": "https://example.com/images/iphone15-pro-max-main.jpg"Max",
        "price": 1199.00,
        "comparePrice": 1299.00,
        "finalPrice": 1199.00,
        "isOnSale": true,
        "discountPercentage": 7.69,
        "isInStock": true,
        "brand": "Apple",
        "condition": "NEW",
        "hasGroupBuying": true,
        "hasInstallments": true,
        "hasMultipleColors": true,
        "groupPrice": 1099.00,
        "startingFromPrice": 1199.00,
        "createdAt": "2025-09-23T10:30:00Z"true
      }
    ],
    "totalProducts": 23
  }
}

Public Shop Information:

  • Only shows active products (ACTIVE status)
  • Shop verification and approval status displayed
  • No internal management statistics
  • Customer-focused product information
  • Simplified product cards optimized for browsing

Error Responses:

  • 404 Not Found: Shop not found, not approved, or not active

11. Get Public Shop Products Paginated

Purpose: Retrieves active products from a shop with pagination for public browsingbrowsing.

Endpoint: GET /api/v1/e-commerce/shops/{shopId}/products/public-view/all-paged

Access Level: ๐ŸŒ Public (No authentication required)

Authentication: None

Path Parameters:

Parameter Type Required Description Validation
shopId UUID Yes ID of the shopValid UUID format, shopShop must be active and approved

Query Parameters:

Parameter Type Required DescriptionDefault ValidationDefaultDescription
page integer No 1Page number (1-indexed)Min: 11
size integer No 10Items per page Min:(max: 1, Max: 501050)

Response JSON Sample:

{
  "success": true,
  "message": "Retrieved 10 products from TechStore Pro (Page 1 of 3)",
  "data": {
    "contents": {
      "shop": {
        "shopId": "123e4567-e89b-12d3-a456-426614174000",
        "shopName": "TechStore Pro",
        "shopSlug": "techstore-pro",
        "logoUrl": "https://example.com/logos/techstore-pro.png",
        "isVerified": true,
        "isApproved": true,
        "isMyShop": false
      },
      "products": [
        {
          "productId": "456e7890-e89b-12d3-a456-426614174001",
          "productName": "iPhone 15 Pro Max 512GB",
          "price": 1199.00,
          "isOnSale": true,
          "isInStock": true,
          "hasGroupBuying": true,
          "hasInstallments": true,
          "createdAt": "2025-09-23T10:30:00Z"
        }
      ],
      "totalProducts": 10
    },
    "currentPage": 1,
    "pageSize": 10,
    "totalElements": 23,
    "totalPages": 3,
    "hasNext": true,
    "hasPrevious": false
  }
}

Public Pagination Limits:

  • Maximum page size limited to 50 items for performance
  • Only active products included in pagination count
  • Shop must be approved and active to show any products

Error Responses:

  • 404 Not Found: Shop not found, not approved, or not active

12. Search Products

Purpose: Searches products within a shop using enhanced multi-word query matching across multiple fieldsfields.

Endpoint: GET /api/v1/e-commerce/shops/{shopId}/products/search

Access Level: ๐ŸŒ Public (Enhanced features for authenticated users)

Authentication: Optional Bearer Token

Request Headers:

HeaderTypeRequiredDescription
AuthorizationstringNoBearer token for authentication (enables additional features)

Path Parameters:

Parameter Type Required DescriptionValidation
shopId UUID Yes ID of the shop to search inValid UUID format, shop must be accessible

Query Parameters:

statuses
Parameter Type Required DescriptionDefault ValidationDefaultDescription
q string Yes โ€”Search query Min:(min: 2, Max:max: 100 charactersNonechars)
status ProductStatus[] No ProductACTIVE Statuses to searchDRAFT, ACTIVE, INACTIVE, OUT_OF_STOCK, ARCHIVEDACTIVE (publicowners/admins users)only for non-ACTIVE)
page integer No Page number (1-indexed)Min: 1 1Page number
size integer No 10Items per page Min:(max: 1, Max: 501050)
sortBy string No Sort fieldrelevance relevance,relevance, createdAt,createdAt, updatedAt,updatedAt, productName,productName, price,price, stockQuantity,stockQuantity, brandrelevance
sortDir string No Sort directionasc, desc asc or desc

Request URL Examples:

# Basic search for "iphone"
GET /api/v1/shops/123e4567-e89b-12d3-a456-426614174000/products/search?q=iphone

# Multi-word search for "dell precision"
GET /api/v1/shops/123e4567-e89b-12d3-a456-426614174000/products/search?q=dell%20precision&sortBy=price&sortDir=asc

# Search with status filter (requires authentication)
GET /api/v1/shops/123e4567-e89b-12d3-a456-426614174000/products/search?q=smartphone&status=ACTIVE&status=DRAFT

# Search with pagination and sorting
GET /api/v1/shops/123e4567-e89b-12d3-a456-426614174000/products/search?q=laptop&page=2&size=20&sortBy=price&sortDir=asc

# Partial word search
GET /api/v1/shops/123e4567-e89b-12d3-a456-426614174000/products/search?q=macbook&sortBy=relevance

Search Features & Behavior:

and"Apple"
Feature Description Example
Multi-word Search Searches for products containing ALL words "dell precision" finds products with both "dell" AND "precision"
Partial Matchingmatch Matches partial words"iph" matches "iPhone"
Cross-field Search SearchesMatches acrossagainst multiple product fieldsQuery matches productName,name, description, shortDescription, brand, tags, specifications
Case InsensitiveSearch is case-Case-insensitive "APPLE" matches "apple"

User Access:

User TypeSearchable Statuses
Public / AuthenticatedACTIVE only
SpecialShop CharactersOwner / Admin RemovesAll harmful charactersAutomatically sanitized for security
Relevance ScoringOrders by relevance when sortBy=relevanceProducts with exact matches ranked higherstatuses

Response JSON Sample:

{
  "success": true,
  "message": "Found 12 products matching 'dell precision'iphone'",
  "data": {
    "contents": {
      "shop": { "shopId": "123e4567-e89b-12d3-a456-426614174000"...", "shopName": "TechStore Pro",
        "shopSlug": "techstore-pro",
        "logoUrl": "https://example.com/logos/techstore-pro.png",
        "isVerified": true,
        "isApproved": true,
        "isMyShop": false },
      "products": [ { "productId":...product summary fields..."789e0123-e89b-12d3-a456-426614174002",
          "productName": "Dell Precision 7770 Mobile Workstation",
          "productSlug": "dell-precision-7770-mobile-workstation",
          "shortDescription": "Professional mobile workstation with Intel Xeon processor",
          "primaryImage": "https://example.com/images/dell-precision-7770.jpg",
          "price": 2499.00,
          "comparePrice": 2799.00,
          "finalPrice": 2499.00,
          "isOnSale": true,
          "discountPercentage": 10.72,
          "stockQuantity": 8,
          "isInStock": true,
          "isLowStock": true,
          "brand": "Dell",
          "sku": "SHP87654321-LAP-DEL-PRE-0005",
          "condition": "NEW",
          "status": "ACTIVE",
          "isFeatured": true,
          "isDigital": false,
          "hasGroupBuying": false,
          "hasInstallments": true,
          "hasMultipleColors": false,
          "groupPrice": null,
          "startingFromPrice": 2499.00,
          "createdAt": "2025-09-22T15:20:00Z"
        },
        {
          "productId": "890e1234-e89b-12d3-a456-426614174003",
          "productName": "Dell Precision 5570 Laptop",
          "productSlug": "dell-precision-5570-laptop",
          "shortDescription": "Compact precision laptop for professionals",
          "primaryImage": "https://example.com/images/dell-precision-5570.jpg",
          "price": 1899.00,
          "comparePrice": null,
          "finalPrice": 1899.00,
          "isOnSale": false,
          "discountPercentage": 0.00,
          "stockQuantity": 15,
          "isInStock": true,
          "isLowStock": false,
          "brand": "Dell",
          "sku": "SHP87654321-LAP-DEL-PRE-0006",
          "condition": "NEW",
          "status": "ACTIVE",
          "isFeatured": false,
          "isDigital": false,
          "hasGroupBuying": true,
          "hasInstallments": true,
          "hasMultipleColors": true,
          "groupPrice": 1749.00,
          "startingFromPrice": 1899.00,
          "createdAt": "2025-09-21T09:45:00Z" } ],
      "totalProducts": 12,
      "searchMetadata": {
        "searchQuery": "dell precision"iphone",
        "searchedStatuses": ["ACTIVE"],
        "userType": "PUBLIC",
        "canSearchAllStatuses": false
      }
    },
    "currentPage": 1,
    "pageSize": 10,
    "totalElements": 12,
    "totalPages": 2,
    "hasNext": true,
    "hasPrevious": false
  }
}

Search Metadata Fields:

FieldDescription
searchQueryThe original search query provided
searchedStatusesProduct statuses included in search
userTypeUser type: PUBLIC, AUTHENTICATED, SHOP_OWNER, ADMIN
canSearchAllStatusesWhether user can search draft/inactive products

User Access Levels:

User TypeSearchable StatusesAdditional Features
Public UserACTIVE onlyBasic search functionality
Authenticated UserACTIVE onlySame as public (unless shop owner/admin)
Shop OwnerAll statusesCan search drafts, inactive products, view management data
System AdminAll statusesCan search all products across all statuses

Sort Options:

Sort FieldDescriptionBest Used For
relevanceOrders by search relevanceDefault search results
createdAtOrders by creation dateFinding newest/oldest products
updatedAtOrders by last updateFinding recently modified products
productNameAlphabetical orderBrowsing products alphabetically
priceOrders by pricePrice comparison
stockQuantityOrders by stock levelInventory management
brandOrders by brand nameBrand-based organization

Error Responses:

  • 400 Bad Request: Search queryQuery too short (< 2 characters),or too long (> 100 characters), or invalid parameters
  • 404 Not Found: Shop not found or not accessible (for public users, shop must be active and approved)

13. Advanced Product Filter

Purpose: Filters products using multiple criteria with complexcombined combinationsAND/OR and boolean logiclogic.

Endpoint: GET /api/v1/e-commerce/shops/{shopId}/products/advanced-filter

Access Level: ๐ŸŒ Public (Enhanced features for authenticated users)

Authentication: Optional Bearer Token

RequestPath HeadersParameters:

HeaderParameter Type Required Description
AuthorizationshopIdUUIDYesID of the shop

Query Parameters:

tokenfilters)
ParameterTypeRequiredDefaultDescription
minPricedecimalNoโ€”Minimum price
maxPricedecimalNoโ€”Maximum price (must be โ‰ฅ minPrice)
conditionProductConditionNoโ€”Condition filter
categoryIdUUIDNoโ€”Category filter
inStockbooleanNoโ€”Filter by availability
onSalebooleanNoโ€”Filter by sale status
hasGroupBuyingbooleanNoโ€”Filter by group buying
hasInstallmentsbooleanNoโ€”Filter by installments
hasMultipleColorsbooleanNoโ€”Filter by color variations
statusProductStatus[]NoACTIVEStatus filter (owners/admins for non-ACTIVE)
pageintegerNo1Page number
sizeintegerNo10Items per page (max: 50)
sortBy string No BearercreatedAt createdAt, forupdatedAt, authenticationproductName, (enablesprice, additionalstockQuantity
sortDirstringNodescasc or desc

Filter Logic:

Filter TypeLogic
Price rangeAND (minPrice AND maxPrice)
Feature flagsAND (all must match)
Multiple statusesOR

Error Responses:

  • 400: Invalid filter values or price range error
  • 404: Shop or category not found

14. Get Public Product by Slug

Purpose: Retrieves a single active product by its slug (same response shape as Get Public Product by ID).

Endpoint: GET api/v1/e-commerce/shops/{shopId}/products/find-by-slug/{slug}

Access Level: ๐ŸŒ Public

Path Parameters:

ParameterTypeRequiredDescription
shopIdUUIDYesShop must be active and approved
slugstringYesProduct slug

Error Responses:

  • 404: Shop not found/not approved, or product not found/not active

15. Installment Plan Config

Purpose: CRUD for installment plans attached to a product. Plans are created separately after the product, and linked to it by productId.

Base URL: api/v1/e-commerce/products/{shopId}/{productId}/installment-plans

Access Level: ๐Ÿ”’ Protected (Requires shop owner or system admin role)

Authentication: Bearer Token

Path Parameters (shared):

ParameterTypeRequiredDescription
shopIdUUIDYesID of the shop
productIdUUIDYesID of the product

15a. Create Installment Plan

Endpoint: POST api/v1/e-commerce/products/{shopId}/{productId}/installment-plans

Request Body:

shop
Parameter Type Required Description Validation
shopIdplanName UUIDstring Yes IDDisplay name for the planMin: 3, Max: 100 chars
paymentFrequencyPaymentFrequencyYesPayment intervalDAILY, WEEKLY, BI_WEEKLY, SEMI_MONTHLY, MONTHLY, QUARTERLY, CUSTOM_DAYS
customFrequencyDaysintegerConditionalDays between paymentsRequired when paymentFrequency=CUSTOM_DAYS, min: 1
numberOfPaymentsintegerYesTotal number of thepayments Min: 2, Max: 120
aprdecimalYesAnnual percentage rateMin: 0.0, Max: 36.0, 2 decimal places
minDownPaymentPercentintegerYesMinimum down payment %Min: 10, Max: 50
fulfillmentTimingFulfillmentTimingYesWhen to filter inship ValidIMMEDIATE UUID(ship format,after shopdown mustpayment), beAFTER_PAYMENT accessible(layaway โ€” ship after final payment)
displayOrderintegerNoSort order in UIMin: 0, Default: 0
isFeaturedbooleanNoHighlight as recommended planDefault: false
isActivebooleanNoPlan is available to buyersDefault: true

QueryRequest JSON Sample:

{
  "planName": "6-Month Interest-Free",
  "paymentFrequency": "MONTHLY",
  "numberOfPayments": 6,
  "apr": 0.00,
  "minDownPaymentPercent": 20,
  "fulfillmentTiming": "IMMEDIATE",
  "displayOrder": 1,
  "isFeatured": true,
  "isActive": true
}

Error Responses:

  • 400: Validation errors
  • 404: Shop or product not found

15b. Get All Installment Plans

Endpoint: GET api/v1/e-commerce/products/{shopId}/{productId}/installment-plans

Returns a list of all installment plans for the product.

Error Responses:

  • 404: Shop or product not found

15c. Get Installment Plan by ID

Endpoint: GET api/v1/e-commerce/products/{shopId}/{productId}/installment-plans/{planId}

Additional Path Parameter:

ParameterTypeDescription
planIdUUIDID of the installment plan

15d. Update Installment Plan

Endpoint: PUT api/v1/e-commerce/products/{shopId}/{productId}/installment-plans/{planId}

All fields are optional โ€” only provided fields are updated. Same field structure as Create.


15e. Delete Installment Plan

Endpoint: DELETE api/v1/e-commerce/products/{shopId}/{productId}/installment-plans/{planId}


15f. Activate / Deactivate Plan

Activate: PATCH api/v1/e-commerce/products/{shopId}/{productId}/installment-plans/{planId}/activate

Deactivate: PATCH api/v1/e-commerce/products/{shopId}/{productId}/installment-plans/{planId}/deactivate

Toggles isActive on the plan without changing any other fields.


Endpoint: PATCH api/v1/e-commerce/products/{shopId}/{productId}/installment-plans/{planId}/set-featured

Marks the specified plan as the featured (recommended) plan for this product.


16. Digital File Management

Purpose: Manages downloadable files for DIGITAL products. Uses a presign โ†’ upload โ†’ confirm flow to upload files directly to object storage.

Base URL: api/v1/e-commerce/shops/{shopId}/products/{productId}/digital-files

Access Level: ๐Ÿ”’ Protected (Requires shop owner or system admin role)

Authentication: Bearer Token

Path Parameters (shared):

Parameter Type Required Description
shopIdUUIDYesID of the shop
productIdUUIDYesID of the digital product

16a. Presign Upload

Purpose: Generates a presigned PUT URL. The client uploads the file directly to this URL, then calls /confirm.

Endpoint: POST api/v1/e-commerce/shops/{shopId}/products/{productId}/digital-files/presign-upload

Request Body:

(e.g. be order
ValidationParameter DefaultTypeRequiredDescription
minPricefileName decimalstring NoYes MinimumOriginal pricefile filterMin: 0, Max: 8 digitsNonename
maxPricecontentType decimalstring NoYes MaximumMIME pricetype filter Min: 0, Max: 8 digits, must be >= minPriceNoneapplication/pdf)
brandfileSize string[]long NoYes BrandFile namessize toin filterbytes (ORmust logic) Multiple values allowedNonepositive)
conditionProductConditionNoProduct condition filterNEW, USED_LIKE_NEW, USED_GOOD, USED_FAIR, REFURBISHED, FOR_PARTSNone
categoryIdUUIDNoCategory filterValid UUID, category must existNone
tagsstring[]NoTag filters (OR logic)Multiple values allowedNone
inStockbooleanNoFilter by stock availabilitytrue (in stock), false (out of stock)None
onSalebooleanNoFilter by sale statustrue (on sale), false (not on sale)None
hasGroupBuyingbooleanNoFilter by group buying availabilitytrue (has group buying), false (no group buying)None
hasInstallmentsbooleanNoFilter by installment availabilitytrue (has installments), false (no installments)None
hasMultipleColorsbooleanNoFilter by color variationstrue (multiple colors), false (single/no colors)None
isFeaturedbooleanNoFilter by featured statustrue (featured), false (not featured)None
statusProductStatus[]NoProduct status filter (OR logic)Multiple statuses allowedACTIVE (public users)
pagedisplayOrder integer No Page number (1-indexed)Min: 11
sizeintegerNoItems per pageMin: 1, Max: 5010
sortBystringNoSort field createdAt,for updatedAt,multiple productName, price, stockQuantity, brandcreatedAt
sortDirstringNoSort directionasc, descdescfiles

Request URLJSON ExamplesSample:

#{
  Price"fileName": range"design-kit-v2.fig",
  filter"contentType": GET"application/octet-stream",
  /api/v1/shops/123e4567-e89b-12d3-a456-426614174000/products/advanced-filter?minPrice=500&maxPrice=1500"fileSize": #52428800,
  Multiple"displayOrder": brand1
filter (Apple OR Samsung)
GET /api/v1/shops/123e4567-e89b-12d3-a456-426614174000/products/advanced-filter?brand=Apple&brand=Samsung&inStock=true

# Feature combination filter
GET /api/v1/shops/123e4567-e89b-12d3-a456-426614174000/products/advanced-filter?hasGroupBuying=true&hasInstallments=true&onSale=true

# Category and condition filter
GET /api/v1/shops/123e4567-e89b-12d3-a456-426614174000/products/advanced-filter?categoryId=123e4567-e89b-12d3-a456-426614174000&condition=NEW&isFeatured=true

# Complex filter with sorting
GET /api/v1/shops/123e4567-e89b-12d3-a456-426614174000/products/advanced-filter?minPrice=100&maxPrice=2000&brand=Apple&brand=Dell&hasInstallments=true&sortBy=price&sortDir=asc

# Tag-based filtering
GET /api/v1/shops/123e4567-e89b-12d3-a456-426614174000/products/advanced-filter?tags=premium&tags=5g&inStock=true

# Status filtering (requires authentication)
GET /api/v1/shops/123e4567-e89b-12d3-a456-426614174000/products/advanced-filter?status=ACTIVE&status=DRAFT&hasGroupBuying=true}

FilterResponse LogicJSON &Sample:

Combinations
{
  "success": true,
  "message": "Upload URL generated โ€” upload directly to this URL then call /confirm",
  "data": {
    "uploadUrl": "https://s3.example.com/bucket/key?X-Amz-Signature=...",
    "objectKey": "digital-files/product-456/design-kit-v2.fig",
    "expiresAt": "2026-05-19T11:00:00"
  }
}

Upload Flow:

  1. Call POST /presign-upload โ†’ receive uploadUrl and objectKey
  2. PUT {uploadUrl} with binary file body (do not call the API for this step)
  3. Call POST /confirm with objectKey to register the file

16b. Confirm Upload

Purpose: Registers a file after direct upload to object storage. Must be called after the actual file upload succeeds.

Endpoint: POST api/v1/e-commerce/shops/{shopId}/products/{productId}/digital-files/confirm

Request Body:

betweenfromwithwith
FilterParameter Type LogicRequired ExampleDescription
Price RangeobjectKey AND (both minPrice AND maxPrice)string ProductsYes Returned $500by AND $1500presign-upload
Multiple BrandsfileName OR (Apple OR Samsung OR Dell)string ProductsYes Original anyfile of the specified brandsname
Multiple TagscontentType OR (premium OR 5g OR wireless)string ProductsYes MIME any of the specified tagstype
Multiple StatusesfileSize OR (ACTIVE OR DRAFT)long ProductsYes File anysize ofin the specified statusesbytes
Feature FlagsdisplayOrder AND (all must be true/false)integer Products that have group buying AND installments
Combined FiltersNo ANDSort (between different filter types)Price range AND brand AND featuresorder

Response JSON Sample:

{
  "success": true,
  "message": "FoundFile 18confirmed productsand matchinglinked yourto filters"product",
  "data": {
    "contents": {
      "shop": {
        "shopId"fileId": "123e4567-aaa1bbbb-e89b-12d3-a456-426614174000"426614174001",
        "shopName": "TechStore Pro",
        "shopSlug": "techstore-pro",
        "logoUrl": "https://example.com/logos/techstore-pro.png",
        "isVerified": true,
        "isApproved": true,
        "isMyShop": false
      },
      "products": [
        {
    "productId": "456e7890-e89b-12d3-a456-426614174001",
    "productName"fileName": "iPhone 15 Pro Max 512GB"design-kit-v2.fig",
    "productSlug"contentType": "iphone-15-pro-max-512gb"application/octet-stream",
    "shortDescription"fileSize": "Premium 6.7-inch iPhone with A17 Pro chip",52428800,
    "primaryImage"fileVersion": "https://example.com/images/iphone15-pro-max.jpg",1,
    "price"displayOrder": 1199.00,1,
    "comparePrice": 1299.00,
          "finalPrice": 1199.00,
          "isOnSale"isActive": true,
    "discountPercentage": 7.69,
          "stockQuantity": 25,
          "isInStock": true,
          "isLowStock": false,
          "brand"uploadedAt": "Apple",
          "sku": "SHP12345678-ELE-APP-512-0001",
          "condition": "NEW",
          "status": "ACTIVE",
          "isFeatured": true,
          "isDigital": false,
          "hasGroupBuying": true,
          "hasInstallments": true,
          "hasMultipleColors": true,
          "groupPrice": 1099.00,
          "startingFromPrice": 1199.00,
          "createdAt": "2025-09-23T10:30:00Z"
        },
        {
          "productId": "567e8901-e89b-12d3-a456-426614174002",
          "productName": "Samsung Galaxy S24 Ultra",
          "productSlug": "samsung-galaxy-s24-ultra",
          "shortDescription": "Premium Android flagship with S Pen",
          "primaryImage": "https://example.com/images/samsung-s24-ultra.jpg",
          "price": 1099.00,
          "comparePrice": 1199.00,
          "finalPrice": 1099.00,
          "isOnSale": true,
          "discountPercentage": 8.34,
          "stockQuantity": 12,
          "isInStock": true,
          "isLowStock": false,
          "brand": "Samsung",
          "sku": "SHP12345678-ELE-SAM-ULT-0007",
          "condition": "NEW",
          "status": "ACTIVE",
          "isFeatured": true,
          "isDigital": false,
          "hasGroupBuying": true,
          "hasInstallments": true,
          "hasMultipleColors": true,
          "groupPrice": 999.00,
          "startingFromPrice": 1099.00,
          "createdAt": "2025-09-22T14:15:00Z"
        }
      ],
      "totalProducts": 18,
      "filterMetadata": {
        "appliedFilters": {
          "minPrice": 800.00,
          "maxPrice": 1500.00,
          "brands": ["Apple", "Samsung"],
          "inStock": true,
          "onSale": true,
          "hasGroupBuying": true,
          "hasInstallments": true,
          "isFeatured": true
        },
        "userType": "PUBLIC",
        "searchedStatuses": ["ACTIVE"],
        "hasActiveFilters": true
      }
    },
    "currentPage": 1,
    "pageSize": 10,
    "totalElements": 18,
    "totalPages": 2,
    "hasNext": true,
    "hasPrevious": false2026-05-19T10:45:00"
  }
}

Applied


Filters Metadata: The appliedFilters object shows exactly which filters were applied:

Filter CategoryPossible ValuesLogic
Price FiltersminPrice, maxPriceRange filtering (between values)
Brand Filtersbrands arrayOR logic (any of the brands)
Availability FiltersinStock, onSaleBoolean filtering
Feature FiltershasGroupBuying, hasInstallments, hasMultipleColors, isFeaturedBoolean filtering
Category FiltercategoryIdExact match
Condition FilterconditionExact match
Tag Filterstags arrayOR logic (any of the tags)
Status Filtersstatus arrayOR logic (any of the statuses)

Filter Validation Rules:

FilterValidationError Behavior
minPrice/maxPriceMust be positive numbers, maxPrice >= minPrice400 Bad Request
brandMust be non-empty stringsIgnored if empty
categoryIdMust be valid UUID and existing category404 Not Found
tagsMust be non-empty stringsIgnored if empty
conditionMust be valid ProductCondition enum400 Bad Request
statusMust be valid ProductStatus enum values400 Bad Request
Boolean filtersMust be true/false400 Bad Request

Performance Considerations:

  • Filters use database indexing for optimal performance
  • Complex filter combinations are optimized with JPA Specifications
  • Page size limited to 50 items to prevent performance issues
  • Popular filter combinations are cached for better response times

User Permission Differences:

User TypeAvailable Status FiltersAdditional Features
Public UserACTIVE onlyBasic filtering
Shop Owner/AdminAll statusesCan filter draft, inactive, archived products
System AdminAll statusesFull access to all filter combinations

Error Responses:

  • 400 Bad Request: Invalid filter values, price range errors, or invalid parameters
  • 404 Not Found: Shop not found, category not found, or shop not accessible
  • 422 Unprocessable Entity: Filter combination validation errors

Common Filter Use Cases:

  1. Price Shopping: minPrice=500&maxPrice=1000&sortBy=price&sortDir=asc
  2. Brand Comparison: brand=Apple&brand=Samsung&hasInstallments=true
  3. Feature Shopping: hasGroupBuying=true&hasInstallments=true&onSale=true
  4. Category Browsing: categoryId=UUID&inStock=true&sortBy=price
  5. Premium Products: isFeatured=true&hasMultipleColors=true&minPrice=500
  6. Sale Items: onSale=true&inStock=true&sortBy=discountPercentage&sortDir=desc

14.

16c. Get Public Product by Slug

Purpose: Retrieves a single active product for public viewing with customer-focused information by slug

Files

Endpoint: GET /api/v1/e-commerce/shops/{shopId}/products/find-by-slug/{slug}productId}/digital-files

Returns a list of DigitalFileResponse objects for all files linked to the product.


16d. Delete File

Endpoint: DELETE api/v1/e-commerce/shops/{shopId}/products/{productId}/digital-files/{fileId}

AccessAdditional LevelPath Parameter:

ParameterTypeDescription
fileIdUUIDID of the file to delete

16e. Toggle File Active Status

Endpoint: ๐ŸŒPATCH Public (No authentication required)api/v1/e-commerce/shops/{shopId}/products/{productId}/digital-files/{fileId}/toggle

Authentication: None

PathQuery Parameters:

false
Parameter Type Required Description Validation
shopIdisActive UUIDboolean Yes IDtrue ofto theactivate, shop Validto UUID format, shop must be active and approved
slugStringYesSlug of the productN/Adeactivate

ResponseDeactivated JSONfiles Sample:

are
{
  "success": true,
  "message": "Product retrieved successfully",
  "data": {
    "productId": "456e7890-e89b-12d3-a456-426614174001",
    "productName": "iPhone 15 Pro Max 512GB",
    "productSlug": "iphone-15-pro-max-512gb",
    "productDescription": "The most advanced iPhone ever, featuring the groundbreaking A17 Pro chip...",
    "shortDescription": "Premium 6.7-inch iPhone with A17 Pro chip and titanium design",
    "productImages": [
      "https://example.com/images/iphone15-pro-max-main.jpg",
      "https://example.com/images/iphone15-pro-max-side.jpg"
    ],
    "price": 1199.00,
    "comparePrice": 1299.00,
    "discountAmount": 100.00,
    "discountPercentage": 7.69,
    "isOnSale": true,
    "isInStock": true,
    "isLowStock": false,
    "stockQuantity": 25,
    "brand": "Apple",
    "condition": "NEW",
    "tags": ["smartphone", "apple", "premium", "5g", "titanium"],
    "shopId": "123e4567-e89b-12d3-a456-426614174000",
    "shopName": "TechStore Pro",
    "shopSlug": "techstore-pro",
    "shopLogoUrl": "https://example.com/logos/techstore-pro.png",
    "categoryId": "789e0123-e89b-12d3-a456-426614174002",
    "categoryName": "Smartphones",
    "isDigital": false,
    "requiresShipping": true,
    "specifications": {
      "Display": "6.7-inch Super Retina XDR OLED",
      "Storage": "512GB",
      "Chip": "A17 Pro with 6-core GPU",
      "Battery Life": "Up to 29 hours video playback"
    },
    "hasSpecifications": true,
    "colors": [
      {
        "name": "Natural Titanium",
        "hex": "#F5F5DC",
        "images": ["https://example.com/colors/natural-titanium.jpg"],
        "priceAdjustment": 0.00,
        "finalPrice": 1199.00
      },
      {
        "name": "Black Titanium",
        "hex": "#1C1C1E",
        "images": ["https://example.com/colors/black-titanium.jpg"],
        "priceAdjustment": 50.00,
        "finalPrice": 1249.00
      }
    ],
    "hasMultipleColors": true,
    "priceRange": {
      "minPrice": 1199.00,
      "maxPrice": 1249.00,
      "hasPriceVariations": true
    },
    "groupBuying": {
      "isAvailable": true,
      "minGroupSize": 10,
      "maxGroupSize": 50,
      "groupPrice": 1099.00,
      "groupDiscount": 100.00,
      "groupDiscountPercentage": 8.34,
      "timeLimitHours": 72
    },
    "installmentOptions": {
      "isAvailable": true,
      "downPaymentRequired": true,
      "minDownPaymentPercentage": 20.00,
      "plans": [
        {
          "duration": 6,
          "interval": "MONTHS",
          "interestRate": 0.00,
          "description": "6 months interest-free installment"
        },
        {
          "duration": 12,
          "interval": "MONTHS",
          "interestRate": 2.90,
          "description": "12 months with low interest rate"
        }
      ]
    },
    "createdAt": "2025-09-23T10:30:00Z"
  }
}

Public Response Features:

  • Only shows active productshidden from approvedbuyers shops
  • Hides internal management data (SKU, creation user IDs, etc.)
  • Shows stock quantity only if product is in stock
  • Includes customer-focused information (shipping, features, pricing)
  • Full specifications and color variations for customer decision making

Error Responses:

  • 404 Not Found: Shopbut not found, not approved, or product not found/not active
deleted.


Quick Reference Guide

Common HTTP Status Codes

  • requestwithresponse data
  • 204
  • NoContent: Successful DELETE request (hard delete)
  • orexpiredtoken
  • (shopowneror system admin required)
  • orproductnot available
  • Validationwithdetailedfield-level messages
  • 429 Too Many Requests: Rate limit exceeded (search/filter endpoints)
  • duringprocessing

    Authentication Types

    • Bearer Token: Include Authorization: Bearer your_token in headers
    • None: No authentication required for public product viewing
    • Optional: Enhanced features available with authentication
    CodeMeaning
    200 OK: Successful GET/PUT/PATCH
    201 Created: Successful POST request, (resource createdcreated)
    400 Bad Request: Invalid request data, validation errors, or business rule violations
    401 Unauthorized: Authentication required,required or invalid token,token
    403 Forbidden: Insufficient permissions
    404 Not Found: Resource not found,found shopor not accessible,accessible
    409 Conflict: Duplicate product name/SKU,name or business constraint violation
    422 Unprocessable Entity: Field-level validation errors
    500 Internal Server Error: Server error

    User Access Levels & Permissions

    User Type Product Management Search/FilterStatus AccessSpecial Features
    Public User View active products only Basic search/filterACTIVE onlyNo management data
    Authenticated User View active products only Basic search/filterACTIVE onlySame as public unless shop owner
    Shop Owner Full CRUD on own shop Enhanced search/filterAll statusesManagement statistics, draft products
    System Admin Full CRUD on all shops Enhanced search/filterAll statusesCross-shop access, system statistics

    DataProduct FormatType StandardsFulfillment Flows

    • Dates:
    • UseISO8601format(2025-09-23T14:30:00Z)
    • Prices:
    • Usedecimal
    • UUIDs:
    • UsestandardUUIDvalidHTTP/HTTPSURLs for product images and color images
    • Colors: Hex format (#1D1D1F) for color codes, case insensitive
    • Percentages: Decimal format (20.00 for 20%), max 2 decimal places
    • Currency: Use shop's base currency, no currency symbols in API
    • Type Flow
      PHYSICALPayment โ†’ PENDING_SHIPMENT โ†’ Seller ships โ†’ Buyer confirms with 26-digit decimalcode placesโ†’ (999.00),Escrow storedreleases asโ†’ BigDecimalCOMPLETED
      DIGITAL Payment formatโ†’ (123e4567-e89b-12d3-a456-426614174000)COMPLETED
    • Pagination:immediately 1-indexedโ†’ pagesEscrow (pagereleased parameterโ†’ startsDigitalDownloadAccess fromrecords 1)
    • created
    • URLs:โ†’ MustBuyer bedownloads
    • Product Status Lifecycle

      DRAFT โ†’ ACTIVE โ†’ INACTIVE โ†’ ARCHIVED
        โ†‘                            โ†“
        โ†“         โ†‘
        โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ RESTORE โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
      
      OUT_OF_STOCK โ†โ†’ ACTIVE (automatic based on inventory)
      
      Status DescriptionPublic Visibility ManagementAvailable Actions
      DRAFTProduct being created/edited Hidden Edit, Publish, Hard Delete
      ACTIVELive and available for purchase Visible Edit, Deactivate, Soft Delete
      INACTIVETemporarily unavailable Hidden Edit, Activate, Soft Delete
      OUT_OF_STOCKNo inventory available Visible with "Out(out of Stock"stock badge) Restock (auto-activates)
      ARCHIVEDNo longer sold, kept for history Hidden Restore, View onlyRestore

      ProductEnums ConditionsReference

      ConditionDescriptionTypical Use Case
      NEWBrand new, unused productNew retail items
      USED_LIKE_NEWMinimal use, perfect conditionReturns, demo units
      USED_GOODGood condition with minor wearRefurbished items
      USED_FAIRFair condition with noticeable wearBudget/economy items
      REFURBISHEDProfessionally restored to working orderCertified refurbished
      FOR_PARTSSold for parts or repair onlyNon-functional items

      ReqAction Values & Effects

      ActionEffect on StatusUse Case
      SAVE_DRAFTSets status to DRAFTSave work in progress
      SAVE_PUBLISHSets status to ACTIVEImmediate publication

      Advanced Features Overview

      Group Buying System

      Group Formation โ†’ Time Limit โ†’ Minimum Check โ†’ Price Activation
           โ†“               โ†“            โ†“               โ†“
        Users Join โ†’ Countdown Timer โ†’ Min Size Met โ†’ Discount Applied
      

      Requirements:

      • groupMinSize: Minimum participants (min: 2)
      • groupMaxSize: Maximum participants (must be >= groupMinSize)
      • groupPrice: Discounted price (must be < regular price)
      • groupTimeLimitHours: Formation time limit (1-8760 hours)
      • groupRequiresMinimum: Whether minimum size is mandatory

      Business Rules:

      • Group price must be less than regular price
      • Time limit starts when first user joins
      • If minimum not reached and required, group fails
      • Successful groups lock in the discount for all participants

      Installment Payment System

      Product Price โ†’ Down Payment โ†’ Remaining Amount โ†’ Monthly Payments
            โ†“             โ†“              โ†“                    โ†“
         $1000.00    โ†’  $200.00    โ†’   $800.00         โ†’  $133.33 x 6
      

      Payment Intervals:

      • DAYS: Daily payments (short-term financing)
      • WEEKS: Weekly payments (flexible scheduling)
      • MONTHS: Monthly payments (standard installments)

      Calculation Formula:

      Down Payment = Product Price ร— (Min Down Payment % รท 100)
      Remaining Amount = Product Price - Down Payment
      Interest Amount = Remaining Amount ร— (Interest Rate รท 100)
      Total Installment Amount = Remaining Amount + Interest Amount
      Payment Per Interval = Total Installment Amount รท Duration
      

      Color Variations System

      Price Calculation:

      Base Price + Color Price Adjustment = Final Color Price
      $999.00 + $50.00 = $1049.00 (Premium Color)
      $999.00 + $0.00 = $999.00 (Standard Color)
      

      Price Range Calculation:

      • minPrice: Lowest price across all color variations
      • maxPrice: Highest price across all color variations
      • startingFromPrice: Same as minPrice for customer display

      Validation Rules Summary

      Product Creation/Update Validation

      FieldValidation RulesError Handling
      productNameMin: 2, Max: 100 chars, unique in shop400 Bad Request with field error
      productDescriptionMin: 10, Max: 1000 chars422 Unprocessable Entity
      priceMin: 0.01, Max: 8 digits, 2 decimal places400 Bad Request
      stockQuantityMin: 0400 Bad Request
      comparePriceMust be > price if providedCustom validation error
      groupPriceMust be < price if group buying enabledCustom validation error
      categoryIdMust exist and be active404 Not Found
      productImagesAt least 1 valid URL required422 Unprocessable Entity
      colors[].hexValid 6-digit hex format (#RRGGBB)400 Bad Request
      installmentPlansRequired if installmentEnabled=trueCustom validation error

      Business Logic Validation

      • Group Size LogicProductType: groupMaxSizePHYSICAL, >=DIGITAL

        groupMinSize
      • Price LogicProductCondition: comparePrice > priceNEW AND, groupPriceUSED_LIKE_NEW, <USED_GOOD, priceUSED_FAIR

      • ,
      • REFURBISHED, FOR_PARTS

        Order Quantity LogicReqAction: maxOrderQuantitySAVE_DRAFT >=(โ†’ minOrderQuantityDRAFT status), SAVE_PUBLISH

      • (โ†’ ACTIVE status)

        Installment LogicUrgencyTag: AtNONE, leastNEW_ARRIVAL, oneLIMITED_EDITION, planLIMITED_OFFER, requiredFEW_REMAINS

        when enabled
      • Publishing RequirementsPaymentFrequency: Name,DAILY, description,WEEKLY, price,BI_WEEKLY, stock,SEMI_MONTHLY, category,MONTHLY, imagesQUARTERLY, required

      • CUSTOM_DAYS

      FulfillmentTiming: IMMEDIATE (ship after down payment), AFTER_PAYMENT (layaway โ€” ship after final payment)

      SKU Generation SystemFormat

      Format: SHP[8-CHAR-UUID]-[CATEGORY-3]-[BRAND-3]-[ATTRIBUTE-3]-[SEQUENCE-4]

      Components:Example: SHP12345678-ELE-APP-512-0001

        Data Format Standards

        • Shop PrefixDates: SHPISO + first 8 characters of shop UUID8601 (uppercase)2026-05-19T14:30:00Z)
        • Category CodePrices: FirstDecimal 3with characters2 ofdecimal categoryplaces, namestored (uppercase,as alphanumeric only)BigDecimal
        • Brand CodeUUIDs: FirstStandard 3UUID characters of brand name (uppercase, alphanumeric only)format
        • Attribute CodePagination: Main1-indexed productpage attribute from specifications or name (3 chars)parameter
        • Sequence NumberColors: 4-digitHex sequentialformat number within shop (0001, 0002, etc.)

      Examples:

      • SHP12345678-ELE-APP-256-0001#RRGGBB (Apple iPhone with 256GB storage)
      • Percentages: Decimal format (SHP87654321-LAP-DEL-PRE-000520.00 (Dell= Precision laptop)
      • SHP11223344-CLO-NIK-XLA-0012 (Nike XL clothing)

      Search & Filter Capabilities

      Search Query Processing

      Query TypeProcessingExampleResult
      Single Word%word% pattern"iphone"Matches "iPhone 15 Pro"
      Multi-word%word1%word2% pattern"dell precision"Matches products with both "dell" AND "precision"
      Partial MatchAutomatic partial matching"macb"Matches "MacBook"
      Cross-fieldSearches multiple fields"apple"Matches brand, name, description, tags

      Filter Combinations Logic

      AND Logic (between different filter types):
      Price Range AND Brand Filter AND Feature Filters
      
      OR Logic (within same filter type):
      Brand: Apple OR Samsung OR Dell
      Tags: premium OR 5g OR wireless
      Status: ACTIVE OR DRAFT OR INACTIVE
      

      Performance Optimizations:

      • Database indexes on: shop_id, status, price, brand, category_id
      • JPA Specifications for dynamic query building
      • Page size limits (max 50 for public, max 100 for management)
      • Query result caching for popular filter combinations20%)

      Error Handling Guidelines

      Error Response Format

      {
        "success": false,
        "message": "Human-readable error message",
        "error": {
          "code": "ERROR_CODE",
          "details": "Detailed error information",
          "field": "fieldName (if field-specific)",
          "timestamp": "2025-09-23T14:2026-05-19T14:30:00Z"
        }
      }
      

      Common Error Scenarios

      Creation
      ScenarioHTTP CodeResponse Strategy
      Invalid

      Product Name

      400Field-specific validation message
      Product Not Found404Generic "Product not found" (security)
      Insufficient Permissions403"Insufficient permissions" without details
      Duplicate Product409"Product with similar details already exists"
      Publishing Validation400List all missing required fields
      Rate Limiting429Include retry-after header

      Best Practices for API UsageFlow

      Product Management Best Practices

      1. Always validate required fields before creating products
      2. Use SAVE_DRAFT action during product creation process
      3. Use SAVE_PUBLISH action only when product is complete
      4. Set appropriate low stock thresholds for inventory alerts
      5. Enable group buying for bulk products to increase sales volume
      6. Set up installments for high-value items (>$500) to improve accessibility
      7. Add comprehensive specifications for better search discoverability
      8. Use high-quality images (minimum 800x600 pixels recommended)
      9. Implement proper inventory tracking to prevent overselling
      10. Regular price updates to maintain competitiveness

      Search & Filter Optimization

      1. Use pagination for better performance and user experience
      2. Implement client-side caching for popular search queries
      3. Provide search suggestions based on common queries
      4. Use filter combinations intelligently to reduce result sets
      5. Sort by relevance for search results, by price for filters
      6. Implement infinite scroll for mobile applications
      7. Show filter result counts before applying filters
      8. Provide clear filter reset functionality
      9. Use debouncing for real-time search input
      10. Cache filter metadata for faster subsequent requests

      Security Best Practices

      1. Always validate user permissions before product operations
      2. Sanitize search queries to prevent injection attacks
      3. Rate limit search endpoints to prevent abuse
      4. Validate all file uploads (images) before processing
      5. Use HTTPS for all API requests containing sensitive data
      6. Implement proper session management for authenticated users
      7. Log all product management actions for audit trails
      8. Validate price inputs to prevent negative or invalid values
      9. Check shop ownership before allowing product modifications
      10. Implement request throttling for high-frequency operations

      Performance Optimization

      1. Use appropriate page sizes (10-20 for mobile, 50+ for desktop)
      2. Implement database indexing on frequently queried fields
      3. Cache expensive calculations (group buying status, installment calculations)
      4. Use CDN for product images to improve load times
      5. Implement lazy loading for non-critical product details
      6. Optimize database queries using JPA Specifications efficiently
      7. Use compression for large response payloads
      8. Implement response caching for public product listings
      9. Monitor API response times and optimize slow endpoints
      10. Use connection pooling for database connections

      Business Logic Guidelines

      1. Maintain price consistency across all product variations
      2. Validate group buying economics (ensure profitability)
      3. Set realistic installment terms based on product value
      4. Implement inventory alerts at appropriate thresholds
      5. Use soft delete for published products to maintain order history
      6. Hard delete only draft products to keep database clean
      7. Validate category assignments for proper product organization
      8. Implement price change logging for audit purposes
      9. Set appropriate product conditions based on actual state
      10. Maintain SEO-friendly slugs for better discoverability

      API Integration Examples

      Creating a Complete Product (Recommended Flow)

      1. POST /shops/{shopId}/productsproducts?action=SAVE_DRAFT
         (action=SAVE_DRAFT)โ€” -create Create basicthe product structure
         - Validate required fieldsshell
      
      2. PUTPOST /products/{shopId}/{productId}/installment-plans
         โ€” add installment plans (if installmentEnabled)
      
      3. POST /shops/{shopId}/products/{productId}/digital-files/presign-upload
         PUT {uploadUrl} (action=SAVE_DRAFT)direct -to Addstorage)
         advancedPOST features/shops/{shopId}/products/{productId}/digital-files/confirm
         โ€” upload digital files (groupDIGITAL buying,products installments)only)
      
      - Upload and set product images
         - Add specifications and color variations
         
      3.4. PATCH /shops/{shopId}/products/{productId}/publish
         -โ€” Finalpublish validationwhen check
         - Publish to make publicly availableready
      

      Search Implementation Pattern

      1. Basic Search: GET /shops/{shopId}/products/search?q=query
      2. Add Filters: GET /shops/{shopId}/products/advanced-filter?brand=X&minPrice=Y
      3. Combine Both: Use search for text matching, filters for refinement
      4. Pagination: Always include page and size parameters
      5. Sort Results: Use appropriate sortBy based on user intent
      

      Error Recovery Strategies

      400 Errors: Validate input client-side, show field-specific errors
      401 Errors: Refresh authentication token, redirect to login
      403 Errors: Show access denied message, don't retry automatically  
      404 Errors: Handle gracefully, suggest alternatives
      409 Errors: Show conflict resolution options to user
      429 Errors: Implement exponential backoff retry strategy
      500 Errors: Log error details, show generic error message to user