Returns a paginated list of categories for the current store
import { createClient } from '@spree/sdk'
const client = createClient({
baseUrl: 'https://your-store.com',
publishableKey: '<api-key>',
})
const categories = await client.categories.list({
page: 1,
limit: 25,
}){
"data": [
{
"id": "ctg_UkLWZg9DAJ",
"name": "taxonomy_1",
"permalink": "taxonomy-1",
"position": 0,
"depth": 0,
"meta_title": null,
"meta_description": null,
"meta_keywords": null,
"children_count": 1,
"parent_id": null,
"description": "",
"description_html": "",
"image_url": null,
"square_image_url": null,
"is_root": true,
"is_child": false,
"is_leaf": false
},
{
"id": "ctg_gbHJdmfrXB",
"name": "taxon_1",
"permalink": "taxonomy-1/taxon-1",
"position": 0,
"depth": 1,
"meta_title": null,
"meta_description": null,
"meta_keywords": null,
"children_count": 1,
"parent_id": "ctg_UkLWZg9DAJ",
"description": "",
"description_html": "",
"image_url": null,
"square_image_url": null,
"is_root": false,
"is_child": true,
"is_leaf": false
},
{
"id": "ctg_EfhxLZ9ck8",
"name": "taxon_2",
"permalink": "taxonomy-1/taxon-1/taxon-2",
"position": 0,
"depth": 2,
"meta_title": null,
"meta_description": null,
"meta_keywords": null,
"children_count": 0,
"parent_id": "ctg_gbHJdmfrXB",
"description": "",
"description_html": "",
"image_url": null,
"square_image_url": null,
"is_root": false,
"is_child": true,
"is_leaf": true
}
],
"meta": {
"page": 1,
"limit": 25,
"count": 3,
"pages": 1,
"from": 1,
"to": 3,
"in": 3,
"previous": null,
"next": null
}
}Publishable API key for store access
Filter by name
Comma-separated list of fields to include (e.g., name,slug,price). id is always included.
Was this page helpful?
import { createClient } from '@spree/sdk'
const client = createClient({
baseUrl: 'https://your-store.com',
publishableKey: '<api-key>',
})
const categories = await client.categories.list({
page: 1,
limit: 25,
}){
"data": [
{
"id": "ctg_UkLWZg9DAJ",
"name": "taxonomy_1",
"permalink": "taxonomy-1",
"position": 0,
"depth": 0,
"meta_title": null,
"meta_description": null,
"meta_keywords": null,
"children_count": 1,
"parent_id": null,
"description": "",
"description_html": "",
"image_url": null,
"square_image_url": null,
"is_root": true,
"is_child": false,
"is_leaf": false
},
{
"id": "ctg_gbHJdmfrXB",
"name": "taxon_1",
"permalink": "taxonomy-1/taxon-1",
"position": 0,
"depth": 1,
"meta_title": null,
"meta_description": null,
"meta_keywords": null,
"children_count": 1,
"parent_id": "ctg_UkLWZg9DAJ",
"description": "",
"description_html": "",
"image_url": null,
"square_image_url": null,
"is_root": false,
"is_child": true,
"is_leaf": false
},
{
"id": "ctg_EfhxLZ9ck8",
"name": "taxon_2",
"permalink": "taxonomy-1/taxon-1/taxon-2",
"position": 0,
"depth": 2,
"meta_title": null,
"meta_description": null,
"meta_keywords": null,
"children_count": 0,
"parent_id": "ctg_gbHJdmfrXB",
"description": "",
"description_html": "",
"image_url": null,
"square_image_url": null,
"is_root": false,
"is_child": true,
"is_leaf": true
}
],
"meta": {
"page": 1,
"limit": 25,
"count": 3,
"pages": 1,
"from": 1,
"to": 3,
"in": 3,
"previous": null,
"next": null
}
}