DashForDevsDocs
DocsNewsAPI v1
dashfordevs.comSign in

© 2026 DashForDevs

DocsNewsdashfordevs.comLegalStatus
DocsCategoriesList Categories
Introduction
Getting Started
Authentication
Products
Categories
List CategoriesCategory ProductsCategory Files
Cart
Checkout
Blog
Reviews
Webhooks
Customers
Orders
Inventory
Shipping
Discounts
Affiliates
Email
Media & Files
Analytics & Tracking
Locations
Tax
Global Data
SEO
Error Handling
Geography
Finance
Automations
Page Types
Surveys
Billing & Subscriptions
Storefront Payments
SDK Reference
REST API
Storefront Architecture
Notifications
Security
Team & Permissions
Migrations & Import
Calendar & Appointments
Contact Forms
AI Bots
Dashboard API
Deployment
Changelog
Troubleshooting
Recipes
CLI & Deployment
Image Pipeline
White-label Platforms
Records Engine
Platform Modules
Platform Security
Site Keys & Client Sites
Use Cases
Operations

List Categories

Retrieve all product categories.

Updated March 29, 2026

On this page
  • Overview
  • SDK Usage
  • Parameters
  • Category Object
  • Tree Structure
  • Navigation Example
  • REST API
  • Next Steps

Overview

Fetch all categories for navigation menus, sidebars, and filter UIs. Categories support nesting (parent/child) for hierarchical navigation.

SDK Usage

typescript
import dash from "@/lib/dash"

// Flat list of all categories
const { categories } = await dash.categories.list()

// Nested tree structure
const { categories: tree } = await dash.categories.getTree()

// Categories at a specific depth
const { categories: topLevel } = await dash.categories.getByDepth(0)

// Children of a specific category
const { categories: children } = await dash.categories.getChildren("flower")

Parameters

ParameterTypeDescription
treebooleanReturn categories as a nested tree
parentstringFilter by parent category slug
depthnumberFilter by nesting depth (0 = top-level)
customFieldsobjectFilter by custom field values

Category Object

json
{
  "id": "cat_abc123",
  "name": "Flower",
  "slug": "flower",
  "description": "Premium cannabis flower",
  "image": "https://cdn.dashfordevs.com/...",
  "hero_image": "https://...",
  "parent_id": null,
  "navbar_name": "Flower",
  "navbar_caption": "Shop our flower collection",
  "show_in_home": true,
  "custom_fields": {},
  "seo_title": "Shop Flower",
  "seo_description": "Browse our flower selection"
}

Tree Structure

When using getTree(), child categories are nested under their parents:

json
[
  {
    "id": "cat_1",
    "name": "Flower",
    "slug": "flower",
    "children": [
      { "id": "cat_2", "name": "Indica", "slug": "indica", "children": [] },
      { "id": "cat_3", "name": "Sativa", "slug": "sativa", "children": [] }
    ]
  },
  {
    "id": "cat_4",
    "name": "Edibles",
    "slug": "edibles",
    "children": []
  }
]

Navigation Example

typescript
// app/components/CategoryNav.tsx
import dash from "@/lib/dash"

export default async function CategoryNav() {
  const { categories } = await dash.categories.getTree()

  return (
    <nav>
      {categories.map(cat => (
        <div key={cat.id}>
          <a href={`/category/${cat.slug}`}>{cat.name}</a>
          {cat.children?.length > 0 && (
            <ul>
              {cat.children.map(child => (
                <li key={child.id}>
                  <a href={`/category/${child.slug}`}>{child.name}</a>
                </li>
              ))}
            </ul>
          )}
        </div>
      ))}
    </nav>
  )
}

REST API

shell
# Flat list
GET /storefront/categories
X-API-Key: pk_live_your_key

# Tree structure
GET /storefront/categories?tree=true

# Children of a parent
GET /storefront/categories?parent=flower

Next Steps

  • Category Products — Get products within a category
  • List Products — Filter products by category
  • Category SEO — SEO metadata for category pages
PreviousProducts in Multiple CategoriesNextCategory Products

On this page

  • Overview
  • SDK Usage
  • Parameters
  • Category Object
  • Tree Structure
  • Navigation Example
  • REST API
  • Next Steps