Skip to main content
GET
/
api
/
v3
/
store
/
products
/
filters
Spree SDK
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',
})
{
  "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",
      "presentation": "Size",
      "options": [
        {
          "id": "optval_UkLWZg9DAJ",
          "name": "small",
          "presentation": "S",
          "position": 1,
          "count": 1
        }
      ]
    },
    {
      "id": "categories",
      "type": "category",
      "options": [
        {
          "id": "ctg_EfhxLZ9ck8",
          "name": "Shirts",
          "permalink": "taxonomy-29/taxon-39/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
}

Authorizations

x-spree-api-key
string
header
required

Publishable API key for store access

Headers

x-spree-api-key
string
required

Publishable API key

Query Parameters

category_id
string

Scope filters to products in this category (prefix ID)

q[name_cont]
string

Filter by name containing string

Response

filters scoped to category

filters
object[]
required

Available filters (price_range, availability, option, category)

sort_options
object[]
required

Available sort options

default_sort
string
required

Default sort option ID

total_count
integer
required

Total products matching current filters