{
  "info": {
    "name": "Storefront product filters (options + attributes)",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
    "description": "Import into Postman for mobile integration. Deploy the updated API and clear the Laravel route cache first. Change client_id/store_code and select IDs returned for your store. X-Store-ID is optional here; enable it only with the matching numeric store ID. GET /products/filters returns data.options (variant choices such as color/size) and data.attributes (active select attributes marked filterable, such as author/publisher). Attribute choices also work on products without variants. Text attributes remain descriptive, following the admin configuration. Names follow Accept-Language or lang. /products/filters accepts the same catalog filters as /products; page/per_page/sort do not limit the returned choices. No login is required. Filter groups and values are isolated by tenant and store."
  },
  "variable": [
    {
      "key": "api_base_url",
      "value": "https://web-api.pixipine.store/api/v1"
    },
    {
      "key": "client_id",
      "value": "kalemat"
    },
    {
      "key": "store_code",
      "value": "kw"
    },
    {
      "key": "store_id",
      "value": ""
    },
    {
      "key": "language",
      "value": "ar"
    },
    {
      "key": "currency",
      "value": "KWD"
    },
    {
      "key": "category_id",
      "value": ""
    },
    {
      "key": "color_value_id",
      "value": ""
    },
    {
      "key": "size_value_id",
      "value": ""
    },
    {
      "key": "author_option_id",
      "value": ""
    },
    {
      "key": "publisher_option_id",
      "value": ""
    },
    {
      "key": "search_query",
      "value": ""
    }
  ],
  "item": [
    {
      "name": "Available product options and attributes",
      "request": {
        "method": "GET",
        "header": [
          {
            "key": "Accept",
            "value": "application/json"
          },
          {
            "key": "X-Client-Id",
            "value": "{{client_id}}"
          },
          {
            "key": "X-Store-Code",
            "value": "{{store_code}}"
          },
          {
            "key": "X-Store-ID",
            "value": "{{store_id}}",
            "disabled": true
          },
          {
            "key": "Accept-Language",
            "value": "{{language}}"
          },
          {
            "key": "X-Currency-Code",
            "value": "{{currency}}"
          }
        ],
        "url": "{{api_base_url}}/products/filters?in_stock=1",
        "description": "Returns data.options[].values[] and data.attributes[].options[] for matching visible products in the selected store. Variant values have id/code/value/color_hex; attribute choices have id/name/image. Both include products_count, in_stock_products_count and is_selected. Counts are distinct matching products. Use in_stock=1 for in-stock products/variant combinations. The saved response is an illustrative Arabic example; replace its IDs with those returned by your store."
      },
      "response": [
        {
          "name": "Illustrative available options + attributes",
          "originalRequest": {
            "method": "GET",
            "header": [
              {
                "key": "Accept",
                "value": "application/json"
              },
              {
                "key": "X-Client-Id",
                "value": "{{client_id}}"
              },
              {
                "key": "X-Store-Code",
                "value": "{{store_code}}"
              },
              {
                "key": "X-Store-ID",
                "value": "{{store_id}}",
                "disabled": true
              },
              {
                "key": "Accept-Language",
                "value": "{{language}}"
              },
              {
                "key": "X-Currency-Code",
                "value": "{{currency}}"
              }
            ],
            "url": "{{api_base_url}}/products/filters?in_stock=1",
            "description": "Returns data.options[].values[] and data.attributes[].options[] for matching visible products in the selected store. Variant values have id/code/value/color_hex; attribute choices have id/name/image. Both include products_count, in_stock_products_count and is_selected. Counts are distinct matching products. Use in_stock=1 for in-stock products/variant combinations. The saved response is an illustrative Arabic example; replace its IDs with those returned by your store."
          },
          "status": "OK",
          "code": 200,
          "_postman_previewlanguage": "json",
          "header": [
            {
              "key": "Content-Type",
              "value": "application/json"
            }
          ],
          "body": "{\n  \"success\": true,\n  \"message\": \"OK\",\n  \"data\": {\n    \"options\": [\n      {\n        \"id\": 1,\n        \"code\": \"color\",\n        \"name\": \"اللون\",\n        \"type\": \"color\",\n        \"values\": [\n          {\n            \"id\": 101,\n            \"code\": \"red\",\n            \"value\": \"أحمر\",\n            \"color_hex\": \"#ff0000\",\n            \"products_count\": 3,\n            \"in_stock_products_count\": 3,\n            \"is_selected\": false\n          }\n        ]\n      }\n    ],\n    \"attributes\": [\n      {\n        \"id\": 5,\n        \"code\": \"author\",\n        \"name\": \"المؤلف\",\n        \"type\": \"select\",\n        \"filterable\": true,\n        \"options\": [\n          {\n            \"id\": 501,\n            \"name\": \"نجيب محفوظ\",\n            \"image\": null,\n            \"products_count\": 2,\n            \"in_stock_products_count\": 2,\n            \"is_selected\": false\n          }\n        ]\n      }\n    ]\n  }\n}"
        }
      ]
    },
    {
      "name": "Available options and attributes in a category",
      "request": {
        "method": "GET",
        "header": [
          {
            "key": "Accept",
            "value": "application/json"
          },
          {
            "key": "X-Client-Id",
            "value": "{{client_id}}"
          },
          {
            "key": "X-Store-Code",
            "value": "{{store_code}}"
          },
          {
            "key": "X-Store-ID",
            "value": "{{store_id}}",
            "disabled": true
          },
          {
            "key": "Accept-Language",
            "value": "{{language}}"
          },
          {
            "key": "X-Currency-Code",
            "value": "{{currency}}"
          }
        ],
        "url": "{{api_base_url}}/products/filters?category_id={{category_id}}&in_stock=1",
        "description": "Set category_id to a category from the selected store. Omit both option_value_ids and attribute_option_ids to fetch the complete available choices for that category. Include selection arrays to narrow counts and choices to currently matching products and variant combinations. Only attributes configured as active + filterable + select appear."
      },
      "response": []
    },
    {
      "name": "Products filtered by option values",
      "request": {
        "method": "GET",
        "header": [
          {
            "key": "Accept",
            "value": "application/json"
          },
          {
            "key": "X-Client-Id",
            "value": "{{client_id}}"
          },
          {
            "key": "X-Store-Code",
            "value": "{{store_code}}"
          },
          {
            "key": "X-Store-ID",
            "value": "{{store_id}}",
            "disabled": true
          },
          {
            "key": "Accept-Language",
            "value": "{{language}}"
          },
          {
            "key": "X-Currency-Code",
            "value": "{{currency}}"
          }
        ],
        "url": "{{api_base_url}}/products?option_value_ids[]={{color_value_id}}&option_value_ids[]={{size_value_id}}&in_stock=1",
        "description": "Use values[].id from the filter response, not the option group id. Values within one option are OR; different options are AND on one active in-stock variant. Repeating a value is rejected. Values from a different store return no matches."
      },
      "response": []
    },
    {
      "name": "Products filtered by an attribute",
      "request": {
        "method": "GET",
        "header": [
          {
            "key": "Accept",
            "value": "application/json"
          },
          {
            "key": "X-Client-Id",
            "value": "{{client_id}}"
          },
          {
            "key": "X-Store-Code",
            "value": "{{store_code}}"
          },
          {
            "key": "X-Store-ID",
            "value": "{{store_id}}",
            "disabled": true
          },
          {
            "key": "Accept-Language",
            "value": "{{language}}"
          },
          {
            "key": "X-Currency-Code",
            "value": "{{currency}}"
          }
        ],
        "url": "{{api_base_url}}/products?attribute_option_ids[]={{author_option_id}}&in_stock=1",
        "description": "Set author_option_id from data.attributes[].options[].id, not the attribute group id and not a product_attribute_values row id. The result includes products without variants. An inactive, unknown, non-filterable or different-store choice returns no matches."
      },
      "response": []
    },
    {
      "name": "Products filtered by author and publisher",
      "request": {
        "method": "GET",
        "header": [
          {
            "key": "Accept",
            "value": "application/json"
          },
          {
            "key": "X-Client-Id",
            "value": "{{client_id}}"
          },
          {
            "key": "X-Store-Code",
            "value": "{{store_code}}"
          },
          {
            "key": "X-Store-ID",
            "value": "{{store_id}}",
            "disabled": true
          },
          {
            "key": "Accept-Language",
            "value": "{{language}}"
          },
          {
            "key": "X-Currency-Code",
            "value": "{{currency}}"
          }
        ],
        "url": "{{api_base_url}}/products?attribute_option_ids[]={{author_option_id}}&attribute_option_ids[]={{publisher_option_id}}&in_stock=1",
        "description": "Choices of the same attribute are OR; choices from different attributes are AND on one product. These IDs are examples of the author and publisher groups; choose valid IDs for your store."
      },
      "response": []
    },
    {
      "name": "Products filtered by variant and attribute",
      "request": {
        "method": "GET",
        "header": [
          {
            "key": "Accept",
            "value": "application/json"
          },
          {
            "key": "X-Client-Id",
            "value": "{{client_id}}"
          },
          {
            "key": "X-Store-Code",
            "value": "{{store_code}}"
          },
          {
            "key": "X-Store-ID",
            "value": "{{store_id}}",
            "disabled": true
          },
          {
            "key": "Accept-Language",
            "value": "{{language}}"
          },
          {
            "key": "X-Currency-Code",
            "value": "{{currency}}"
          }
        ],
        "url": "{{api_base_url}}/products?option_value_ids[]={{color_value_id}}&attribute_option_ids[]={{author_option_id}}&in_stock=1",
        "description": "Variant selections use option_value_ids, attribute selections use attribute_option_ids. The two sets combine with AND. Values across different variant options must match one active variant; attributes belong to the matching product."
      },
      "response": []
    },
    {
      "name": "Available filters for the current selections",
      "request": {
        "method": "GET",
        "header": [
          {
            "key": "Accept",
            "value": "application/json"
          },
          {
            "key": "X-Client-Id",
            "value": "{{client_id}}"
          },
          {
            "key": "X-Store-Code",
            "value": "{{store_code}}"
          },
          {
            "key": "X-Store-ID",
            "value": "{{store_id}}",
            "disabled": true
          },
          {
            "key": "Accept-Language",
            "value": "{{language}}"
          },
          {
            "key": "X-Currency-Code",
            "value": "{{currency}}"
          }
        ],
        "url": "{{api_base_url}}/products/filters?attribute_option_ids[]={{author_option_id}}&in_stock=1",
        "description": "Returns both options and attributes limited to products matching this selection. Selected attribute choices have is_selected=true. Counts and available choices update when category, search, prices or other selections change."
      },
      "response": []
    },
    {
      "name": "Search products with attribute filters",
      "request": {
        "method": "GET",
        "header": [
          {
            "key": "Accept",
            "value": "application/json"
          },
          {
            "key": "X-Client-Id",
            "value": "{{client_id}}"
          },
          {
            "key": "X-Store-Code",
            "value": "{{store_code}}"
          },
          {
            "key": "X-Store-ID",
            "value": "{{store_id}}",
            "disabled": true
          },
          {
            "key": "Accept-Language",
            "value": "{{language}}"
          },
          {
            "key": "X-Currency-Code",
            "value": "{{currency}}"
          }
        ],
        "url": "{{api_base_url}}/products/search?q={{search_query}}&attribute_option_ids[]={{author_option_id}}&in_stock=1",
        "description": "Search accepts the same attribute_option_ids array as /products. q is required. Use the same tenant, store, language and currency headers for the filters request and the product listing."
      },
      "response": []
    }
  ]
}
