Skip to content

Filter Products

Filter and search product variants with advanced filtering options including category, price range, attributes, and sorting.

Endpoint

GET /v1/products/filter/

Authentication

Not required (public endpoint)

Query Parameters

Parameter Type Required Description
page integer No Page number (default: 1)
count integer No Items per page (default: 20)
category_id integer No Filter by category ID
currency_id integer No Currency ID for price conversion
min_price float No Minimum price filter
max_price float No Maximum price filter
price_sort string No Sort by price: asc or desc
created_sort string No Sort by creation date: asc or desc
lang string No Language code for search (e.g., az, en, es, de)
search string No Search term for product name/description
{attribute_name} string No Filter by attribute values (comma-separated)

Attribute Filtering

You can filter by any product attribute by passing the attribute name as a query parameter with comma-separated values:

?color=red,blue&size=small,medium

Response

Success (200 OK)

{
  "count": 50,
  "data": [
    {
      "id": 1,
      "product_id": 5,
      "product": {
        "id": 5,
        "store_id": 3,
        "store": {...},
        "category_id": 2,
        "category": {...},
        "brand_id": 1,
        "brand": {...},
        "currency_id": 1,
        "currency": {...},
        "created": "2025-01-15T10:30:00Z"
      },
      "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",
      "description_es": "Descripción del Producto",
      "description_de": "Produktbeschreibung",
      "sku": "SKU-001",
      "stock_quantity": 100,
      "price": 29.99,
      "discount_percent": 10.0,
      "discount_price": 26.99,
      "currency_name": "USD",
      "attributes": [
        {
          "id": 1,
          "attribute_id": 1,
          "attribute_name": "Color",
          "attribute_name_az": "Rəng",
          "attribute_name_en": "Color",
          "attribute_name_es": "Color",
          "attribute_name_de": "Farbe",
          "attribute_type": "select",
          "value": "Red",
          "value_az": "Qırmızı",
          "value_en": "Red",
          "value_es": "Rojo",
          "value_de": "Rot",
          "is_filter": true,
          "is_view": true
        }
      ],
      "images": [...],
      "created": "2025-01-15T10:30:00Z"
    }
  ],
  "price_range": {
    "min": 10.0,
    "max": 100.0
  },
  "filters": {
    "color": {
      "name": "color",
      "values": ["red", "blue", "green"]
    },
    "size": {
      "name": "size",
      "values": ["small", "medium", "large"]
    }
  }
}

Error Responses

Invalid Parameters (400)

{
  "error": "Invalid parameter value"
}

Example Request

# Filter by category and price range
curl -X GET "https://api.luxmart.site/v1/products/filter/?category_id=2&min_price=10&max_price=100&price_sort=asc&page=1&count=20"

# Filter by attributes
curl -X GET "https://api.luxmart.site/v1/products/filter/?color=red,blue&size=large&page=1&count=20"

# Search with language
curl -X GET "https://api.luxmart.site/v1/products/filter/?search=laptop&lang=en&page=1&count=20"

# Filter with currency conversion
curl -X GET "https://api.luxmart.site/v1/products/filter/?category_id=2&currency_id=1&page=1&count=20"

Notes

  • Multiple attribute filters can be combined
  • Attribute values can be comma-separated for multiple options
  • Price filtering is applied to the base product price
  • Sorting can be combined (price and created date)
  • Search is case-insensitive and searches in the specified language
  • Only returns non-deleted products and variants
  • Results are paginated
  • discount_percent is the discount percentage (0 if no discount)
  • discount_price is the final price after discount
  • Response includes price_range (min/max prices) and filters (available attribute values) for the filtered results
  • When currency_id is provided, prices are converted from the product's currency to the requested currency via base currency (AZN)
  • currency_name field indicates the currency of the returned prices (requested currency if currency_id provided, otherwise product's original currency)
  • is_wish field indicates if the product variant is in the user's wishlist (requires authentication)
  • Attribute names and values include translations for all supported languages (attribute_name_az, attribute_name_en, attribute_name_es, attribute_name_de, value_az, value_en, value_es, value_de)
  • Base fields (attribute_name, value) are kept for backward compatibility