Acme Store Docs
API Reference

GET /api/store/categories

List the store product categories.

Returns the storefront's product categories, straight from the site config. This is the same list that powers the storefront's own category navigation, and the slug values are exactly what the products endpoint accepts for its category filter.

Endpoint

GET /api/store/categories
  • Auth: none. This is a public, read-only endpoint.
  • Source: the productCategories array in src/config/site.ts — no database is involved, so it works out of the box in the default quote-based setup.
  • Caching: responses are sent with a long Cache-Control header (categories change rarely).

Categories are configuration, not data. To add, rename, or remove a category, edit productCategories in src/config/site.ts and redeploy — there is no admin UI or database write path for this list.

Response

200 OK with a JSON body of the shape:

{ categories: { name: string; slug: string; description: string }[] }

Each entry is projected from the site config; the config's icon, image, secondaryDescription, and badges fields are intentionally not exposed by this endpoint.

FieldTypeDescription
namestringHuman-readable category label (e.g. "Smart Home").
slugstringURL-safe identifier. Pass this to the products endpoint's category filter.
descriptionstringShort one-line summary of the category.

Headers

HeaderValue
Cache-Controlpublic, s-maxage=3600, stale-while-revalidate=86400

Example

Terminal
curl https://your-store.example.com/api/store/categories
200 OK
{
  "categories": [
    {
      "name": "Audio",
      "slug": "audio",
      "description": "Headphones, speakers, and studio gear engineered for rich, accurate sound."
    },
    {
      "name": "Wearables",
      "slug": "wearables",
      "description": "Smartwatches and fitness trackers that keep your health and notifications on your wrist."
    },
    {
      "name": "Smart Home",
      "slug": "smart-home",
      "description": "Lighting, plugs, and sensors that make any home more comfortable and efficient."
    },
    {
      "name": "Cameras",
      "slug": "cameras",
      "description": "Cameras and accessories for creators, from vlogging kits to security systems."
    },
    {
      "name": "Computing",
      "slug": "computing",
      "description": "Laptops, peripherals, and components for work, play, and everything in between."
    },
    {
      "name": "Accessories",
      "slug": "accessories",
      "description": "Cables, chargers, cases, and stands — the small things that complete every setup."
    }
  ]
}

The slug values shown above (audio, wearables, smart-home, cameras, computing, accessories) are the defaults shipped with the boilerplate; your deployment returns whatever you have configured in productCategories.

Errors

The endpoint only fails on an unexpected server error:

500 Internal Server Error
{ "error": "Internal server error" }

Using slugs to filter products

Feed a slug from this endpoint into the products list to fetch a single category:

Terminal
curl "https://your-store.example.com/api/store/products?category=smart-home"

The products endpoint validates category against this same set of slugs and returns 400 with { "error": "Unknown category" } for anything else. See GET /api/store/products for the full filtering and pagination reference.

On this page