> ## Documentation Index
> Fetch the complete documentation index at: https://spreecommerce.org/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Get product filters

> Returns available filters for products with their options and counts.
Use this endpoint to build filter UIs for product listing pages.

The filters are context-aware - when a category_id is provided, only filters
relevant to products in that category are returned.




## OpenAPI

````yaml /api-reference/store.yaml get /api/v3/store/products/filters
openapi: 3.0.3
info:
  title: Store API
  contact:
    name: Spree Commerce
    url: https://spreecommerce.org
    email: hello@spreecommerce.org
  description: >
    Spree Store API v3 - Customer-facing storefront API for building headless
    commerce experiences.


    ## Authentication


    The Store API uses two authentication methods:


    ### API Key (Required)

    All requests must include a publishable API key in the `x-spree-api-key`
    header.


    ### JWT Bearer Token (For authenticated customers)

    After login, include the JWT token in the `Authorization: Bearer <token>`
    header.


    ### Order Token (For guest checkout)

    When creating an order, a `token` is returned. Include this in the
    `x-spree-token` header

    for guest access to that specific order.


    ## Response Format


    All responses are JSON. List endpoints return paginated responses with
    `data` and `meta` keys.


    ## Error Handling


    Errors return a consistent format:

    ```json

    {
      "error": {
        "code": "record_not_found",
        "message": "Product not found"
      }
    }

    ```
  version: v3
servers:
  - url: http://{defaultHost}
    variables:
      defaultHost:
        default: localhost:3000
security: []
tags:
  - name: Authentication
    description: Customer authentication (login, logout, token refresh)
  - name: Product Catalog
    description: Products and categories
  - name: Carts
    description: Shopping cart management
  - name: Orders
    description: Order lookup
  - name: Customers
    description: Customer account, addresses, saved payment methods, and order history
  - name: Markets
    description: Markets, countries, currencies, and locales
  - name: Wishlists
    description: Customer wishlists
  - name: Policies
    description: Store policies (return policy, privacy policy, terms of service)
  - name: Digitals
    description: Digital product downloads
paths:
  /api/v3/store/products/filters:
    get:
      tags:
        - Product Catalog
      summary: Get product filters
      description: >
        Returns available filters for products with their options and counts.

        Use this endpoint to build filter UIs for product listing pages.


        The filters are context-aware - when a category_id is provided, only
        filters

        relevant to products in that category are returned.
      parameters:
        - name: x-spree-api-key
          in: header
          required: true
          description: Publishable API key
          schema:
            type: string
        - name: category_id
          in: query
          required: false
          description: Scope filters to products in this category (prefix ID)
          schema:
            type: string
        - name: q[name_cont]
          in: query
          required: false
          description: Filter by name containing string
          schema:
            type: string
      responses:
        '200':
          description: filters scoped to category
          content:
            application/json:
              example:
                filters:
                  - id: price
                    type: price_range
                    min: 19.99
                    max: 19.99
                    currency: USD
                  - id: availability
                    type: availability
                    options:
                      - id: in_stock
                        count: 2
                      - id: out_of_stock
                        count: 0
                  - id: opt_UkLWZg9DAJ
                    type: option
                    name: size
                    label: Size
                    kind: dropdown
                    options:
                      - id: optval_UkLWZg9DAJ
                        name: small
                        label: S
                        position: 1
                        color_code: null
                        image_url: null
                        count: 1
                  - id: categories
                    type: category
                    options:
                      - id: ctg_EfhxLZ9ck8
                        name: Shirts
                        permalink: taxonomy-25/taxon-32/shirts
                        count: 2
                sort_options:
                  - id: manual
                  - id: best_selling
                  - id: price
                  - id: '-price'
                  - id: '-available_on'
                  - id: available_on
                  - id: name
                  - id: '-name'
                default_sort: manual
                total_count: 2
              schema:
                type: object
                properties:
                  filters:
                    type: array
                    description: >-
                      Available filters (price_range, availability, option,
                      category)
                    items:
                      type: object
                  sort_options:
                    type: array
                    description: Available sort options
                    items:
                      type: object
                      properties:
                        id:
                          type: string
                      required:
                        - id
                  default_sort:
                    type: string
                    description: Default sort option ID
                  total_count:
                    type: integer
                    description: Total products matching current filters
                required:
                  - filters
                  - sort_options
                  - default_sort
                  - total_count
        '401':
          description: unauthorized - invalid or missing API key
          content:
            application/json:
              example:
                error:
                  code: invalid_token
                  message: Valid API key required
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - api_key: []
      x-codeSamples:
        - lang: javascript
          label: Spree SDK
          source: |-
            import { createClient } from '@spree/sdk'

            const client = createClient({
              baseUrl: 'https://your-store.com',
              publishableKey: '<api-key>',
            })

            const filters = await client.products.filters({
              category_id: 'ctg_abc123',
            })
components:
  schemas:
    ErrorResponse:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              example: record_not_found
            message:
              type: string
              example: Record not found
            details:
              type: object
              description: Field-specific validation errors
              nullable: true
              example:
                name:
                  - is too short
                  - is required
                email:
                  - is invalid
          required:
            - code
            - message
      required:
        - error
      example:
        error:
          code: validation_error
          message: Validation failed
          details:
            name:
              - is too short
            email:
              - is invalid
  securitySchemes:
    api_key:
      type: apiKey
      name: x-spree-api-key
      in: header
      description: Publishable API key for store access

````