Skip to content

Get All Variants

Get a paginated list of all product variants for a specific product.

Endpoint

GET /v1/products/variant/store/?product_id={product_id}

Authentication

Required (Store role)

Query Parameters

Parameter Type Required Description
product_id integer Yes Product ID
page integer Yes Page number (starts at 1)
count integer Yes Items per page (max 100)
search string No Search by variant name (case-insensitive)

Response

Success (200 OK)

{
  "count": 10,
  "data": [
    {
      "id": 1,
      "product_id": 5,
      "product": {...},
      "name_az": "Məhsul Adı",
      "name_en": "Product Name",
      "name_es": "Nombre del Producto",
      "name_de": "Produktname",
      "description_az": "Məhsul Təsviri",
      "description_en": "Product Description",
      "sku": "SKU-001",
      "stock_quantity": 100,
      "price": 29.99,
      "attributes": [...],
      "images": [...],
      "created": "2025-01-15T10:30:00Z"
    }
  ]
}

Error Responses

Product Not Found (404)

{
  "error": "Product not found"
}

Pagination Error (400)

{
  "error": "page cannot be zero or minus"
}

Example Request

curl -X GET "https://api.luxmart.site/v1/products/variant/store/?product_id=5&page=1&count=20&search=red" \
  -H "Authorization: Token your_access_token"

Notes

  • Only returns variants for products belonging to the authenticated store
  • Only returns non-deleted variants
  • Search matches against variant name (in any language)
  • Results are ordered by ID descending (newest first)